From ea269db73631ff50e9d161f69b044b915cdac089 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期四, 28 三月 2024 16:52:11 +0800 Subject: [PATCH] #周计划 --- src/main/webapp/static/js/weekly/weekly.js | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 285 insertions(+), 15 deletions(-) diff --git a/src/main/webapp/static/js/weekly/weekly.js b/src/main/webapp/static/js/weekly/weekly.js index 3231054..afa0435 100644 --- a/src/main/webapp/static/js/weekly/weekly.js +++ b/src/main/webapp/static/js/weekly/weekly.js @@ -333,6 +333,9 @@ case "edit": showEditModel(data); break; + case "editReality": + showEditModel2(data); + break; case "lookPlan": var $a = $(obj.tr).find('a[lay-event="lookPlan"]'); var offset = $a.offset(); @@ -360,17 +363,17 @@ cols: [[ {type: 'numbers'} ,{field: 'weeklyDay$', align: 'center',title: '鏄熸湡'} - ,{field: 'workContent', title: '宸ヤ綔鍐呭', style: 'color: blue;font-weight: bold', edit:true} - ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', style: 'color: blue;font-weight: bold', edit:true} - ,{field: 'comment', title: '璇勮', style: 'color: blue;font-weight: bold', edit:true} - ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'workContent', title: '宸ヤ綔鍐呭', edit:true} + ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', edit:true} + ,{field: 'comment', title: '璇勮', edit:true} + ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', edit:true} // ,{field: 'dailyTime$', align: 'center',title: '鏃ユ姤鏃ユ湡'} // ,{field: 'settleMsg', align: 'center',title: '瀹℃牳杩涘害'} // ,{field: 'director', align: 'center',title: '璐熻矗浜�'} // ,{field: 'settleSize', align: 'center',title: '娴佺▼闀垮害'} // ,{field: 'settleCurrent', align: 'center',title: '褰撳墠杩涘害'} - ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} - ,{field: 'memo', align: 'center',title: '澶囨敞', style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} + ,{field: 'memo', align: 'center',title: '澶囨敞', edit:true} ]], request: { pageName: 'curr', @@ -422,17 +425,17 @@ cols: [[ {type: 'numbers'} ,{field: 'weeklyDay$', align: 'center',title: '鏄熸湡'} - ,{field: 'workContent', title: '宸ヤ綔鍐呭', style: 'color: blue;font-weight: bold', edit:true} - ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', style: 'color: blue;font-weight: bold', edit:true} - ,{field: 'comment', title: '璇勮', style: 'color: blue;font-weight: bold', edit:true} - ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'workContent', align: 'center', title: '宸ヤ綔鍐呭', edit:true} + ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', edit:true} + ,{field: 'comment', title: '璇勮', edit:true} + ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', edit:true} // ,{field: 'dailyTime$', align: 'center',title: '鏃ユ姤鏃ユ湡'} // ,{field: 'settleMsg', align: 'center',title: '瀹℃牳杩涘害'} // ,{field: 'director', align: 'center',title: '璐熻矗浜�'} // ,{field: 'settleSize', align: 'center',title: '娴佺▼闀垮害'} // ,{field: 'settleCurrent', align: 'center',title: '褰撳墠杩涘害'} - ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} - ,{field: 'memo', align: 'center',title: '澶囨敞', width: 100, style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} + ,{field: 'memo', align: 'center',title: '澶囨敞', edit:true} ]], request: { pageName: 'curr', @@ -506,7 +509,7 @@ headers: {'token': localStorage.getItem('token')}, data: JSON.stringify({ weeklyType: Number(data.field.weeklyType), - orderId: data.field.orderId, + weeklyId: data.field.id, // type: Number(data.field.type), type: Number(1), weeklyDailyPlanList: nList @@ -595,8 +598,8 @@ method: 'POST', success: function (res) { if (res.code === 200) { - console.log("res111111111111") - console.log(res) + // console.log("res111111111111") + // console.log(res) var template = $('#cstmrId').html(); // 鑾峰彇妯℃澘鍐呭 var compiledTemplate = Handlebars.compile(template); // 缂栬瘧妯℃澘 var html = compiledTemplate(res.data); // 灏嗘暟鎹簲鐢ㄥ埌妯℃澘涓� @@ -757,6 +760,273 @@ }); } + // 鏄剧ず琛ㄥ崟寮圭獥 + function showEditModel2(expTpe) { + admin.open({ + type: 1, + title: (expTpe ? '鍒涘缓' : '鍒涘缓') + '鏃ヨ绋�', + content: $('#editDialog').html(), + area: '2200px', + success: function (layero, dIndex) { + $(layero).children('.layui-layer-content').css('overflow', 'visible'); + var isExpAdd = !expTpe; + if (expTpe){ + document.getElementById('weeklyDisplay').style.display = 'none'; + } + // 鍥炴樉鏁版嵁 + form.val('editForm', expTpe); + console.log(expTpe) + if (expTpe) { + // $('#orderNo').attr("disabled", "disabled"); + } + // 琛ㄥ崟鎻愪氦浜嬩欢 + form.on('submit(weeklyEditSubmit)', function (data) { + // 缁勮鏁版嵁 + if (xxDataList.length <= 0) { + layer.tips('璇锋坊鍔犳姤閿�鏄庣粏', '#matAddBtnComment', {tips: [1, '#ff4c4c']}); + return false; + } + let nList = admin.util.deepClone(xxDataList); + for (let xi = 0; xi < nList.length; xi++) { + // if (nList[xi].anfme <= 0){ + // layer.msg('鏄庣粏淇敼鏁伴噺涓嶅悎娉�', {icon: 2}); + // return false; + // } + } + layer.load(2); + $.ajax({ + url: baseUrl+"/weekly/from/" + (isExpAdd?"add":"modify") + "/auth2", + headers: {'token': localStorage.getItem('token')}, + data: JSON.stringify({ + weeklyType: Number(data.field.weeklyType), + weeklyId: data.field.id, + // type: Number(data.field.type), + type: Number(1), + weeklyDailyRealityList: nList + }), + contentType:'application/json;charset=UTF-8', + method: 'POST', + success: function (res) { + layer.closeAll('loading'); + if (res.code === 200){ + layer.close(dIndex); + $(".layui-laypage-btn")[0].click(); + layer.msg(res.msg, {icon: 1}); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg, {icon: 2}); + } + } + }) + return false; + }); + // 鏄庣粏琛ㄦ牸 + var xxDataList = []; + var tbOptions = { + elem: '#formSSXMTable', + headers: {token: localStorage.getItem('token')}, + data: xxDataList, + page: true, + height: '350px;', + cellMinWidth: 100, + cols: [[ + {type: 'numbers', title: '#'} + ,{field: 'weeklyDay$', align: 'center',title: '鏄熸湡'} + ,{field: 'workContent', title: '宸ヤ綔鍐呭', style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'workPurpose', title: '宸ヤ綔鐩殑', style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'comment', title: '璇勮', style: 'color: blue;font-weight: bold', edit:true} + ,{field: 'weeklyMatter', title: '闇�鍗忓姪浜嬮」', style: 'color: blue;font-weight: bold', edit:true} + // ,{field: 'dailyTime$', align: 'center',title: '鏃ユ姤鏃ユ湡'} + // ,{field: 'settleMsg', align: 'center',title: '瀹℃牳杩涘害'} + // ,{field: 'director', align: 'center',title: '璐熻矗浜�'} + // ,{field: 'settleSize', align: 'center',title: '娴佺▼闀垮害'} + // ,{field: 'settleCurrent', align: 'center',title: '褰撳墠杩涘害'} + ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;} + ,{field: 'memo', align: 'center',title: '澶囨敞', width: 100, style: 'color: blue;font-weight: bold', edit:true} + ,{align: 'center', title: '鎿嶄綔', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'} + ]], + parseData: function (res) { + return { + 'code': res.code, + 'msg': res.msg, + 'count': res.data.total, + 'data': res.data.records + } + }, + done: function (res, curr, count) { + $(".layui-table-cell").css('overflow', 'visible');//瑙e喅layui鏁版嵁琛ㄦ牸涓祵濂椾笅鎷夋鏄剧ず闂 + $(layero).find('.layui-table-view').css('margin', '0'); + var options = this; + + // 鑾峰彇褰撳墠琛屾暟鎹� + table.getRowData = function(elem){ + var index = $(elem).closest('tr').data('index'); + return table.cache[options.id][index] || {}; + }; + + $('.select-cstmr').on('change', function(){ + console.log("cstmrId") + var value = this.value; // 鑾峰彇閫変腑椤� value + var data = table.getRowData(this); + xxDataList.forEach(res => { + if (data.LAY_TABLE_INDEX === res.LAY_TABLE_INDEX){ + console.log(res) + // console.log(data) + res.cstmrId = value; + } + }) + }); + }, + size: '' + }; + if (!isExpAdd) { + $.ajax({ + url: baseUrl+"/weekly/detl/all/auth2?weeklyId=" + expTpe.id, + headers: {'token': localStorage.getItem('token')}, + method: 'GET', + async: false, + success: function (res) { + if (res.code === 200){ + xxDataList = res.data; + tbOptions.data = xxDataList; + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg, {icon: 2}) + } + } + }) + } + var insTbSSXM = table.render(tbOptions); + // 宸ュ叿鏉$偣鍑讳簨浠� + table.on('tool(formSSXMTable)', function (obj) { + var data = obj.data; + var layEvent = obj.event; + if (layEvent === 'edit') { + showEditModel2(data); + } else if (layEvent === 'del') { + layer.confirm('纭畾瑕佸垹闄ゅ悧锛�', { + shade: .1, + skin: 'layui-layer-admin' + }, function (i) { + layer.close(i); + for (var j = 0; j < xxDataList.length; j++) { + if (xxDataList[j].matnr === data.matnr && xxDataList[j].batch === data.batch) { + xxDataList.splice(j, 1); + break; + } + } + insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); + }); + } + }); + // 鏄庣粏鏁版嵁淇敼 + table.on('edit(formSSXMTable)', function (obj) { + let index = obj.tr.attr("data-index"); + let data = xxDataList[index]; + if (obj.field === 'anfme'){ + let vle = Number(obj.value); + if (isNaN(vle)) { + layer.msg("璇疯緭鍏ユ暟瀛�", {icon: 2}); + return false; + } else { + if (vle <= 0) { + layer.msg("鏁伴噺蹇呴』澶т簬闆�", {icon: 2}); + return false; + } + } + } + data[obj.field] = obj.value; + insTbSSXM.reload({data: xxDataList}); + }); + + $('#matAddBtnComment').click(function () { + showEditModel2(); + }); + + // 鏄剧ず娣诲姞鏄庣粏琛ㄥ崟寮圭獥 + function showEditModel2(exp) { + admin.open({ + type: 1, + offset: '150px', + area: '680px', + title: (exp ? '淇敼' : '娣诲姞') + '鏄庣粏', + content: $('#matEditDialog').html(), + success: function (layero, dIndex) { + // 鍥炴樉鏁版嵁 + form.val('matEditForm', exp); + // 琛ㄥ崟鎻愪氦浜嬩欢 + form.on('submit(matEditSubmit)', function (data) { + let selectList = matXmSelect.getValue(); + console.log(selectList) + for (let i = 0; i<selectList.length; i++) { + let item = selectList[i]; + // 鏌ヨ鐗╂枡璇︽儏 + $.ajax({ + url: baseUrl+"/weeklyCostTypes/covert/reality/"+item.value+"/auth", + headers: {'token': localStorage.getItem('token')}, + method: 'GET', + async: false, + success: function (res) { + if (res.code === 200){ + var bige=true; + + if (bige){ + // console.log("-------2.3-------") + xxDataList.push(res.data); + insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); + } + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg, {icon: 2}) + } + } + }) + } + layer.close(dIndex); + return false; + }); + // 娓叉煋鐗╂枡閫夋嫨 + var matXmSelect = xmSelect.render({ + el: '#weeklyCostTypes', + style: { + width: '340px', + }, + autoRow: true, + toolbar: { show: true }, + filterable: true, + remoteSearch: true, + remoteMethod: function(val, cb, show){ + $.ajax({ + url: baseUrl+"/weeklyCostTypes/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}); + } + } + }); + } + }) + // 寮圭獥涓嶅嚭鐜版粴鍔ㄦ潯 + $(layero).children('.layui-layer-content').css('overflow', 'visible'); + layui.form.render('select'); + } + }); + } + } + }); + } + function approval2(planId, plannerId, dIdx) { let loadIndex = layer.load(2); $.ajax({ -- Gitblit v1.9.1