| | |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工序:" prop="process"> |
| | | <el-select v-model="form.process" placeholder="请选择工序" clearable :disabled="processQuantityDisabled" style="width: 100%"> |
| | | <el-option v-for="item in processList" :key="item.name" :label="item.name" :value="item.name"/> |
| | | <el-form-item label="部件:" prop="process"> |
| | | <el-select v-model="form.process" placeholder="请选择部件" clearable :disabled="processQuantityDisabled" style="width: 100%"> |
| | | <el-option v-for="item in processList" :key="item.id" :label="item.name" :value="item.id"/> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} 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"; |
| | | const { proxy } = getCurrentInstance() |
| | | const { product_process_type } = proxy.useDict('product_process_type') |
| | | const emit = defineEmits(['close']) |
| | | |
| | | |
| | |
| | | const v = form.value || {}; |
| | | return !!(v.productMainId != null || v.purchaseLedgerId != null); |
| | | }); |
| | | const processList = ref([]); // 工序下拉列表(工序名称 name) |
| | | // 工序/部件下拉:来源于字典 `product_process_type` |
| | | // 字典返回结构:{ label, value },这里统一成 { id, name } |
| | | const processList = computed(() => { |
| | | return (product_process_type?.value || []).map(item => ({ |
| | | id: item.value, |
| | | name: item.label |
| | | })) |
| | | }) |
| | | const supplierList = ref([]); |
| | | const productOptions = ref([]); |
| | | const tableColumn = ref([ |
| | |
| | | getOptions().then((res) => { |
| | | supplierList.value = res.data; |
| | | }); |
| | | // 加载工序下拉列表 |
| | | try { |
| | | const res = await list(); |
| | | processList.value = res.data || []; |
| | | } catch (e) { |
| | | console.error("加载工序列表失败", e); |
| | | processList.value = []; |
| | | } |
| | | // 工序/部件下拉由字典 product_process_type 自动提供,无需再请求接口 |
| | | let userLists = await userListNoPage(); |
| | | userList.value = userLists.data; |
| | | // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框“闪一下”) |
| | |
| | | let params = { |
| | | productId: currentProductId.value, |
| | | inspectType: 1, |
| | | // 字典 product_process_type 的 value 作为 processType 传入 |
| | | processType: form.value.process || '', |
| | | // 兼容旧字段(如后端仍使用 process) |
| | | process: form.value.process || '' |
| | | } |
| | | qualityInspectDetailByProductId(params).then(res => { |
| | |
| | | proxy.$refs.formRef.validate(valid => { |
| | | if (valid) { |
| | | form.value.inspectType = 1 |
| | | const processName = form.value.process || ''; |
| | | const processType = form.value.process || ''; |
| | | if (operationType.value === "add") { |
| | | tableData.value.forEach((item) => { |
| | | delete item.id |
| | |
| | | } |
| | | const data = { |
| | | ...form.value, |
| | | process: processName, // 保留 process 字段以兼容后端 |
| | | // processType:字典 product_process_type 的 value |
| | | processType: processType, |
| | | // 兼容旧字段(如后端仍使用 process) |
| | | process: processType, |
| | | qualityInspectParams: tableData.value |
| | | } |
| | | if (operationType.value === "add") { |
| | |
| | | tableData.value = []; |
| | | return; |
| | | } |
| | | const processName = form.value.process || ''; |
| | | const processType = form.value.process || ''; |
| | | let params = { |
| | | productId: currentProductId.value, |
| | | inspectType: 1, |
| | | process: processName |
| | | // 字典 product_process_type 的 value 作为 processType 传入 |
| | | processType: processType, |
| | | // 兼容旧字段(如后端仍使用 process) |
| | | process: processType |
| | | } |
| | | qualityInspectDetailByProductId(params).then(res => { |
| | | // 保存下拉框选项数据 |