| | |
| | | :color="progressColor(toProgressPercentage(row?.completionStatus))" |
| | | :status="toProgressPercentage(row?.completionStatus) >= 100 ? 'success' : ''" /> |
| | | </template> |
| | | <template #todayReportState="{ row }"> |
| | | {{ formatTodayReportState(row?.todayReportState) }} |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | |
| | |
| | | |
| | | <!-- 报工弹窗 --> |
| | | <el-dialog v-model="reportDialogVisible" |
| | | title="报工" |
| | | :title="reportDialogTitle" |
| | | width="500px"> |
| | | <el-form ref="reportFormRef" |
| | | :model="reportForm" |
| | |
| | | readonly |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="本次生产数量" |
| | | <el-form-item v-if="currentReportState !== 1" |
| | | label="本次生产数量" |
| | | prop="quantity"> |
| | | <el-input v-model.number="reportForm.quantity" |
| | | type="number" |
| | |
| | | placeholder="请输入本次生产数量" |
| | | @input="handleQuantityInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="报废数量" |
| | | <el-form-item v-if="currentReportState !== 1" |
| | | label="报废数量" |
| | | prop="scrapQty"> |
| | | <el-input v-model.number="reportForm.scrapQty" |
| | | type="number" |
| | |
| | | productWorkOrderPage, |
| | | addProductMain, |
| | | downProductWorkOrder, |
| | | reportState, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import QRCode from "qrcode"; |
| | |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "今日报工状态", |
| | | prop: "todayReportState", |
| | | dataType: "slot", |
| | | slot: "todayReportState", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "计划工时(小时)", |
| | | prop: "plannedWorkHours", |
| | | prop: "salaryQuota", |
| | | width: "140", |
| | | }, |
| | | { |
| | |
| | | const transferCardQrUrl = ref(""); |
| | | const transferCardRowData = ref(null); |
| | | const reportDialogVisible = ref(false); |
| | | const currentReportState = ref(2); |
| | | const reportDialogTitle = ref("报工"); |
| | | const workOrderFilesRef = ref(null); |
| | | const reportFormRef = ref(null); |
| | | const userOptions = ref([]); |
| | |
| | | if (p < 80) return "#409eff"; |
| | | return "#67c23a"; |
| | | }; |
| | | const formatTodayReportState = val => { |
| | | const state = Number(val); |
| | | if (state === 1) return "未开始"; |
| | | if (state === 2) return "已开始"; |
| | | if (state === 3) return "已结束"; |
| | | return "-"; |
| | | }; |
| | | |
| | | // 查询列表 |
| | | /** 搜索按钮操作 */ |
| | |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm.value, ...page }; |
| | | const params = { ...searchForm.value, ...page, type: 2 }; |
| | | productWorkOrderPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | |
| | | workOrderFilesRef.value?.openDialog(row); |
| | | }; |
| | | |
| | | const showReportDialog = row => { |
| | | const showReportDialog = async row => { |
| | | currentReportRowData.value = row; |
| | | reportForm.planQuantity = row.planQuantity; |
| | | reportForm.quantity = |
| | |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | | }); |
| | | try { |
| | | const reportStateRes = await reportState({ |
| | | workOrderId: row.id, |
| | | productProcessRouteItemId: row.productProcessRouteItemId, |
| | | }); |
| | | const state = reportStateRes?.data?.state; |
| | | currentReportState.value = state === 1 ? 1 : 2; |
| | | reportDialogTitle.value = currentReportState.value === 1 ? "开始报工" : "结束报工"; |
| | | if (currentReportState.value === 1) { |
| | | reportForm.quantity = null; |
| | | reportForm.scrapQty = null; |
| | | } |
| | | } catch (error) { |
| | | currentReportState.value = 2; |
| | | reportDialogTitle.value = "结束报工"; |
| | | console.error("获取报工状态失败", error); |
| | | } |
| | | // 获取当前登录用户信息,设置为默认选中 |
| | | getUserProfile() |
| | | .then(res => { |
| | |
| | | return; |
| | | } |
| | | |
| | | // 验证本次生产数量 |
| | | if ( |
| | | reportForm.quantity === null || |
| | | reportForm.quantity === undefined || |
| | | reportForm.quantity === "" |
| | | ) { |
| | | ElMessageBox.alert("请输入本次生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | let quantity = 0; |
| | | let scrapQty = 0; |
| | | if (currentReportState.value !== 1) { |
| | | // 验证本次生产数量 |
| | | if ( |
| | | reportForm.quantity === null || |
| | | reportForm.quantity === undefined || |
| | | reportForm.quantity === "" |
| | | ) { |
| | | ElMessageBox.alert("请输入本次生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | const quantity = Number(reportForm.quantity); |
| | | quantity = Number(reportForm.quantity); |
| | | |
| | | if (isNaN(quantity) || quantity <= 0) { |
| | | ElMessageBox.alert("本次生产数量必须大于0", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | if (isNaN(quantity) || quantity <= 0) { |
| | | ElMessageBox.alert("本次生产数量必须大于0", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (quantity > reportForm.planQuantity) { |
| | | ElMessageBox.alert("本次生产数量不能超过待生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | if (quantity > reportForm.planQuantity) { |
| | | ElMessageBox.alert("本次生产数量不能超过待生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 验证报废数量 |
| | | const scrapQty = Number(reportForm.scrapQty); |
| | | if (!isNaN(scrapQty) && scrapQty < 0) { |
| | | ElMessageBox.alert("报废数量不能小于0", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | // 验证报废数量 |
| | | scrapQty = Number(reportForm.scrapQty); |
| | | if (!isNaN(scrapQty) && scrapQty < 0) { |
| | | ElMessageBox.alert("报废数量不能小于0", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (!isNaN(scrapQty) && scrapQty > quantity) { |
| | | ElMessageBox.alert("报废数量不能大于本次生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | if (!isNaN(scrapQty) && scrapQty > quantity) { |
| | | ElMessageBox.alert("报废数量不能大于本次生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | const params = { |
| | |
| | | |
| | | addProductMain(params) |
| | | .then(res => { |
| | | proxy.$modal.msgSuccess("报工成功"); |
| | | proxy.$modal.msgSuccess( |
| | | currentReportState.value === 1 ? "开始报工成功" : "结束报工成功" |
| | | ); |
| | | reportDialogVisible.value = false; |
| | | getList(); |
| | | }) |
| | | .catch(() => { |
| | | ElMessageBox.alert("报工失败", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | }); |
| | | }); |
| | | }; |