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.

91 lines
2.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <el-tree :data="patientRegister.customerOrgTreeAll" :props="customerOrg.treeprops" @node-click="treeclick"></el-tree>
  3. </template>
  4. <script>
  5. import { mapState } from 'vuex'
  6. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  7. import { tcdate } from '../../utlis/proFunc'
  8. export default {
  9. components: {},
  10. data() {
  11. return {};
  12. },
  13. //<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
  14. computed:{
  15. ...mapState(['dict','customerOrg','patientRegister']),
  16. },
  17. //创建组件后
  18. created() {},
  19. //挂载组件完成
  20. mounted() {
  21. //获取体检单位列表树信息
  22. this.getCustomerOrgTree();
  23. },
  24. methods: {
  25. //获取体检单位列表树信息
  26. getCustomerOrgTree(){
  27. getapi("/api/app/customer-org/by-code-all").then(
  28. (res) => {
  29. //customerOrgTree = res.data;
  30. console.log('res.data',res.data)
  31. this.patientRegister.customerOrgTreeAll = res.data
  32. //tcdate(this.patientRegister.customerOrgTreeAll)
  33. }
  34. );
  35. },
  36. //获取体检单位父级ID api/app/customer-org/parent/[CustomerOrgld
  37. getCustomerOrgParentld(customerOrgld){
  38. if(customerOrgld == this.dict.personOrgId){
  39. this.patientRegister.query.CustomerOrgParentld = this.dict.personOrgId
  40. return
  41. }
  42. getapi(`/api/app/customer-org/parent/${customerOrgld}`).then(
  43. (res) => {
  44. console.log('res.data',res.data)
  45. if(res.code == 1){
  46. this.patientRegister.query.CustomerOrgParentld = res.data
  47. }
  48. }
  49. )
  50. },
  51. //获取单位分组 /api/app/customer-org-group/in-customer-org-id/3a0c0444-d7a0-871f-4074-19faf1655caf
  52. getCustomerOrgGroup(customerOrgld){
  53. getapi(`/api/app/customer-org-group/in-customer-org-id/${customerOrgld}`).then(
  54. (res) => {
  55. console.log('res.data',res.data)
  56. if(res.code == 1){
  57. this.patientRegister.customerOrgGroup = res.data
  58. }
  59. }
  60. )
  61. },
  62. //点击树节点
  63. treeclick(data) {
  64. this.patientRegister.query.customerOrgId = data.id
  65. this.getCustomerOrgParentld(data.id)
  66. this.patientRegister.query.times++ //用于触发查询条件
  67. },
  68. },
  69. //监听事件
  70. watch: {
  71. //
  72. 'patientRegister.query.CustomerOrgParentld'(newVal, oldVal) {
  73. console.log('patientRegister.query.CustomerOrgParentld newVal:',newVal,' oldVal:',oldVal)
  74. if (newVal != oldVal && newVal !== this.dict.personOrgId) {
  75. this.getCustomerOrgGroup(newVal)
  76. }
  77. },
  78. },
  79. };
  80. </script>
  81. <style>
  82. </style>