| | |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检品数量:" prop="inspectedQuantity"> |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.inspectedQuantity" placeholder="请输入,不大于总数量" clearable :precision="2" :disabled="quantityDisabled"/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验用粉剂/液情况:" prop="inspectMaterialCondition"> |
| | | <el-radio-group v-model="form.inspectMaterialCondition"> |
| | | <el-radio label="检验用粉剂情况">检验用粉剂情况</el-radio> |
| | | <el-radio label="检验用液剂情况">检验用液剂情况</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="生产日期:" prop="productionDate"> |
| | | <el-date-picker |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验用粉剂/液情况:" prop="inspectMaterialConditionId"> |
| | | <el-tree-select |
| | | v-model="form.inspectMaterialConditionId" |
| | | placeholder="请选择" |
| | | clearable |
| | | check-strictly |
| | | :data="productOptions" |
| | | :render-after-expand="false" |
| | | style="width: 100%" |
| | | @change="handleInspectMaterialChange" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="批号(新):" prop="inspectBatchNo"> |
| | | <el-select |
| | | v-model="form.inspectBatchNo" |
| | | placeholder="请选择批号" |
| | | clearable |
| | | filterable |
| | | style="width: 100%" |
| | | @change="handleInspectBatchChange" |
| | | > |
| | | <el-option |
| | | v-for="item in inspectBatchOptions" |
| | | :key="item.batchNo" |
| | | :label="item.batchNo" |
| | | :value="item.batchNo" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="规格型号:" prop="inspectProductModelId"> |
| | | <el-select v-model="form.inspectProductModelId" placeholder="请选择" clearable |
| | | filterable readonly @change="handleChangeModels"> |
| | | <el-option v-for="item in inspectProductModel" :key="item.id" :label="item.model" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="生产日期(新):" prop="inspectProductionDate"> |
| | | <el-input v-model="form.inspectProductionDate" placeholder="自动带出" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="有效期(新):" prop="inspectValidityDate"> |
| | | <el-input v-model="form.inspectValidityDate" placeholder="自动计算" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测单位:" prop="checkCompany"> |
| | | <el-input v-model="form.checkCompany" placeholder="请输入" clearable/> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测结果:" prop="checkResult"> |
| | | <el-select v-model="form.checkResult"> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检验员:" prop="checkName"> |
| | | <el-select v-model="form.checkName" placeholder="请选择" clearable> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="检测日期:" prop="checkTime"> |
| | | <el-date-picker |
| | |
| | | import {modelList, productTreeList} from "@/api/basicData/product.js"; |
| | | import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js"; |
| | | import {userListNoPage} from "@/api/system/user.js"; |
| | | import { getStockInventoryListPage } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js"; |
| | | import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js"; |
| | | import {deviceList as qualityInspectParamDeviceList} from "@/api/energyManagement/index.js"; |
| | |
| | | batchNo: "", |
| | | inspectedQuantity: "", |
| | | quantity: "", |
| | | inspectedQuantity: "", |
| | | inspectMaterialCondition: "", |
| | | productionDate: "", |
| | | validityDate: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | | // 检验用粉剂/液情况相关新字段 |
| | | inspectMaterialConditionId: "", |
| | | inspectMaterialCondition: "", |
| | | inspectProductModelId : "", |
| | | inspectBatchNo: "", |
| | | inspectProductModel: "", |
| | | inspectProductionDate: "", |
| | | inspectValidityDate: "", |
| | | inspectValidityPeriod: "", |
| | | }, |
| | | rules: { |
| | | checkTime: [{ required: true, message: "请输入", trigger: "blur" },], |
| | |
| | | productModelId: [{ required: true, message: "请选择", trigger: "change" }], |
| | | testStandardId: [{required: false, message: "请选择指标", trigger: "change"}], |
| | | unit: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | inspectedQuantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | inspectedQuantity: [ |
| | | { required: true, message: "请输入检品数量", trigger: "blur" }, |
| | | { |
| | |
| | | trigger: "blur" |
| | | } |
| | | ], |
| | | quantity: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | checkCompany: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | batchNo: [{ required: true, validator: validateBatchNo, trigger: "blur" }], |
| | | checkResult: [{ required: true, message: "请输入", trigger: "change" }], |
| | |
| | | }); |
| | | const supplierList = ref([]); |
| | | const productOptions = ref([]); |
| | | const inspectProductModel = ref([]); |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "检测项目", |
| | |
| | | const testStandardOptions = ref([]); // 指标选择下拉框数据 |
| | | const modelOptions = ref([]); |
| | | const deviceList = ref([]); |
| | | const inspectBatchOptions = ref([]); |
| | | |
| | | // 打开弹框 |
| | | const openDialog = async (type, row) => { |
| | |
| | | proxy.$refs.formRef?.clearValidate(); |
| | | // 加载设备台账列表 |
| | | loadDeviceList(); |
| | | |
| | | |
| | | // 并行加载基础数据 |
| | | const [userListsRes] = await Promise.all([ |
| | | userListNoPage(), |
| | |
| | | }) |
| | | ]); |
| | | userList.value = userListsRes.data; |
| | | |
| | | |
| | | form.value = {} |
| | | testStandardOptions.value = []; |
| | | tableData.value = []; |
| | | |
| | | |
| | | if (operationType.value === 'edit') { |
| | | // 先保存 testStandardId,避免被清空 |
| | | const savedTestStandardId = row.testStandardId; |
| | |
| | | nextTick(() => { |
| | | proxy.$refs.formRef?.clearValidate(); |
| | | }); |
| | | |
| | | |
| | | // 编辑模式下,并行加载规格型号和指标选项 |
| | | if (currentProductId.value) { |
| | | // 设置产品名称 |
| | | form.value.productName = findNodeById(productOptions.value, currentProductId.value); |
| | | |
| | | |
| | | // 并行加载规格型号和指标选项 |
| | | const params = { |
| | | productId: currentProductId.value, |
| | | inspectType: 2 |
| | | }; |
| | | |
| | | |
| | | Promise.all([ |
| | | modelList({ id: currentProductId.value }), |
| | | qualityInspectDetailByProductId(params) |
| | |
| | | form.value.uidNo = selectedModel.uidNo || ''; |
| | | } |
| | | } |
| | | |
| | | |
| | | // 设置指标选项 |
| | | testStandardOptions.value = testStandardRes.data || []; |
| | | |
| | | |
| | | // 设置 testStandardId 并加载参数列表 |
| | | nextTick(() => { |
| | | if (savedTestStandardId) { |
| | | // 确保类型匹配(item.id 可能是数字或字符串) |
| | | const matchedOption = testStandardOptions.value.find(item => |
| | | const matchedOption = testStandardOptions.value.find(item => |
| | | item.id == savedTestStandardId || String(item.id) === String(savedTestStandardId) |
| | | ); |
| | | if (matchedOption) { |
| | |
| | | if (children && children.length > 0) { |
| | | newItem.children = convertIdToValue(children); |
| | | } |
| | | |
| | | |
| | | return newItem; |
| | | }); |
| | | } |
| | |
| | | } |
| | | }; |
| | | |
| | | // 选择检验用粉剂/液情况后,根据产品ID查询库存批号列表 |
| | | const handleInspectMaterialChange = (productId) => { |
| | | inspectBatchOptions.value = []; |
| | | form.value.inspectBatchNo = ""; |
| | | form.value.inspectProductModel = ""; |
| | | form.value.inspectProductionDate = ""; |
| | | form.value.inspectValidityDate = ""; |
| | | form.value.inspectValidityPeriod = ""; |
| | | // let productName = findNodeById(productOptions.value, productId); |
| | | |
| | | modelList({ id: productId }).then((res) => { |
| | | inspectProductModel.value = res; |
| | | }) |
| | | /*getStockInventoryListPage({ |
| | | productName: productName, |
| | | pageNum: 1, |
| | | pageSize: -1 |
| | | }).then(res => { |
| | | inspectBatchOptions.value = res.data || [] |
| | | // 清空已选择的批号和新字段 |
| | | form.value.inspectBatchNo = ""; |
| | | form.value.inspectProductModel = ""; |
| | | form.value.inspectProductionDate = ""; |
| | | form.value.inspectValidityDate = ""; |
| | | });*/ |
| | | }; |
| | | |
| | | const handleChangeModels = (value) => { |
| | | form.value.inspectProductModel = inspectProductModel.value.find(item => item.id == value)?.model || ''; |
| | | |
| | | getStockInventoryListPage({ |
| | | model: form.value.inspectProductModel, |
| | | pageNum: 1, |
| | | pageSize: -1 |
| | | }).then(res => { |
| | | inspectBatchOptions.value = res.data || [] |
| | | // 清空已选择的批号和新字段 |
| | | form.value.inspectBatchNo = ""; |
| | | form.value.inspectProductionDate = ""; |
| | | form.value.inspectValidityDate = ""; |
| | | }); |
| | | |
| | | if (form.value.productionDate) { |
| | | calculateInspectValidityDate(); |
| | | } |
| | | } |
| | | |
| | | |
| | | const calculateInspectValidityDate = () => { |
| | | if (!form.value.inspectProductionDate) { |
| | | form.value.inspectValidityDate = ''; |
| | | return; |
| | | } |
| | | // 获取规格型号的有效期 |
| | | const selectedModel = inspectProductModel.value.find(item => item.id == form.value.inspectProductModelId); |
| | | if (selectedModel && selectedModel.validityPeriod) { |
| | | const inspectProductionDate = new Date(form.value.inspectProductionDate); |
| | | const validityPeriod = parseFloat(selectedModel.inspectValidityDate); |
| | | const validityDate = new Date(inspectProductionDate); |
| | | validityDate.setFullYear(validityDate.getFullYear() + Math.floor(validityPeriod)); |
| | | validityDate.setMonth(validityDate.getMonth() + Math.round((validityPeriod % 1) * 12)); |
| | | form.value.inspectValidityDate = validityDate.toISOString().split('T')[0]; |
| | | } |
| | | } |
| | | |
| | | const handleInspectBatchChange = (batchNo) => { |
| | | if (!batchNo) { |
| | | form.value.inspectProductionDate = ""; |
| | | form.value.inspectValidityDate = ""; |
| | | return; |
| | | } |
| | | const selectedBatch = inspectBatchOptions.value.find(item => item.batchNo === batchNo); |
| | | if (selectedBatch) { |
| | | // 带出规格型号和生产日期 |
| | | // form.value.inspectProductModel = selectedBatch.model || ""; |
| | | form.value.inspectProductionDate = selectedBatch.productionDate || ""; |
| | | calculateInspectValidityDate() |
| | | } |
| | | }; |
| | | |
| | | // 获取设备台账列表 |
| | | const loadDeviceList = () => { |
| | | qualityInspectParamDeviceList().then(res => { |
| | |
| | | proxy.resetForm("formRef"); |
| | | tableData.value = []; |
| | | testStandardOptions.value = []; |
| | | inspectBatchOptions.value = []; |
| | | form.value.testStandardId = ''; |
| | | dialogFormVisible.value = false; |
| | | emit('close') |