From e3f1353f7760c2a9362d06ac1bfd0a79186b1b86 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期五, 20 八月 2021 13:24:00 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/matStore/matStore.js | 234 +++++++++++++++++++++++
src/main/webapp/views/matStore/matStore.html | 132 +++++++++++++
src/main/webapp/views/matStore/waitMatinQuery.html | 201 ++++++++++++++++++++
3 files changed, 567 insertions(+), 0 deletions(-)
diff --git a/src/main/webapp/static/js/matStore/matStore.js b/src/main/webapp/static/js/matStore/matStore.js
new file mode 100644
index 0000000..7f83832
--- /dev/null
+++ b/src/main/webapp/static/js/matStore/matStore.js
@@ -0,0 +1,234 @@
+
+var initCountVal = 0;
+var matCodeData = [];
+function getCol() {
+ var cols = [
+ {fixed: 'left', field: 'count', title: '鏁伴噺(蹇呭~)', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'}
+ ,{field: 'billNo', title:'鍗曟嵁缂栧彿', align: 'center'}
+ ,{field: 'seqNo', title:'搴忓彿', align: 'center'}
+ ,{field: 'qty', title:'閫氱煡鍏ュ簱閲�', align: 'center'}
+ ,{field: 'inQty', title:'宸插叆搴撻噺', align: 'center'}
+ ];
+ cols.push.apply(cols, matCols);
+ cols.push(
+ {field: 'memo', title:'澶囨敞', align: 'center'},
+ {fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
+ )
+ return cols;
+}
+
+layui.use(['table','laydate', 'form'], function() {
+ var table = layui.table;
+ var $ = layui.jquery;
+ var layer = layui.layer;
+ var layDate = layui.laydate;
+ var form = layui.form;
+
+ tableIns = table.render({
+ elem: '#chooseData',
+ data: [],
+ even: true,
+ limit: 500,
+ cellMinWidth: 50,
+ toolbar: '#toolbar',
+ cols: [getCol()],
+ done: function (res, curr, count) {
+ $('td[data-field=count] div').html(initCountVal);
+ setMatCodeData(res.data);
+ limit();
+ getInBound();
+ }
+ });
+
+ // 椤甸潰淇敼
+ table.on('edit(chooseData)', function (obj) {
+ updateMatCodeData(obj.data.matNo, Number(obj.value));
+ });
+
+ // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+ table.on('toolbar(chooseData)', function (obj) {
+ var checkStatus = table.checkStatus(obj.config.id);
+ var data = checkStatus.data;
+ switch(obj.event) {
+ case 'comb':
+ // 鍒ゆ柇鏄惁瀛樺湪浜у搧
+ if (matCodeData.length === 0) {
+ layer.msg("璇峰厛娣诲姞浜у搧");
+ return;
+ }
+ // 鍒ゆ柇浜у搧鏁伴噺鏄惁瀛樺湪寮傚父
+ for (var i=0;i<matCodeData.length;i++){
+ if (isNaN(matCodeData[i].count)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�");
+ return;
+ }
+ if (matCodeData[i].count === 0){
+ layer.msg("鏁伴噺涓嶈兘涓洪浂");
+ return;
+ }
+ }
+ $.ajax({
+ url: baseUrl+"/full/store/put/start",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify({
+ devpNo: Number($('#putSiteSelect').val()),
+ list: matCodeData
+ }),
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ layer.msg("鍏ュ簱鍚姩鎴愬姛锛岀洰鏍囧簱浣嶏細" + res.data);
+ matCodeData = [];
+ tableIns.reload({data: matCodeData,done:function (res) { limit(); getInBound();}});
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ break;
+ }
+ });
+
+ // 鐩戝惉琛屽伐鍏蜂簨浠�
+ table.on('tool(chooseData)', function(obj){
+ var data = obj.data;
+
+ switch (obj.event) {
+ case 'remove':
+ for (var i = matCodeData.length - 1; i >= 0; i--) {
+ if (matCodeData[i].matNo === data.matNo) {
+ matCodeData.splice(i, 1);
+ }
+ }
+ tableIns.reload({data: matCodeData,done:function (res) {
+ limit();
+ getInBound();
+ // 瑕嗙洊render鏂规硶鐨刣one
+ }});
+ break;
+ case 'memo':
+ var memoLayer = layer.open({
+ type: 2,
+ title: '澶囨敞',
+ maxmin: true,
+ area: ['400px', '215px'],
+ shadeClose: false,
+ content: 'matMemo.html',
+ btn: ['淇濆瓨', '鍙栨秷'],
+ style: 'text-algin: center',
+ yes: function(index, layero){
+ var memo = layer.getChildFrame('body', index).find("#memo")[0].value;
+ matCodeData.map(function (item) {
+ if (item.matNo === data.matNo) {
+ item.memo = memo;
+ }
+ });
+ // 閲嶇疆琛ㄦ牸鏁版嵁
+ tableIns.reload({data: matCodeData,done:function (res) {
+ limit();
+ getInBound();
+ layer.close(memoLayer);
+ }});
+ },
+ success: function(layero, index){
+ var iframeWin = window[layero.find('iframe')[0]['name']];//寰楀埌iframe椤电殑绐楀彛瀵硅薄
+ iframeWin.setMatMemo(data.memo);
+ }
+ });
+ break;
+ }
+ });
+
+ function setMatCodeData(data) {
+ matCodeData = data;
+ for (var i=0;i<matCodeData.length;i++){
+ matCodeData[i]["count"] = initCountVal;
+ }
+ }
+
+ function updateMatCodeData(matNo, count) {
+ if (isNaN(count)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�");
+ } else {
+ if (count > 0) {
+ for (var i=0;i<matCodeData.length;i++){
+ if (matCodeData[i]["matNo"] === matNo){
+ matCodeData[i]["count"] = count;
+ }
+ }
+ } else {
+ layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+ }
+ }
+
+ tableIns.reload({data: matCodeData,done:function (res) {
+ limit();
+ getInBound();
+ // 瑕嗙洊render鏂规硶鐨刣one
+ }});
+ }
+
+ // 鑾峰彇鍙敤鍏ュ簱绔欑偣
+ function getInBound() {
+ $.ajax({
+ url: baseUrl + "/available/put/site",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200) {
+ var tpl = $("#putSiteSelectTemplate").html();
+ var template = Handlebars.compile(tpl);
+ var html = template(res);
+ $('#putSiteSelect').append(html);
+ form.render('select');
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg)
+ }
+ }
+ })
+ }
+
+
+});
+
+// 鎻愬彇鍏ュ簱閫氱煡妗�
+var matCodeLayerIdx;
+function getWaitMatin() {
+ matCodeLayerIdx = layer.open({
+ type: 2,
+ title: '鎻愬彇閫氱煡鍏ュ簱鏁版嵁',
+ maxmin: true,
+ area: [top.detailWidth, top.detailHeight],
+ shadeClose: true,
+ content: 'waitMatinQuery.html',
+ success: function(layero, index){
+ }
+ });
+}
+
+// 娣诲姞琛ㄦ牸鏁版嵁
+function addTableData(data) {
+ for (var i=0;i<data.length;i++){
+ let pass = false;
+ for (var j=0;j<matCodeData.length;j++){
+ if (data[i].matNo === matCodeData[j].matNo) {
+ pass = true;
+ break;
+ }
+ }
+ if (pass) {
+ data.splice(i--, 1);
+ } else {
+ data[i]["count"] = initCountVal;
+ }
+ }
+ matCodeData.push.apply(matCodeData, data);
+ tableIns.reload({data: matCodeData});
+ layer.close(matCodeLayerIdx);
+}
\ No newline at end of file
diff --git a/src/main/webapp/views/matStore/matStore.html b/src/main/webapp/views/matStore/matStore.html
new file mode 100644
index 0000000..57124d3
--- /dev/null
+++ b/src/main/webapp/views/matStore/matStore.html
@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title></title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
+ <link rel="stylesheet" href="../../static/css/cool.css" media="all">
+ <link rel="stylesheet" href="../../static/css/common.css" media="all">
+ <style>
+ html {
+ height: 100%;
+ padding: 10px;
+ background-color: #f1f1f1;
+ }
+ body {
+ background-color: #fff;
+ border-radius: 5px;
+ box-shadow: 0 0 3px rgba(0,0,0,.3);
+ }
+
+ .function-area {
+ padding: 20px 50px;
+ }
+ .function-btn {
+ font-size: 16px;
+ padding: 1px 1px 1px 1px;
+ width: 100px;
+ height: 50px;
+ border-color: #2b425b;
+ border-radius: 4px;
+ border-width: 2px;
+ background: none;
+ border-style: solid;
+ transition: 0.4s;
+ cursor: pointer;
+ letter-spacing: 3px;
+ }
+ .function-btn:hover {
+ background-color: #2b425b;
+ color: #fff;
+ }
+
+ .layui-layer-page .layui-layer-content {
+ position: relative;
+ overflow: visible !important;
+ }
+
+ #mat-query {
+ /*display: none;*/
+ }
+
+ #staNoSpan {
+ text-align: center;
+ display: inline-block;
+ width: 100px;
+ font-size: 13px;
+ }
+ .layui-btn-container .layui-form-select {
+ display: inline-block;
+ width: 150px;
+ height: 30px;
+ }
+ .layui-btn-container .layui-form-select.layui-form-selected {
+ display: inline-block;
+ width: 150px;
+ }
+ .layui-btn-container .layui-select-title input {
+ font-size: 13px;
+ }
+ .layui-btn-container .layui-anim.layui-anim-upbit dd {
+ font-size: 13px;
+ }
+
+ #btn-comb {
+ margin-left: 60px;
+ display: none;
+ }
+ </style>
+</head>
+<body>
+<!-- 鍔熻兘鍖� -->
+<div class="function-area">
+ <button id="mat-query" class="function-btn" onclick="getWaitMatin()">鏂板</button>
+</div>
+
+<hr>
+
+<!-- 琛ㄦ牸 -->
+<div style="padding-bottom: 5px; margin-bottom: 45px">
+
+ <!-- 澶撮儴 -->
+ <script type="text/html" id="toolbar">
+ <div class="layui-form">
+ <div class="layui-btn-container">
+ <!-- 1.閫夋嫨鍏ュ簱鍙� -->
+ <span id="staNoSpan">鍏ュ簱鍙o細</span>
+ <select id="putSiteSelect" lay-verify="required">
+ <option value="">璇烽�夋嫨绔欑偣</option>
+ </select>
+ <!-- 2.鍚姩鍑哄簱 -->
+ <button class="layui-btn layui-btn-normal layui-btn-lg" id="btn-comb" lay-event="comb" style="">鍚姩鍏ュ簱</button>
+ </div>
+ </div>
+ </script>
+
+ <!-- 琛� -->
+ <script type="text/html" id="operate">
+ <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="memo">澶囨敞</a>
+ <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="remove">绉婚櫎</a>
+ </script>
+
+ <table class="layui-table" id="chooseData" lay-filter="chooseData"></table>
+</div>
+
+<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
+<script type="text/javascript" src="../../static/js/matStore/matStore.js" charset="utf-8"></script>
+
+<script type="text/template" id="putSiteSelectTemplate">
+ {{#each data}}
+ <option value="{{this}}">{{this}}</option>
+ {{/each}}
+</script>
+</body>
+</html>
+
diff --git a/src/main/webapp/views/matStore/waitMatinQuery.html b/src/main/webapp/views/matStore/waitMatinQuery.html
new file mode 100644
index 0000000..769681d
--- /dev/null
+++ b/src/main/webapp/views/matStore/waitMatinQuery.html
@@ -0,0 +1,201 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title></title>
+ <meta name="renderer" content="webkit">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
+ <link rel="stylesheet" href="../../static/css/cool.css" media="all">
+ <link rel="stylesheet" href="../../static/css/common.css" media="all">
+ <style>
+ body {
+ padding: 0 20px;
+ }
+ .layui-table-box {
+ border-right: 1px solid #9F9F9F;
+ border-left: 1px solid #9F9F9F;
+ }
+ </style>
+</head>
+<body>
+
+<!-- 鎼滅储鏍� -->
+<fieldset class="layui-elem-field site-demo-button" style="margin: 20px;">
+ <legend>鎼滅储鏍�</legend>
+ <div id="search-box" class="layui-form layui-card-header">
+ <div class="layui-inline">
+ <div class="layui-input-inline">
+ <input class="layui-input" type="text" name="bill_no" placeholder="鍏ュ簱鍗曞彿" autocomplete="off">
+ </div>
+ </div>
+ <div class="layui-inline">
+ <div class="layui-input-inline">
+ <input class="layui-input" type="text" name="mat_no" placeholder="浜у搧缂栫爜" autocomplete="off">
+ </div>
+ </div>
+ <!-- 鏃ユ湡鑼冨洿 -->
+ <div class="layui-inline" style="width: 300px">
+ <div class="layui-input-inline">
+ <input class="layui-input layui-laydate-range" name="modi_time" type="text" placeholder="璧峰鏃堕棿 - 缁堟鏃堕棿" autocomplete="off" style="width: 300px">
+ </div>
+ </div>
+ <div class="layui-inline">
+ <div class="layui-input-inline">
+ <input class="layui-input" type="text" name="condition" placeholder="璇疯緭鍏�" autocomplete="off">
+ </div>
+ </div>
+ <!-- 寰呮坊鍔� -->
+ <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block">
+ <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">鎼滅储</button>
+ <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">閲嶇疆</button>
+ </div>
+ </div>
+</fieldset>
+
+<script type="text/html" id="toolbar">
+ <div class="layui-btn-container">
+ <button class="layui-btn" id="btn-confirm" lay-event="confirm" style="">鎻愬彇</button>
+ </div>
+</script>
+
+<div class="layui-form">
+ <table class="layui-hide" id="matCode" lay-filter="matCode"></table>
+</div>
+
+<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
+<script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
+<script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
+
+</body>
+<script>
+ function getCol() {
+ var cols = [
+ {type: 'checkbox', fixed: 'left'}
+ ,{type: 'qty', title: '閫氱煡鍏ュ簱閲�', fixed: 'left'}
+ ,{type: 'inQty', title: '宸插叆搴撻噺', fixed: 'left'}
+ ];
+ cols.push.apply(cols, matCols);
+ cols.push(
+ {field: 'modiUser$', align: 'center',title: '淇敼浜哄憳', hide: true},
+ {field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿'}
+ )
+ return cols;
+ }
+ var pageCurr;
+ layui.use(['table','laydate', 'form'], function() {
+ var table = layui.table;
+ var $ = layui.jquery;
+ var layer = layui.layer;
+ var layDate = layui.laydate;
+ var form = layui.form;
+ // 浜у搧鏌ヨ鏁版嵁琛�
+ matQueryTable = table.render({
+ elem: '#matCode',
+ headers: {token: localStorage.getItem('token')},
+ url: baseUrl + '/waitMatin/list/auth',
+ page: true,
+ limit: 7,
+ limits: [7, 10, 30,50,100],
+ even: true,
+ cellMinWidth: 50,
+ toolbar: '#toolbar',
+ cols: [getCol()],
+ request: {
+ pageName: 'curr',
+ pageSize: 'limit'
+ },
+ parseData: function (res) {
+ return {
+ 'code': res.code,
+ 'msg': res.msg,
+ 'count': res.data.total,
+ 'data': res.data.records
+ }
+ },
+ response: {
+ statusCode: 200
+ },
+ done: function (res, curr, count) {
+ console.log(res);
+ if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ }
+ }
+ });
+
+ // 鐩戝惉澶村伐鍏锋爮浜嬩欢
+ table.on('toolbar(matCode)', function (obj) {
+ var checkStatus = table.checkStatus(obj.config.id);
+ var data = checkStatus.data;
+ switch(obj.event) {
+ case 'confirm':
+ if (data.length === 0){
+ layer.msg("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ parent.addTableData(data);
+ break;
+ }
+ });
+
+ // 鎼滅储鏍忔悳绱簨浠�
+ form.on('submit(search)', function (data) {
+ pageCurr = 1;
+ tableReload(false);
+ });
+
+ // 鎼滅储鏍忛噸缃簨浠�
+ form.on('submit(reset)', function (data) {
+ pageCurr = 1;
+ clearFormVal($('#search-box'));
+ tableReload();
+ });
+
+ layDate.render({
+ elem: '.layui-laydate-range'
+ ,type: 'datetime'
+ ,range: true
+ });
+ })
+
+ function tableReload(child) {
+ var searchData = {};
+ $.each($('#search-box [name]').serializeArray(), function() {
+ searchData[this.name] = this.value;
+ });
+ matQueryTable.reload({
+ where: searchData,
+ page: {
+ curr: pageCurr
+ },
+ done: function (res, curr, count) {
+ if (res.code === 403) {
+ top.location.href = baseUrl+"/";
+ }
+ pageCurr=curr;
+ if (res.data.length === 0 && count !== 0) {
+ tableIns.reload({
+ where: searchData,
+ page: {
+ curr: pageCurr-1
+ }
+ });
+ pageCurr -= 1;
+ }
+ }
+ });
+ }
+
+ function clearFormVal(el) {
+ $(':input', el)
+ .val('')
+ .removeAttr('checked')
+ .removeAttr('selected');
+ }
+</script>
+</html>
+
--
Gitblit v1.9.1