| | |
| | | <div class="grid-value">{{ p.outputQty ?? 0 }}</div> |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="grid-label">报废数量</div> |
| | | <div class="grid-value success">{{ p.scrapQty ?? 0 }}</div> |
| | | </div> |
| | | <div class="grid-item"> |
| | | <div class="grid-label">合格数量</div> |
| | | <div class="grid-value success">{{ p.qualifiedQty ?? 0 }}</div> |
| | | </div> |
| | |
| | | <div v-else class="right-content"> |
| | | <el-table :data="reports" border height="420" v-loading="reportLoading"> |
| | | <el-table-column label="序号" type="index" width="60" align="center" /> |
| | | <el-table-column label="报工单号" prop="reportNo" min-width="140" show-overflow-tooltip /> |
| | | <el-table-column label="报工人员" prop="reportUser" min-width="120" show-overflow-tooltip /> |
| | | <el-table-column label="报工时间" prop="reportTime" min-width="160" show-overflow-tooltip /> |
| | | <el-table-column label="产出数量" prop="outputQty" min-width="110" /> |
| | | <el-table-column label="报工单号" prop="productNo" min-width="140" show-overflow-tooltip /> |
| | | <el-table-column label="报工人员" prop="nickName" min-width="120" show-overflow-tooltip /> |
| | | <el-table-column label="报工时间" prop="createTime" min-width="160" show-overflow-tooltip /> |
| | | <el-table-column label="产出数量" prop="quantity" min-width="110" /> |
| | | <el-table-column label="报废数量" prop="scrapQty" min-width="110" /> |
| | | <el-table-column label="合格数量" prop="qualifiedQty" min-width="110" /> |
| | | <el-table-column label="不良数量" prop="badQty" min-width="110" /> |
| | | <el-table-column label="不良数量" prop="defectiveQuantity" min-width="110" /> |
| | | <el-table-column label="不合格处理" prop="dealResult" min-width="160" show-overflow-tooltip /> |
| | | <el-table-column label="操作" width="150" fixed="right"> |
| | | <template #default="{ row }"> |
| | |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | <el-dialog |
| | | v-model="reportRecordDialogVisible" |
| | | title="报工生产记录" |
| | | width="680px" |
| | | destroy-on-close |
| | | > |
| | | <div class="report-record-placeholder"> |
| | | <div>报工单号:{{ currentReportRow?.reportNo || "-" }}</div> |
| | | <div>工序:{{ selectedProcess?.processName || "-" }}</div> |
| | | <div class="placeholder-tip">弹框内容待定(后续补充详细生产记录)。</div> |
| | | </div> |
| | | <template #footer> |
| | | <el-button @click="reportRecordDialogVisible = false">关闭</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- <el-dialog--> |
| | | <!-- v-model="reportRecordDialogVisible"--> |
| | | <!-- title="报工生产记录"--> |
| | | <!-- width="680px"--> |
| | | <!-- destroy-on-close--> |
| | | <!-- >--> |
| | | <!-- <div class="report-record-placeholder">--> |
| | | <!-- <div>报工单号:{{ currentReportRow?.reportNo || "-" }}</div>--> |
| | | <!-- <div>工序:{{ selectedProcess?.processName || "-" }}</div>--> |
| | | <!-- <div class="placeholder-tip">弹框内容待定(后续补充详细生产记录)。</div>--> |
| | | <!-- </div>--> |
| | | <!-- <template #footer>--> |
| | | <!-- <el-button @click="reportRecordDialogVisible = false">关闭</el-button>--> |
| | | <!-- </template>--> |
| | | <!-- </el-dialog>--> |
| | | |
| | | <CopperPrintingForm |
| | | v-if="copperPrintingFormVisible" |
| | | v-model:isShow="copperPrintingFormVisible" |
| | | :isEdit="false" |
| | | :row="currentReportRow" |
| | | @refreshData="fetchReportsForProcess(selectedProcess.value)"/> |
| | | <VoltageSortingForm |
| | | v-if="voltageSortingFormVisible" |
| | | v-model:isShow="voltageSortingFormVisible" |
| | | :isEdit="false" |
| | | :row="currentReportRow" |
| | | @refreshData="fetchReportsForProcess(selectedProcess.value)"/> |
| | | <GranulationForm |
| | | v-if="granulationFormVisible" |
| | | v-model:isShow="granulationFormVisible" |
| | | :isEdit="false" |
| | | :row="currentReportRow" |
| | | @refreshData="fetchReportsForProcess(selectedProcess.value)"/> |
| | | <Detail |
| | | v-if="reportRecordDialogVisible" |
| | | v-model:isShow="reportRecordDialogVisible" |
| | | @refreshData="fetchReportsForProcess(selectedProcess.value)" |
| | | :row="currentReportRow"/> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { useRoute } from "vue-router"; |
| | | import { getByProductOrderId } from "@/api/productionManagement/workOrder.js"; |
| | | import { getByProductWorkOrderId } from "@/api/productionManagement/productionProductMain.js"; |
| | | |
| | | const VoltageSortingForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/VoltageSortingForm.vue")); |
| | | const CopperPrintingForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/CopperPrintingForm.vue")); |
| | | const GranulationForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/GranulationForm.vue")); |
| | | const Detail = defineAsyncComponent(() => import("@/views/productionManagement/productionReporting/components/Detail.vue")); |
| | | const route = useRoute(); |
| | | |
| | | const header = computed(() => ({ |
| | |
| | | |
| | | // 工序数据(接口替换) |
| | | const processes = ref([]); |
| | | |
| | | const copperPrintingFormVisible = ref(false); |
| | | const voltageSortingFormVisible = ref(false); |
| | | const granulationFormVisible = ref(false); |
| | | |
| | | const normalizeStatus = (statusText, completionStatus, inputQty, outputQty) => { |
| | | const s = statusText === null || statusText === undefined ? "" : String(statusText).trim(); |
| | |
| | | |
| | | const normalizeProcess = (item) => { |
| | | // 字段以接口约定为准(你给的截图字段映射) |
| | | // 工序:completionStatus/statusText/processNo/scrapRate/planQuantity/completeQuantity/completeQty/scrapQty |
| | | // 工序:completionStatus/statusText/processNo/defectiveRate/planQuantity/completeQuantity/completeQty/scrapQty |
| | | const inputQty = Number(item?.planQuantity ?? item?.inputQty ?? 0); |
| | | const outputQty = Number(item?.completeQuantity ?? item?.outputQty ?? 0); |
| | | const outputQty = Number(item?.totalQty ?? item?.outputQty ?? 0); |
| | | const qualifiedQty = Number(item?.completeQty ?? item?.qualifiedQty ?? item?.goodQty ?? 0); |
| | | const badQty = Number(item?.scrapQty ?? item?.badQty ?? item?.defectQty ?? 0); |
| | | const badQty = Number(item?.defectiveQuantity ?? item?.badQty ?? item?.defectQty ?? 0); |
| | | const scrapQty = Number(item?.scrapQty ?? 0); |
| | | const completionStatus = Number(item?.completionStatus ?? 0); |
| | | const scrapRate = Number(item?.scrapRate ?? NaN); |
| | | const defectiveRate = Number(item?.defectiveRate ?? NaN); |
| | | |
| | | const status = normalizeStatus(item?.statusText ?? item?.status ?? item?.workStatus ?? item?.processStatus ?? item?.state, completionStatus, inputQty, outputQty); |
| | | |
| | |
| | | outputQty: Number.isFinite(outputQty) ? outputQty : 0, |
| | | qualifiedQty: Math.max(0, Number.isFinite(qualifiedQty) ? qualifiedQty : 0), |
| | | badQty: Math.max(0, Number.isFinite(badQty) ? badQty : 0), |
| | | scrapQty: Math.max(0, Number.isFinite(scrapQty) ? scrapQty : 0), |
| | | completionStatus: Number.isFinite(completionStatus) ? completionStatus : 0, |
| | | scrapRate: Number.isFinite(scrapRate) ? scrapRate : null, |
| | | defectiveRate: Number.isFinite(defectiveRate) ? defectiveRate : null, |
| | | status, |
| | | }; |
| | | }; |
| | |
| | | const reportLoading = ref(false); |
| | | |
| | | const normalizeReport = (item) => { |
| | | // 报工记录:productNo/userName/createTime/quantity/qualifiedQty/scrapQty |
| | | const outputQty = Number(item?.quantity ?? item?.outputQty ?? 0); |
| | | const qualifiedQty = Number(item?.qualifiedQty ?? item?.completeQty ?? item?.goodQty ?? 0); |
| | | const badQty = Number(item?.scrapQty ?? item?.badQty ?? 0); |
| | | |
| | | return { |
| | | reportNo: item?.productNo ?? item?.reportNo ?? item?.productionReportNo ?? item?.id ?? "", |
| | | reportUser: item?.userName ?? item?.reportUser ?? item?.createdByName ?? item?.reportUserName ?? "", |
| | | reportTime: item?.createTime ?? item?.reportTime ?? item?.createdAt ?? item?.reportDate ?? "", |
| | | outputQty: Number.isFinite(outputQty) ? outputQty : 0, |
| | | qualifiedQty: Math.max(0, Number.isFinite(qualifiedQty) ? qualifiedQty : 0), |
| | | badQty: Number.isFinite(badQty) ? Math.max(0, badQty) : 0, |
| | | dealResult: item?.dealResult ?? item?.dealResultText ?? item?.description ?? "", |
| | | ...item, |
| | | quantity: Math.max(0, Number.isFinite(item.quantity) ? item.quantity : 0), |
| | | scrapQty: Math.max(0, Number.isFinite(item.scrapQty) ? item.scrapQty : 0), |
| | | qualifiedQty: Math.max(0, Number.isFinite(item.qualifiedQty) ? item.qualifiedQty : 0), |
| | | }; |
| | | }; |
| | | |
| | |
| | | ); |
| | | |
| | | const viewReportRecord = (row) => { |
| | | if (!row?.reportNo) return; |
| | | if (!row?.productNo) return; |
| | | currentReportRow.value = row; |
| | | reportRecordDialogVisible.value = true; |
| | | if (row.process ==='印铜' || row.process ==='印银') { |
| | | copperPrintingFormVisible.value = true; |
| | | } else if (row.process === '电压分选') { |
| | | voltageSortingFormVisible.value = true; |
| | | } else if (row.process === '造粒') { |
| | | granulationFormVisible.value = true; |
| | | } else { |
| | | reportRecordDialogVisible.value = true; |
| | | } |
| | | }; |
| | | |
| | | const reportRecordDialogVisible = ref(false); |
| | |
| | | |
| | | // 不良率:不良数量 / 产出数量(先按此口径,后续对接接口可调整) |
| | | const defectRateText = (p) => { |
| | | // 优先使用接口字段 scrapRate(你给的截图“不良率”) |
| | | const scrapRate = Number(p?.scrapRate ?? NaN); |
| | | if (Number.isFinite(scrapRate)) { |
| | | // 有些接口 scrapRate 可能是 0~1 或 0~100,这里做一个简单判断 |
| | | const percent = scrapRate <= 1 ? scrapRate * 100 : scrapRate; |
| | | // 优先使用接口字段 defectiveRate(你给的截图“不良率”) |
| | | const defectiveRate = Number(p?.defectiveRate ?? NaN); |
| | | if (Number.isFinite(defectiveRate)) { |
| | | // 有些接口 defectiveRate 可能是 0~1 或 0~100,这里做一个简单判断 |
| | | const percent = defectiveRate <= 1 ? defectiveRate * 100 : defectiveRate; |
| | | return `${percent.toFixed(2)}%`; |
| | | } |
| | | |
| | |
| | | |
| | | .step-grid { |
| | | display: grid; |
| | | grid-template-columns: repeat(4, minmax(0, 1fr)); |
| | | grid-template-columns: repeat(5, minmax(0, 1fr)); |
| | | gap: 10px; |
| | | .grid-item { |
| | | background: #ffffff; |