| | |
| | | :page="page" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination"> |
| | | <template #productionStatus="{ row }"> |
| | | <el-tag :type="getProductionStatusType(row)" |
| | | size="small"> |
| | | {{ getProductionStatusText(row) }} |
| | | </el-tag> |
| | | </template> |
| | | <template #completionStatus="{ row }"> |
| | | <el-progress :percentage="toProgressPercentage(row?.completionStatus)" |
| | | :color="progressColor(toProgressPercentage(row?.completionStatus))" |
| | | :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | </template> |
| | | <template #picked="{ row }"> |
| | | <el-tag :type="row.picked ? 'success' : 'info'" |
| | | size="small"> |
| | | {{ row.picked ? "已领料" : "未领料" }} |
| | | </el-tag> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "生产状态", |
| | | prop: "productionStatus", |
| | | dataType: "slot", |
| | | slot: "productionStatus", |
| | | width: "100", |
| | | }, |
| | | { |
| | | label: "完成进度", |
| | | prop: "completionStatus", |
| | | dataType: "slot", |
| | |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | // 生产状态文字:未领料 → 待生产 → 生产中 → 已生产 |
| | | const getProductionStatusText = row => { |
| | | const percent = toProgressPercentage(row?.completionStatus); |
| | | if (percent >= 100) return "已生产"; |
| | | if (!row?.picked) return "未领料"; |
| | | const completeQty = Number(row?.completeQuantity) || 0; |
| | | if (completeQty > 0) return "生产中"; |
| | | return "待生产"; |
| | | }; |
| | | |
| | | // 生产状态标签颜色 |
| | | const getProductionStatusType = row => { |
| | | const percent = toProgressPercentage(row?.completionStatus); |
| | | if (percent >= 100) return "success"; |
| | | if (!row?.picked) return "info"; |
| | | const completeQty = Number(row?.completeQuantity) || 0; |
| | | if (completeQty > 0) return "warning"; |
| | | return "primary"; |
| | | }; |
| | | |
| | | const toProgressPercentage = val => { |
| | | const n = Number(val); |
| | | if (!Number.isFinite(n)) return 0; |