From 431f88fdade07a22b636714f1690cee3a55668d0 Mon Sep 17 00:00:00 2001
From: cp <513960435@qq.com>
Date: 星期三, 30 十月 2024 13:35:56 +0800
Subject: [PATCH] 完善
---
zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js | 217 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 167 insertions(+), 50 deletions(-)
diff --git a/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js b/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js
index cbda7a6..e017858 100644
--- a/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js
+++ b/zy-asrs-wms/src/main/webapp/static/js/locInPrintMat/locInPrintMat.js
@@ -1,5 +1,6 @@
var pageCurr;
var pageCount = 0;
+var admin;
layui.config({
base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin', 'xmSelect'], function(){
@@ -8,7 +9,7 @@
var layer = layui.layer;
var layDate = layui.laydate;
var form = layui.form;
- var admin = layui.admin;
+ admin = layui.admin;
var xmSelect = layui.xmSelect;
// 鏁版嵁娓叉煋
@@ -24,20 +25,22 @@
height: 'full-120',
cols: [[
{type: 'checkbox'}
- ,{field: 'id', align: 'center',title: ''}
- ,{field: 'uuid', align: 'center',title: ''}
- ,{field: 'status', align: 'center',title: ''}
- ,{field: 'createTime$', align: 'center',title: ''}
- ,{field: 'createBy', align: 'center',title: ''}
- ,{field: 'updateTime$', align: 'center',title: ''}
- ,{field: 'updateBy', align: 'center',title: ''}
- ,{field: 'memo', align: 'center',title: ''}
- ,{field: 'matnr', align: 'center',title: ''}
- ,{field: 'batch', align: 'center',title: ''}
- ,{field: 'anfme', align: 'center',title: ''}
- ,{field: 'locNo', align: 'center',title: ''}
- ,{field: 'maktx', align: 'center',title: ''}
- ,{field: 'ownerId', align: 'center',title: ''}
+ ,{field: 'id', align: 'center',title: 'ID',hide : true}
+ ,{field: 'uuid', align: 'center',title: '缂栧彿',hide: true}
+ ,{field: 'status$', align: 'center',title: '鎵撳嵃鎯呭喌', width:100,hide: false}
+ ,{field: 'matnr', align: 'center',title: '鍝佸彿', width:180,hide: false}
+ ,{field: 'orderNo', align: 'center',title: '璁㈠崟鍙�', width:180,hide: false}
+ ,{field: 'decrees', align: 'center',title: '鍒朵护', width:180,hide: false}
+ // ,{field: 'batch', align: 'center',title: '鎵规', width:100,hide: false}
+ // ,{field: 'anfme', align: 'center',title: '閲嶉噺(kg)', width:100,hide: false}
+ // ,{field: 'locNo', align: 'center',title: '搴撲綅鍙�', width:120,hide: false}
+ ,{field: 'maktx', align: 'center',title: '鍝佸悕',hide: false}
+ // ,{field: 'owner$', align: 'center',title: '璐т富',hide: false}
+ // ,{field: 'createTime$', align: 'center',title: '鍏ュ簱鏃堕棿', width:120,hide: false}
+ // ,{field: 'createBy$', align: 'center',title: '鍏ュ簱浜哄憳', width:100,hide: false}
+ ,{field: 'updateTime$', align: 'center',title: '鎵撳嵃鏃堕棿', width:180,hide: false}
+ ,{field: 'updateBy$', align: 'center',title: '鎵撳嵃浜哄憳',hide: false}
+ ,{field: 'memo', align: 'center',title: '澶囨敞',hide: false}
,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
]],
@@ -60,7 +63,7 @@
if (res.code === 403) {
top.location.href = baseUrl+"/";
}
- pageCurr=curr;pageCount=count;
+ pageCurr=curr;
limit();
}
});
@@ -87,14 +90,14 @@
showEditModel();
break;
case 'deleteData':
- if (checkStatus.length === 0) {
- layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
- return;
- }
- del(checkStatus.map(function (d) {
- return d.id;
- }));
- break;
+ if (checkStatus.length === 0) {
+ layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2});
+ return;
+ }
+ del(checkStatus.map(function (d) {
+ return d.id;
+ }));
+ break;
case 'exportData':
admin.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
var titles=[];
@@ -133,6 +136,29 @@
});
});
break;
+ // 鎵归噺鎵撳嵃
+ case "btnPrintBatch":
+ printMatCodeNos = [];
+ var data = checkStatus;
+ if (data.length === 0){
+ layer.msg('璇烽�夋嫨鎵撳嵃鏁版嵁');
+ } else {
+ layer.open({
+ type: 1,
+ title: '鎵归噺鎵撳嵃 [鏁伴噺'+ data.length +']',
+ area: ['500px'],
+ shadeClose: true,
+ content: $('#printDataDiv'),
+ success: function(layero, index){
+ for (var i = 0; i<data.length;i++) {
+ printMatCodeNos.push(data[i].id);
+ }
+ },
+ end: function () {
+ }
+ });
+ }
+ break;
}
});
@@ -140,6 +166,10 @@
table.on('tool(locInPrintMat)', function(obj){
var data = obj.data;
switch (obj.event) {
+ case 'btnPrint':
+ layer.msg("搴熷純")
+ break;
+ // btnPrint(data.id, data.orderNo, 4);
case 'edit':
showEditModel(data);
break;
@@ -154,11 +184,11 @@
admin.open({
type: 1,
area: '600px',
- title: (mData ? '淇敼' : '娣诲姞') + '',
+ title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��',
content: $('#editDialog').html(),
success: function (layero, dIndex) {
- form.val('detail', mData);
layDateRender(mData);
+ form.val('detail', mData);
form.on('submit(editSubmit)', function (data) {
var loadIndex = layer.load(2);
$.ajax({
@@ -218,59 +248,146 @@
// 鎼滅储
form.on('submit(search)', function (data) {
pageCurr = 1;
- tableReload(true);
+ tableReload(false);
});
// 閲嶇疆
form.on('submit(reset)', function (data) {
pageCurr = 1;
clearFormVal($('#search-box'));
- tableReload(true);
+ tableReload(false);
+ });
+
+ // 妯℃澘閫夋嫨
+ form.on('radio(selectTemplateRadio)', function (data) {
+ $('.template-preview').hide();
+ $('#template-preview-'+data.value).show();
+ });
+
+ // 寮�濮嬫墦鍗�
+ form.on('submit(doPrint)', function (data) {
+ var templateNo = data.field.selectTemplate;
+ $.ajax({
+ url: baseUrl+"/loc/in/mat/print/auth",
+ headers: {'token': localStorage.getItem('token')},
+ data: {param: printMatCodeNos},
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ layer.closeAll();
+ for (let i=0;i<res.data.length;i++){
+ var templateDom = $("#templatePreview"+templateNo);
+ var className = templateDom.attr("class");
+ if (className === 'template-barcode') {
+ res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=1¶m="
+ +res.data[i].matnr
+ } else {
+ res.data[i]["barcodeUrl"]=baseUrl+"/mac/code/auth?type=2¶m="
+ +res.data[i].matnr
+ }
+ }
+ var tpl = templateDom.html();
+ var template = Handlebars.compile(tpl);
+ var html = template(res);
+ var box = $("#box");
+ box.html(html);box.show();
+ box.print({mediaPrint:true});
+ box.hide();
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ }else {
+ layer.msg(res.msg)
+ }
+ }
+ })
});
// 鏃堕棿閫夋嫨鍣�
function layDateRender(data) {
setTimeout(function () {
layDate.render({
- elem: '.layui-laydate-range'
- ,type: 'datetime'
- ,range: true
- });
- layDate.render({
elem: '#createTime\\$',
type: 'datetime',
- value: data!==undefined?data['createTime$']:null
+ value: data!==undefined?data['createTime\\$']:null
});
layDate.render({
elem: '#updateTime\\$',
type: 'datetime',
- value: data!==undefined?data['updateTime$']:null
+ value: data!==undefined?data['updateTime\\$']:null
});
- }, 100);
+ }, 300);
}
layDateRender();
-
-
});
+// excel瀵煎叆妯℃澘涓嬭浇
+function excelMouldDownload(){
+ layer.load(1, {shade: [0.1,'#fff']});
+ location.href = baseUrl + "/out/loc/box/excel/import/mould";
+ layer.closeAll('loading');
+}
+// excel瀵煎叆
+function importExcel() {
+ $("#importExcel").trigger("click");
+}
// 鍏抽棴鍔ㄤ綔
$(document).on('click','#data-detail-close', function () {
parent.layer.closeAll();
});
-function tableReload(search) {
- if (pageCount === 0 || search) {
- let searchData = {};
- $.each($('#search-box [name]').serializeArray(), function() {
- searchData[this.name] = this.value;
- });
- tableIns.reload({
- where: searchData,
- page: {curr: pageCurr}
- });
- } else {
- $(".layui-laypage-btn")[0].click();
+function tableReload(child) {
+ var searchData = {};
+ $.each($('#search-box [name]').serializeArray(), function() {
+ searchData[this.name] = this.value;
+ });
+ tableIns.reload({
+ where: searchData,
+ page: {curr: pageCurr}
+ });
+}
+
+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 + "/out/loc/box/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){
+ $("#importExcel").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