|
@@ -55,12 +55,15 @@
|
|
|
:props="{
|
|
|
label: 'ClassifyName',
|
|
|
children: 'Children',
|
|
|
+ isLeaf:'isLeaf'
|
|
|
}"
|
|
|
draggable
|
|
|
:current-node-key="select_node"
|
|
|
:expand-on-click-node="false"
|
|
|
check-strictly
|
|
|
empty-text="暂无分类"
|
|
|
+ lazy
|
|
|
+ :load="getLazyTreeData"
|
|
|
@current-change="nodeChangeHandle"
|
|
|
:default-expanded-keys="defaultShowNodes"
|
|
|
@node-expand="handleNodeExpand"
|
|
@@ -377,6 +380,37 @@ export default {
|
|
|
});
|
|
|
return arr;
|
|
|
},
|
|
|
+ // 懒加载指标
|
|
|
+ async getLazyTreeData(node,resolve){
|
|
|
+ // console.log(node);
|
|
|
+ let arr=[]
|
|
|
+ // 点击二级分类或者一级分类但是分类id为0的
|
|
|
+ if((node.level===2&&node.data.ClassifyId!=0)||(node.level===1&&node.data.ClassifyId==0)){
|
|
|
+ const res=await smmDataInterface.edbListForClassify({ClassifyId:node.data.ClassifyId})
|
|
|
+ if(res.Ret===200){
|
|
|
+ const temarr = res.Data.List || [];
|
|
|
+ arr=temarr.map(item=>{
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ UniqueCode:`${item.ClassifyId}_${item.BaseFromSmmIndexId}_${item.BaseFromSmmIndexCode}`,
|
|
|
+ Button:{
|
|
|
+ AddButton: false,
|
|
|
+ OpButton: true,
|
|
|
+ DeleteButton: false,
|
|
|
+ MoveButton: true,
|
|
|
+ cleanButton: true,
|
|
|
+ targetDelButton: true,
|
|
|
+ },
|
|
|
+ isLeaf:true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(node.level===1&&node.data.ClassifyId!==0){
|
|
|
+ arr=node.data.Children||[]
|
|
|
+ }
|
|
|
+ resolve(arr)
|
|
|
+ },
|
|
|
/* 获取频度 */
|
|
|
async getFrequency(defaultSelect) {
|
|
|
const res = await smmDataInterface.frequencyList({
|
|
@@ -621,7 +655,7 @@ export default {
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
//找到父节点并展开
|
|
|
- const targetData = this.getTargetData(e.IndexCode, this.classifyList);
|
|
|
+ const targetData = this.getTargetData(e.ClassifyId, this.classifyList);
|
|
|
if (targetData) {
|
|
|
//一级节点
|
|
|
const { topParentNodeId, UniqueCode } = targetData;
|
|
@@ -636,11 +670,14 @@ export default {
|
|
|
let width = tree.offsetWidth;
|
|
|
let label_width =
|
|
|
width > 500 ? "auto" : width <= 500 ? 90 : 0.7 * width;
|
|
|
- targetData.NodeWidth = label_width;
|
|
|
- this.select_node = UniqueCode;
|
|
|
- this.$refs.treeRef.setCurrentNode(targetData);
|
|
|
- const node = this.$refs.treeRef.getCurrentNode();
|
|
|
- this.resetNodeStyle(node);
|
|
|
+ // targetData.NodeWidth = label_width;
|
|
|
+ this.select_node = `${e.ClassifyId}_${e.BaseFromSmmIndexId}_${e.IndexCode}`;
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.treeRef.setCurrentKey(this.select_node);
|
|
|
+ const node = this.$refs.treeRef.getNode(this.select_node);
|
|
|
+ this.resetNodeStyle(node);
|
|
|
+ }, 1000);
|
|
|
}
|
|
|
//this.handleScrollLeftWrap()
|
|
|
});
|
|
@@ -652,11 +689,11 @@ export default {
|
|
|
scrollTop: top - 200,
|
|
|
});
|
|
|
},
|
|
|
- getTargetData(code, arr) {
|
|
|
+ getTargetData(ClassifyId, arr) {
|
|
|
for (const item of arr) {
|
|
|
- if (item.BaseFromSmmIndexCode === code) return item;
|
|
|
+ if (item.ClassifyId === ClassifyId) return item;
|
|
|
if (item.Children && item.Children.length) {
|
|
|
- const _item = this.getTargetData(code, item.Children);
|
|
|
+ const _item = this.getTargetData(ClassifyId, item.Children);
|
|
|
if (_item) return _item;
|
|
|
}
|
|
|
}
|