|
@@ -189,7 +189,7 @@ export default {
|
|
if (res.Ret !== 200) return;
|
|
if (res.Ret !== 200) return;
|
|
this.classifyList = 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(() => { // 获取到节点后设置选中
|
|
this.$refs.treeRef.setCurrentKey(this.select_classify)
|
|
this.$refs.treeRef.setCurrentKey(this.select_classify)
|
|
})
|
|
})
|
|
@@ -345,25 +345,29 @@ export default {
|
|
//指标懒加载
|
|
//指标懒加载
|
|
async getLazyTreeData(node,resolve){
|
|
async getLazyTreeData(node,resolve){
|
|
let arr=[]
|
|
let arr=[]
|
|
- if(node.level===2||node.data.ClassifyId === 0){
|
|
|
|
|
|
+ if(!node.data.Child && !node.data.isLeaf && node.data.ClassifyId){
|
|
const res=await fwmtInterface.dataList({
|
|
const res=await fwmtInterface.dataList({
|
|
ClassifyId: node.data.ClassifyId
|
|
ClassifyId: node.data.ClassifyId
|
|
})
|
|
})
|
|
if(res.Ret===200){
|
|
if(res.Ret===200){
|
|
const temarr=res.Data||[]
|
|
const temarr=res.Data||[]
|
|
- arr=temarr.map((item, i)=>{
|
|
|
|
- const classId = item.ClassifyId
|
|
|
|
- delete item.ClassifyId
|
|
|
|
- return {
|
|
|
|
- ...item,
|
|
|
|
- classId,
|
|
|
|
- isLeaf:true
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ if (temarr.length > 0) {
|
|
|
|
+ arr=temarr.map((item, i)=>{
|
|
|
|
+ const classId = item.ClassifyId
|
|
|
|
+ delete item.ClassifyId
|
|
|
|
+ return {
|
|
|
|
+ ...item,
|
|
|
|
+ classId,
|
|
|
|
+ isLeaf: true
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ arr = []
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
arr=node.data.Child||[]
|
|
arr=node.data.Child||[]
|
|
- }
|
|
|
|
|
|
+ }
|
|
resolve(arr)
|
|
resolve(arr)
|
|
},
|
|
},
|
|
// 树节点展开
|
|
// 树节点展开
|
|
@@ -513,7 +517,6 @@ export default {
|
|
|
|
|
|
//改变选中节点
|
|
//改变选中节点
|
|
nodeChangeHandle(data, node) {
|
|
nodeChangeHandle(data, node) {
|
|
- console.log(data, node);
|
|
|
|
this.classId = data.classId
|
|
this.classId = data.classId
|
|
if (data.ClassifyId === this.repetition || data.IndexCode === this.repetition) return;
|
|
if (data.ClassifyId === this.repetition || data.IndexCode === this.repetition) return;
|
|
this.select_classify = data.ClassifyId;
|
|
this.select_classify = data.ClassifyId;
|