Browse Source

store

master
pengjun 2 years ago
parent
commit
9b57e916f6
  1. 15
      src/components/customerOrg/customerOrgTree.vue
  2. 1
      src/store/index.js

15
src/components/customerOrg/customerOrgTree.vue

@ -1,7 +1,9 @@
<template>
<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
<el-tree :data="customerOrg.customerOrgTree" :props="customerOrg.treeprops" @node-click="treeclick"></el-tree>
</template>
<script>
import { mapState,mapMutations } from 'vuex'
import { getapi, postapi, putapi, deletapi } from "@/api/api";
export default {
components: {
@ -12,7 +14,10 @@ export default {
};
},
//<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
computed:{
...mapState(['customerOrg']),
},
//
created() {
@ -25,7 +30,7 @@ export default {
},
methods: {
...mapMutations(['setData']),
//
getCustomerOrgTree() {
let customerOrgTree = [{
@ -40,12 +45,12 @@ export default {
}
]
//console.log('this.data.customerOrgTree',this.data.customerOrgTree)
this.$store.commit("setData", { key: 'customerOrg.customerOrgTree', value: customerOrgTree});
this.setData({ key: 'customerOrg.customerOrgTree', value: customerOrgTree})
},
//
treeclick(data) {
this.$message.success("查询单位详情、体检次数、联系人等信息");//
this.$message.success(data.id + " 查询单位详情、体检次数、联系人等信息 " + data.displayName);//
getapi(`/api/app/item/in-item-type/${data.id}`).then((res) => {
this.tableData = res.data;
console.log(res.data, "ress");

1
src/store/index.js

@ -13,6 +13,7 @@ export default new Vuex.Store({
value: "id",
children: "treeChildren",
}, //树形组件的数据结构
customerOrgId:'',//当前单位ID(可根据此值是否为空,判断是新增还是编辑)
customerOrgRd:{displayName:'单位名称',englishShortName:'简称'}, //单个体检单位记录值
customerOrgRegister: [], //单位体检次数登记
}

Loading…
Cancel
Save