From 23a8e862f07ddf33e36ac47a618389088790ab0e Mon Sep 17 00:00:00 2001 From: zc <zc@123> Date: 星期三, 23 四月 2025 18:09:36 +0800 Subject: [PATCH] 初步完成调试 --- src/main/webapp/static/js/pakStoreSxk/emptyOut.js | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 190 insertions(+), 0 deletions(-) diff --git a/src/main/webapp/static/js/pakStoreSxk/emptyOut.js b/src/main/webapp/static/js/pakStoreSxk/emptyOut.js new file mode 100644 index 0000000..a4dcee1 --- /dev/null +++ b/src/main/webapp/static/js/pakStoreSxk/emptyOut.js @@ -0,0 +1,190 @@ +var pageCurr; + +layui.config({ + base: baseUrl + "/static/layui/lay/modules/" +}).use(['table','laydate', 'form', 'admin'], function() { + var table = layui.table; + var $ = layui.jquery; + var layer = layui.layer; + var layDate = layui.laydate; + var form = layui.form; + var admin = layui.admin; + + // 鑾峰彇鍑哄簱鍙� + function getOutBound(){ + $.ajax({ + url: baseUrl+"/sxk/available/empty/take/site", + headers: {'token': localStorage.getItem('token')}, + method: 'POST', + async: false, + data: {crn_no: 1}, + success: function (res) { + if (res.code === 200){ + var tpl = $("#takeSiteSelectTemplate").html(); + var template = Handlebars.compile(tpl); + var html = template(res); + $('#staNoSelect').append(html); + form.render('select'); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg) + } + } + }) + } + + // 鏁版嵁娓叉煋 + tableIns = table.render({ + elem: '#locMast', + headers: {token: localStorage.getItem('token')}, + url: baseUrl+'/locMast/list/auth', + page: true, + limit: 16, + limits: [16, 30, 50, 100, 200, 500], + where: {loc_sts: "D",crn_no: 7}, + even: true, + toolbar: '#toolbar', + defaultToolbar: ['filter'], + cellMinWidth: 50, + cols: [[ + {type: 'checkbox', fixed: 'left'} + ,{field: 'locNo', align: 'center',title: '搴撲綅鍙�',sort:true} + ,{field: 'locSts$', align: 'center',title: '搴撲綅鐘舵��',width:200} + // ,{field: 'whsType$', align: 'center',title: '搴撲綅绫诲瀷'} + ,{field: 'crnNo', align: 'center',title: '鍫嗗灈鏈哄彿'} + ,{field: 'row1', align: 'center',title: '鎺�'} + ,{field: 'bay1', align: 'center',title: '鍒�'} + ,{field: 'lev1', align: 'center',title: '灞�'} + ,{field: 'fullPlt', align: 'center',title: '婊℃澘', templet:function(row){ + var html = "<input value='fullPlt' type='checkbox' disabled=鈥榙isabled鈥� lay-skin='primary' lay-filter='tableCheckbox' table-index='"+row.LAY_TABLE_INDEX+"'"; + if(row.fullPlt === 'Y'){html += " checked ";} + html += ">"; + return html; + },width:80} + ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳',event: 'modiUser'} + ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿'} + ]], + 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) { + if (res.code === 403) { + top.location.href = baseUrl+"/"; + } + pageCurr=curr; + getOutBound(); + limit(); + form.on('checkbox(tableCheckbox)', function (data) { + var _index = $(data.elem).attr('table-index')||0; + if(data.elem.checked){ + res.data[_index][data.value] = 'Y'; + }else{ + res.data[_index][data.value] = 'N'; + } + }); + } + }); + + // 鐩戝惉澶村伐鍏锋爮浜嬩欢 + table.on('toolbar(locMast)', function (obj) { + var data = table.checkStatus(obj.config.id).data; + switch (obj.event) { + case 'outbound': + var staNo = $("#staNoSelect").val(); + if (staNo === "" || staNo === null){ + layer.msg("璇烽�夋嫨鍑哄簱鍙�"); + return; + } + var locNos = []; + data.forEach(function(elem) { + locNos.push(elem.locNo); + }); + if (data.length === 0){ + layer.msg('璇疯嚦灏戦�変腑涓�琛屾暟鎹�'); + } else { + $.ajax({ + url: baseUrl+"/empty/plate/out/start", + headers: {'token': localStorage.getItem('token')}, + data: { + outSite: staNo, + locNos: locNos + }, + method: 'POST', + traditional:true, + success: function (res) { + if (res.code === 200){ + tableReload(); // 閲嶈浇琛ㄦ牸 + getOutBound(); // 閲嶈浇鍑哄簱鍙� + layer.msg(res.msg); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + layer.msg(res.msg) + } + } + }); + } + break; + } + }); + + // 鎼滅储鏍忔悳绱簨浠� + form.on('submit(search)', function (data) { + pageCurr = 1; + $('#detlTable').css("display", 'none'); + tableReload(false); + getOutBound(); + }); + + // 鎼滅储鏍忛噸缃簨浠� + form.on('submit(reset)', function (data) { + pageCurr = 1; + clearFormVal($('#search-box')); + $('#detlTable').css("display", 'none'); + tableReload(false); + getOutBound(); + }); + +}) + +function tableReload(child) { + var searchData = {}; + $.each($('#search-box [name]').serializeArray(), function() { + searchData[this.name] = this.value; + }); + (child ? parent.tableIns : tableIns).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; + } + limit(child); + } + }); +} -- Gitblit v1.9.1