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.5 KiB

2 years ago
2 years ago
2 years 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 :style="'overflow: scroll;height:' +(window.pageHeight < 600 ? 410 : window.pageHeight - 190) + 'px;'">
  7. <el-tree :data="dataTransOpts.tableM.menu_info" :props="customerOrg.treeprops"
  8. node-key="id" :filter-node-method="filterNode"
  9. :default-expanded-keys="customerOrg.defaultExpandedKeys"
  10. @node-click="treeclick" highlight-current ref="customerOrgTree"/>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import { mapState, mapMutations } from "vuex";
  16. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  17. import { tcdate } from "../../utlis/proFunc";
  18. export default {
  19. components: {},
  20. data() {
  21. return {
  22. filterText:''
  23. };
  24. },
  25. //<el-tree :data="$store.state.customerOrg.customerOrgTree" :props="$store.state.customerOrg.treeprops" @node-click="treeclick"></el-tree>
  26. computed: {
  27. ...mapState(["window", "dataTransOpts", "customerOrg" ]),
  28. },
  29. //创建组件后
  30. created() {
  31. },
  32. //挂载组件完成
  33. mounted() {
  34. //获取体检单位列表树信息
  35. this.getMenuInfoTree();
  36. },
  37. methods: {
  38. ...mapMutations(["setData"]),
  39. //获取体检单位列表树信息
  40. getMenuInfoTree() {
  41. getapi("/api/app/menuinfo/getmenuinfotreelist").then((res) => {
  42. if(res.code != -1){
  43. this.dataTransOpts.tableM.menu_info = res.data
  44. tcdate(this.dataTransOpts.tableM.menu_info);
  45. }
  46. });
  47. },
  48. //点击树节点
  49. treeclick(data) {
  50. this.dataTransOpts.tableS.menu_info.id = data.id;
  51. setTimeout(() => {
  52. this.dataTransOpts.refresh.menu_info.S++
  53. }, 20);
  54. },
  55. //树过滤
  56. filterNode(value, data) {
  57. //console.log(value,data)
  58. if (!value) return true;
  59. return data['displayName'].indexOf(value) !== -1 || data['simpleCode'].indexOf(value.toUpperCase()) !== -1;
  60. }
  61. },
  62. watch: {
  63. "customerOrg.treeCurrentNodekey"(newVal,oldVal){
  64. //console.log('watch:customerOrg.treeCurrentNodekey',newVal,oldVal)
  65. if(newVal && newVal != oldVal){
  66. this.$nextTick(() => {
  67. this.$refs['customerOrgTree'].setCurrentKey(newVal);
  68. })
  69. }
  70. },
  71. "filterText"(newVal,oldVal){ //过滤菜单
  72. this.$refs['customerOrgTree'].filter(newVal);
  73. }
  74. },
  75. };
  76. </script>
  77. <style scoped>
  78. @import "../../assets/css/global.css";
  79. @import "../../assets/css/global_tree.css";
  80. </style>