| | |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog |
| | | v-model="auditDialogVisible" |
| | | title="审核" |
| | | width="1000px" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-table :data="auditTableData" border style="width: 100%" v-loading="auditLoading"> |
| | | <el-table-column label="产品名称" prop="productName" min-width="140" show-overflow-tooltip /> |
| | | <el-table-column label="规格" prop="model" min-width="120" show-overflow-tooltip /> |
| | | <el-table-column label="单位" prop="unit" width="80" /> |
| | | <el-table-column label="工序名称" prop="processName" min-width="120" show-overflow-tooltip /> |
| | | <el-table-column label="需求数量" prop="planQuantity" width="110" /> |
| | | <el-table-column label="完成数量" prop="completeQuantity" width="110" /> |
| | | <el-table-column label="完成进度" prop="completionStatus" width="140"> |
| | | <template #default="{ row }"> |
| | | <el-progress |
| | | :percentage="toProgressPercentage(row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(row?.completionStatus))" |
| | | :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="计划开始时间" prop="planStartTime" width="140" /> |
| | | <el-table-column label="计划结束时间" prop="planEndTime" width="140" /> |
| | | </el-table> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" :loading="auditLoading" @click="submitAudit(1)">通过</el-button> |
| | | <el-button type="danger" :loading="auditLoading" @click="submitAudit(2)">不通过</el-button> |
| | | <el-button :disabled="auditLoading" @click="auditDialogVisible = false">取消</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | <FilesDia ref="workOrderFilesRef" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { |
| | | productWorkOrderPage, |
| | |
| | | }, |
| | | disabled: row => row.planQuantity <= 0, |
| | | }, |
| | | { |
| | | name:"审核", |
| | | color: "#f56c6c", |
| | | clickFun: row => { |
| | | handleAudit(row); |
| | | }, |
| | | disabled: row => Number(row?.auditStatus) === 1, |
| | | } |
| | | ], |
| | | }, |
| | | ]); |
| | |
| | | const transferCardQrUrl = ref(""); |
| | | const transferCardRowData = ref(null); |
| | | const reportDialogVisible = ref(false); |
| | | const auditDialogVisible = ref(false); |
| | | const auditRowData = ref(null); |
| | | const auditTableData = ref([]); |
| | | const auditLoading = ref(false); |
| | | const workOrderFilesRef = ref(null); |
| | | const reportFormRef = ref(null); |
| | | const userOptions = ref([]); |
| | |
| | | callback(); |
| | | }; |
| | | |
| | | // 审核 |
| | | const handleAudit = (row) => { |
| | | if (Number(row?.auditStatus) === 1) { |
| | | ElMessage.warning("该工单已审核"); |
| | | return; |
| | | } |
| | | auditRowData.value = row; |
| | | const workOrderNo = row?.workOrderNo; |
| | | const related = workOrderNo |
| | | ? tableData.value.filter(r => r?.workOrderNo === workOrderNo) |
| | | : []; |
| | | auditTableData.value = related.length > 0 ? related : [row]; |
| | | auditDialogVisible.value = true; |
| | | }; |
| | | |
| | | const submitAudit = async (result) => { |
| | | const current = auditRowData.value; |
| | | if (!current) return; |
| | | if (auditLoading.value) return; |
| | | |
| | | const confirmText = result === 1 ? "确定审核通过吗?" : "确定审核不通过吗?"; |
| | | try { |
| | | await ElMessageBox.confirm(confirmText, "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }); |
| | | } catch { |
| | | return; |
| | | } |
| | | |
| | | auditLoading.value = true; |
| | | try { |
| | | const updates = auditTableData.value.map(item => { |
| | | const id = item?.id; |
| | | if (!id) return Promise.resolve(); |
| | | return updateProductWorkOrder({ id, auditStatus: result }); |
| | | }); |
| | | await Promise.all(updates); |
| | | ElMessage.success("审核成功"); |
| | | auditDialogVisible.value = false; |
| | | getList(); |
| | | } finally { |
| | | auditLoading.value = false; |
| | | } |
| | | }; |
| | | |
| | | // 查看详情 |
| | | const handleView = (row) => { |
| | | const { workOrderId } = row; |
| | | router.push({ |
| | | path: "/productionManagement/workOrderDetail", |
| | | query: { workOrderId }, |
| | | }); |
| | | } |
| | | |
| | | // 验证规则 |
| | | const reportFormRules = { |
| | | quantity: [{ required: true, validator: validateQuantity, trigger: "blur" }], |