Commit 411fc79a by songchangcheng

增加资产选择的下拉树

1 parent d2d402ee
Showing with 37 additions and 17 deletions
......@@ -111,11 +111,11 @@
<el-select clearable placeholder="请选择" v-model="ruleForm.let2">
<!-- <el-option v-for="item in shangJiJieDianSelect" :key="item.assetId" :label="item.assetName" :value="item.assetId"></el-option> -->
<el-option :value="valueTitle" :label="valueTitle">
<el-option :value="selectValue" :label="selectLabel">
<el-tree
lazy
:props="{ children: 'children', label: 'assetName', id: 'assetId' }"
@load="loadTreeSelect"></el-tree>
:load="loadTreeSelect" :highlight-current="true" @node-click="treeSelectClick" ></el-tree>
</el-option>
</el-select>
</el-form-item>
......@@ -217,7 +217,9 @@
},
data() {
return {
valueTitle: '',
selectValue:'',
selectLabel: '',
selectCode: '',
templateDialog: false,
ruleForm2: {
let1: null,
......@@ -338,11 +340,11 @@
// console.log(this.ruleForm);
let parentAssetName, assetCode, fieldsValue = [], eleName, targetAsset = [];
if(this.ruleForm.let2 && this.shangJiJieDianSelect.length > 0) {
const items = this.shangJiJieDianSelect.find(item => item.assetId == this.ruleForm.let2);
parentAssetName = items.assetName;
assetCode = items.parentCode;
}
// if(this.ruleForm.let2 && this.shangJiJieDianSelect.length > 0) {
// const items = this.shangJiJieDianSelect.find(item => item.assetId == this.ruleForm.let2);
// parentAssetName = items.assetName;
// assetCode = items.parentCode;
// }
const items2 = this.zuJianLeiXingSelect.find(item => item.typeId == this.ruleForm.let3);
eleName = items2.elementName;
......@@ -382,12 +384,12 @@
assetName: this.ruleForm.let1,
sort: this.ruleForm.let4,
assetId: this.is_add_edit == 'add' ? null : this.editId,
parentAssetId: this.ruleForm.let2,
parentAssetName: parentAssetName,
parentAssetId: this.selectValue,
parentAssetName: this.selectLabel,
isShow: this.ruleForm.let5 == '显示' ? 1 : 0,
fieldsValue: fieldsValue,
targetAsset: targetAsset,
assetCode: assetCode,
assetCode: this.selectCode,
eleName: eleName
}
if(this.is_add_edit == 'add') {
......@@ -498,19 +500,26 @@
this.ruleForm.let6 = null;
this.ruleForm.dynamicForm_ = [];
this.ruleForm.dynamicForm0_ = [];
this.selectLabel = '';
this.selectValue = '';
this.selectCode = '';
});
},
editItem(row){//编辑
this.addDialog = true;
this.is_add_edit = 'edit';
this.ruleForm.let1 = row.assetName;
this.ruleForm.let2 = row.parentAssetId ? String(row.parentAssetId) : null;
this.ruleForm.let2 = row.parentAssetName ? String(row.parentAssetId) : null;
this.ruleForm.let3 = row.archiEleId;
this.ruleForm.let4 = row.sort;
this.ruleForm.let5 = row.isShow == 1 ? '显示' : '隐藏';
this.editId = row.assetId;
let fieldsValue = row.fieldsValue;
let targetAsset = row.targetAsset;
this.selectCode = row.assetCode;
this.selectLabel = row.parentAssetName;
this.selectValue = row.parentAssetId;
let targetAsset_id = [];
if(targetAsset.length == 4) {
......@@ -541,15 +550,26 @@
this.ruleForm.dynamicForm_ = fieldsValue_;
}
},
treeSelectClick(data) {
console.log(data)
this.selectValue = data.assetId;
this.selectLabel = data.assetName;
this.selectCode = data.assetCode;
this.ruleForm.let2 = this.selectValue;
},
loadTreeSelect(node, resolve) {
console.log(node)
// if (node.level === 0) {
// return resolve([{ name: 'region' }]);
// }
// console.log(node)
let id;
if (node.level === 0) {
id = 0;
}else {
id = node.data.assetId
}
// if (node.level > 1) return resolve([]);
// console.log('node.assetId : '+id);
const params = {
archiType: this.assetConstant,
// parentAssetId: this.archiBelongId,
parentAssetId: id
// archiAssetTypeId: this.archiAssetTypeId,
};
queryZiChanJiaGouShangJiJieDian(params).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!