qx
2025-06-12 a9929166ee6f4def812519684a739336c7202531
Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region
1个文件已修改
44 ■■■■■ 已修改文件
src/components/jianqianwenzhen/index.vue 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/jianqianwenzhen/index.vue
@@ -1270,6 +1270,48 @@
      }
    },
    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);
@@ -1293,7 +1335,7 @@
      } else {
        this.$message.warning("请先选择要删除的项");
      }
    },
    }, */
    handlebingChange(selection) {
      this.bingshiall = [];
      this.bingshiall = selection;