From 0e69b6d27e19862a9832b627d358d9ce04118a6e Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 23 三月 2021 17:00:27 +0800
Subject: [PATCH] #
---
src/main/webapp/static/js/custOrder/custOrder.js | 295 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 186 insertions(+), 109 deletions(-)
diff --git a/src/main/webapp/static/js/custOrder/custOrder.js b/src/main/webapp/static/js/custOrder/custOrder.js
index a5adbdd..beae1f1 100644
--- a/src/main/webapp/static/js/custOrder/custOrder.js
+++ b/src/main/webapp/static/js/custOrder/custOrder.js
@@ -1,29 +1,28 @@
var pageCurr;
-
function right(){
- top.layui.admin.popupRight({
+ top.popupRight = top.layui.admin.popupRight({
id: 'LAY_adminPopupLayerTest'
, area: '750px'
, type: 2
- ,content:'custOrder/matQuery.html'
- ,success: function(){
+ , content:'custOrder/matQuery.html'
+ , success: function(){
// $('#'+ this.id).html('<div style="padding: 20px;">鏀惧叆鍐呭</div>');
//admin.view(this.id).render('system/xxx')
}
+ , end: function () {
+ $(".layui-laypage-btn")[0].click();
+ }
});
}
-
layui.config({
- base: '../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
-}).extend({
- index: 'lib/index' //涓诲叆鍙fā鍧�
-}).use(['table', 'laydate', 'form'], function(){
+ base: baseUrl + "/static/layui/lay/modules/" // 閰嶇疆妯″潡鎵�鍦ㄧ殑鐩綍
+}).use(['table', 'laydate', 'form', 'tableX'], function(){
var table = layui.table;
var $ = layui.jquery;
var layer = layui.layer;
var layDate = layui.laydate;
var form = layui.form;
- var admin = layui.admin;
+ var tableX = layui.tableX;
// 鏁版嵁娓叉煋
tableIns = table.render({
@@ -39,17 +38,18 @@
cols: [[
{type: 'checkbox'}
// ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
- ,{field: 'number', align: 'center',title: '閿�鍞崟鍙�'}
- ,{field: 'billDate', align: 'center',title: '鍗曟嵁鏃ユ湡'}
- ,{field: 'bTypeId', align: 'center',title: '瀹㈡埛缂栧彿'}
- ,{field: 'eTypeId', align: 'center',title: '缁忔墜浜虹紪鍙�'}
+ ,{field: 'number', align: 'center',title: '鍗曞彿'}
+
+ ,{field: 'btypeId', align: 'center',title: '瀹㈡埛缂栧彿'}
+ ,{field: 'etypeId', align: 'center',title: '缁忔墜浜虹紪鍙�', hide: true}
,{field: 'userCode', align: 'center',title: '鍟嗗搧缂栧彿'}
,{field: 'qty', align: 'center',title: '鍟嗗搧鏁伴噺'}
- ,{field: 'price', align: 'center',title: '鍟嗗搧鍗曚环'}
- ,{field: 'comment', align: 'center',title: '鍟嗗搧澶囨敞'}
- ,{field: 'status$', align: 'center',title: '鐘舵��'}
+ ,{field: 'price', align: 'center',title: '鍟嗗搧鍗曚环', hide: true}
+ ,{field: 'comment', align: 'center',title: '鍟嗗搧澶囨敞', hide: true}
+ ,{field: 'status$', align: 'center',title: '鐘舵��', templet: '#statusTpl', width: 100}
+ ,{field: 'billDate', align: 'center',title: '鍗曟嵁鏃ユ湡'}
// ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
- ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+ ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿', hide: true}
// ,{field: 'memo', align: 'center',title: '澶囨敞'}
,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width: 120}
@@ -74,6 +74,7 @@
top.location.href = baseUrl+"/";
}
pageCurr=curr;
+ tableX.merges('custOrder', [1, 11]);
limit();
form.on('checkbox(tableCheckbox)', function (data) {
var _index = $(data.elem).attr('table-index')||0;
@@ -113,20 +114,6 @@
table.on('toolbar(custOrder)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event) {
- case 'addData':
- layer.open({
- type: 2,
- title: '鏂板',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- content: 'custOrder_detail.html',
- success: function(layero, index){
- layer.getChildFrame('#data-detail-submit-edit', index).hide();
- clearFormVal(layer.getChildFrame('#detail', index));
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- }
- });
- break;
case 'deleteData':
var data = checkStatus.data;
if (data.length === 0){
@@ -142,7 +129,7 @@
success: function (res) {
if (res.code === 200){
layer.closeAll();
- tableReload(false);
+ $(".layui-laypage-btn")[0].click();
} else if (res.code === 403){
top.location.href = baseUrl+"/";
} else {
@@ -200,68 +187,89 @@
switch (obj.event) {
// 鎷h揣
case 'stockOut':
- layer.confirm(data.number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){
- layer.closeAll();
- $.ajax({
- url: baseUrl+"/work/stock/out",
- headers: {'token': localStorage.getItem('token')},
- contentType:'application/json;charset=UTF-8',
- data: JSON.stringify({
- number: data.number
- }),
- method: 'POST',
- success: function (res) {
- // 鎴愬姛
- if (res.code === 200){
- layer.confirm(res.msg, {
- shadeClose: true
- , btn: ['鎵撳嵃鎷h揣鍗�']
- }, function() {
- layer.closeAll();
- printPakouts(data.number);
- }
- )
- // 缂烘枡
- } else if (res.code === 20001) {
- layer.confirm(res.msg, {
- shadeClose: true
- , btn: ['搴撳瓨璋冩嫧', '鎵撳嵃']
- }, function() {
- // todo 搴撳瓨璋冩嫧
- layer.closeAll();
- }, function() {
- printPakouts(data.number);
- layer.closeAll();
- }
- )
- } else if (res.code === 403){
- top.location.href = baseUrl+"/";
- } else {
- layer.msg(res.msg)
- }
- $(".layui-laypage-btn")[0].click();
+ var loadIndex = layer.load(2);
+ $.ajax({
+ url: baseUrl + "/work/stock/out/preview",
+ headers: {'token': localStorage.getItem('token')},
+ contentType: 'application/json;charset=UTF-8',
+ data: JSON.stringify({
+ number: data.number
+ }),
+ method: 'POST',
+ success: function (res) {
+ layer.close(loadIndex);
+ // 鎴愬姛
+ if (res.code === 200){
+ layer.open({
+ type: 1
+ ,title: false
+ ,closeBtn: false
+ ,offset: '100px'
+ // ,area: ['800px','450px']
+ ,area: '1000px'
+ ,shade: 0.5
+ ,shadeClose: true
+ ,id: 'LAY_layuipro'
+ ,btn: ['绔嬪嵆鐢熸垚', '绋嶅悗澶勭悊']
+ ,btnAlign: 'c'
+ ,moveType: 1 //鎷栨嫿妯″紡锛�0鎴栬��1
+ ,content: $('#stoukOutPreview')
+ ,success: function(layero, index){
+ table.render({
+ elem: '#stoPreTab',
+ data: res.data,
+ page: true,
+ cellMinWidth: 100,
+ // ,width: admin.screen() > 1 ? 892 : ''
+ height: 432,
+ cols: [[
+ {field: 'title', title: '鍟嗗搧', align: 'center'},
+ {field: 'anfme', title: '鎬绘暟閲�', align: 'center', style: 'font-weight: bold', width: 90},
+ {field: 'type', title: '浠撳簱', align: 'center', templet: '#typeTpl', width: 90},
+ {field: 'locNo', title: '璐т綅', align: 'center'},
+ {field: 'prior$', title: '鎺ㄨ崘璐т綅', align: 'center', width: 100},
+ {field: 'reduce', title: '鏁伴噺', align: 'center', width: 90, style: 'font-weight: bold'},
+ // {field: 'remQty', title: '浣欓噺', align: 'center', width: 80},
+ {field: 'total', title: '鎬婚噺', align: 'center', width: 90},
+ ]],
+ done: function () {
+ tableX.merges('stoPreTab', [0,1,2]);
+ $('.layui-table-body.layui-table-main').css("overflow", "auto")
+ }
+ });
+
+ }
+ ,yes: function(index, layero){
+ //鎸夐挳銆愰┈涓婃嫞璐с�戠殑鍥炶皟
+ stockOut(data.number);
+ }
+ ,btn2: function(index, layero){
+ //鎸夐挳銆愮◢鍚庡鐞嗐�戠殑鍥炶皟
+ //return false 寮�鍚浠g爜鍙姝㈢偣鍑昏鎸夐挳鍏抽棴
+ }
+ });
+ // 缂烘枡
+ } else if (res.code === 20001) {
+ layer.confirm(res.msg, {
+ shadeClose: true
+ , area: ['400px']
+ , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
+ }, function() {
+ // 搴撳瓨璋冩嫧
+ stockTransfer(data.number);
+ layer.closeAll();
+ }, function() {
+ // printPakouts(data.number);
+ layer.closeAll();
+ }
+ )
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg, {icon: 1})
}
- })
- });
- break;
- // 璇︽儏
- case 'detail':
- layer.open({
- type: 2,
- title: '璇︽儏',
- maxmin: true,
- area: [top.detailWidth, top.detailHeight],
- shadeClose: true,
- content: 'custOrder_detail.html',
- success: function(layero, index){
- setFormVal(layer.getChildFrame('#detail', index), data, true);
- top.convertDisabled(layer.getChildFrame('#data-detail :input', index), true);
- layer.getChildFrame('#data-detail-submit-save,#data-detail-submit-edit,#prompt', index).hide();
- layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
- layero.find('iframe')[0].contentWindow.layui.form.render('select');
- layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
}
- });
+ })
break;
// 鎵撳嵃
case 'print':
@@ -273,6 +281,75 @@
}
});
+
+ // 寮�濮嬫嫞璐�
+ function stockOut(number) {
+ // layer.confirm(number + ' 璁㈠崟寮�濮嬫嫞璐э紵', {shadeClose: true}, function(){
+ layer.closeAll();
+ $.ajax({
+ url: baseUrl+"/work/stock/out",
+ headers: {'token': localStorage.getItem('token')},
+ contentType:'application/json;charset=UTF-8',
+ data: JSON.stringify({
+ number: number
+ }),
+ method: 'POST',
+ success: function (res) {
+ // 鎴愬姛
+ if (res.code === 200){
+ layer.confirm(res.msg, {
+ shadeClose: true
+ , btn: ['鎵撳嵃鎷h揣鍗�']
+ }, function() {
+ layer.closeAll();
+ printPakouts(number);
+ }
+ )
+ // 缂烘枡
+ } else if (res.code === 20001) {
+ layer.confirm(res.msg, {
+ shadeClose: true
+ , btn: ['搴撳瓨璋冩嫧', '鍙栨秷']
+ }, function() {
+ // 搴撳瓨璋冩嫧
+ layer.closeAll();
+ }, function() {
+ alert(number)
+ layer.closeAll();
+ }
+ )
+ } else if (res.code === 403){
+ top.location.href = baseUrl+"/";
+ } else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ $(".layui-laypage-btn")[0].click();
+ }
+ })
+ // });
+ }
+
+ // 搴撳瓨璋冩嫧
+ function stockTransfer(number) {
+
+ $.ajax({
+ url: baseUrl + "/work/stock/transfer",
+ headers: {'token': localStorage.getItem('token')},
+ data: {
+ number: number
+ },
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200) {
+ layer.msg(res.msg, {icon: 1})
+ } else if (res.code === 403) {
+ top.location.href = baseUrl + "/";
+ } else {
+ layer.msg(res.msg, {icon: 2})
+ }
+ }
+ });
+ }
// 鎵撳嵃鎷h揣鍗�
function printPakouts(docNumber) {
@@ -435,22 +512,22 @@
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);
- }
+ // 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