1
lkk
2025-04-11 4155e844855e22f52e82f657eab6d3c1e616706e
src/components/public/index.vue
@@ -58,7 +58,9 @@
              :data="dataList"
              ref="multipleTable"
              v-loading="loading"
              row-key="aid"
              @selection-change="handleSelectionChange"
              :reserve-selection="false"
              border
              height="420px"
            >
@@ -236,6 +238,9 @@
        if (!this.fList?.rulesList?.length) return;
  
        await this.$nextTick();
        // 先清除所有选择
        this.$refs.multipleTable?.clearSelection();
        // 再进行选择
        this.dataList.forEach((item) => {
          const shouldSelect = this.fList.rulesList.some(
            (rule) => rule.aid === item.aid
@@ -264,13 +269,12 @@
      },
  
      handleSelectionChange(selection) {
        this.list = selection;
        console.log('Selection changed:', selection);
        this.list = [...selection]; // 使用展开运算符创建新数组
        this.updateFormContent(selection);
      },
  
      updateFormContent(selection) {
        if (!selection.length) return;
        // 如果处于检查状态,使用传入的值
        if (this.checkStatus === "1") {
          this.updateData(this.proResult, this.conclusion);
@@ -281,16 +285,19 @@
        this.form.desc = "";
        this.form.jcsj = "";
  
        // 使用map和join替代forEach和字符串拼接
        this.form.desc = selection
          .map((item) => item.bingzhong || item.ruleStr)
          .filter(Boolean)
          .join(",");
        // 只有在有选中项时才进行拼接
        if (selection.length > 0) {
          // 使用map和join替代forEach和字符串拼接
          this.form.desc = selection
            .map((item) => item.bingzhong || item.ruleStr)
            .filter(Boolean)
            .join(",");
  
        this.form.jcsj = selection
          .map((item) => item.yxbx)
          .filter(Boolean)
          .join(",");
          this.form.jcsj = selection
            .map((item) => item.yxbx)
            .filter(Boolean)
            .join(",");
        }
      },
  
      handleOk() {