qx
2025-04-09 93a6f70b8eb631c6c1faab8f9e8a734669e49e6e
src/views/picture/picture/index.vue
@@ -280,7 +280,12 @@
            label-width="68px"
          >
            <el-form-item label="检查所见" prop="proResult">
              <el-input v-model="form.proResult" clearable type="textarea" />
              <el-input
                v-model="form.proResult"
                clearable
                type="textarea"
                @focus="submiepilog"
              />
            </el-form-item>
            <el-form-item label="检查结论" prop="conclusion">
              <el-input
@@ -335,7 +340,8 @@
      />
    </div>
    <Public ref="aaa" :last-desc="form.conclusion" @add="handleChanges" />
    <Public ref="aaa" :check-status="checkStatus" :pro-result="form.proResult" :conclusion="form.conclusion" @add="handleChanges" />
    <!--  :last-desc="form.conclusion" -->
  </div>
</template>
@@ -750,6 +756,13 @@
        console.log(res, 222);
        this.tableList = res.data;
        this.loading = false;
        this.$nextTick(() => {
          if (this.tableList.length > 0) {
            const firstRow = this.tableList[0];
            this.$refs.mu.toggleRowSelection(firstRow, true);
            this.handleChange([firstRow]);
          }
        });
      });
    },
@@ -807,7 +820,7 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
    /* handleSelectionChange(selection) {
      this.imgsrc = selection[0].picturePath;
      this.tjNumber = selection[0].customer.tjNumber;
      this.ids = selection.map((item) => item.id);
@@ -834,9 +847,60 @@
      }
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    }, */
    handleSelectionChange(selection) {
      this.imgsrc = selection[0].picturePath;
      this.tjNumber = selection[0].customer.tjNumber;
      this.ids = selection.map((item) => item.id);
      if (selection.length > 1) {
        let del_row = selection.shift();
        this.$refs.tb.toggleRowSelection(del_row, false);
      }
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
      selection.forEach((element) => {
        this.tableList = element.list;
        if (this.tableList.length !== 0) {
          // ✅ 提前赋值 selectedRow,避免 handleChange 时未赋值
          this.selectedRow = this.tableList[0];
          this.form.proResult = this.tableList[0].proResult;
          this.form.conclusion = this.tableList[0].conclusion;
          this.$nextTick(() => {
            this.$refs.mu.toggleRowSelection(this.tableList[0], true);
          });
        } else {
          this.selectedRow = null;
          this.$refs.mu.clearSelection();
        }
      });
    },
    handleChange(selection) {
      if (selection && selection.length > 0) {
        const proId = selection[0].proId;
        // ✅ 确保 selectedRow 存在且有 tjNumber
        if (this.selectedRow && this.selectedRow.tjNumber) {
          const tjNumber = this.selectedRow.tjNumber;
          getYxJcXxJg(tjNumber, proId).then((res) => {
            this.form.proResult = res.data.jcsj;
            this.form.conclusion = res.data.jcjl;
            this.$refs.aaa.updateData(res.data.jcsj, res.data.jcjl);
          });
        } else {
          console.warn("selectedRow 未准备好,跳过接口调用");
        }
        // ✅ 同时更新 selectedRow
        this.selectedRow = selection[0];
      }
    },
    handleChange(selection) {
    /* handleChange(selection) {
      // console.log(selection, 123);
      if (selection && selection.length > 0) {
        const proId = selection[0].proId;
@@ -848,9 +912,9 @@
          this.form.conclusion = res.data.jcjl;
        });
      }
    },
    }, */
    handleChanges(value,yxbx) {
    handleChanges(value, yxbx) {
      this.form.conclusion = value;
      this.form.proResult = yxbx;
    },
@@ -858,9 +922,8 @@
    submiepilog() {
      this.$refs.aaa.open = true;
      let proId = "1633660948860522585";
      // let proId = null
      // let proId = null
      this.$refs.aaa.getList(proId);
    },
    tupian() {
      this.dialogVisible = true;