| | |
| | | </div> |
| | | <div class="search-item"> |
| | | <span class="search_title">生产订单号:</span> |
| | | <el-input v-model="searchForm.productOrderNpsNo" |
| | | <el-input v-model="searchForm.npsNo" |
| | | style="width: 240px" |
| | | placeholder="请输入" |
| | | @change="handleQuery" |
| | |
| | | readonly |
| | | style="width: 300px" /> |
| | | </el-form-item> |
| | | <el-form-item label="本次生产数量" |
| | | <el-form-item label="生产合格数量" |
| | | prop="quantity"> |
| | | <el-input v-model.number="reportForm.quantity" |
| | | type="number" |
| | | min="1" |
| | | min="0" |
| | | step="1" |
| | | style="width: 300px" |
| | | placeholder="请输入本次生产数量" |
| | | placeholder="请输入生产合格数量" |
| | | @input="handleQuantityInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="报废数量" |
| | |
| | | @refresh="getList" /> |
| | | <FileList v-if="fileDialogVisible" |
| | | v-model:visible="fileDialogVisible" |
| | | :editable="!currentWorkOrderRow?.endOrder" |
| | | :record-type="'production_operation_task'" |
| | | :record-id="currentWorkOrderId" /> |
| | | </div> |
| | |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | import MaterialDialog from "./components/MaterialDialog.vue"; |
| | | import FileList from "@/components/Dialog/FileList.vue"; |
| | | const FileList = defineAsyncComponent(() => |
| | | import("@/components/Dialog/FileList.vue") |
| | | ); |
| | | |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | |
| | | clickFun: row => { |
| | | showReportDialog(row); |
| | | }, |
| | | disabled: row => row.planQuantity <= 0, |
| | | showHide: row => !row.endOrder, |
| | | disabled: row => { |
| | | if (row.planQuantity <= 0) return true; |
| | | if (!row.userIds) return false; |
| | | try { |
| | | const userIds = |
| | | typeof row.userIds === "string" |
| | | ? JSON.parse(row.userIds) |
| | | : row.userIds; |
| | | if (Array.isArray(userIds)) { |
| | | return !userIds.some(id => String(id) === String(userStore.id)); |
| | | } |
| | | return true; |
| | | } catch (e) { |
| | | return true; |
| | | } |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | |
| | | const dictOptions = ref({}); |
| | | const paramLoading = ref(false); |
| | | |
| | | // 本次生产数量验证规则 |
| | | // 生产合格数量验证规则 |
| | | const validateQuantity = (rule, value, callback) => { |
| | | if (value === null || value === undefined || value === "") { |
| | | callback(new Error("请输入本次生产数量")); |
| | | callback(new Error("请输入生产合格数量")); |
| | | return; |
| | | } |
| | | const num = Number(value); |
| | | // 整数且大于等于1 |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 1) { |
| | | callback(new Error("本次生产数量必须大于等于1")); |
| | | if (isNaN(num) || !Number.isInteger(num) || num < 0) { |
| | | callback(new Error("生产合格数量必须大于等于0")); |
| | | return; |
| | | } |
| | | callback(); |
| | |
| | | scrapQty: [{ validator: validateScrapQty, trigger: "blur" }], |
| | | }; |
| | | |
| | | // 处理本次生产数量输入,限制必须大于等于1 |
| | | // 处理生产合格数量输入,限制必须大于等于0 |
| | | const handleQuantityInput = value => { |
| | | if (value === "" || value === null || value === undefined) { |
| | | reportForm.quantity = null; |
| | |
| | | return; |
| | | } |
| | | // 如果小于1,清除 |
| | | if (num < 1) { |
| | | if (num < 0) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | |
| | | if (!Number.isInteger(num)) { |
| | | const intValue = Math.floor(num); |
| | | // 如果取整后小于1,清除 |
| | | if (intValue < 1) { |
| | | if (intValue < 0) { |
| | | reportForm.quantity = null; |
| | | return; |
| | | } |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | workOrderNo: "", |
| | | productOrderNpsNo: "", |
| | | npsNo: "", |
| | | }, |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | |
| | | const printTransferCard = () => { |
| | | window.print(); |
| | | }; |
| | | const currentWorkOrderRow = ref(null); |
| | | |
| | | const openWorkOrderFiles = row => { |
| | | currentWorkOrderId.value = row.id; |
| | | currentWorkOrderRow.value = row; |
| | | fileDialogVisible.value = true; |
| | | }; |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | // 验证本次生产数量 |
| | | // 验证生产合格数量 |
| | | if ( |
| | | reportForm.quantity === null || |
| | | reportForm.quantity === undefined || |
| | | reportForm.quantity === "" |
| | | ) { |
| | | ElMessageBox.alert("请输入本次生产数量", "提示", { |
| | | ElMessageBox.alert("请输入生产合格数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | |
| | | |
| | | const quantity = Number(reportForm.quantity); |
| | | |
| | | if (isNaN(quantity) || quantity <= 0) { |
| | | ElMessageBox.alert("本次生产数量必须大于0", "提示", { |
| | | if (isNaN(quantity) || quantity < 0) { |
| | | ElMessageBox.alert("生产合格数量必须大于等于0", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | |
| | | return; |
| | | } |
| | | |
| | | if (!isNaN(scrapQty) && scrapQty > quantity) { |
| | | ElMessageBox.alert("报废数量不能大于本次生产数量", "提示", { |
| | | confirmButtonText: "确定", |
| | | }); |
| | | return; |
| | | } |
| | | // if (!isNaN(scrapQty) && scrapQty > quantity) { |
| | | // ElMessageBox.alert("报废数量不能大于本次生产数量", "提示", { |
| | | // confirmButtonText: "确定", |
| | | // }); |
| | | // return; |
| | | // } |
| | | |
| | | const productionOperationParamList = params.value.map(param => ({ |
| | | ...param, |
| | |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | userStore.getInfo(); |
| | | getList(); |
| | | // 获取用户列表 |
| | | userListNoPageByTenantId().then(res => { |