|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-tabs v-model="activeName1" @tab-click="handleClick(index)">
|
|
|
+ <el-tabs v-model="activeName1" @tab-click="handleClick">
|
|
|
<el-tab-pane
|
|
|
:label="dict.label"
|
|
|
:name="dict.value"
|
|
@@ -23,7 +23,7 @@
|
|
|
>
|
|
|
</dept-tree>
|
|
|
</div>
|
|
|
- <keep-alive>
|
|
|
+ <keep-alive include="Echarts-box">
|
|
|
<Echarts-box
|
|
|
v-loading="loading"
|
|
|
:key="queryParams.para2"
|
|
@@ -258,18 +258,15 @@ export default {
|
|
|
para3: "1",
|
|
|
para4: null,
|
|
|
},
|
|
|
+ // 接收到的数据
|
|
|
formData: {
|
|
|
unit: null,
|
|
|
vales: null,
|
|
|
keys: null,
|
|
|
},
|
|
|
index: "0",
|
|
|
- // 外层点击过的tab
|
|
|
- firstTabClicked: ["1"],
|
|
|
- // 内层点击过的tab,
|
|
|
- secondTabClicked: [{ firstTab: "1", secondTab: ["1"] }],
|
|
|
- // 已经点击过的tab的对应状态
|
|
|
- oldClickNum: [{ firstTab: "1", secondTab: "1" }],
|
|
|
+ // 服务器获取数据后,本地备份一份
|
|
|
+ localBackup: [],
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -324,55 +321,62 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 父tabs栏切换事件
|
|
|
- handleClick() {
|
|
|
- if (!this.firstTabClicked.includes(this.activeName1)) {
|
|
|
- this.firstTabClicked.push(this.activeName1);
|
|
|
- this.secondTabClicked.push({
|
|
|
- firstTab: this.activeName1,
|
|
|
- secondTab: ["1"],
|
|
|
- });
|
|
|
- this.oldClickNum.push({ firstTab: this.activeName1, secondTab: "1" });
|
|
|
- this.$refs.tree1[this.index].treeClear();
|
|
|
- this.$refs.tree2[this.index].treeClear();
|
|
|
- this.$refs.tree3[this.index].treeClear();
|
|
|
+ handleClick(tab) {
|
|
|
+ let dataInBackup = undefined; // 存储本地备份数据中调出的所需数据
|
|
|
+ dataInBackup = this.localBackup.find(
|
|
|
+ (item) => item.tabName1 === this.activeName1
|
|
|
+ );
|
|
|
+ if (dataInBackup !== undefined) {
|
|
|
+ this.activeName2 = dataInBackup.tabName2;
|
|
|
+ this.formData = dataInBackup.data;
|
|
|
+ } else {
|
|
|
+ // this.$refs.tree1[this.index].treeClear();
|
|
|
+ // this.$refs.tree2[this.index].treeClear();
|
|
|
+ // this.$refs.tree3[this.index].treeClear();
|
|
|
this.activeName2 = "1";
|
|
|
this.queryParams.para2 = null;
|
|
|
this.queryParams.para4 = null;
|
|
|
this.queryParams.para3 = this.activeName2;
|
|
|
this.queryParams.para1 = this.activeName1;
|
|
|
this.getTableList();
|
|
|
- } else {
|
|
|
- this.oldClickNum.map((curVal) => {
|
|
|
- if (curVal.firstTab == this.activeName1) {
|
|
|
- this.activeName2 = curVal.secondTab;
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
+ console.log("dataInBackup1", dataInBackup);
|
|
|
+ console.log("localBackup", this.localBackup);
|
|
|
},
|
|
|
// 子tabs栏切换事件
|
|
|
handleTabsClick(index) {
|
|
|
- for (let i = 0; i < this.secondTabClicked.length; i++) {
|
|
|
- if (this.secondTabClicked[i].firstTab == this.activeName1) {
|
|
|
- this.oldClickNum[i].secondTab = this.activeName2;
|
|
|
- if (!this.secondTabClicked[i].secondTab.includes(this.activeName2)) {
|
|
|
- this.secondTabClicked[i].secondTab.push(this.activeName2);
|
|
|
- this.index = index;
|
|
|
- this.$refs.tree1[index].treeClear();
|
|
|
- this.$refs.tree2[index].treeClear();
|
|
|
- this.$refs.tree3[index].treeClear();
|
|
|
- this.queryParams.para2 = null;
|
|
|
- this.queryParams.para4 = null;
|
|
|
- this.queryParams.para3 = this.activeName2;
|
|
|
- this.getTableList();
|
|
|
- }
|
|
|
- }
|
|
|
+ let dataInBackup = undefined, // 存储本地备份数据中调出的所需数据
|
|
|
+ idx = this.localBackup.findIndex(
|
|
|
+ (item) =>
|
|
|
+ item.tabName2 === this.activeName2 &&
|
|
|
+ item.tabName1 === this.activeName1
|
|
|
+ );
|
|
|
+ dataInBackup = this.localBackup.find(
|
|
|
+ (item) =>
|
|
|
+ item.tabName2 === this.activeName2 &&
|
|
|
+ item.tabName1 === this.activeName1
|
|
|
+ );
|
|
|
+ if (dataInBackup !== undefined) {
|
|
|
+ this.localBackup.splice(idx, 1);
|
|
|
+ this.localBackup.unshift(dataInBackup);
|
|
|
+ this.formData = dataInBackup.data;
|
|
|
+ } else {
|
|
|
+ this.index = index;
|
|
|
+ // this.$refs.tree1[index].treeClear();
|
|
|
+ // this.$refs.tree2[index].treeClear();
|
|
|
+ // this.$refs.tree3[index].treeClear();
|
|
|
+ this.queryParams.para2 = null;
|
|
|
+ this.queryParams.para4 = null;
|
|
|
+ this.queryParams.para3 = this.activeName2;
|
|
|
+ this.getTableList();
|
|
|
}
|
|
|
- console.log("queryParams", this.queryParams);
|
|
|
+ console.log("dataInBackup2", dataInBackup, idx);
|
|
|
+ console.log("localBackup", this.localBackup);
|
|
|
},
|
|
|
// 节点单击事件
|
|
|
handleNodeClick(data) {
|
|
|
// console.log(data);
|
|
|
- console.log("queryParams", this.queryParams);
|
|
|
+ // console.log("queryParams", this.queryParams);
|
|
|
this.ssqh = data.code;
|
|
|
this.queryParams.para2 = data.code;
|
|
|
// this.$nextTick(() => {
|
|
@@ -382,28 +386,29 @@ export default {
|
|
|
// this.handleQuery()
|
|
|
this.getTableList();
|
|
|
},
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getTableList();
|
|
|
- },
|
|
|
- // 获取表格数据
|
|
|
+
|
|
|
+ // 从服务器获取表格数据
|
|
|
async getTableList() {
|
|
|
// var para = {}
|
|
|
// para.dictType = 'yljg_zhtj'
|
|
|
// para.outType = '0'
|
|
|
// para.para1 = '1'
|
|
|
// para.para2 = '277f45bc79f040839848fba510be1c6d'
|
|
|
+
|
|
|
this.loading = true;
|
|
|
let retdata = await getstatisticaldata(this.queryParams);
|
|
|
this.loading = false;
|
|
|
if (retdata.code == 200) {
|
|
|
var data = this.$DBRetToObjA(retdata.data);
|
|
|
this.formData = data[0];
|
|
|
+ this.localBackup.unshift({
|
|
|
+ tabName1: this.activeName1,
|
|
|
+ tabName2: this.activeName2,
|
|
|
+ data: data[0],
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- mounted() {},
|
|
|
created() {
|
|
|
this.getTableList();
|
|
|
},
|