qx
qx
2025-04-23 0d541fcd7dc65b10dc475792bb7646976259c2aa
src/views/hosp/project/index.vue
@@ -14,9 +14,19 @@
        </div>
        <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" v-loading="loadings" />
            <el-tree
              :data="deptOptions"
              :props="defaultProps"
              :expand-on-click-node="false"
              :filter-node-method="filterNode"
              ref="tree1"
              node-key="id"
              :default-expanded-keys="treeId"
              highlight-current
              @node-click="handleNodeClick"
              :render-content="renderContent"
              v-loading="loadings"
            />
          </div>
        </div>
      </el-col>
@@ -120,6 +130,7 @@
          v-loading="loading"
          :data="projectList"
          ref="tableRef"
          height="580"
          border
        >
          <el-table-column
@@ -206,7 +217,13 @@
            width="90px"
          >
          </el-table-column>
          <el-table-column label="Lis项目名称" align="center" prop="lisXmmc" :show-overflow-tooltip="true" width="200px">
          <el-table-column
            label="Lis项目名称"
            align="center"
            prop="lisXmmc"
            :show-overflow-tooltip="true"
            width="200px"
          >
          </el-table-column>
          <el-table-column
            label="Lis编码"
@@ -589,6 +606,12 @@
            style="width: 200px"
          />
        </el-form-item>
        <el-form-item label="是否参与异常" prop="sfcyyc">
          <el-select v-model="form.sfcyyc" placeholder="请选择是否参与异常" style="width: 260px">
            <el-option v-for="dict in dictTypesy" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-button
        style="margin-left: 40px"
@@ -964,6 +987,16 @@
        children: "dictSfxms",
        label: "xmmc",
      },
      dictTypesy: [
        {
          value:"0",
          label:"是"
        },
        {
          value:"1",
          label:"否"
        }
      ],
      xmmc: "",
      chargeId: [],
      List: false,
@@ -1040,6 +1073,7 @@
        proScope: "",
        proSex: "2",
        resultType: "",
        sfcyyc: "0",
      },
      rules: {
        createTime: [
@@ -1104,9 +1138,9 @@
  created() {
    this.getConsumables();
    this.getDeptList();
    this.getDeptTree().then(() => {
      this.precomputePinyin();
    });
    // this.getDeptTree().then(() => {
    //   this.precomputePinyin();
    // });
  },
  mounted() {
    this.getDeptTree().then(() => {
@@ -1115,23 +1149,18 @@
  },
  methods: {
    debounceFilter: debounce(function (val) {
      this.$refs.tree.filter(val);
    }, 800),
      this.$refs.tree1.filter(val);
    }, 300),
    precomputePinyin() {
      const traverse = (nodes) => {
        nodes.forEach((node) => {
          if (node.label) {
            const lowerSpell = cnchar.spell(node.label, 'low', 'array').join(''); // 完整小写拼音
            const upperSpell = cnchar.spell(node.label, 'up', 'array').join('');  // 完整大写拼音
            const shortPinyin = node.label
              .split('')
              .map(char => cnchar.spell(char, 'array')[0]?.[0]?.toLowerCase() || char) // 拼音首字母
              .join('');
            const lowerSpell = node.label.spell("low", "array").join("");
            const upperSpell = node.label.spell("up", "array").join("");
            this.pinyinCache.set(node.id, {
              lowerSpell,
              upperSpell,
              shortPinyin, // 缓存拼音简写
              label: node.label
              label: node.label,
            });
          }
          if (node.children) traverse(node.children);
@@ -1142,12 +1171,11 @@
    filterNode(value, data) {
      if (!value) return true;
      const cached = this.pinyinCache.get(data.id);
      if (!cached) return false; // 如果没有缓存数据,不显示该节点
      const searchLower = value.toLowerCase(); // 将搜索词转为小写
      if (!cached) return false;
      return (
        cached.label.includes(value) ||           // 直接匹配汉字
        cached.shortPinyin.includes(searchLower) || // 匹配拼音简写
        cached.lowerSpell.includes(searchLower)   // 匹配完整拼音
        cached.label.includes(value) ||
        cached.lowerSpell.includes(value) ||
        cached.upperSpell.includes(value)
      );
    },
    filterNode2(value, data) {
@@ -1265,8 +1293,8 @@
            this.open = true;
          } else if (this.treeDate.id) {
            if (this.treeDate.qf == "0") {
              this.form.proParentId = "0"
              this.form.deptId = this.treeDate.id
              this.form.proParentId = "0";
              this.form.deptId = this.treeDate.id;
            } else {
              this.form.proParentId = this.treeDate.id;
              this.projectOptions.forEach((item) => {
@@ -1278,10 +1306,9 @@
              });
            }
            this.open = true;
          } else {
            this.form.proParentId = "0"
            this.form.proParentId = "0";
            this.open = true;
          }
        }
@@ -1401,13 +1428,18 @@
    getDeptTree() {
      return deptTree111().then((response) => {
        this.deptOptions = response.data;
        this.treeId.push(this.treeDate.id);
        this.treeId = []
        if(this.treeDate.id){
          this.treeId.push( this.treeDate.id)
        }else{
          this.treeId.push("532")
        }
      });
    },
    handleNodeClick(date) {
      this.treeDate = date;
      this.treeId = []
      console.log(this.treeId,2222);
      this.xiugaiList ={}
      this.xiugais = date.qf === "0";
      let proId = date.id;
      getInfoByProId(proId).then((response) => {
@@ -1562,8 +1594,10 @@
      }
    },
    handleUpdate1() {
      this.form={}
      this.form = this.xiugaiList;
      this.form.proStatus = this.form.proStatus.toString();
      this.form.sfcyyc = this.form.sfcyyc.toString();
      this.proParent = true;
      this.isPriceDisabled = true;
      getlist().then((response) => {
@@ -1589,6 +1623,7 @@
        this.showPrise = this.form.proParentId === "0";
        this.showRentPrise = !this.showPrise;
        this.form.proStatus = this.form.proStatus.toString();
        this.form.sfcyyc = this.form.sfcyyc.toString();
        this.form.consumablesList = response.data.consumablesList;
        this.form.tjStandardList = response.data.tjStandardList;
        if (this.form.tjStandardList) {
@@ -1741,7 +1776,7 @@
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
        .catch(() => {});
    },
    handleExport() {
      this.download(