store_tree_data

master
luoJunYong.123 3 years ago
parent 00eef97493
commit 007ae3ba14
  1. 41
      src/views/Transaction.vue

@ -353,6 +353,7 @@
import quill from "@/components/quill";
import MyTree from "@/components/myTree/src/tree";
import {deepCopy} from "@/utils/deepCopy";
import { mapState } from 'vuex'
export default {
components: {quill, MyTree},
@ -401,6 +402,11 @@ export default {
loading:true,
};
},
computed: {
...mapState({
treeDataStore: state => state.treeDataStore
})
},
mounted() {
this.$route.query.token && this.$store.commit("setParam", {
token: atob(decodeURI(this.$route.query.token))
@ -671,15 +677,23 @@ export default {
}
},
getTreeData() { //
if(this.treeDataStore.length) {
const tmp = [...this.treeDataStore]
this.treeData = this.toTreeId(tmp, this.treeDataStore[0].parentId);
if (this.$route.query.lcId) {
this.lcId = this.$route.query.lcId;
this.getInfoData(this.$route.query.lcId);
}
}else {
this.$get(this.api.getLcRecord).then(res => {
if (res.status == 200 && res.list.length>0) {
if (res.list.length>0) {
this.$store.commit('setTreeDataStore', { treeDataStore: res.list})
this.treeData = this.toTreeId(res.list, res.list[0].parentId);
if (this.$route.query.lcId) {
this.lcId = this.$route.query.lcId;
this.getInfoData(this.$route.query.lcId);
} else {
this.loading = false
}
}
} else {
@ -688,6 +702,26 @@ export default {
}).catch(err => {
// console.log(err);
});
}
// this.$get(this.api.getLcRecord).then(res => {
// if (res.status == 200 && res.list.length>0) {
// if (res.list.length>0) {
// this.treeData = this.toTreeId(res.list, res.list[0].parentId);
// if (this.$route.query.lcId) {
// this.lcId = this.$route.query.lcId;
// this.getInfoData(this.$route.query.lcId);
// } else {
// this.loading = false
// }
// }
// } else {
// this.$message.warning(res.message);
// }
// }).catch(err => {
// // console.log(err);
// });
},
toTreeId(data, parentId) { // id++,便key,id
let result = [];
@ -840,7 +874,10 @@ export default {
})
}
addSuffix(treeData)
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys([])
})
},
addRule() { //
this.changeArr.splice(0, this.changeArr.length)

Loading…
Cancel
Save