处理问题
This commit is contained in:
parent
0b0da605d5
commit
982d82979b
@ -123,7 +123,10 @@ function LayuiSelect(layui) {
|
|||||||
let valueKey = opt.valueKey;
|
let valueKey = opt.valueKey;
|
||||||
// option text key
|
// option text key
|
||||||
let nameKey = opt.nameKey;
|
let nameKey = opt.nameKey;
|
||||||
|
let dataForm = opt.dataForm;
|
||||||
let optionDataKeyArray = opt.optionDataKeyArray && (opt.optionDataKeyArray instanceof Array) ? opt.optionDataKeyArray : [];
|
let optionDataKeyArray = opt.optionDataKeyArray && (opt.optionDataKeyArray instanceof Array) ? opt.optionDataKeyArray : [];
|
||||||
|
// 选择的值列表
|
||||||
|
let selectedValueArray = opt.selectedValueArray;
|
||||||
// 级联数量
|
// 级联数量
|
||||||
let linkageSize = opt.linkageSize ? opt.linkageSize : 1;
|
let linkageSize = opt.linkageSize ? opt.linkageSize : 1;
|
||||||
// 选择ID
|
// 选择ID
|
||||||
@ -156,7 +159,12 @@ function LayuiSelect(layui) {
|
|||||||
$('#' + refreshSelectId).append(`<option value="${item[valueKey]}"${optionDatas}>${item[nameKey]}</option>`);
|
$('#' + refreshSelectId).append(`<option value="${item[valueKey]}"${optionDatas}>${item[nameKey]}</option>`);
|
||||||
});
|
});
|
||||||
// 渲染表单下拉框
|
// 渲染表单下拉框
|
||||||
form.render('select');
|
if (dataForm) {
|
||||||
|
console.log(dataForm)
|
||||||
|
form.render(null, dataForm);
|
||||||
|
} else {
|
||||||
|
form.render('select');
|
||||||
|
}
|
||||||
}, function (code, data) {
|
}, function (code, data) {
|
||||||
dialog.msg(data.msg);
|
dialog.msg(data.msg);
|
||||||
})
|
})
|
||||||
@ -203,6 +211,7 @@ function LayuiSelect(layui) {
|
|||||||
url: 'api/area/listbyparentid/{parentId}',
|
url: 'api/area/listbyparentid/{parentId}',
|
||||||
valueKey: 'areaId',
|
valueKey: 'areaId',
|
||||||
nameKey: 'areaName',
|
nameKey: 'areaName',
|
||||||
|
dataForm: opt.dataForm,
|
||||||
linkageSize: opt.linkageSize ? opt.linkageSize : 5,
|
linkageSize: opt.linkageSize ? opt.linkageSize : 5,
|
||||||
baseRootId: opt.baseRootId,
|
baseRootId: opt.baseRootId,
|
||||||
selectId: opt.selectId,
|
selectId: opt.selectId,
|
||||||
|
@ -130,15 +130,6 @@
|
|||||||
return rowData;
|
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',
|
{field: 'areaName', width: 180, title: '地区名称', align:'center',
|
||||||
templet: function(row) {
|
templet: function(row) {
|
||||||
var rowData = row[this.field];
|
var rowData = row[this.field];
|
||||||
@ -148,24 +139,6 @@
|
|||||||
return rowData;
|
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',
|
{field: 'gmtCreate', width: 180, title: '创建时间', align:'center',
|
||||||
templet: function(row) {
|
templet: function(row) {
|
||||||
var rowData = row[this.field];
|
var rowData = row[this.field];
|
||||||
@ -267,7 +240,7 @@
|
|||||||
onSelect: function (data, option, index) {
|
onSelect: function (data, option, index) {
|
||||||
var value = data.value;
|
var value = data.value;
|
||||||
// 删除元素
|
// 删除元素
|
||||||
selectedAreaArray.splice(index, 5 - index);
|
selectedAreaArray.splice(index, 2 - index);
|
||||||
if (value) {
|
if (value) {
|
||||||
selectedAreaArray[index] = {
|
selectedAreaArray[index] = {
|
||||||
areaName: option.innerText,
|
areaName: option.innerText,
|
||||||
|
@ -83,8 +83,8 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||||
<div class="layui-input-block layui-input-block-down select-area">
|
<div class="layui-input-block layui-input-block-down select-area">
|
||||||
<input type="hidden" id="areaCode" name="areaCode">
|
<input type="hidden" id="areaCode" name="areaCode" class="layui-input" value="" readonly maxlength="255">
|
||||||
<input type="hidden" id="areaName" name="areaName">
|
<input type="hidden" id="areaName" name="areaName" class="layui-input" value="" readonly maxlength="255">
|
||||||
<div>
|
<div>
|
||||||
<select id="area0" name="area0" lay-filter="area0Select"></select>
|
<select id="area0" name="area0" lay-filter="area0Select"></select>
|
||||||
</div>
|
</div>
|
||||||
@ -219,7 +219,7 @@
|
|||||||
onSelect: function (data, option, index) {
|
onSelect: function (data, option, index) {
|
||||||
var value = data.value;
|
var value = data.value;
|
||||||
// 删除元素
|
// 删除元素
|
||||||
selectedAreaArray.splice(index, 5 - index);
|
selectedAreaArray.splice(index, 2 - index);
|
||||||
if (value) {
|
if (value) {
|
||||||
selectedAreaArray[index] = {
|
selectedAreaArray[index] = {
|
||||||
areaName: option.innerText,
|
areaName: option.innerText,
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
|
.layui-input-block-down {margin: 0px !important; left: 0px !important;}
|
||||||
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
|
.layui-input-block-down .layui-form-select .layui-edge {top: 74%;}
|
||||||
.select-area {position: relative;}
|
.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 {position: absolute; top: 30px; right: 0px; width: 36%; border-color: #e6e6e6;}
|
||||||
.select-area .select-btn button {height: 38px; width: 50%;}
|
.select-area .select-btn button {height: 38px; width: 50%;}
|
||||||
</style>
|
</style>
|
||||||
@ -82,8 +81,8 @@
|
|||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
<label class="layui-form-label layui-form-label-up">选择地区</label>
|
||||||
<div class="layui-input-block layui-input-block-down select-area">
|
<div class="layui-input-block layui-input-block-down select-area">
|
||||||
<input type="hidden" id="areaCode" name="areaCode">
|
<input type="hidden" id="areaCode" name="areaCode" class="layui-input" value="" readonly maxlength="255">
|
||||||
<input type="hidden" id="areaName" name="areaName">
|
<input type="text" id="areaName" name="areaName" class="layui-input" value="" readonly maxlength="255" style="border: 0;padding-left: 0;">
|
||||||
<div>
|
<div>
|
||||||
<select id="area0" name="area0" lay-filter="area0Select"></select>
|
<select id="area0" name="area0" lay-filter="area0Select"></select>
|
||||||
</div>
|
</div>
|
||||||
@ -240,11 +239,12 @@
|
|||||||
linkageSize: 2,
|
linkageSize: 2,
|
||||||
baseRootId: 0,
|
baseRootId: 0,
|
||||||
selectId: 'area',
|
selectId: 'area',
|
||||||
|
dataForm: 'dataForm',
|
||||||
optionDataKeyArray: ['areaCode'],
|
optionDataKeyArray: ['areaCode'],
|
||||||
onSelect: function (data, option, index) {
|
onSelect: function (data, option, index) {
|
||||||
var value = data.value;
|
var value = data.value;
|
||||||
// 删除元素
|
// 删除元素
|
||||||
selectedAreaArray.splice(index, 5 - index);
|
selectedAreaArray.splice(index, 2 - index);
|
||||||
if (value) {
|
if (value) {
|
||||||
selectedAreaArray[index] = {
|
selectedAreaArray[index] = {
|
||||||
areaName: option.innerText,
|
areaName: option.innerText,
|
||||||
|
Loading…
Reference in New Issue
Block a user