1
lkk
2025-04-11 5c8adc16e9b0c0e71998d3cefc35170fa4a60900
src/components/public/index.vue
@@ -58,6 +58,7 @@
            :data="dataList"
            ref="multipleTable"
            v-loading="loading"
            row-key="aid"
            @selection-change="handleSelectionChange"
            border
            height="420px"
@@ -178,7 +179,7 @@
        bingzhong: "",
        bzPinyin: "",
        proId:"",
        proName:"",
      //   proName:"",
        pageNum: 1,
        pageSize: 10,
      },
@@ -203,7 +204,7 @@
        if (newVal && newVal.length > 0) {
          const firstProject = newVal[0]; // 你也可以遍历所有项目,看你业务需求
          this.queryParams.proId = firstProject.proId; // 假设项目中叫 id
          this.queryParams.proName = firstProject.proName; // 假设叫 proName
          // this.queryParams.proName = firstProject.proName;
          this.proName = firstProject.proName
        }
      },
@@ -236,6 +237,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 +268,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 +284,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() {