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> <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> </template>
<script> <script>
import { mapState,mapMutations } from 'vuex'
import { getapi, postapi, putapi, deletapi } from "@/api/api"; import { getapi, postapi, putapi, deletapi } from "@/api/api";
export default { export default {
components: { 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() { created() {
@ -25,7 +30,7 @@ export default {
}, },
methods: { methods: {
...mapMutations(['setData']),
// //
getCustomerOrgTree() { getCustomerOrgTree() {
let customerOrgTree = [{ let customerOrgTree = [{
@ -40,12 +45,12 @@ export default {
} }
] ]
//console.log('this.data.customerOrgTree',this.data.customerOrgTree) //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) { treeclick(data) {
this.$message.success("查询单位详情、体检次数、联系人等信息");//
this.$message.success(data.id + " 查询单位详情、体检次数、联系人等信息 " + data.displayName);//
getapi(`/api/app/item/in-item-type/${data.id}`).then((res) => { getapi(`/api/app/item/in-item-type/${data.id}`).then((res) => {
this.tableData = res.data; this.tableData = res.data;
console.log(res.data, "ress"); console.log(res.data, "ress");

1
src/store/index.js

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

Loading…
Cancel
Save