|
@@ -62,6 +62,9 @@
|
|
|
:expand-on-click-node="false"
|
|
|
check-strictly
|
|
|
highlight-current
|
|
|
+ :default-expanded-keys="defaultShowNodes"
|
|
|
+ @node-expand="handleNodeExpand"
|
|
|
+ @node-collapse="handleNodeCollapse"
|
|
|
empty-text="暂无分类"
|
|
|
@current-change="nodeChangeHandle"
|
|
|
>
|
|
@@ -160,6 +163,7 @@ export default {
|
|
|
leftSearchVal: "", //左侧搜索值
|
|
|
leftSearchTradeCode: "", //如果是搜索选择的 则有此code
|
|
|
isShowSingleData: false, //右侧是否展示的是单个指标数据
|
|
|
+ defaultShowNodes: [], //展开的节点
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -253,8 +257,6 @@ export default {
|
|
|
this.rightShow = true;
|
|
|
if (res.Ret !== 200) return;
|
|
|
const DataList = res.Data.Data || [];
|
|
|
- // 设置为没有更多数据
|
|
|
- this.haveMore = false;
|
|
|
// 合并数据
|
|
|
this.tableOption = [
|
|
|
{
|
|
@@ -262,6 +264,7 @@ export default {
|
|
|
...res.Data,
|
|
|
},
|
|
|
];
|
|
|
+ this.orientationNode(res.Data ? res.Data.ClassifyId:-1)
|
|
|
// 这里是单个指标所以不用合并日期
|
|
|
const arr = DataList.map((item) => item.DataTime);
|
|
|
this.dateArr = [...new Set(arr)].sort().reverse();
|
|
@@ -278,16 +281,47 @@ export default {
|
|
|
this.dateArr.push("");
|
|
|
if (this.dateArr.length >= 12) break;
|
|
|
}
|
|
|
- this.select_quota = res.Data.IndexName;
|
|
|
- this.select_Unit = res.Data.Unit;
|
|
|
- this.select_frequency = res.Data.Frequency;
|
|
|
- this.select_ModifyTime = res.Data.ModifyTime || "";
|
|
|
this.dataloading = false;
|
|
|
this.rightShow && this.initWidth();
|
|
|
} catch (err) {
|
|
|
console.log(err);
|
|
|
}
|
|
|
},
|
|
|
+ // 左侧目录定位
|
|
|
+ orientationNode(Id){
|
|
|
+ this.select_classify = Id;
|
|
|
+ this.defaultShowNodes.push(Id)
|
|
|
+ this.$refs.treeRef.setCurrentKey(Id);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(()=>{
|
|
|
+ let parent = document.getElementsByClassName('scroll-wrap')[0]
|
|
|
+ let node = parent.querySelector('.is-current')
|
|
|
+ parent.scrollTo({
|
|
|
+ top: node.offsetTop-200
|
|
|
+ })
|
|
|
+ },300)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 树节点展开
|
|
|
+ handleNodeExpand(data) {
|
|
|
+ // 保存当前展开的节点
|
|
|
+ let flag = this.defaultShowNodes.some((item) => item === data.ClassifyId);
|
|
|
+
|
|
|
+ if (!flag) {
|
|
|
+ // 不存在则存到数组里
|
|
|
+ this.defaultShowNodes.push(data.ClassifyId);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 树节点关闭
|
|
|
+ handleNodeCollapse(data) {
|
|
|
+ this.defaultShowNodes.some((item, index) => {
|
|
|
+ if (item === data.ClassifyId) {
|
|
|
+ // 删除关闭节点
|
|
|
+ this.defaultShowNodes.length = index;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
initWidth() {
|
|
|
this.$nextTick(() => {
|
|
|
$(".right-box")[0].style.width =
|