| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="生产批号:"> |
| | | <el-input |
| | | :model-value="productionBatchDisplay" |
| | | disabled |
| | | placeholder="—" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="料号:" prop="materialCode"> |
| | | <el-input v-model="form.materialCode" placeholder="请输入" disabled/> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="单位:" prop="unit"> |
| | | <el-input v-model="form.unit" placeholder="请输入" clearable/> |
| | |
| | | <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="请输入" clearable :precision="2"/> |
| | | </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 style="width: 100%"> |
| | |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="不合格现象:" prop="defectivePhenomena"> |
| | | <el-input v-model="form.defectivePhenomena" placeholder="请输入" clearable/> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | |
| | | <el-col :span="12"> |
| | | <el-form-item label="处理人:" prop="dealName"> |
| | | <el-select v-model="form.dealName" placeholder="请选择" clearable style="width: 100%"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, reactive, toRefs} from "vue"; |
| | | import { ref, reactive, toRefs, computed, getCurrentInstance } from "vue"; |
| | | import {modelList, productTreeList} from "@/api/basicData/product.js"; |
| | | import { |
| | | getQualityUnqualifiedInfo, |
| | |
| | | productId: "", |
| | | model: "", |
| | | unit: "", |
| | | materialCode: "", |
| | | /** 来自业务数据,仅展示 */ |
| | | batchNo: "", |
| | | quantity: "", |
| | | checkCompany: "", |
| | | checkResult: "", |
| | |
| | | }, |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | const productionBatchDisplay = computed(() => { |
| | | const f = form.value || {}; |
| | | const v = f.batchNo ?? f.productionBatchNo; |
| | | if (v === null || v === undefined || String(v).trim() === "") { |
| | | return ""; |
| | | } |
| | | return String(v); |
| | | }); |
| | | |
| | | const productOptions = ref([]); |
| | | const modelOptions = ref([]); |
| | | const userList = ref([]); // 检验员/处理人下拉列表 |
| | |
| | | productId: '', |
| | | model: '', |
| | | unit: '', |
| | | materialCode: '', |
| | | batchNo: '', |
| | | quantity: '', |
| | | productName: '', |
| | | }; |
| | |
| | | getQualityUnqualifiedInfo(row.id).then(res => { |
| | | const { inspectState, ...rest } = (res.data || {}) |
| | | form.value = { ...rest } |
| | | form.value.batchNo = |
| | | rest.batchNo ?? rest.productionBatchNo ?? form.value.batchNo ?? "" |
| | | }) |
| | | } |
| | | } |
| | |
| | | return newItem; |
| | | }); |
| | | } |
| | | |
| | | const handleChangeModel = (value) => { |
| | | form.value.materialCode = modelOptions.value.find(item => item.id == value)?.materialCode || ''; |
| | | } |
| | | |
| | | // 提交产品表单 |
| | | const submitForm = () => { |
| | | proxy.$refs.formRef.validate(valid => { |
| | | if (valid) { |
| | | // 状态字段不在表单填写,也不传给后端 |
| | | const { inspectState, ...payload } = (form.value || {}) |
| | | const selectedModel = modelOptions.value.find(item => |
| | | String(item.id) === String(payload.model) |
| | | ); |
| | | payload.model = selectedModel ? selectedModel.model : ''; |
| | | if (operationType.value === "add") { |
| | | qualityUnqualifiedAdd(payload).then(res => { |
| | | proxy.$modal.msgSuccess("提交成功"); |