|
@@ -55,10 +55,11 @@
|
|
ref="treeRef"
|
|
ref="treeRef"
|
|
class="target_tree word-wrap"
|
|
class="target_tree word-wrap"
|
|
:data="classifyList"
|
|
:data="classifyList"
|
|
- node-key="ClassifyId"
|
|
|
|
|
|
+ node-key="key"
|
|
:props="{
|
|
:props="{
|
|
label: 'ClassifyName',
|
|
label: 'ClassifyName',
|
|
children: 'Child',
|
|
children: 'Child',
|
|
|
|
+ isLeaf: 'leaf'
|
|
}"
|
|
}"
|
|
:default-checked-keys = "defaultCheckedKeys"
|
|
:default-checked-keys = "defaultCheckedKeys"
|
|
:default-expanded-keys="defaultShowNodes"
|
|
:default-expanded-keys="defaultShowNodes"
|
|
@@ -180,6 +181,8 @@ export default {
|
|
indexFrequency: 0, // 当前选中的指标code
|
|
indexFrequency: 0, // 当前选中的指标code
|
|
select_frequency: '', // 当前选中的频度
|
|
select_frequency: '', // 当前选中的频度
|
|
classId: '', // 当前选中的指标的分类id
|
|
classId: '', // 当前选中的指标的分类id
|
|
|
|
+ selectedEdb: false, // 是否选中指标
|
|
|
|
+ FenweiIndexId: '', // 当前选中的指标的key
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -187,7 +190,13 @@ export default {
|
|
getClassify() {
|
|
getClassify() {
|
|
fwmtInterface.classifyList().then((res) => {
|
|
fwmtInterface.classifyList().then((res) => {
|
|
if (res.Ret !== 200) return;
|
|
if (res.Ret !== 200) return;
|
|
- this.classifyList = res.Data || [];
|
|
|
|
|
|
+ const addKey = arr => arr.map(item => ({
|
|
|
|
+ ...item,
|
|
|
|
+ key: item.ClassifyId, // key值为当前项ClassifyId
|
|
|
|
+ Child: item.Child ? addKey(item.Child) : null // 这里要判断原数据有没有子级如果没有判断会报错
|
|
|
|
+ }))
|
|
|
|
+ this.classifyList = addKey(res.Data || []);
|
|
|
|
+ // this.classifyList = res.Data || [];
|
|
this.select_classify = this.classifyList.length ? (this.classifyList[0].Child && this.classifyList[0].Child.length ? this.classifyList[0].Child[0].ClassifyId : this.classifyList[0].ClassifyId) : 0; // 获取classifyList中第一个元素的ClassifyId,如果该元素有子元素,则取第一个子元素的ClassifyId
|
|
this.select_classify = this.classifyList.length ? (this.classifyList[0].Child && this.classifyList[0].Child.length ? this.classifyList[0].Child[0].ClassifyId : this.classifyList[0].ClassifyId) : 0; // 获取classifyList中第一个元素的ClassifyId,如果该元素有子元素,则取第一个子元素的ClassifyId
|
|
// this.defaultShowNodes = [this.classifyList[0].ClassifyId]
|
|
// this.defaultShowNodes = [this.classifyList[0].ClassifyId]
|
|
this.$nextTick(() => { // 获取到节点后设置选中
|
|
this.$nextTick(() => { // 获取到节点后设置选中
|
|
@@ -358,7 +367,8 @@ export default {
|
|
return {
|
|
return {
|
|
...item,
|
|
...item,
|
|
classId,
|
|
classId,
|
|
- isLeaf: true
|
|
|
|
|
|
+ key: item.FenweiIndexId,
|
|
|
|
+ leaf: true
|
|
}
|
|
}
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
@@ -369,6 +379,9 @@ export default {
|
|
arr=node.data.Child||[]
|
|
arr=node.data.Child||[]
|
|
}
|
|
}
|
|
resolve(arr)
|
|
resolve(arr)
|
|
|
|
+ this.$nextTick(() => { // 获取到节点后设置选中
|
|
|
|
+ this.$refs.treeRef.setCurrentKey(this.FenweiIndexId)
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 树节点展开
|
|
// 树节点展开
|
|
handleNodeExpand(data) {
|
|
handleNodeExpand(data) {
|
|
@@ -400,8 +413,9 @@ export default {
|
|
//添加指标到库
|
|
//添加指标到库
|
|
intoBaseBack() {
|
|
intoBaseBack() {
|
|
this.isAddIndicsDiaShow = false
|
|
this.isAddIndicsDiaShow = false
|
|
- if(this.selectedEdb){
|
|
|
|
- this.$refs.edbDetailRef.getEdbDetail()
|
|
|
|
|
|
+ if(this.isShowSingleData){
|
|
|
|
+ // this.$refs.edbDetailRef.getEdbDetail()
|
|
|
|
+ this.getTargetDataList(this.leftSearchTradeCode)
|
|
}else {
|
|
}else {
|
|
this.getDataList()
|
|
this.getDataList()
|
|
}
|
|
}
|
|
@@ -491,11 +505,13 @@ export default {
|
|
},
|
|
},
|
|
// 选中左侧搜索值
|
|
// 选中左侧搜索值
|
|
handleSelectLeftSearchval(e) {
|
|
handleSelectLeftSearchval(e) {
|
|
|
|
+ console.log(e);
|
|
if (!e.IndexCode) return;
|
|
if (!e.IndexCode) return;
|
|
this.leftSearchTradeCode = e.IndexCode;
|
|
this.leftSearchTradeCode = e.IndexCode;
|
|
this.leftSearchVal = e.IndexName;
|
|
this.leftSearchVal = e.IndexName;
|
|
const ParentClassifyId = this.classifyList[this.findIndex(this.classifyList, (item) => item.ClassifyId === e.ClassifyId)[0]].ClassifyId
|
|
const ParentClassifyId = this.classifyList[this.findIndex(this.classifyList, (item) => item.ClassifyId === e.ClassifyId)[0]].ClassifyId
|
|
this.defaultShowNodes = [ParentClassifyId, e.ClassifyId];
|
|
this.defaultShowNodes = [ParentClassifyId, e.ClassifyId];
|
|
|
|
+ this.FenweiIndexId = e.FenweiIndexId;
|
|
// this.defaultShowNodes = [ParentClassifyId, e.ClassifyId];
|
|
// this.defaultShowNodes = [ParentClassifyId, e.ClassifyId];
|
|
// 获取单独指标数据
|
|
// 获取单独指标数据
|
|
this.getTargetDataList(e.IndexCode);
|
|
this.getTargetDataList(e.IndexCode);
|