gongchunyi
17 小时以前 7b8e5ab57c3da7cfe46d1b0360f642bd1f841c06
src/views/safeProduction/lineInspection/index.vue
@@ -176,6 +176,13 @@
            </template>
          </el-table-column>
          <el-table-column prop="checkDesc" label="检查说明" width="200" show-overflow-tooltip />
          <el-table-column label="现场照片" width="100">
            <template #default="{ row }">
              <el-tag :type="hasAttachments(row.storageBlobVOs) ? 'success' : 'info'">
                {{ hasAttachments(row.storageBlobVOs) ? '已上传' : '未上传' }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="checkTime" label="检查时间" width="180" />
          <el-table-column label="操作" width="120" fixed="right">
            <template #default="{ row }">
@@ -226,6 +233,11 @@
                      type="textarea"
                      :rows="2"
                      placeholder="请输入检查说明" />
          </el-form-item>
          <el-form-item v-if="recordForm.checkResult === '异常'" label="现场照片">
            <ImageUpload v-model:file-list="recordForm.storageBlobDTOs"
                         :limit="6"
                         button-text="上传照片" />
          </el-form-item>
          <el-form-item label="检查时间">
            <el-date-picker v-model="recordForm.checkTime"
@@ -368,9 +380,10 @@
<script setup>
import { Search } from "@element-plus/icons-vue";
import { nextTick, onMounted, ref, reactive, toRefs } from "vue";
import { onMounted, ref, reactive, toRefs } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
import { userListNoPage } from "@/api/system/user.js";
import {
  getLineInspectionList,
@@ -450,7 +463,8 @@
    checkContent: "",
    checkResult: "正常",
    checkDesc: "",
    checkTime: ""
    checkTime: "",
    storageBlobDTOs: []
  },
  // 隐患管理
  hazardDialogVisible: false,
@@ -684,6 +698,9 @@
  return map[status] || "info";
};
const getAttachments = row => row?.storageBlobDTOs || row?.storageBlobVOs || [];
const hasAttachments = attachments => Array.isArray(attachments) && attachments.length > 0;
// 打开表单
const openForm = (type, row = null) => {
  dialogType.value = type;
@@ -809,7 +826,8 @@
    checkContent: "",
    checkResult: "正常",
    checkDesc: "",
    checkTime: ""
    checkTime: "",
    storageBlobDTOs: []
  });
  recordFormVisible.value = true;
};
@@ -823,7 +841,8 @@
    checkContent: row.checkContent,
    checkResult: row.checkResult,
    checkDesc: row.checkDesc,
    checkTime: row.checkTime
    checkTime: row.checkTime,
    storageBlobDTOs: getAttachments(row)
  });
  recordFormVisible.value = true;
};
@@ -849,6 +868,10 @@
const submitRecordForm = async () => {
  try {
    await recordFormRef.value.validate();
    if (recordForm.value.checkResult === "异常" && !hasAttachments(recordForm.value.storageBlobDTOs)) {
      ElMessage.warning("巡检结果异常时请上传现场照片");
      return;
    }
    const api = recordForm.value.id ? updateInspectionRecord : addInspectionRecord;
    const res = await api({ ...recordForm.value });
    if (res.code === 200) {