处理问题

This commit is contained in:
wanggeng 2022-09-23 15:14:50 +08:00
parent 0b0da605d5
commit 982d82979b
4 changed files with 18 additions and 36 deletions

View File

@ -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(`<option value="${item[valueKey]}"${optionDatas}>${item[nameKey]}</option>`);
});
// 渲染表单下拉框
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,

View File

@ -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,

View File

@ -83,8 +83,8 @@
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-up">选择地区</label>
<div class="layui-input-block layui-input-block-down select-area">
<input type="hidden" id="areaCode" name="areaCode">
<input type="hidden" id="areaName" name="areaName">
<input type="hidden" id="areaCode" name="areaCode" class="layui-input" value="" readonly maxlength="255">
<input type="hidden" id="areaName" name="areaName" class="layui-input" value="" readonly maxlength="255">
<div>
<select id="area0" name="area0" lay-filter="area0Select"></select>
</div>
@ -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,

View File

@ -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%;}
</style>
@ -82,8 +81,8 @@
<div class="layui-form-item">
<label class="layui-form-label layui-form-label-up">选择地区</label>
<div class="layui-input-block layui-input-block-down select-area">
<input type="hidden" id="areaCode" name="areaCode">
<input type="hidden" id="areaName" name="areaName">
<input type="hidden" id="areaCode" name="areaCode" class="layui-input" value="" readonly maxlength="255">
<input type="text" id="areaName" name="areaName" class="layui-input" value="" readonly maxlength="255" style="border: 0;padding-left: 0;">
<div>
<select id="area0" name="area0" lay-filter="area0Select"></select>
</div>
@ -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,