|
|
<template> <el-tree :data="customerOrg.customerOrgTree" :props="customerOrg.treeprops" @node-click="treeclick" /></template><script>import { mapState, mapMutations } 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(["customerOrg", "window"]), }, //创建组件后
created() {},
//挂载组件完成
mounted() { //获取体检单位列表树信息
this.getCustomerOrgTree(); },
methods: { ...mapMutations(["setData"]),
//获取体检单位列表树信息
getCustomerOrgTree() { //let customerOrgTree = []
// [
// {
// displayName: "个人体检", //
// id: "00000000-0000-0000-0000-000000000000", //
// //treeChildren: [],
// },
// {
// displayName: "组件式", //
// id: "10000000-0000-0000-0000-000000000000", //
// //treeChildren: [],
// },
// ];
//console.log('getCustomerOrgTree start')
// api/app/organization-units/organization-unit-by-is-peis // api/app/customer-org/by-code-all
getapi("/api/app/customer-org/by-code-all").then((res) => { //customerOrgTree = res.data;
console.log("res.data", res.data); this.setData({ key: "customerOrg.customerOrgTree", value: res.data }); tcdate(this.customerOrg.customerOrgTree); }); },
//获取单位基本信息
getCustomerOrgRd(id) { getapi(`/api/app/customer-org/${id}`).then((res) => { //console.log("res.data", res.data);
this.customerOrg.customerOrgRd = res.data; }); },
//获取体检次数列表
getCustomerOrgRegisterList(customerOrgId) { getapi( `/api/app/customer-org-register/in-customer-org-id/${customerOrgId}` ).then((res) => { //console.log('res.data',res.data)
this.customerOrg.customerOrgRegisterList = res.data; }); },
//获取联系人列表
getContactPersonList(customerOrgId) { getapi( `/api/app/contact-person/in-customer-org-id/${customerOrgId}` ).then((res) => { //console.log('res.data',res.data)
this.customerOrg.contactPersonList = res.data; if (res.data.length > 0) { this.getContactMethodList(res.data[0].id); } else { this.customerOrg.contactMethodList = []; } }); },
//获取联系方式列表
//api/app/contact-method/in-contact-person-id?ContactPersonId=3a0c08ad-4304-138b-d9e6-a7338739dfc4' \
getContactMethodList(ContactPersonId) { getapi("/api/app/contact-method/in-contact-person-id", { ContactPersonId, }).then((res) => { //console.log('res.data',res.data)
this.customerOrg.contactMethodList = res.data; }); },
//点击树节点
treeclick(data) { //this.$message.success(data.id + " 查询单位详情、体检次数、联系人等信息 " + data.displayName);// api/app/customer-org/3a0c0439-a5ca-8a63-b2b9-e0eb24cb58b1
this.customerOrg.customerOrgId = data.id; this.getCustomerOrgRd(data.id); this.getCustomerOrgRegisterList(data.id); this.getContactPersonList(data.id); }, },};</script><style scoped></style>
|