| | |
| | | ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工序:" |
| | | prop="process"> |
| | | <el-select v-model="form.process" |
| | | placeholder="请选择工序" |
| | | <el-form-item label="采购合同号:" |
| | | prop="purchaseContractNo"> |
| | | <el-select v-model="form.purchaseContractNo" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="isViewMode || processQuantityDisabled" |
| | | filterable |
| | | :disabled="isViewMode" |
| | | style="width: 100%"> |
| | | <el-option v-for="item in processList" |
| | | :key="item.name" |
| | | :label="item.name" |
| | | :value="item.name" /> |
| | | <el-option v-for="item in purchaseContractList" |
| | | :key="item.id" |
| | | :label="item.purchaseContractNo" |
| | | :value="item.purchaseContractNo" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | getCurrentInstance, |
| | | nextTick, |
| | | } from "vue"; |
| | | import { getOptions } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getOptions, getSalesNo } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { modelList, productTreeList } from "@/api/basicData/product.js"; |
| | | import { |
| | | qualityInspectAdd, |
| | |
| | | } from "@/api/qualityManagement/metricMaintenance.js"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import { qualityInspectParamInfo } from "@/api/qualityManagement/qualityInspectParam.js"; |
| | | import { list } from "@/api/productionManagement/productionProcess"; |
| | | |
| | | import qualified from "@/views/inventoryManagement/stockManagement/Qualified.vue"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(["close"]); |
| | |
| | | const data = reactive({ |
| | | form: { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | |
| | | unqualifiedQuantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | purchaseContractNo: "", |
| | | }, |
| | | rules: { |
| | | checkTime: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | process: [{ required: true, message: "请选择工序", trigger: "change" }], |
| | | checkTime: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | checkName: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | productId: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | productModelId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | testStandardId: [{ required: false, message: "请选择指标", trigger: "change" }], |
| | | unit: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | quantity: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | qualifiedQuantity: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | unqualifiedQuantity: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | checkResult: [{ required: true, message: "请输入", trigger: "change" }], |
| | | purchaseContractNo: [{ required: false, message: "请选择", trigger: "change" }], |
| | | checkResult: [{ required: false, message: "请输入", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const userList = ref([]); |
| | |
| | | const v = form.value || {}; |
| | | return !!(v.productMainId != null || v.purchaseLedgerId != null); |
| | | }); |
| | | const processList = ref([]); // 工序下拉列表(工序名称 name) |
| | | |
| | | const supplierList = ref([]); |
| | | const productOptions = ref([]); |
| | | const purchaseContractList = ref([]); // 采购合同号列表 |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "指标", |
| | |
| | | getOptions().then(res => { |
| | | supplierList.value = res.data; |
| | | }); |
| | | // 加载工序下拉列表 |
| | | try { |
| | | const res = await list({ size: -1, current: -1 }); |
| | | processList.value = res.data.records || []; |
| | | } catch (e) { |
| | | console.error("加载工序列表失败", e); |
| | | processList.value = []; |
| | | } |
| | | let userLists = await userListNoPage(); |
| | | userList.value = userLists.data; |
| | | // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框“闪一下”) |
| | | // 加载采购合同号列表 |
| | | try { |
| | | const contractRes = await getSalesNo(); |
| | | purchaseContractList.value = contractRes || []; |
| | | } catch (e) { |
| | | console.error("加载采购合同号失败", e); |
| | | purchaseContractList.value = []; |
| | | } |
| | | // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框"闪一下") |
| | | form.value = { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | purchaseContractNo: "", |
| | | }; |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | |
| | | let params = { |
| | | productId: currentProductId.value, |
| | | inspectType: 1, |
| | | process: form.value.process || "", |
| | | }; |
| | | qualityInspectDetailByProductId(params).then(res => { |
| | | testStandardOptions.value = res.data || []; |
| | |
| | | return; |
| | | } |
| | | |
| | | // 根据采购合同号查找对应的 purchaseLedgerId |
| | | const selectedContract = purchaseContractList.value.find( |
| | | item => item.purchaseContractNo === form.value.purchaseContractNo |
| | | ); |
| | | const purchaseLedgerId = selectedContract ? selectedContract.id : null; |
| | | |
| | | const data = { |
| | | ...form.value, |
| | | process: processName, // 保留 process 字段以兼容后端 |
| | | purchaseLedgerId: purchaseLedgerId, // 提交 purchaseLedgerId |
| | | qualityInspectParams: tableData.value, |
| | | }; |
| | | if (operationType.value === "add") { |