1
lkk
2025-06-10 c1cf70d01a5b11075170cfc6278a213833d1f799
1
1个文件已修改
44 ■■■■■ 已修改文件
src/components/jianqianwenzhen/index.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/jianqianwenzhen/index.vue
@@ -1164,7 +1164,6 @@
      this.$forceUpdate(); // 强制刷新(如果需要)
    },
    async delezz() {
      if (!this.selectedZhiyezz?.length) {
        this.$message.warning("请先选择要删除的项");
@@ -1358,6 +1357,47 @@
    },
    delemembers() {
      if (!this.bingshiall || this.bingshiall.length === 0) {
        this.$message.warning("请先选择要删除的项");
        return;
      }
      // 区分新增项和数据库项
      const localItems = this.bingshiall.filter((item) => !item.diseaseId); // 新增的
      const dbItems = this.bingshiall.filter((item) => item.diseaseId); // 数据库已有的
      // 先删除新增的(本地直接删)
      if (localItems.length > 0) {
        this.form.tjAskHistorysList = this.form.tjAskHistorysList.filter(
          (item) => !localItems.includes(item)
        );
      }
      if (dbItems.length === 0) {
        // 只有新增项,无需调用接口,直接清空选中,退出
        this.bingshiall = [];
        this.$forceUpdate();
        return;
      }
      // 调接口删除数据库项
      const historyId = dbItems.map((item) => item.diseaseId);
      removeAskHistorys(historyId)
        .then((res) => {
          this.$message.success("删除成功");
          // 接口成功后删除数据库项
          this.form.tjAskHistorysList = this.form.tjAskHistorysList.filter(
            (item) =>
              !dbItems.some((selected) => selected.diseaseId === item.diseaseId)
          );
          this.bingshiall = [];
          this.$forceUpdate();
        })
        .catch(() => {
          this.$message.warning("删除失败");
        });
    },
    /*  delemembers() {
      if (this.bingshiall && this.bingshiall.length > 0) {
        const historyId = this.bingshiall.map((item) => item.diseaseId);
@@ -1381,7 +1421,7 @@
      } else {
        this.$message.warning("请先选择要删除的项");
      }
    },
    }, */
    handlebingChange(selection) {
      this.bingshiall = [];