| | |
| | | draggable |
| | | @close="closeDia" |
| | | > |
| | | <el-form label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-table |
| | | :data="reportList" |
| | | border |
| | |
| | | <span>{{ scope.row.schedulingNum }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="待生产数量" prop="pendingNum" width="100"> |
| | | <el-table-column label="待生产数量" prop="pendingFinishNum" width="100"> |
| | | <template #default="scope"> |
| | | <span>{{ scope.row.pendingNum }}</span> |
| | | <span>{{ scope.row.pendingFinishNum }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="本次生产数量" prop="finishedNum" width="150"> |
| | |
| | | v-model="scope.row.unitPrice" |
| | | placeholder="请输入" |
| | | :min="0" |
| | | :step="0.01" |
| | | :precision="2" |
| | | :step="0.001" |
| | | :precision="3" |
| | | clearable |
| | | style="width: 100%" |
| | | @change="() => calculateTotalPrice(scope.row)" |
| | |
| | | const operationType = ref('') |
| | | const reportList = ref([]) |
| | | const data = reactive({ |
| | | form: {}, |
| | | rules: { |
| | | schedulingNum: [{ required: true, message: "请输入", trigger: "blur" },], |
| | | }, |
| | | }); |
| | | const { rules } = toRefs(data); |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | // 打开弹框 |
| | | const openDialog = (type, rows) => { |
| | |
| | | const total = Number(row?.schedulingNum ?? 0); |
| | | const pendingFinish = Number(row?.pendingFinishNum ?? 0); |
| | | const autoFill = pendingFinish > 0 ? Math.min(pendingFinish, total) : total; |
| | | const unitPrice = row?.unitPrice ? Number(row.unitPrice) : 0.33; |
| | | const unitPrice = row?.unitPrice ? Number(row.unitPrice) : 0.033; |
| | | |
| | | return { |
| | | id: row?.id ?? null, |
| | |
| | | productCategory: row?.productCategory ?? '', |
| | | specificationModel: row?.specificationModel ?? '', |
| | | schedulingNum: total, |
| | | pendingNum: Math.max(total - autoFill, 0), |
| | | pendingFinishNum: pendingFinish, // 保存原始的待报工数量 |
| | | finishedNum: autoFill, |
| | | unitPrice: unitPrice, |
| | | totalPrice: (autoFill * unitPrice).toFixed(2), |
| | | totalPrice: (autoFill * unitPrice).toFixed(3), |
| | | schedulingUserId: row?.schedulingUserId ?? '', |
| | | schedulingDate: row?.schedulingDate ?? '', |
| | | }; |
| | |
| | | row.finishedNum = row.schedulingNum; |
| | | proxy.$modal.msgWarning('本次生产数量不可大于排产数量') |
| | | } |
| | | row.pendingNum = row.schedulingNum - row.finishedNum; |
| | | // 验证本次生产数量不能大于待报工数量 |
| | | if (value > row.pendingFinishNum) { |
| | | row.finishedNum = row.pendingFinishNum; |
| | | proxy.$modal.msgWarning('本次生产数量不可大于待报工数量') |
| | | } |
| | | calculateTotalPrice(row); |
| | | } |
| | | |
| | |
| | | const unitPrice = Number(row.unitPrice ?? 0); |
| | | |
| | | if (quantity > 0 && unitPrice > 0) { |
| | | row.totalPrice = (quantity * unitPrice).toFixed(2); |
| | | row.totalPrice = (quantity * unitPrice).toFixed(3); |
| | | } else { |
| | | row.totalPrice = '0.00'; |
| | | } |
| | |
| | | proxy.$modal.msgError(`第${i + 1}行本次生产数量不可大于排产数量`); |
| | | return; |
| | | } |
| | | if (item.finishedNum > item.pendingFinishNum) { |
| | | proxy.$modal.msgError(`第${i + 1}行本次生产数量不可大于待报工数量`); |
| | | return; |
| | | } |
| | | if (!item.schedulingUserId) { |
| | | proxy.$modal.msgError(`第${i + 1}行请选择生产人`); |
| | | return; |
| | |
| | | const payloadList = reportList.value.map(item => ({ |
| | | id: item.id, |
| | | finishedNum: Number(item.finishedNum), |
| | | unitPrice: Number(item.unitPrice || 0.33), |
| | | unitPrice: Number(item.unitPrice || 0.033), |
| | | totalPrice: Number(item.totalPrice || 0), |
| | | schedulingUserId: item.schedulingUserId, |
| | | schedulingDate: item.schedulingDate, |
| | |
| | | |
| | | // 关闭弹框 |
| | | const closeDia = () => { |
| | | if (proxy.$refs.formRef) { |
| | | proxy.resetForm("formRef"); |
| | | } |
| | | dialogFormVisible.value = false; |
| | | reportList.value = []; |
| | | emit('close') |