qx
qx
2025-04-23 37e09a8edf9afb70342b68352329ce959f8ebda6
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" v-loading="loadings"/>
              :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>
@@ -79,7 +79,7 @@
          </el-table-column>
          <el-table-column label="项目标准值" align="center" prop="proScope" :show-overflow-tooltip="true" 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编码" align="center" prop="lisXmbm" :show-overflow-tooltip="true" width="90px">
          </el-table-column>
@@ -228,6 +228,12 @@
        </el-form-item>
        <el-form-item label="排序" prop="xh">
          <el-input v-model="form.xh" placeholder="请输入排序" 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" type="primary" plain size="mini" icon="el-icon-plus"
@@ -441,6 +447,16 @@
      },
      xmmc: "",
      chargeId: [],
      dictTypesy: [
        {
          value:"0",
          label:"是"
        },
        {
          value:"1",
          label:"否"
        }
      ],
      List: false,
      deptName: "",
      deptOption: [],
@@ -515,6 +531,7 @@
        proScope: "",
        proSex: "2",
        resultType: "",
        sfcyyc: "0",
      },
      rules: {
        createTime: [
@@ -549,7 +566,7 @@
          const lastId = newVal[newVal.length - 1] || "532";
          const node = this.findNodeById(this.deptOptions, lastId);
          if (node) {
            this.$refs.tree.setCurrentKey(lastId);
            this.$refs.tree1.setCurrentKey(lastId);
            const nodeElement = document.querySelector(`.el-tree-node[data-key="${lastId}"] .el-tree-node__content`);
            if (nodeElement) {
              nodeElement.click();
@@ -586,16 +603,25 @@
    });
  },
  methods: {
    debounceFilter: debounce(function(val) {
      this.$refs.tree.filter(val);
    debounceFilter: debounce(function (val) {
      this.$refs.tree1.filter(val);
    }, 300),
    precomputePinyin() {
      const traverse = (nodes) => {
        nodes.forEach(node => {
          if (node.label) {
            const lowerSpell = node.label.spell('low', 'array').join('');
            const upperSpell = node.label.spell('up', 'array').join('');
            this.pinyinCache.set(node.id, { lowerSpell, upperSpell, label: 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('');
            this.pinyinCache.set(node.id, {
              lowerSpell,
              upperSpell,
              shortPinyin, // 缓存拼音简写
              label: node.label
            });
          }
          if (node.children) traverse(node.children);
        });
@@ -603,13 +629,14 @@
      traverse(this.deptOptions);
    },
    filterNode(value, data) {
      if (!value) return true;
      if (!value) return true; // 如果搜索值为空,返回所有节点
      const cached = this.pinyinCache.get(data.id);
      if (!cached) return false;
      if (!cached) return false; // 如果没有缓存数据,不显示该节点
      const searchLower = value.toLowerCase(); // 将搜索词转为小写
      return (
        cached.label.includes(value) ||
        cached.lowerSpell.includes(value) ||
        cached.upperSpell.includes(value)
        cached.label.includes(value) ||           // 直接匹配汉字
        cached.shortPinyin.includes(searchLower) || // 匹配拼音简写
        cached.lowerSpell.includes(searchLower)   // 匹配完整拼音
      );
    },
    filterNode2(value, data) {
@@ -690,24 +717,24 @@
            this.form.proParentId = row.proId || 0;
            this.open = true;
          } else if (this.treeDate.id) {
           if(this.treeDate.qf == "0"){
            this.form.proParentId = "0"
            this.form.deptId=this.treeDate.id
           }else{
            this.form.proParentId = this.treeDate.id;
            this.projectOptions.forEach((item) => {
              item.children.forEach((item1) => {
                if (this.form.proParentId == item1.proId) {
                  this.form.deptId = item1.deptId;
                }
            if (this.treeDate.qf == "0") {
              this.form.proParentId = "0"
              this.form.deptId = this.treeDate.id
            } else {
              this.form.proParentId = this.treeDate.id;
              this.projectOptions.forEach((item) => {
                item.children.forEach((item1) => {
                  if (this.form.proParentId == item1.proId) {
                    this.form.deptId = item1.deptId;
                  }
                });
              });
            });
           }
            }
            this.open = true;
          } else {
             this.form.proParentId = "0"
            this.form.proParentId = "0"
            this.open = true;
          }
        }
@@ -824,9 +851,9 @@
      });
    },
    handleNodeClick(date) {
      this.treeDate = date;
      console.log(this.treeDate)
      this.xiugaiList ={}
      this.xiugais = date.qf === "0";
      let proId = date.id;
      getInfoByProId(proId).then((response) => {
@@ -861,6 +888,11 @@
      let data = { proId: this.queryParams.proId };
      getAllChildListById(data).then(() => {
        this.loading = false;
      });
      this.deptName = "";
      // 手动调用过滤方法(需等待 DOM 更新)
      this.$nextTick(() => {
        this.$refs.tree1.filter(this.deptName);
      });
    },
    handleClose() {
@@ -900,7 +932,7 @@
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.proId = undefined;
      this.$refs.tree.setCurrentKey(null);
      this.$refs.tree1.setCurrentKey(null);
      this.handleQuery();
    },
    flexColumnWidth(column) {
@@ -971,8 +1003,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) => {
@@ -983,6 +1017,7 @@
          project.children = this.handleTree(response.data.list, "proId");
          this.key = response.data.key;
          this.projectOptions.push(project);
          console.log( this.projectOptions,11111)
        }
      });
      this.open = true;
@@ -998,6 +1033,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) {
@@ -1056,6 +1092,11 @@
            this.processSubmission(isUpdate, true);
          }
        }
      });
      this.deptName = "";
      // 手动调用过滤方法(需等待 DOM 更新)
      this.$nextTick(() => {
        this.$refs.tree1.filter(this.deptName);
      });
    },
    processSubmission(isUpdate, isY) {
@@ -1116,7 +1157,7 @@
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
        .catch(() => { });
    },
    handleExport() {
      this.download(