From 982d82979bc9ca9b403384f4e88b4bdf544288c3 Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Fri, 23 Sep 2022 15:14:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static/assets/js/layui-select.js | 11 ++++++- .../templates/grid/grid/default/list.html | 29 +------------------ .../templates/grid/grid/default/save.html | 6 ++-- .../templates/grid/grid/default/update.html | 8 ++--- 4 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/main/resources/static/assets/js/layui-select.js b/src/main/resources/static/assets/js/layui-select.js index fc34a44..d78ae12 100644 --- a/src/main/resources/static/assets/js/layui-select.js +++ b/src/main/resources/static/assets/js/layui-select.js @@ -123,7 +123,10 @@ function LayuiSelect(layui) { let valueKey = opt.valueKey; // option text key let nameKey = opt.nameKey; + let dataForm = opt.dataForm; let optionDataKeyArray = opt.optionDataKeyArray && (opt.optionDataKeyArray instanceof Array) ? opt.optionDataKeyArray : []; + // 选择的值列表 + let selectedValueArray = opt.selectedValueArray; // 级联数量 let linkageSize = opt.linkageSize ? opt.linkageSize : 1; // 选择ID @@ -156,7 +159,12 @@ function LayuiSelect(layui) { $('#' + refreshSelectId).append(``); }); // 渲染表单下拉框 - form.render('select'); + if (dataForm) { + console.log(dataForm) + form.render(null, dataForm); + } else { + form.render('select'); + } }, function (code, data) { dialog.msg(data.msg); }) @@ -203,6 +211,7 @@ function LayuiSelect(layui) { url: 'api/area/listbyparentid/{parentId}', valueKey: 'areaId', nameKey: 'areaName', + dataForm: opt.dataForm, linkageSize: opt.linkageSize ? opt.linkageSize : 5, baseRootId: opt.baseRootId, selectId: opt.selectId, diff --git a/src/main/resources/templates/grid/grid/default/list.html b/src/main/resources/templates/grid/grid/default/list.html index e47a2b3..c278bcc 100644 --- a/src/main/resources/templates/grid/grid/default/list.html +++ b/src/main/resources/templates/grid/grid/default/list.html @@ -130,15 +130,6 @@ return rowData; } }, - {field: 'gridCode', width: 180, title: '网格编码', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, {field: 'areaName', width: 180, title: '地区名称', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -148,24 +139,6 @@ return rowData; } }, - {field: 'areaCode', width: 180, title: '地区编码', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData; - } - }, - {field: 'gridSquare', width: 180, title: '单元网格面积', align:'center', - templet: function(row) { - var rowData = row[this.field]; - if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') { - return '-'; - } - return rowData + ' ㎡'; - } - }, {field: 'gmtCreate', width: 180, title: '创建时间', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -267,7 +240,7 @@ onSelect: function (data, option, index) { var value = data.value; // 删除元素 - selectedAreaArray.splice(index, 5 - index); + selectedAreaArray.splice(index, 2 - index); if (value) { selectedAreaArray[index] = { areaName: option.innerText, diff --git a/src/main/resources/templates/grid/grid/default/save.html b/src/main/resources/templates/grid/grid/default/save.html index d2e38f8..36f95a8 100644 --- a/src/main/resources/templates/grid/grid/default/save.html +++ b/src/main/resources/templates/grid/grid/default/save.html @@ -83,8 +83,8 @@
- - + +
@@ -219,7 +219,7 @@ onSelect: function (data, option, index) { var value = data.value; // 删除元素 - selectedAreaArray.splice(index, 5 - index); + selectedAreaArray.splice(index, 2 - index); if (value) { selectedAreaArray[index] = { areaName: option.innerText, diff --git a/src/main/resources/templates/grid/grid/default/update.html b/src/main/resources/templates/grid/grid/default/update.html index 481199a..eca64b7 100644 --- a/src/main/resources/templates/grid/grid/default/update.html +++ b/src/main/resources/templates/grid/grid/default/update.html @@ -14,7 +14,6 @@ .layui-input-block-down {margin: 0px !important; left: 0px !important;} .layui-input-block-down .layui-form-select .layui-edge {top: 74%;} .select-area {position: relative;} - .select-area #areaName {width: 64%} .select-area .select-btn {position: absolute; top: 30px; right: 0px; width: 36%; border-color: #e6e6e6;} .select-area .select-btn button {height: 38px; width: 50%;} @@ -82,8 +81,8 @@
- - + +
@@ -240,11 +239,12 @@ linkageSize: 2, baseRootId: 0, selectId: 'area', + dataForm: 'dataForm', optionDataKeyArray: ['areaCode'], onSelect: function (data, option, index) { var value = data.value; // 删除元素 - selectedAreaArray.splice(index, 5 - index); + selectedAreaArray.splice(index, 2 - index); if (value) { selectedAreaArray[index] = { areaName: option.innerText,