From cf943cb90fde999773267cbc14bf51a70881481a Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期二, 13 四月 2021 14:24:21 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/order/order.js | 228 +++++++++++++++++++++++--------------------------------- 1 files changed, 93 insertions(+), 135 deletions(-) diff --git a/src/main/webapp/static/js/order/order.js b/src/main/webapp/static/js/order/order.js index 99d261e..d973001 100644 --- a/src/main/webapp/static/js/order/order.js +++ b/src/main/webapp/static/js/order/order.js @@ -39,7 +39,7 @@ '</p>'].join(''), defaultToolbar: [], cols: [[ - {field: 'docId', title: '缂栧彿', width: 80, align: 'center'}, + {field: 'docId', title: '缂栧彿', width: 70, align: 'center'}, {field: 'docName', title: '鍗曟嵁绫诲瀷'} ]], done: function (res, curr, count) { @@ -48,8 +48,8 @@ }); /* 琛ㄦ牸鎼滅储 */ - form.on('submit(docTypeTable)', function (data) { - insTb.reload({where: data.field}); + form.on('submit(docTypeTableSearch)', function (data) { + insTb.reload({where: {doc_name: data.field.docName}}); return false; }); @@ -75,28 +75,32 @@ function showEditModel(mData, obj) { admin.open({ type: 1, - title: (mData ? '淇敼' : '娣诲姞') + '瀛楀吀', - content: $('#dictEditDialog').html(), + title: (mData ? '淇敼' : '娣诲姞') + '鍗曟嵁绫诲瀷', + content: $('#docTypeEditDialog').html(), success: function (layero, dIndex) { // 鍥炴樉琛ㄥ崟鏁版嵁 - form.val('dictEditForm', mData); + form.val('docTypeEditForm', mData); // 琛ㄥ崟鎻愪氦浜嬩欢 - form.on('submit(dictEditSubmit)', function (data) { + form.on('submit(docTypeEditSubmit)', function (data) { var loadIndex = layer.load(2); - $.get(mData ? '../../json/ok.json' : '../../json/ok.json', data.field, function (res) { - layer.close(loadIndex); - if (200 === res.code) { - layer.close(dIndex); - layer.msg(res.msg, {icon: 1}); - if (obj) { - obj.update(data.field); - } else { + $.ajax({ + url: baseUrl+"/docType/"+(mData?'update':'add')+"/auth", + headers: {'token': localStorage.getItem('token')}, + data: data.field, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + if (res.code === 200){ + layer.close(dIndex); + layer.msg(res.msg, {icon: 1}); insTb.reload(); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg, {icon: 2}); } - } else { - layer.msg(res.msg, {icon: 2}); } - }, 'json'); + }) return false; }); } @@ -105,30 +109,35 @@ /* 鍒犻櫎 */ function doDel(obj) { - layer.confirm('纭畾瑕佸垹闄ゆ瀛楀吀鍚楋紵', { + layer.confirm('纭畾瑕佸垹闄ゆ鍗曟嵁绫诲瀷鍚楋紵', { skin: 'layui-layer-admin', shade: .1 }, function (i) { layer.close(i); var loadIndex = layer.load(2); - $.get('../../json/ok.json', { - id: obj.data.dictId, - }, function (res) { - layer.close(loadIndex); - if (200 === res.code) { - layer.msg(res.msg, {icon: 1}); - obj.del(); - $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); - } else { - layer.msg(res.msg, {icon: 2}); + $.ajax({ + url: baseUrl+"/docType/delete/one/auth", + headers: {'token': localStorage.getItem('token')}, + data: {param: JSON.stringify(obj.data)}, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + if (res.code === 200){ + layer.closeAll(); + insTb.reload(); + $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + layer.msg(res.msg, {icon: 2}); + } } - }, 'json'); + }) }); } /****************************************** 鍙宠竟琛� *************************************************/ - /* 娓叉煋琛ㄦ牸2 */ var insTb2 = table.render({ @@ -138,7 +147,7 @@ page: true, limit: 16, limits: [16, 30, 50, 100, 200, 500], - toolbar: '#toolbar', + toolbar: '#orderToolbar', height: 'full-100', cols: [[ {type: 'checkbox'} @@ -147,7 +156,7 @@ ,{field: 'orderNo', align: 'center',title: '璁㈠崟缂栧彿'} ,{field: 'orderTime', align: 'center',title: '鍗曟嵁鏃ユ湡'} ,{field: 'docType$', align: 'center',title: '鍗曟嵁绫诲瀷'} - ,{field: 'itemId$', align: 'center',title: '椤圭洰缂栧彿'} + ,{field: 'itemName', align: 'center',title: '椤圭洰'} ,{field: 'allotItemId$', align: 'center',title: '璋冩嫧椤圭洰缂栧彿', hide: true} ,{field: 'defNumber', align: 'center',title: '鍒濆绁ㄦ嵁鍙�', hide: true} ,{field: 'number', align: 'center',title: '绁ㄦ嵁鍙�'} @@ -176,7 +185,6 @@ // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳',event: 'updateBy', style: 'cursor:pointer'} // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'} // ,{field: 'memo', align: 'center',title: '澶囨敞'} - ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150} ]], request: { @@ -194,6 +202,7 @@ response: { statusCode: 200 }, + size: 'lg', done: function(res, curr, count) { if (res.code === 403) { top.location.href = baseUrl+"/"; @@ -211,8 +220,13 @@ } }); /* 琛ㄦ牸2鎼滅储 */ - form.on('submit(orderTable)', function (data) { + form.on('submit(orderTbSearch)', function (data) { insTb2.reload({where: data.field, page: {curr: 1}}); + return false; + }); + /* 琛ㄦ牸2閲嶇疆 */ + form.on('submit(orderTbReset)', function (data) { + insTb2.reload({page: {curr: 1}}); return false; }); @@ -221,24 +235,27 @@ if (obj.event === 'edit') { // 淇敼 showEditModel2(obj.data); } else if (obj.event === 'del') { // 鍒犻櫎 - doDel2(obj); + var ids = []; + ids.push(obj.id) + doDelOrder({ids: ids}); } }); /* 琛ㄦ牸2澶村伐鍏锋爮鐐瑰嚮浜嬩欢 */ table.on('toolbar(orderTable)', function (obj) { if (obj.event === 'add') { // 娣诲姞 - showEditModel2(); + // showEditModel2(); + right(); } else if (obj.event === 'del') { // 鍒犻櫎 - var checkRows = table.checkStatus('dictDataTable'); + var checkRows = table.checkStatus('orderTable'); if (checkRows.data.length === 0) { layer.msg('璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁', {icon: 2}); return; } var ids = checkRows.data.map(function (d) { - return d.dictDataId; + return d.id; }); - doDel2({ids: ids}); + doDelOrder({ids: ids}); } }); @@ -271,26 +288,32 @@ }); } - /* 鍒犻櫎2 */ - function doDel2(obj) { + /* 鍒犻櫎璁㈠崟 */ + function doDelOrder(obj) { layer.confirm('纭畾瑕佸垹闄ら�変腑鏁版嵁鍚楋紵', { skin: 'layui-layer-admin', shade: .1 }, function (i) { layer.close(i); var loadIndex = layer.load(2); - $.get('../../json/ok.json', { - id: obj.data ? obj.data.dictDataId : '', - ids: obj.ids ? obj.ids.join(',') : '' - }, function (res) { - layer.close(loadIndex); - if (200 === res.code) { - layer.msg(res.msg, {icon: 1}); - insTb2.reload({page: {curr: 1}}); - } else { - layer.msg(res.msg, {icon: 2}); + $.ajax({ + url: baseUrl+"/orders/delete/auth", + headers: {'token': localStorage.getItem('token')}, + data: {ids: obj.ids}, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + 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 { + layer.msg(res.msg, {icon: 2}); + } } - }, 'json'); + }) + }); } @@ -309,88 +332,6 @@ -// // 鏁版嵁娓叉煋 -// tableIns = table.render({ -// elem: '#order', -// headers: {token: localStorage.getItem('token')}, -// url: baseUrl+'/order/list/auth', -// page: true, -// limit: 16, -// limits: [16, 30, 50, 100, 200, 500], -// even: true, -// toolbar: '#toolbar', -// cellMinWidth: 50, -// cols: [[ -// {type: 'checkbox'} -// // ,{field: 'id', align: 'center',title: 'ID'} -// // ,{field: 'uuid', align: 'center',title: '缂栧彿'} -// ,{field: 'orderNo', align: 'center',title: '璁㈠崟缂栧彿'} -// ,{field: 'orderTime', align: 'center',title: '鍗曟嵁鏃ユ湡'} -// ,{field: 'docType$', align: 'center',title: '鍗曟嵁绫诲瀷'} -// ,{field: 'itemId$', align: 'center',title: '椤圭洰缂栧彿'} -// ,{field: 'allotItemId$', align: 'center',title: '璋冩嫧椤圭洰缂栧彿', hide: true} -// ,{field: 'defNumber', align: 'center',title: '鍒濆绁ㄦ嵁鍙�', hide: true} -// ,{field: 'number', align: 'center',title: '绁ㄦ嵁鍙�'} -// // ,{field: 'cstmr$', align: 'center',title: '瀹㈡埛缂栧彿'} -// ,{field: 'cstmrName', align: 'center',title: '瀹㈡埛', hide: true} -// ,{field: 'tel', align: 'center',title: '鑱旂郴鏂瑰紡', hide: true} -// ,{field: 'operMemb', align: 'center',title: '鎿嶄綔浜哄憳'} -// ,{field: 'totalFee', align: 'center',title: '鍚堣閲戦'} -// ,{field: 'discount', align: 'center',title: '浼樻儬鐜�', hide: true} -// ,{field: 'discountFee', align: 'center',title: '浼樻儬閲戦', hide: true} -// ,{field: 'otherFee', align: 'center',title: '閿�鍞垨閲囪喘璐圭敤鍚堣', hide: true} -// ,{field: 'actFee', align: 'center',title: '瀹炰粯閲戦', hide: true} -// ,{field: 'payType$', align: 'center',title: '浠樻绫诲瀷'} -// ,{field: 'salesman', align: 'center',title: '涓氬姟鍛�', hide: true} -// ,{field: 'accountDay', align: 'center',title: '缁撶畻澶╂暟', hide: true} -// ,{field: 'postFeeType$', align: 'center',title: '閭垂鏀粯绫诲瀷', hide: true} -// ,{field: 'postFee', align: 'center',title: '閭垂', hide: true} -// ,{field: 'payTime$', align: 'center',title: '浠樻鏃堕棿', hide: true} -// ,{field: 'sendTime$', align: 'center',title: '鍙戣揣鏃堕棿', hide: true} -// ,{field: 'shipName', align: 'center',title: '鐗╂祦鍚嶇О', hide: true} -// ,{field: 'shipCode', align: 'center',title: '鐗╂祦鍗曞彿', hide: true} -// ,{field: 'settle$', align: 'center',title: '璁㈠崟鐘舵��'} -// // ,{field: 'status$', align: 'center',title: '鐘舵��'} -// // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳',event: 'createBy', style: 'cursor:pointer'} -// // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'} -// // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳',event: 'updateBy', style: 'cursor:pointer'} -// // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'} -// // ,{field: 'memo', align: 'center',title: '澶囨敞'} -// -// ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150} -// ]], -// 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; -// 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('sort(locMast)', function (obj) { // var searchData = {}; @@ -668,6 +609,23 @@ }); +function right(){ + top.popupRight = top.layui.admin.popupRight({ + id: 'LAY_adminPopupLayerTest' + , area: '750px' + , type: 2 + , shade: [0.5,'#000'] + , content:'order/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(); + } + }); +} + // 鍏抽棴鍔ㄤ綔 $(document).on('click','#data-detail-close', function () { parent.layer.closeAll(); -- Gitblit v1.9.1