1
lkk
2025-04-11 5c8adc16e9b0c0e71998d3cefc35170fa4a60900
src/views/hosp/project/index.vue
@@ -1,7 +1,7 @@
<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="3" :xs="24">
      <el-col :span="4" :xs="24">
        <div class="head-container">
          <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search"
            style="margin-bottom: 15px" />
@@ -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>
@@ -542,6 +542,7 @@
  watch: {
    deptName(val) {
      this.debounceFilter(val);
    },
    treeId(newVal) {
      if (newVal && newVal.length > 0) {
@@ -549,7 +550,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,8 +587,8 @@
    });
  },
  methods: {
    debounceFilter: debounce(function(val) {
      this.$refs.tree.filter(val);
    debounceFilter: debounce(function (val) {
      this.$refs.tree1.filter(val);
    }, 300),
    precomputePinyin() {
      const traverse = (nodes) => {
@@ -603,6 +604,7 @@
      traverse(this.deptOptions);
    },
    filterNode(value, data) {
      console.log(value, data,2233)
      if (!value) return true;
      const cached = this.pinyinCache.get(data.id);
      if (!cached) return false;
@@ -685,20 +687,29 @@
          project.children = this.handleTree(response.data.list, "proId");
          this.key = response.data.key;
          this.projectOptions.push(project);
          // this.open = true;
          if (row.proId) {
            this.form.proParentId = row.proId || 0;
            this.open = true;
          } else if (this.treeDate.id) {
            this.form.proParentId = this.treeDate.id || 0;
            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.open = true;
          }
        }
@@ -720,9 +731,12 @@
      } else if (this.form.proParentId) {
        if (this.form.proParentId != 0) {
          this.dialogTableVisible = true;
          this.$nextTick(() => {
            this.chargeId.push(this.deptOptionstree[0].id);
          });
          if (this.deptOptionstree.length != 0) {
            this.$nextTick(() => {
              this.chargeId.push(this.deptOptionstree[0].id);
            });
          }
          this.getlistSfxm();
        } else {
          this.dialogTableVisible = false;
@@ -815,7 +829,9 @@
      });
    },
    handleNodeClick(date) {
      this.treeDate = date;
      console.log(this.treeDate)
      this.xiugais = date.qf === "0";
      let proId = date.id;
      getInfoByProId(proId).then((response) => {
@@ -850,6 +866,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() {
@@ -889,7 +910,7 @@
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.proId = undefined;
      this.$refs.tree.setCurrentKey(null);
      this.$refs.tree1.setCurrentKey(null);
      this.handleQuery();
    },
    flexColumnWidth(column) {
@@ -1046,6 +1067,11 @@
          }
        }
      });
      this.deptName = "";
      // 手动调用过滤方法(需等待 DOM 更新)
      this.$nextTick(() => {
        this.$refs.tree1.filter(this.deptName);
      });
    },
    processSubmission(isUpdate, isY) {
      if (isUpdate) {
@@ -1059,7 +1085,7 @@
        } else {
          this.form.consumablesList = null;
        }
        if (!this.form.deptId || !this.form.proParentId) {
        if (!this.form.deptId || this.form.proParentId == null) {
          this.$message.error("请填写父项名称或科室名称");
          this.open = true;
        } else {
@@ -1088,6 +1114,10 @@
        this.sfxmId = parseInt(item.id);
      });
      this.dialogTableVisible = false;
       this.getDeptList();
    this.getDeptTree().then(() => {
      this.precomputePinyin();
    });
    },
    handleDelete(row) {
      const proIds = row.proId || this.ids;
@@ -1105,7 +1135,7 @@
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
        .catch(() => { });
    },
    handleExport() {
      this.download(