lkk
2 天以前 97ddbdb0827051db8fb25e42b964185fa6a9a3b5
src/views/hosp/project/index.vue
@@ -1327,7 +1327,7 @@
      this.form.lisXmbm = param1[0].pacCode;
      this.form.lisXmmc = param1[0].pacName;
    },
    /* getList() {
    getList() {
      this.loading = true;
      let data = {
        proName: this.queryParams.proName,
@@ -1339,7 +1339,7 @@
        this.projectList = response.data.list;
        this.loading = false;
      });
    }, */
    },
    getConsumables() {
      this.loading = true;
      listConsumables(this.queryParams).then((response) => {
@@ -1665,25 +1665,39 @@
      }
    },
    handleUpdate1() {
      // this.updateLoading = true;
      this.form = {};
      this.form = this.xiugaiList;
      this.form.proStatus = this.form.proStatus.toString();
      this.form.sfcyyc = this.form.sfcyyc.toString();
      this.form.proDelivery = this.form.proDelivery.toString();
      this.proParent = true;
      this.isPriceDisabled = true;
      getlist().then((response) => {
        if (response.code == 200) {
      // 先加载科室列表数据,再设置表单数据
      Promise.all([
        listDept(this.queryParams),
        getlist()
      ]).then(([deptResponse, listResponse]) => {
        // 先设置科室列表
        this.parentNameList = deptResponse.data;
        // 再设置表单数据
        this.form = this.xiugaiList;
        this.form.proStatus = this.form.proStatus.toString();
        this.form.sfcyyc = this.form.sfcyyc.toString();
        // 处理项目选项
        if (listResponse.code == 200) {
          this.loading = false;
          this.projectOptions = [];
          const project = { proId: 0, proName: "主类目", children: [] };
          project.children = this.handleTree(response.data.list, "proId");
          this.key = response.data.key;
          project.children = this.handleTree(listResponse.data.list, "proId");
          this.key = listResponse.data.key;
          this.projectOptions.push(project);
          console.log(this.projectOptions, 11111);
        }
      });
      this.open = true;
        this.open = true;
      }).catch((error) => {
        console.error("加载数据失败:", error);
        this.$message.error("加载数据失败");
      })
    },
    handleUpdate(row) {
      this.reset();
@@ -1691,7 +1705,9 @@
      const proId = row.proId || this.ids;
      this.proParent = false;
      this.isPriceDisabled = false;
      getProject(proId).then((response) => {
      listDept(this.queryParams).then((response) => {
        this.parentNameList = response.data;
        getProject(proId).then((response) => {
        this.form = response.data;
        this.showPrise = this.form.proParentId === "0";
        this.showRentPrise = !this.showPrise;
@@ -1733,6 +1749,8 @@
        this.open = true;
        this.title = "体检项目信息维护";
      });
      })
    },
    getSelectValue(val) {
      this.form.consumablesList.forEach((formitem) => {
@@ -1822,6 +1840,9 @@
      // 等待右侧表格刷新
      await this.getList();
      // 立即刷新当前项目数据,确保数据是最新的
      await this.refreshCurrentProjectData();
      this.pageLoading = false; // ✅ 统一加载状态控制
    },
@@ -1834,6 +1855,23 @@
        });
      }
    }, */
    // 刷新当前选中项目的数据
    async refreshCurrentProjectData() {
      if (this.id) {
        try {
          const response = await getInfoByProId(this.id);
          this.xiugaiList = response.data;
          console.log("刷新项目数据成功:", this.xiugaiList);
          return response.data;
        } catch (error) {
          console.error("刷新项目数据失败:", error);
          this.$message.error("刷新项目数据失败");
          this.xiugaiList = null; // 刷新失败时重置为 null
          return null;
        }
      }
      return null;
    },
    submit() {
      this.ChangeList.forEach((item) => {
        this.form.proPrice = item.ckdj;
@@ -1843,6 +1881,10 @@
        this.sfxmId = parseInt(item.id);
      });
      this.dialogTableVisible = false;
      this.getDeptList();
      this.getDeptTree().then(() => {
        this.precomputePinyin();
      });
    },
    handleDelete(row) {
      const proIds = row.proId || this.ids;