From 3d66ebbd639ce6d47475f1729b0c9957f735ced0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 10 六月 2020 13:56:23 +0800
Subject: [PATCH] #
---
src/main/webapp/views/pakStore/pakStore.html | 17 ++++-
src/main/webapp/static/js/pakStore/pakStore.js | 85 +++++++++++++++++++--------
src/main/webapp/views/pakStore/matQuery.html | 42 +-------------
3 files changed, 76 insertions(+), 68 deletions(-)
diff --git a/src/main/webapp/static/js/pakStore/pakStore.js b/src/main/webapp/static/js/pakStore/pakStore.js
index 0fbe465..0f2a8d4 100644
--- a/src/main/webapp/static/js/pakStore/pakStore.js
+++ b/src/main/webapp/static/js/pakStore/pakStore.js
@@ -1,3 +1,7 @@
+
+var initCountVal = 0;
+var matCodeData = [];
+
layui.use(['table','laydate', 'form'], function() {
var table = layui.table;
var $ = layui.jquery;
@@ -13,39 +17,30 @@
cellMinWidth: 50,
toolbar: '#toolbar',
cols: [[
- {type: 'checkbox'},
- {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜', sort: 'true'},
+ {fixed: 'left', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:80},
+ {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜'},
{field: 'barcode', align: 'center', title: '鏉$爜'},
{field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'},
{field: 'str1', align: 'center', title: '鐗╂枡鍗曚綅'},
{field: 'str2', align: 'center', title: '鐗╂枡瑙勬牸'},
- {field: 'count', title: '鏁伴噺', align: 'center', edit:'text', width: 100}
+ {fixed: 'right', field: 'count', title: '鏁伴噺', align: 'center', edit:'text', width: 100}
]],
done: function (res, curr, count) {
+ $('td[data-field=count] div').html(initCountVal);
+ setMatCodeData(res.data);
}
});
- // 鐩戝惉鎺掑簭浜嬩欢
- table.on('sort(chooseData)', function (obj) {
- var searchData = {};
- $.each($('#search-box [name]').serializeArray(), function() {
- searchData[this.name] = this.value;
- });
- searchData['orderByField'] = obj.field;
- searchData['orderByType'] = obj.type;
- matQueryTable.reload({
- where: searchData,
- page: {
- curr: 1
- },
- done: function (res, curr, count) {
- if (res.code === 403) {
- top.location.href = baseUrl+"/";
- }
- pageCurr=curr;
- limit();
- }
- });
+ // 椤甸潰淇敼
+ table.on('edit(chooseData)', function (obj) {
+ if (!isNaN(obj.value)) {
+ updateMatCodeData(obj.data.matNo, Number(obj.value));
+ tableIns.reload({data: matCodeData,done:function (res) {
+ // 瑕嗙洊render鏂规硶鐨刣one
+ }});
+ } else {
+ layer.msg("璇疯緭鍏ユ暟瀛�");
+ }
});
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -71,13 +66,45 @@
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) {
+ // 瑕嗙洊render鏂规硶鐨刣one
+ }});
+ break;
+ }
+ });
+
+ function setMatCodeData(data) {
+ matCodeData = data;
+ for (var i=0;i<matCodeData.length;i++){
+ matCodeData[i]["count"] = initCountVal;
+ }
+ }
+
+ function updateMatCodeData(matNo, count) {
+ for (var i=0;i<matCodeData.length;i++){
+ if (matCodeData[i]["matNo"] === matNo){
+ matCodeData[i]["count"] = count;
+ }
+ }
+ }
+});
// 鎻愬彇鐗╂枡
var matCodeLayerIdx;
function getMat() {
- tableIns.reload({data: []});
+ // tableIns.reload({data: []});
matCodeLayerIdx = layer.open({
type: 2,
title: '鎻愬彇鐗╂枡',
@@ -88,4 +115,10 @@
success: function(layero, index){
}
});
+}
+
+// 鍚姩鍏ュ簱
+function putMat() {
+
+
}
\ No newline at end of file
diff --git a/src/main/webapp/views/pakStore/matQuery.html b/src/main/webapp/views/pakStore/matQuery.html
index 45bf474..d43a665 100644
--- a/src/main/webapp/views/pakStore/matQuery.html
+++ b/src/main/webapp/views/pakStore/matQuery.html
@@ -59,8 +59,7 @@
</body>
<script>
- var initCountVal = 1;
- var matCodeData = [];
+
var pageCurr;
layui.use(['table','laydate', 'form'], function() {
var table = layui.table;
@@ -85,7 +84,6 @@
{field: 'matName', align: 'center', title: '鐗╂枡鍚嶇О'},
{field: 'str1', align: 'center', title: '鐗╂枡鍗曚綅'},
{field: 'str2', align: 'center', title: '鐗╂枡瑙勬牸'},
- {field: 'count', title: '鏁伴噺', align: 'center', edit:'text', width: 100}
]],
request: {
pageName: 'curr',
@@ -106,17 +104,7 @@
if (res.code === 403) {
top.location.href = baseUrl + "/";
}
- $('td[data-field=count] div').html("1");
- setMatCodeData(res.data);
- }
- });
- // 椤甸潰淇敼
- table.on('edit(matCode)', function (obj) {
- if (!isNaN(obj.value)) {
- updateMatCodeData(obj.data.matNo, Number(obj.value));
- } else {
- layer.msg("璇疯緭鍏ユ暟瀛�");
}
});
@@ -149,14 +137,8 @@
var data = checkStatus.data;
switch(obj.event) {
case 'confirm':
- // 鏁版嵁鏍煎紡妫�鏌�
- for (var i=0;i<data.length;i++){
- if (isNaN(data[i]["count"])) {
- layer.msg("鏁伴噺閿欒");
- return;
- }
- }
- parent.tableIns.reload({data: data});
+ parent.matCodeData.push.apply(parent.matCodeData, data);
+ parent.tableIns.reload({data: parent.matCodeData});
parent.layer.close(parent.matCodeLayerIdx);
break;
}
@@ -176,22 +158,6 @@
});
})
- function setMatCodeData(data) {
- matCodeData = data;
- for (var i=0;i<matCodeData.length;i++){
- matCodeData[i]["count"] = initCountVal;
- }
- }
-
- function updateMatCodeData(matNo, count) {
- for (var i=0;i<matCodeData.length;i++){
- if (matCodeData[i]["matNo"] === matNo){
- matCodeData[i]["count"] = count;
- }
- }
- console.log(matCodeData);
- }
-
function tableReload(child) {
var searchData = {};
$.each($('#search-box [name]').serializeArray(), function() {
@@ -206,8 +172,6 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
- $('td[data-field=count] div').html("1");
- setMatCodeData(res.data);
pageCurr=curr;
if (res.data.length === 0 && count !== 0) {
tableIns.reload({
diff --git a/src/main/webapp/views/pakStore/pakStore.html b/src/main/webapp/views/pakStore/pakStore.html
index 816c11d..9026965 100644
--- a/src/main/webapp/views/pakStore/pakStore.html
+++ b/src/main/webapp/views/pakStore/pakStore.html
@@ -24,7 +24,7 @@
.function-area {
padding: 20px 50px;
}
- .mat-query {
+ .function-btn {
font-size: 16px;
padding: 1px 1px 1px 1px;
width: 100px;
@@ -37,8 +37,9 @@
transition: 0.4s;
cursor: pointer;
letter-spacing: 3px;
+ margin: 0 10px;
}
- .mat-query:hover {
+ .function-btn:hover {
background-color: #2b425b;
color: #fff;
}
@@ -47,7 +48,11 @@
<body>
<!-- 鍔熻兘鍖� -->
<div class="function-area">
- <button class="mat-query" onclick="getMat()">鏂板</button>
+ <button id="mat-query" class="function-btn" onclick="getMat()">鏂板</button>
+
+ <!-- 绔欑偣閫夋嫨妗� group by -- 绌哄簱浣� -->
+
+ <button id="mat-put" class="function-btn" onclick="putMat()">鍚姩鍏ュ簱</button>
</div>
<hr>
@@ -55,12 +60,18 @@
<!-- 琛ㄦ牸 -->
<div style="padding-bottom: 5px">
+ <!-- 澶撮儴 -->
<script type="text/html" id="toolbar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal" id="btn-comb" lay-event="comb" style="">缁勭洏</button>
</div>
</script>
+ <!-- 琛� -->
+ <script type="text/html" id="operate">
+ <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="remove">绉婚櫎</a>
+ </script>
+
<table class="layui-table" id="chooseData" lay-filter="chooseData"></table>
</div>
--
Gitblit v1.9.1