You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

92 lines
2.7 KiB

<template>
<el-tree :data="patientRegister.customerOrgTreeAll" :props="customerOrg.treeprops" @node-click="treeclick"></el-tree>
</template>
<script>
import { mapState } from 'vuex'
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { tcdate } from '../../utlis/proFunc'
export default {
components: {},
data() {
return {};
},
//<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
computed:{
...mapState(['dict','customerOrg','patientRegister']),
},
//创建组件后
created() {},
//挂载组件完成
mounted() {
//获取体检单位列表树信息
this.getCustomerOrgTree();
},
methods: {
//获取体检单位列表树信息
getCustomerOrgTree(){
getapi("/api/app/customer-org/by-code-all").then(
(res) => {
//customerOrgTree = res.data;
console.log('res.data',res.data)
this.patientRegister.customerOrgTreeAll = res.data
//tcdate(this.patientRegister.customerOrgTreeAll)
}
);
},
//获取体检单位父级ID api/app/customer-org/parent/[CustomerOrgld
getCustomerOrgParentld(customerOrgld){
if(customerOrgld == this.dict.personOrgId){
this.patientRegister.query.CustomerOrgParentld = this.dict.personOrgId
return
}
getapi(`/api/app/customer-org/parent/${customerOrgld}`).then(
(res) => {
console.log('res.data',res.data)
if(res.code == 1){
this.patientRegister.query.CustomerOrgParentld = res.data
}
}
)
},
//获取单位分组 /api/app/customer-org-group/in-customer-org-id/3a0c0444-d7a0-871f-4074-19faf1655caf
getCustomerOrgGroup(customerOrgld){
getapi(`/api/app/customer-org-group/in-customer-org-id/${customerOrgld}`).then(
(res) => {
console.log('res.data',res.data)
if(res.code == 1){
this.patientRegister.customerOrgGroup = res.data
}
}
)
},
//点击树节点
treeclick(data) {
this.patientRegister.query.customerOrgId = data.id
this.getCustomerOrgParentld(data.id)
this.patientRegister.query.times++ //用于触发查询条件
},
},
//监听事件
watch: {
//
'patientRegister.query.CustomerOrgParentld'(newVal, oldVal) {
console.log('patientRegister.query.CustomerOrgParentld newVal:',newVal,' oldVal:',oldVal)
if (newVal != oldVal && newVal !== this.dict.personOrgId) {
this.getCustomerOrgGroup(newVal)
}
},
},
};
</script>
<style>
</style>