From 356840f0e99a3a16620b33367af0893eca053b30 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 12 四月 2021 13:21:39 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/ioWorks/matQuery.js | 210 ++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 162 insertions(+), 48 deletions(-)
diff --git a/src/main/webapp/static/js/ioWorks/matQuery.js b/src/main/webapp/static/js/ioWorks/matQuery.js
index ed49f52..66d4b01 100644
--- a/src/main/webapp/static/js/ioWorks/matQuery.js
+++ b/src/main/webapp/static/js/ioWorks/matQuery.js
@@ -9,12 +9,17 @@
cols.push({fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:65})
return cols;
}
-
-layui.use(['table','laydate', 'form'], function() {
+layui.config({
+ base: baseUrl + "/static/layui/lay/modules/"
+}).extend({
+ notice: 'notice/notice',
+}).use(['table','laydate', 'form', 'notice'], function() {
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
var form = layui.form;
+ var notice = layui.notice;
+ var layDate = layui.laydate;
tableIns = table.render({
elem: '#chooseData',
@@ -41,46 +46,102 @@
switch (obj.event) {
case 'createDoc':
if (data.length === 0){
- layer.msg('璇锋坊鍔犵墿鏂�');
- } else {
-
- layer.open({
- type: 1,
- title: '瀹氫箟閿�鍞崟缂栧彿',
- offset: '100px',
- area: ['360px'],
- shade: 0.1,
- content: $('#getOrderNo'),
- success: function(layero, index){
- layer.iframeAuto(index)
- },
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: '璇锋坊鍔犵墿鏂�'
});
+ } else {
+ var success = true;
+ for (var i=0;i<matData.length;i++) {
+ if (matData[i].count <= 0) {
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: matData[i].matnr + '鐗╂枡鏁伴噺蹇呴』澶т簬闆讹紒'
+ });
+ success = false;
+ return false;
+ }
+ }
+ var index = layer.load(1, {shade: [0.1,'#000']});
+ // 鍗曟嵁绫诲瀷
+ var docTypeData;
+ $.ajax({
+ url: baseUrl+"/work/docType/all/get",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ docTypeData = res;
+ } else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ }
+ });
+ var tpl1 = $('#docTypeSelectTpl').html();
+ var template1 = Handlebars.compile(tpl1);
+ var html1 = template1(docTypeData);
+ $("#docType").html(html1);
+ // 瀹㈡埛
+ var cstmrData;
+ $.ajax({
+ url: baseUrl+"/work/cstmr/all/get",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ cstmrData = res;
+ } else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ }
+ });
+ var tpl2 = $('#cstmrSelectTpl').html();
+ var template2 = Handlebars.compile(tpl2);
+ var html2 = template2(cstmrData);
+ $("#cstmr").html(html2);
- // var matDetls = [];
- // data.forEach(function(elem) {
- // matDetls.push({matnr: elem.matnr, count: elem.count});
- // });
- // $.ajax({
- // url: baseUrl+"/work/pakout/init",
- // headers: {'token': localStorage.getItem('token')},
- // data: JSON.stringify(matDetls),
- // contentType:'application/json;charset=UTF-8',
- // method: 'POST',
- // success: function (res) {
- // if (res.code === 200){
- // matData = [];
- // tableIns.reload({data: matData,done:function (res) {
- // limit();
- // }});
- // layer.msg(res.msg, {icon: 1});
- // } else if (res.code === 403){
- // top.location.href = baseUrl+"/";
- // } else {
- // layer.msg(res.msg)
- // }
- // }
- // });
+ // 椤圭洰
+ var itemData;
+ $.ajax({
+ url: baseUrl+"/work/item/all/get",
+ headers: {'token': localStorage.getItem('token')},
+ method: 'POST',
+ async: false,
+ success: function (res) {
+ if (res.code === 200){
+ itemData = res;
+ } else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ }
+ });
+ var tpl3 = $('#itemSelectTpl').html();
+ var template3 = Handlebars.compile(tpl3);
+ var html3 = template3(itemData);
+ $("#item").html(html3);
+
+ layer.close(index);
+ if (success) {
+ layer.open({
+ type: 1,
+ title: '鍗曟嵁濉厖',
+ offset: '100px',
+ area: ['360px'],
+ shade: 0.1,
+ content: $('#getOrderNo'),
+ success: function(layero, index){
+ layer.iframeAuto(index);
+ $(layero).children('.layui-layer-content').css('overflow', 'visible');
+ layui.form.render('select');
+ },
+ cancel: function () {
+ $('#orderNo').val('');
+ }
+ });
+ }
}
break;
}
@@ -103,34 +164,84 @@
}
});
- // 寮�濮嬫墦鍗�
+ // 寮�濮嬬敓鎴愭嫞璐у崟
form.on('submit(confirm)', function (data) {
+ var matDetls = [];
+ matData.forEach(function(elem) {
+ matDetls.push({matnr: elem.matnr
+ , count: elem.count
+ });
+ });
+ var number = data.field.orderNo; // 鍗曞彿
+ if (number.substring(0, 3) !== 'PR-') {
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: '鍗曞彿涓嶇鍚堣鍒欙紝璇蜂互 PR- 寮�澶�'
+ });
+ return false;
+ }
+ var req = JSON.stringify({
+ number: number
+ , customerTypeId: data.field.customerTypeId
+ , list: matDetls
+ })
+ $.ajax({
+ url: baseUrl+"/work/order/init",
+ headers: {'token': localStorage.getItem('token')},
+ data: req,
+ contentType:'application/json;charset=UTF-8',
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200){
+ notice.success({
+ title: '娑堟伅閫氱煡',
+ message: res.msg
+ });
+ top.layui.layer.close(top.popupRight);
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: res.msg
+ });
+ }
+ }
+ });
})
function updateMatData(locNo, matnr, count) {
if (isNaN(count)) {
- layer.msg("璇疯緭鍏ユ暟瀛�");
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: '璇疯緭鍏ユ暟瀛�'
+ });
} else {
if (count > 0) {
for (var i=0;i<matData.length;i++){
if (matData[i]["matnr"] === matnr){
- // if (count > locDetlData[i]["anfme"]) {
- // layer.msg("涓嶈兘瓒呰繃鍘熸暟閲�");
- // } else {
- matData[i]["count"] = count;
- // }
+ matData[i]["count"] = count;
break;
}
}
} else {
- layer.msg("鏁伴噺蹇呴』澶т簬闆�");
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: '鏁伴噺蹇呴』澶т簬闆�'
+ });
}
}
tableIns.reload({data: matData,done:function (res) {
limit();
}});
}
+
+ layDate.render({
+ elem: '#orderTime',
+ trigger: 'click',
+ type: 'date'
+ });
})
@@ -183,7 +294,10 @@
} else if (res.code === 403){
top.location.href = baseUrl+"/";
} else {
- layer.msg(res.msg, {icon: 2})
+ notice.error({
+ title: '娑堟伅閫氱煡',
+ message: res.msg
+ });
}
}
});
--
Gitblit v1.9.1