1
wwl
2025-03-07 72a256b377fb61525c9c2982b35d1cb13b47497a
src/views/hosp/project/index.vue
@@ -9,8 +9,8 @@
        <div class="scrollable-container">
          <div class="content">
            <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false"
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
              highlight-current @node-click="handleNodeClick" :render-content="renderContent" />
              :filter-node-method="filterNode" ref="tree" node-key="id" :default-expanded-keys="treeId"
              highlight-current @node-click="handleNodeClick" :render-content="renderContent"  v-loading="loadings"/>
          </div>
        </div>
      </el-col>
@@ -418,6 +418,7 @@
import IconSelect from "@/components/IconSelect";
import { listConsumables } from "@/api/hosp/consumables";
import { Message } from "element-ui";
import cnchar from 'cnchar';
import {
  listSfxm,
  getSfxm,
@@ -475,6 +476,7 @@
      ChangeList: [],
      // 遮罩层
      loading: true,
      loadings: false,
      key: "",
      // 选中数组
      ids: [],
@@ -667,7 +669,7 @@
      };
      getAllChildListById(data).then((response) => {
        this.projectList = response.data.list;
        console.log("进来了列表并且获取到了值", this.projectList);
        // console.log("进来了列表并且获取到了值", this.projectList);
        this.loading = false;
      });
@@ -887,7 +889,6 @@
      deptTree111().then((response) => {
        this.deptOptions = response.data;
        this.treeId.push(this.treeDate.id);
        console.log(this.treeId)
      });
    },
@@ -924,12 +925,31 @@
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
      const input = value.toLowerCase();
      const label = data.label;
      // 1. 直接中文匹配
      if (label.includes(input)) return true;
      // 2. 全拼匹配(支持大小写)
      const fullPinyin = cnchar.spell(label, 'low', 'array').join('');
      if (fullPinyin.includes(input)) return true;
      // 3. 首字母简拼匹配
      const simplePinyin = cnchar.spell(label, 'first', 'low').replace(/\s+/g, '');
      if (simplePinyin.includes(input)) return true;
      // 4. 带空格的全拼匹配(如:zhang san)
      const spacedPinyin = cnchar.spell(label, 'low', ' ').replace(/\s+/g, ' ');
      if (spacedPinyin.includes(input)) return true;
      return false;
    },
    // 节点单击事件
    handleNodeClick(date) {
      console.log("调用了handleNodeClick ", date.id, this.id)
      // console.log("调用了handleNodeClick ", date.id, this.id)
      this.treeDate = date;
      if (date.qf == "0") {
        this.xiugais = true;