| | |
| | | <template> |
| | | <div> |
| | | <el-dialog v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? '新增过程检验' : '编辑过程检验'" |
| | | :title="operationType === 'add' ? '新增过程检验' : operationType === 'view' ? '查看过程检验' : '编辑过程检验'" |
| | | width="70%" |
| | | @close="closeDia"> |
| | | <el-form :model="form" |
| | |
| | | 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="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.purchaseContractNumber + ' - ' + item.supplierName" |
| | | :value="item.purchaseContractNumber" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | @change="getModels" |
| | | :data="productOptions" |
| | | :render-after-expand="false" |
| | | :disabled="operationType === 'edit'" |
| | | :disabled="isViewMode || operationType === 'edit'" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-select v-model="form.productModelId" |
| | | placeholder="请选择" |
| | | clearable |
| | | :disabled="operationType === 'edit'" |
| | | :disabled="isViewMode || operationType === 'edit'" |
| | | filterable |
| | | readonly |
| | | @change="handleChangeModel"> |
| | |
| | | placeholder="请选择指标" |
| | | clearable |
| | | @change="handleTestStandardChange" |
| | | style="width: 100%"> |
| | | style="width: 100%" |
| | | :disabled="isViewMode"> |
| | | <el-option v-for="item in testStandardOptions" |
| | | :key="item.id" |
| | | :label="item.standardName || item.standardNo" |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | :precision="2" |
| | | :disabled="processQuantityDisabled" /> |
| | | :disabled="isViewMode || processQuantityDisabled" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | :precision="2" |
| | | @change="handleQualifiedQuantityChange" /> |
| | | @change="handleQualifiedQuantityChange" |
| | | :disabled="isViewMode" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | :precision="2" |
| | | @change="handleUnqualifiedQuantityChange" /> |
| | | @change="handleUnqualifiedQuantityChange" |
| | | :disabled="isViewMode" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | clearable |
| | | :disabled="isViewMode" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测结果:" |
| | | prop="checkResult"> |
| | | <el-select v-model="form.checkResult"> |
| | | <el-select v-model="form.checkResult" :disabled="isViewMode"> |
| | | <el-option label="合格" |
| | | value="合格" /> |
| | | <el-option label="不合格" |
| | |
| | | prop="checkName"> |
| | | <el-select v-model="form.checkName" |
| | | placeholder="请选择" |
| | | clearable> |
| | | clearable |
| | | :disabled="isViewMode"> |
| | | <el-option v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | clearable |
| | | style="width: 100%" /> |
| | | style="width: 100%" |
| | | :disabled="isViewMode" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | height="400"> |
| | | <template #slot="{ row }"> |
| | | <el-input v-model="row.testValue" |
| | | clearable /> |
| | | clearable |
| | | :disabled="isViewMode" /> |
| | | </template> |
| | | </PIMTable> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">取消</el-button> |
| | | <template v-if="!isViewMode"> |
| | | <el-button type="primary" |
| | | @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">取消</el-button> |
| | | </template> |
| | | <el-button v-else @click="closeDia">关闭</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | getCurrentInstance, |
| | | nextTick, |
| | | } from "vue"; |
| | | import { getOptions } from "@/api/procurementManagement/procurementLedger.js"; |
| | | import { getOptions, purchaseListPage } 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 { form, rules } = toRefs(data); |
| | | // 是否为查看模式 |
| | | const isViewMode = computed(() => operationType.value === 'view'); |
| | | // 编辑时:productMainId 或 purchaseLedgerId 任一有值则工序、数量置灰 |
| | | const processQuantityDisabled = computed(() => { |
| | | 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 purchaseListPage({ pageNum: -1, pageSize: -1 }); |
| | | purchaseContractList.value = contractRes.data?.records || []; |
| | | } catch (e) { |
| | | console.error("加载采购合同号失败", e); |
| | | purchaseContractList.value = []; |
| | | } |
| | | // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框"闪一下") |
| | | form.value = { |
| | | checkTime: "", |
| | | process: "", |
| | | checkName: "", |
| | | productName: "", |
| | | productId: "", |
| | |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | purchaseContractNo: "", |
| | | }; |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | | // 先确保产品树已加载,否则编辑时产品/规格型号无法反显 |
| | | await getProductOptions(); |
| | | if (operationType.value === "edit") { |
| | | if (operationType.value === "edit" || operationType.value === "view") { |
| | | // 先保存 testStandardId,避免被清空 |
| | | const savedTestStandardId = row.testStandardId; |
| | | // 先设置表单数据,但暂时清空 testStandardId,等选项加载完成后再设置 |
| | |
| | | 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.purchaseContractNumber === 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") { |
| | |
| | | getQualityTestStandardParamByTestStandardId(testStandardId) |
| | | .then(res => { |
| | | tableData.value = res.data || []; |
| | | tableData.value = tableData.value.map(item => ({ |
| | | ...item, |
| | | id: null |
| | | })); |
| | | }) |
| | | .catch(error => { |
| | | console.error("获取标准参数失败:", error); |