From 70b86bb70e6941127888979dbde37dda3b1db0b6 Mon Sep 17 00:00:00 2001
From: cp <513960435@qq.com>
Date: 星期二, 19 十一月 2024 09:14:43 +0800
Subject: [PATCH] 完善下架功能
---
zy-asrs-wms/src/main/webapp/static/js/safeSto/safeSto.js | 215 ++++++++++++++++++++++++++++++++---------------------
1 files changed, 131 insertions(+), 84 deletions(-)
diff --git a/zy-asrs-wms/src/main/webapp/static/js/safeSto/safeSto.js b/zy-asrs-wms/src/main/webapp/static/js/safeSto/safeSto.js
index bcbbedf..bad03ce 100644
--- a/zy-asrs-wms/src/main/webapp/static/js/safeSto/safeSto.js
+++ b/zy-asrs-wms/src/main/webapp/static/js/safeSto/safeSto.js
@@ -1,21 +1,23 @@
var pageCurr;
+var admin;
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
-}).use(['table','laydate', 'form', 'element', 'admin', 'xmSelect'], function(){
+}).use(['table', 'laydate', 'form', 'element', 'admin', 'xmSelect'], function () {
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
var layDate = layui.laydate;
var form = layui.form;
var element = layui.element;
- var admin = layui.admin;
+ admin = layui.admin;
var xmSelect = layui.xmSelect;
+
// 鏁版嵁娓叉煋
tableIns = table.render({
elem: '#safeSto',
headers: {token: localStorage.getItem('token')},
- url: baseUrl+'/safeSto/list/auth',
+ url: baseUrl + '/safeSto/list/auth',
page: true,
limit: 16,
limits: [16, 30, 50, 100, 200, 500],
@@ -23,14 +25,14 @@
cellMinWidth: 50,
cols: [[
{type: 'numbers', fixed: 'left'}
- ,{field: 'node_name', align: 'center',title: '璐т綅'}
- ,{field: 'matnr', align: 'center',title: '鍟嗗搧缂栧彿'}
- ,{field: 'maktx', align: 'center',title: '鍟嗗搧鍚嶇О'}
- ,{field: 'progress', align: 'center',title: '浣跨敤鎯呭喌', templet: '#progressTpl', width: 350}
- ,{field: 'status', align: 'center',title: '璀︽姤', templet: '#statusTpl', width: 100}
- ,{field: 'safe_qua', align: 'center',title: '瀹夊叏搴撳瓨閲�', style: 'font-weight: bold'}
- ,{field: 'amount', align: 'center',title: '褰撳墠搴撳瓨閲�', style: 'font-weight: bold; color: #2d8cf0'}
- ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
+ , {field: 'locNo$', align: 'center', title: '搴撲綅'}
+ , {field: 'matnr', align: 'center', title: '鍝佸彿'}
+ , {field: 'maktx', align: 'center', title: '鍚嶇О'}
+ , {field: 'progress', align: 'center', title: '浣跨敤鎯呭喌', templet: '#progressTpl', width: 350}
+ , {field: 'status', align: 'center', title: '璀︽姤', templet: '#statusTpl', width: 100}
+ , {field: 'safeQua', align: 'center', title: '瀹夊叏搴撳瓨閲�', style: 'font-weight: bold'}
+ , {field: 'amount', align: 'center', title: '褰撳墠搴撳瓨閲�', style: 'font-weight: bold; color: #2d8cf0'}
+ , {fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 120}
]],
request: {
pageName: 'curr',
@@ -47,12 +49,12 @@
response: {
statusCode: 200
},
- done: function(res, curr, count) {
+ done: function (res, curr, count) {
if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ top.location.href = baseUrl + "/";
}
element.render('progress')
- pageCurr=curr;
+ pageCurr = curr;
limit();
}
});
@@ -61,13 +63,13 @@
// 鐩戝惉澶村伐鍏锋爮浜嬩欢
table.on('toolbar(safeSto)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
- switch(obj.event) {
+ switch (obj.event) {
case 'add':
showEditModel();
break;
case 'exportData':
- layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
- window.location.href = baseUrl + '/safeSto/excel/export/auth?token='+localStorage.getItem('token');
+ layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function () {
+ window.location.href = baseUrl + '/safeSto/excel/export/auth?token=' + localStorage.getItem('token');
layer.closeAll();
});
break;
@@ -75,7 +77,7 @@
});
// 鐩戝惉琛屽伐鍏蜂簨浠�
- table.on('tool(safeSto)', function(obj){
+ table.on('tool(safeSto)', function (obj) {
var data = obj.data;
switch (obj.event) {
// 淇敼
@@ -86,34 +88,34 @@
case 'del':
var params = [];
params.push({
- nodeId: data.node_id,
- nodeName: data.node_name,
+ id: data.id,
+ locNo: data.locNo,
matnr: data.matnr
})
doDel(params);
break;
// 琛ヤ粨
case 'allot':
- layer.confirm(data.node_name +'琛ヤ粨 '+ data.matnr + '锛屾暟閲忥細' + (data.safe_qua - data.amount), function(){
- var index = layer.load(1, {shade: [0.1,'#000']});
+ layer.confirm(data.node_name + '琛ヤ粨 ' + data.matnr + '锛屾暟閲忥細' + (data.safe_qua - data.amount), function () {
+ var index = layer.load(1, {shade: [0.1, '#000']});
$.ajax({
- url: baseUrl+"/work/stock/transfer",
+ url: baseUrl + "/work/stock/transfer",
headers: {'token': localStorage.getItem('token')},
- contentType:'application/json;charset=UTF-8',
+ contentType: 'application/json;charset=UTF-8',
data: JSON.stringify({
node_id: data.node_id,
matnr: data.matnr,
safe_qua: data.safe_qua,
amount: data.amount
}),
- dataType:'json',
+ dataType: 'json',
method: 'POST',
success: function (res) {
if (res.code === 200) {
layer.msg(res.msg, {icon: 1})
$(".layui-laypage-btn")[0].click();
} else if (res.code === 403) {
- top.location.href = baseUrl+"/";
+ top.location.href = baseUrl + "/";
} else {
layer.msg(res.msg, {icon: 2})
}
@@ -137,70 +139,59 @@
form.val('detail', mData);
// 琛ㄥ崟鎻愪氦浜嬩欢
form.on('submit(editSubmit)', function (data) {
- data.field.nodeId = insNodeXmSel.getValue()[0] ? insNodeXmSel.getValue()[0].id : null;
+ data.field.locNo = locNoXmSelect.getValue()[0] ? locNoXmSelect.getValue()[0].name : null;
data.field.matId = matXmSelect.getValue()[0] ? matXmSelect.getValue()[0].value : null;
var loadIndex = layer.load(2);
$.ajax({
- url: baseUrl+"/safeSto/"+(mData?'update':'add')+"/auth",
+ url: baseUrl + "/safeSto/" + (mData ? 'update' : 'add') + "/auth",
headers: {'token': localStorage.getItem('token')},
data: JSON.stringify(data.field),
- contentType:'application/json;charset=UTF-8',
+ contentType: 'application/json;charset=UTF-8',
method: 'POST',
success: function (res) {
layer.close(loadIndex);
- if (res.code === 200){
+ if (res.code === 200) {
layer.close(dIndex);
layer.msg(res.msg, {icon: 1});
tableReload();
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- }else {
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
layer.msg(res.msg, {icon: 2});
}
}
})
return false;
});
- // 娓叉煋浠撳簱涓嬫媺鏍�
- var insNodeXmSel;
- $.ajax({
- url: baseUrl + "/node/tree/auth",
- headers: {'token': localStorage.getItem('token')},
- method: 'POST',
- async: false,
- success: function (res) {
- if (res.code === 200) {
- insNodeXmSel = xmSelect.render({
- el: '#nodeSel',
- autoRow: true,
- radio: true, // 鍗曢��
- filterable: true,
- height: '300px',
- tree: {
- show: true,
- showFolderIcon: true,
- showLine: true,
- indent: 20,
- strict: false, // 鐖惰妭鐐逛篃鑳介�変腑锛岄噸瑕�
- clickExpand: true,
- clickCheck: false,
- expandedKeys: true
- },
- prop: {
- name: 'title',
- value: 'id',
- },
- toolbar: {
- show: true,
- list: ['ALL', 'REVERSE', 'CLEAR']
- },
- data: function(){
- return res.data
+ // 娓叉煋鍟嗗搧閫夋嫨
+ var locNoXmSelect = xmSelect.render({
+ el: '#locNo',
+ radio: true,
+ autoRow: true,
+ toolbar: {show: true},
+ filterable: true,
+ remoteSearch: true,
+ remoteMethod: function (val, cb, show) {
+ //杩欓噷濡傛灉val涓虹┖, 鍒欎笉瑙﹀彂鎼滅储
+ // if(!val){
+ // return cb([]);
+ // }
+ $.ajax({
+ url: baseUrl + "/locMast/all/get/kv",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ condition: val
+ },
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200) {
+ cb(res.data)
+ } else {
+ cb([]);
+ layer.msg(res.msg, {icon: 2});
}
- })
- } else {
- layer.msg(res.msg, {icon: 2});
- }
+ }
+ });
}
})
// 娓叉煋鍟嗗搧閫夋嫨
@@ -208,23 +199,23 @@
el: '#mat',
radio: true,
autoRow: true,
- toolbar: { show: true },
+ toolbar: {show: true},
filterable: true,
remoteSearch: true,
- remoteMethod: function(val, cb, show){
+ remoteMethod: function (val, cb, show) {
//杩欓噷濡傛灉val涓虹┖, 鍒欎笉瑙﹀彂鎼滅储
// if(!val){
// return cb([]);
// }
$.ajax({
- url: baseUrl+"/mat/all/get/kv",
+ url: baseUrl + "/mat/all/get/kv",
headers: {'token': localStorage.getItem('token')},
data: {
condition: val
},
method: 'POST',
success: function (res) {
- if (res.code === 200){
+ if (res.code === 200) {
cb(res.data)
} else {
cb([]);
@@ -251,18 +242,18 @@
layer.close(i);
var loadIndex = layer.load(2);
$.ajax({
- url: baseUrl+"/safeSto/delete/auth",
+ url: baseUrl + "/safeSto/delete/auth",
headers: {'token': localStorage.getItem('token')},
data: JSON.stringify(params),
- contentType:'application/json;charset=UTF-8',
+ contentType: 'application/json;charset=UTF-8',
method: 'POST',
success: function (res) {
layer.close(loadIndex);
- if (res.code === 200){
+ if (res.code === 200) {
layer.msg(res.msg, {icon: 1});
$(".layui-laypage-btn")[0].click();
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
} else {
layer.msg(res.msg, {icon: 2});
}
@@ -298,13 +289,13 @@
});
// 鍏抽棴鍔ㄤ綔
-$(document).on('click','#data-detail-close', function () {
+$(document).on('click', '#data-detail-close', function () {
parent.layer.closeAll();
});
function tableReload() {
var searchData = {};
- $.each($('#search-box [name]').serializeArray(), function() {
+ $.each($('#search-box [name]').serializeArray(), function () {
searchData[this.name] = this.value;
});
tableIns.reload({
@@ -316,9 +307,65 @@
}
-
$('body').keydown(function () {
if (event.keyCode === 13) {
$("#search").click();
}
});
+
+// excel瀵煎叆妯℃澘涓嬭浇
+function downloadData() {
+ layer.load(1, {shade: [0.1, '#fff']});
+ location.href = baseUrl + "/safeSto/excel/import/mould";
+ layer.closeAll('loading');
+}
+
+// excel瀵煎叆
+function importData() {
+ $("#btn-import").trigger("click");
+}
+
+function upload(obj) {
+ if (!obj.files) {
+ return;
+ }
+ var file = obj.files[0];
+ admin.confirm('纭鍚屾 [' + file.name + '] 鏂囦欢鍚楋紵', function (index) {
+ layer.load(1, {shade: [0.1, '#fff']});
+ var url = baseUrl + "/safeSto/excel/import/auth";
+ var form = new FormData();
+ form.append("file", file);
+ xhr = new XMLHttpRequest();
+ xhr.open("post", url, true); //post鏂瑰紡锛寀rl涓烘湇鍔″櫒璇锋眰鍦板潃锛宼rue 璇ュ弬鏁拌瀹氳姹傛槸鍚﹀紓姝ュ鐞嗐��
+ xhr.setRequestHeader('token', localStorage.getItem('token'));
+ xhr.onload = uploadComplete; //璇锋眰瀹屾垚
+ xhr.onerror = uploadFailed; //璇锋眰澶辫触
+ xhr.onloadend = function () { // // 涓婁紶瀹屾垚閲嶇疆鏂囦欢娴�
+ layer.closeAll('loading');
+ $("#importExcel").val("");
+ };
+ // xhr.upload.onprogress = progressFunction;//銆愪笂浼犺繘搴﹁皟鐢ㄦ柟娉曞疄鐜般��
+ xhr.upload.onloadstart = function () {//涓婁紶寮�濮嬫墽琛屾柟娉�
+ ot = new Date().getTime(); //璁剧疆涓婁紶寮�濮嬫椂闂�
+ oloaded = 0;//璁剧疆涓婁紶寮�濮嬫椂锛屼互涓婁紶鐨勬枃浠跺ぇ灏忎负0
+ };
+ xhr.send(form);
+ }, function (index) {
+ $("#btn-import").val("");
+ });
+}
+
+function uploadComplete(evt) {
+ var res = JSON.parse(evt.target.responseText);
+ if(res.code === 200) {
+ layer.msg(res.msg, {icon: 1});
+ loadTree("");
+ } else {
+ layer.msg(res.msg, {icon: 2});
+ }
+}
+
+function uploadFailed(evt) {
+ var res = JSON.parse(evt.target.responseText);
+ layer.msg(res.msg, {icon: 2});
+}
--
Gitblit v1.9.1