qx
3 天以前 ed1bb201eabb0061f038359e04457b998edb1ae5
src/components/public/index.vue
@@ -6,7 +6,7 @@
        检测结果 :{{ fList.proResult }}{{ fList.project.proMetering }}
      </h3>
      <h2 style="text-align: center;">{{ proName || '暂无项目名称' }}</h2>
      <h2 style="text-align: center">{{ proName || "暂无项目名称" }}</h2>
      <div style="display: flex; width: 100%">
        <div style="width: 50%; margin-right: 40px">
          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
@@ -33,9 +33,9 @@
          <h3 style="margin-left: 160px">已选项目</h3>
        </el-form-item> -->
          </el-form>
          <el-table :data="dataList" ref="multipleTable" v-loading="loading" @selection-change="handleSelectionChange"
          <el-table :data="dataList" ref="multipleTable" row-key="aid" v-loading="loading" @selection-change="handleSelectionChange"
            border height="480px">
            <el-table-column type="selection" width="40" align="center" />
            <el-table-column type="selection" width="40" align="center"  :reserve-selection="true"/>
            <el-table-column label="序号" type="index" align="center" width="50px" />
            <!-- <el-table-column label="规则" align="center" prop="ruleStr" /> -->
            <el-table-column label="检查所见" align="center" prop="yxbx" />
@@ -109,7 +109,7 @@
      // 弹出层标题
      title: "",
      yxbx: "",
      proName: '',
      proName: "",
      //   lastDesc: "",
      total: 0,
      dataList: [],
@@ -122,7 +122,7 @@
      queryParams: {
        ruleStr: "",
        pageNum: 1,
        pageSize: 10,
        pageSize: 50,
      },
      list: [],
      fList: {},
@@ -132,29 +132,31 @@
  },
  watch: {
    checkStatus(newValue) {
      console.log(565658)
      if (newValue === "1") {
        this.updateData(this.proResult, this.conclusion);
      }else{
      }
    },
    projectList: {
      immediate: true,
      deep: true,
      handler(newVal) {
        console.log("收到的项目数据:", newVal);
        // 你可以在这里处理数据,比如保存到 data 或做逻辑判断
        if (newVal && newVal.length > 0) {
          const firstProject = newVal[0]; // 你也可以遍历所有项目,看你业务需求
          this.queryParams.proId = firstProject.proId; // 假设项目中叫 id
          //this.queryParams.proName = firstProject.proName; // 假设叫 proName
          this.proName = firstProject.proName
          this.proName = firstProject.proName;
        }
      },
    },
  },
  mounted() { },
  created() { },
  created() {
  },
  methods: {
    async getList() {
      try {
@@ -201,34 +203,46 @@
    },
    updateData(proResult, conclusion) {
      console.log(proResult, conclusion, 5658)
      if (this.checkStatus == 1) {
        this.form.jcsj = proResult; // 更新检查所见
        this.form.desc = conclusion; // 更新检查结论
      } else {
        this.form.desc = "";
        this.form.jcsj = "";
      }
      if (this.list.length != 0) {
        let desc = ""
        let desc = "";
        desc += this.list
          .map((item) => item.bingzhong || item.ruleStr)
          .filter(Boolean)
          .join(",");
        let jcsj = ""
        let jcsj = "";
        jcsj += this.list
          .map((item) => item.yxbx)
          .filter(Boolean)
          .join(",");
        this.form.jcsj = this.form.jcsj + jcsj; // 更新检查所见
        this.form.desc = this.form.desc + desc;
           this.form.jcsj = jcsj; // 更新检查所见
          this.form.desc = desc;
        // if (this.queryParams.pageNum == 1) {
        // } else {
        //   this.form.jcsj = this.form.jcsj + jcsj; // 更新检查所见
        //   this.form.desc = this.form.desc + desc;
        //   this.form.jcsj = this.uniqueStrings(this.form.jcsj)
        //   this.form.desc = this.uniqueStrings(this.form.desc)
        // }
      }else{
           this.form.jcsj = ""; // 更新检查所见
          this.form.desc = "";
      }
    },
    },
    // uniqueStrings(strings) {
    //   // 使用Set来去重
    //   const uniqueSet = new Set(strings);
    //   return Array.from(uniqueSet).join("")
    // },
    handleSelectionChange(selection) {
      this.list = selection;
      this.list = selection
      this.updateFormContent(selection);
    },
@@ -261,6 +275,19 @@
      if (!this.form.desc && !this.form.jcsj) {
        this.$message.warning("请选择数据");
        return;
      } else {
        const desc = this.form.desc?.trim();
        const jcsj = this.form.jcsj?.trim();
        // 如果没有选中表格项
        if (!this.list || this.list.length === 0) {
          if (!desc && !jcsj) {
            this.$message.warning(
              "请填写有效的检查所见和检查结论,或选择表格数据"
            );
            return;
          }
        }
      }
      try {
@@ -271,6 +298,7 @@
        console.error("处理数据失败:", error);
        this.$message.error("操作失败");
      }
         this.$refs.multipleTable?.clearSelection();
    },
    resetForm() {
@@ -283,7 +311,8 @@
    },
    callcolos() {
      this.open = false;
    }
         this.$refs.multipleTable?.clearSelection();
    },
  },
  computed: {
    isCheckMode() {
@@ -315,6 +344,6 @@
.jianc {
  width: 100%;
  height: 600px;
  padding-top: 40px
  padding-top: 40px;
}
</style>