From cc85911b19cc25838f19ffb2fbb120fbc72b2fb4 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期五, 29 三月 2024 13:00:32 +0800 Subject: [PATCH] #周计划 --- src/main/webapp/static/js/weekly/weekly.js | 129 +++++++++++++++++++++++-------------------- 1 files changed, 69 insertions(+), 60 deletions(-) diff --git a/src/main/webapp/static/js/weekly/weekly.js b/src/main/webapp/static/js/weekly/weekly.js index abe1977..a79ee16 100644 --- a/src/main/webapp/static/js/weekly/weekly.js +++ b/src/main/webapp/static/js/weekly/weekly.js @@ -76,35 +76,6 @@ }) } - // // 娓叉煋鎼滅储妯℃澘 - // $.ajax({ - // url: baseUrl+"/cstmr/all/get/kv", - // headers: {'token': localStorage.getItem('token')}, - // data: { - // limit: 9999 - // }, - // method: 'POST', - // // async: false, // 璁剧疆涓哄悓姝ユ墽琛� - // success: function (res) { - // htmlCstme = "<select id=\"select_cstmr\" name=\"select_cstmr\" lay-vertype=\"tips\" lay-verify=\"required\" required=\"\">" - // htmlCstme = htmlCstme + - // " <option style=\"display: none\"></option>\n" - // if (res.code === 200){ - // for (var val in res.data) { - // var cstmrVal = res.data[val] - // console.log(cstmrVal) - // htmlCstme = htmlCstme + - // " <option value = \""+cstmrVal.value+"\"+\n" + - // " > "+cstmrVal.name+" </option>\n" - // } - // } else { - // htmlCstme = htmlCstme + - // "<option value=\"0\">寮傚父</option>" - // } - // htmlCstme = htmlCstme + "\n" + " </select>"; - // } - // }) - // 鏁版嵁娓叉煋 tableIns = table.render({ elem: '#weekly', @@ -375,7 +346,7 @@ // ,{field: 'director', align: 'center',title: '璐熻矗浜�'} // ,{field: 'settleSize', align: 'center',title: '娴佺▼闀垮害'} // ,{field: 'settleCurrent', align: 'center',title: '褰撳墠杩涘害'} - ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID'}//, templet: function () { return htmlCstme;} + ,{field: 'cstmrId$', align: 'center',title: '鐢叉柟鍗曚綅ID'}//, templet: function () { return htmlCstme;} ,{field: 'memo', align: 'center',title: '澶囨敞', edit:false} ]], request: { @@ -438,7 +409,7 @@ // ,{field: 'director', align: 'center',title: '璐熻矗浜�'} // ,{field: 'settleSize', align: 'center',title: '娴佺▼闀垮害'} // ,{field: 'settleCurrent', align: 'center',title: '褰撳墠杩涘害'} - ,{field: 'cstmrId', align: 'center',title: '鐢叉柟鍗曚綅ID'}//, templet: function () { return htmlCstme;} + ,{field: 'cstmrId$', align: 'center',title: '鐢叉柟鍗曚綅ID'}//, templet: function () { return htmlCstme;} ,{field: 'memo', align: 'center',title: '澶囨敞', edit:false} ]], request: { @@ -570,35 +541,30 @@ }, done: function (res, curr, count) { $(".layui-table-cell").css('overflow', 'visible');//瑙e喅layui鏁版嵁琛ㄦ牸涓祵濂椾笅鎷夋鏄剧ず闂 + $(".laytable-cell-2-0-6").css('color', 'rgba(0, 0, 0, 0)'); + $(layero).find('.layui-table-view').css('margin', '0'); var options = this; var indexSign = 0; // 鑾峰彇褰撳墠琛屾暟鎹� table.getRowData = function(elem){ var index = $(elem).closest('tr').data('index'); - console.log("index-----") - console.log(index) var indexArray = indexS.split(","); // 灏嗗瓧绗︿覆鎷嗗垎涓烘暟缁� // 閬嶅巻鏁扮粍涓殑姣忎釜鍏冪礌 for (var i = 0; i < indexArray.length; i++) { var element = Number(indexArray[i]); // 杩涜鐩稿簲鐨勬搷浣� - console.log("element-----"); - console.log(element); if (element===index){ indexSign = 1; } } if (indexSign === 0){ indexS = indexS+","+index; - console.log("indexS-----") - console.log(indexS) } return table.cache[options.id][index] || {}; }; if (indexSign === 0 && indexDelSign === 0){ - console.log("娓叉煋") // 娓叉煋鎼滅储妯℃澘 $.ajax({ url: baseUrl+"/cstmr/all/get/kv", @@ -609,33 +575,18 @@ method: 'POST', // async: false, // 璁剧疆涓哄悓姝ユ墽琛� success: function (res) { - console.log(res) - console.log($("#cstmrId").html()) + // console.log(res) + // console.log($("#cstmrId").html()) res.data.forEach((item) => { - $("#cstmrId").append("<option value='" + item.value + "'>" + item.name + "</option>") + // console.log(item) + $("#cstmrId").append("<option value='" + item.value + "';"+" class=\"cstmrDetl\""+">" + item.name + "</option>") }) - // htmlCstme = "<select id=\"select_cstmr\" name=\"select_cstmr\" lay-vertype=\"tips\" lay-verify=\"required\" required=\"\">" - // htmlCstme = htmlCstme + - // " <option style=\"display: none\"></option>\n" - // if (res.code === 200){ - // for (var val in res.data) { - // var cstmrVal = res.data[val] - // console.log(cstmrVal) - // htmlCstme = htmlCstme + - // " <option value = \""+cstmrVal.value+"\"+\n" + - // " > "+cstmrVal.name+" </option>\n" - // } - // } else { - // htmlCstme = htmlCstme + - // "<option value=\"0\">寮傚父</option>" - // } - // htmlCstme = htmlCstme + "\n" + " </select>"; } }) } $('.select-cstmr').on('change', function(){ - console.log("cstmrId") + // console.log("cstmrId") var value = this.value; // 鑾峰彇閫変腑椤� value var data = table.getRowData(this); xxDataList.forEach(res => { @@ -918,17 +869,52 @@ }, done: function (res, curr, count) { $(".layui-table-cell").css('overflow', 'visible');//瑙e喅layui鏁版嵁琛ㄦ牸涓祵濂椾笅鎷夋鏄剧ず闂 + $(".laytable-cell-2-0-6").css('color', 'rgba(0, 0, 0, 0)'); + $(layero).find('.layui-table-view').css('margin', '0'); var options = this; - + var indexSign = 0; // 鑾峰彇褰撳墠琛屾暟鎹� table.getRowData = function(elem){ var index = $(elem).closest('tr').data('index'); + var indexArray = indexS.split(","); // 灏嗗瓧绗︿覆鎷嗗垎涓烘暟缁� + // 閬嶅巻鏁扮粍涓殑姣忎釜鍏冪礌 + for (var i = 0; i < indexArray.length; i++) { + var element = Number(indexArray[i]); + // 杩涜鐩稿簲鐨勬搷浣� + if (element===index){ + indexSign = 1; + } + } + if (indexSign === 0){ + indexS = indexS+","+index; + } return table.cache[options.id][index] || {}; }; + if (indexSign === 0 && indexDelSign === 0){ + // 娓叉煋鎼滅储妯℃澘 + $.ajax({ + url: baseUrl+"/cstmr/all/get/kv", + headers: {'token': localStorage.getItem('token')}, + data: { + limit: 9999 + }, + method: 'POST', + // async: false, // 璁剧疆涓哄悓姝ユ墽琛� + success: function (res) { + // console.log(res) + // console.log($("#cstmrId").html()) + res.data.forEach((item) => { + // console.log(item) + $("#cstmrId").append("<option value='" + item.value + "';"+" class=\"cstmrDetl\""+">" + item.name + "</option>") + }) + } + }) + } + $('.select-cstmr').on('change', function(){ - console.log("cstmrId") + // console.log("cstmrId") var value = this.value; // 鑾峰彇閫変腑椤� value var data = table.getRowData(this); xxDataList.forEach(res => { @@ -939,6 +925,29 @@ } }) }); + + $(document).ready(function () { + $.ajax({ + url: baseUrl + "/cstmr/all/get/kv", + headers: { 'token': localStorage.getItem('token') }, + data: { + limit: 9999 + }, + method: 'POST', + success: function (res) { + if (res.code === 200) { + // console.log("res111111111111") + // console.log(res) + var template = $('#cstmrId').html(); // 鑾峰彇妯℃澘鍐呭 + var compiledTemplate = Handlebars.compile(template); // 缂栬瘧妯℃澘 + var html = compiledTemplate(res.data); // 灏嗘暟鎹簲鐢ㄥ埌妯℃澘涓� + $('.select-cstmr').html(html); // 娓叉煋妯℃澘鍒伴〉闈� + } else { + // 澶勭悊寮傚父鎯呭喌 + } + } + }); + }); }, size: '' }; -- Gitblit v1.9.1