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.

162 lines
5.1 KiB

2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <div style="margin:2px 2px 2px 2px;">
  4. <el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" />
  5. </div>
  6. <div>
  7. <el-tree :data="customerOrg.customerOrgTree" :props="treeprops" node-key="id" :filter-node-method="filterNode"
  8. :style="'overflow: scroll;width:200px;height:' + (window.pageHeight < 600 ? 465 : window.pageHeight - 135) + 'px;'"
  9. :default-expanded-keys="customerOrg.defaultExpandedKeys" @node-contextmenu="nodeContextmenu"
  10. @node-click="treeclick" highlight-current ref="customerOrgTree">
  11. <span class="custom-tree-node" slot-scope="{ node, data }">
  12. <div>
  13. <span class="treeicons">
  14. <img style="width:20px;height:20px;vertical-align: sub;" src="@/assets/images/order.png"
  15. v-if="!data.parentId" />
  16. </span>
  17. <span :class="!data.parentId ? 'maxtitle' : 'mintitle'">{{ node.label }}
  18. </span>
  19. </div>
  20. </span>
  21. </el-tree>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import { mapState, mapMutations } from "vuex";
  27. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  28. import { tcdate, deepCopy, reMadeOrgTree } from "../../utlis/proFunc";
  29. import { getTreePids } from "../../utlis/tree";
  30. export default {
  31. components: {},
  32. data() {
  33. return {
  34. filterText: '',
  35. treeprops: {
  36. label: "displayName", // label/displayName
  37. value: "id",
  38. id: "id",
  39. children: "treeChildren",
  40. }, //树形组件的数据结构
  41. };
  42. },
  43. //<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
  44. computed: {
  45. ...mapState(["customerOrg", "window", "dataTransOpts"]),
  46. },
  47. //创建组件后
  48. created() {
  49. },
  50. //挂载组件完成
  51. mounted() {
  52. //获取体检单位列表树信息
  53. this.getCustomerOrgTree();
  54. },
  55. methods: {
  56. ...mapMutations(["setData"]),
  57. //获取体检单位列表树信息
  58. getCustomerOrgTree() {
  59. //let customerOrgTree = []
  60. // [
  61. // {
  62. // displayName: "个人体检", //
  63. // id: "00000000-0000-0000-0000-000000000000", //
  64. // //treeChildren: [],
  65. // },
  66. // {
  67. // displayName: "组件式", //
  68. // id: "10000000-0000-0000-0000-000000000000", //
  69. // //treeChildren: [],
  70. // },
  71. // ];
  72. //console.log('getCustomerOrgTree start')
  73. // api/app/organization-units/organization-unit-by-is-peis // api/app/customer-org/by-code-all
  74. getapi("/api/app/customerorg/getbycodeall?IsHidePerson=1").then((res) => {
  75. //customerOrgTree = res.data;
  76. if (res.code != -1) {
  77. this.customerOrg.customerOrgTree = reMadeOrgTree(deepCopy(res.data))
  78. // tcdate(this.customerOrg.customerOrgTree);
  79. }
  80. });
  81. },
  82. //获取联系方式列表
  83. //api/app/contact-method/in-contact-person-id?ContactPersonId=3a0c08ad-4304-138b-d9e6-a7338739dfc4' \
  84. getContactMethodList(ContactPersonId) {
  85. getapi("/api/app/contact-method/in-contact-person-id", {
  86. ContactPersonId,
  87. }).then((res) => {
  88. if (res.code != -1) {
  89. this.customerOrg.contactMethodList = res.data;
  90. }
  91. });
  92. },
  93. //点击树节点
  94. treeclick(data) {
  95. //console.log(data.id + " 查询单位详情、体检次数、联系人等信息 " + data.displayName);// api/app/customer-org/3a0c0439-a5ca-8a63-b2b9-e0eb24cb58b1
  96. this.customerOrg.oprStatus = 'edit'
  97. //只有单位才有体检次数登记,部门无
  98. this.dataTransOpts.tableS.customer_org.id = data.id //单位ID
  99. this.dataTransOpts.tableS.customer_org.parent_id = data.id //一级单位ID
  100. if (data.parentId) {
  101. let pids = getTreePids(this.customerOrg.customerOrgTree, "treeChildren", 'parentId', 'id', data.id)
  102. this.dataTransOpts.tableS.customer_org.parent_id = pids[pids.length - 2]
  103. }
  104. this.dataTransOpts.refresh.customer_org.S++
  105. this.dataTransOpts.refresh.customer_org_register.M++
  106. this.dataTransOpts.refresh.contact_person.M++
  107. },
  108. // 节点右击事件
  109. nodeContextmenu(event, data, node, ids) {
  110. console.log('event,data,node,ids', event, data, node, ids)
  111. },
  112. //树过滤
  113. filterNode(value, data) {
  114. //console.log(value,data)
  115. if (!value) return true;
  116. return data['displayName'].indexOf(value) !== -1 || data['simpleCode'].indexOf(value.toUpperCase()) !== -1;
  117. }
  118. },
  119. watch: {
  120. "customerOrg.treeCurrentNodekey"(newVal, oldVal) {
  121. //console.log('watch:customerOrg.treeCurrentNodekey',newVal,oldVal)
  122. if (newVal && newVal != oldVal) {
  123. this.$nextTick(() => {
  124. this.$refs['customerOrgTree'].setCurrentKey(newVal);
  125. })
  126. }
  127. },
  128. "filterText"(newVal, oldVal) {
  129. this.$refs['customerOrgTree'].filter(newVal);
  130. }
  131. },
  132. };
  133. </script>
  134. <style scoped>
  135. @import "../../assets/css/global.css";
  136. @import "../../assets/css/global_tree.css";
  137. .treeicons {
  138. font-size: 20px;
  139. margin-right: 5px;
  140. }
  141. :deep .el-tree-node>.el-tree-node__children {
  142. overflow: visible;
  143. }
  144. </style>