| | |
| | | </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 }"> |
| | |
| | | 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" |
| | |
| | | |
| | | <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, |
| | |
| | | checkContent: "", |
| | | checkResult: "正常", |
| | | checkDesc: "", |
| | | checkTime: "" |
| | | checkTime: "", |
| | | storageBlobDTOs: [] |
| | | }, |
| | | // 隐患管理 |
| | | hazardDialogVisible: false, |
| | |
| | | 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; |
| | |
| | | checkContent: "", |
| | | checkResult: "正常", |
| | | checkDesc: "", |
| | | checkTime: "" |
| | | checkTime: "", |
| | | storageBlobDTOs: [] |
| | | }); |
| | | recordFormVisible.value = true; |
| | | }; |
| | |
| | | checkContent: row.checkContent, |
| | | checkResult: row.checkResult, |
| | | checkDesc: row.checkDesc, |
| | | checkTime: row.checkTime |
| | | checkTime: row.checkTime, |
| | | storageBlobDTOs: getAttachments(row) |
| | | }); |
| | | recordFormVisible.value = true; |
| | | }; |
| | |
| | | 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) { |