From 86c69620f1bb3976f01b726d3d1804527474898f Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 24 三月 2025 09:34:01 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/pakStore/pakStore.js | 226 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 169 insertions(+), 57 deletions(-)
diff --git a/src/main/webapp/static/js/pakStore/pakStore.js b/src/main/webapp/static/js/pakStore/pakStore.js
index 24ad683..a2017e7 100644
--- a/src/main/webapp/static/js/pakStore/pakStore.js
+++ b/src/main/webapp/static/js/pakStore/pakStore.js
@@ -1,9 +1,24 @@
-layui.use(['table','laydate', 'form'], function() {
+var matCodeLayerIdx;
+var initCountVal = 8;
+var matCodeData = [];
+function getCol() {
+ var cols = [
+ {fixed: 'left', field: 'anfme', title: '鏁伴噺锛堝繀濉級', align: 'center', edit:'text', width: 120, style:'color: blue;font-weight: bold'},
+ {field: 'batch', title: '鎵瑰彿锛堥�夊~锛�', align: 'center', edit:'text', width: 200, style:'color: block;font-weight: bold'}
+ ];
+ cols.push.apply(cols, matCols);
+ cols.push({fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 80})
+ return cols;
+}
+
+layui.config({
+ base: baseUrl + "/static/layui/lay/modules/"
+}).use(['admin', 'table','laydate', 'form'], function() {
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
- var layDate = layui.laydate;
var form = layui.form;
+ var admin = layui.admin;
tableIns = table.render({
elem: '#chooseData',
@@ -12,40 +27,34 @@
limit: 500,
cellMinWidth: 50,
toolbar: '#toolbar',
- cols: [[
- {type: 'checkbox'},
- {field: 'matNo', align: 'center', title: '鐗╂枡缂栫爜', sort: 'true'},
- {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}
- ]],
+ cols: [getCol()],
done: function (res, curr, count) {
+ limit();
+ getInBound();
}
});
- // 鐩戝惉鎺掑簭浜嬩欢
- 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+"/";
+ // 椤甸潰淇敼
+ table.on('edit(chooseData)', function (obj) {
+ let index = obj.tr.attr("data-index");
+ let data = matCodeData[index];
+ let modify = true;
+ if (obj.field === 'anfme'){
+ let vle = Number(obj.value);
+ if (isNaN(vle)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
+ modify = false;
+ } else {
+ if (vle <= 0) {
+ layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
+ modify = false;
}
- pageCurr=curr;
- limit();
}
- });
+ }
+ if (modify) {
+ data[obj.field] = obj.value;
+ }
+ tableIns.reload({data: matCodeData});
});
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
@@ -54,38 +63,141 @@
var data = checkStatus.data;
switch(obj.event) {
case 'comb':
- if (data.length === 0){
- layer.msg('璇烽�夋嫨鏁版嵁');
- } else {
- layer.open({
- type: 1,
- title: '缁勭洏',
- maxmin: true,
- shadeClose: true,
- content: $('#combDiv'),
- success: function (layero, index) {
-
- }
- })
+ // 鍒ゆ柇鏄惁瀛樺湪鐗╂枡
+ if (matCodeData.length === 0) {
+ layer.msg("璇峰厛鎻愬彇鍟嗗搧", {icon: 2});
+ return;
}
+ // 鍒ゆ柇鐗╂枡鏁伴噺鏄惁瀛樺湪寮傚父
+ for (var i=0;i<matCodeData.length;i++){
+ if (isNaN(matCodeData[i].anfme)) {
+ layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2});
+ return;
+ }
+ if (matCodeData[i].anfme <= 0){
+ layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2});
+ return;
+ }
+ }
+ let devpNo = $('#putSiteSelect').val();
+ if (isEmpty(devpNo)) {
+ layer.msg("璇烽�夋嫨鍏ュ簱绔�", {icon: 2});
+ return;
+ }
+ console.log(matCodeData)
+ $.ajax({
+ url: baseUrl+"/full/store/put/start",
+ headers: {'token': localStorage.getItem('token')},
+ data: JSON.stringify({
+ devpNo: Number(devpNo),
+ list: matCodeData
+ }),
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ layer.msg("鍏ュ簱鍚姩鎴愬姛锛岀洰鏍囧簱浣嶏細" + res.data, {icon: 1});
+ matCodeData = [];
+ $('#focusMatByMat').val("");
+ tableIns.reload({data: matCodeData,done:function (res) { limit(); getInBound();}});
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ }
+ })
+ break;
+ default:
break;
}
});
+
+ // 鐩戝惉琛屽伐鍏蜂簨浠�
+ table.on('tool(chooseData)', function(obj){
+ switch (obj.event) {
+ case 'remove':
+ let index = obj.tr.attr("data-index");
+ matCodeData.splice(index, 1);
+ tableIns.reload({data: matCodeData});
+ break;
+ }
+ });
+
+ // 鑾峰彇鍙敤鍏ュ簱绔欑偣
+ function getInBound() {
+ $.ajax({
+ url: baseUrl + "/available/put/site5",
+ 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, {icon: 2})
+ }
+ }
+ })
+ }
+
+ // 鎻愬彇鐗╂枡
+ $(document).on('click','#mat-query', function () {
+ let loadIndex = layer.msg('璇锋眰涓�...', {icon: 16, shade: 0.01, time: false});
+ matCodeLayerIdx = admin.open({
+ type: 2,
+ title: false,
+ closeBtn: false,
+ maxmin: false,
+ area: ['90%', '85%'],
+ shadeClose: true,
+ content: 'matQuery.html',
+ success: function(layero, index){
+ layer.close(loadIndex);
+ }
+ });
+ })
+
});
-// 鎻愬彇鐗╂枡
-var matCodeLayerIdx;
-function getMat() {
- tableIns.reload({data: []});
- matCodeLayerIdx = layer.open({
- type: 2,
- title: '搴撲綅鐗╂枡',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: true,
- content: 'matQuery.html',
- success: function(layero, index){
+
+// 鎵爜
+function focusMat(el) {
+ if (isEmpty(el.value)) {
+ return
+ }
+ $.ajax({
+ url: baseUrl + "/mat/" + el.value + "/auth",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'GET',
+ success: function (res) {
+ if (res.code === 200) {
+ matCodeData = [];
+ var param = new Array();
+ param[0] = res.data;
+ addTableData(param);
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, {icon: 2})
+ }
}
- });
-}
\ No newline at end of file
+ })
+}
+
+// 娣诲姞琛ㄦ牸鏁版嵁
+function addTableData(list) {
+ list.map(function (d) {
+ d['anfme'] = initCountVal;
+ })
+ matCodeData.push.apply(matCodeData, list);
+ tableIns.reload({data: matCodeData});
+ layer.close(matCodeLayerIdx);
+}
--
Gitblit v1.9.1