Commit 411fc79a by songchangcheng

增加资产选择的下拉树

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