| | |
| | | }); |
| | | } |
| | | |
| | | //获取原辅材产品检验项 |
| | | export function materialItem(query) { |
| | | return request({ |
| | | url: "/reliabilityPlanProductItem/materialItem", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | //获取产品检验项 |
| | | export function codeList(query) { |
| | | return request({ |
| | |
| | | }); |
| | | } |
| | | |
| | | //获取原辅材产品检验项 |
| | | export function materialCodeList(query) { |
| | | return request({ |
| | | url: "/reliabilityPlanProductItem/materialCodeList", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | //更新插入产品计划 |
| | | export function addOrUpdateItem(query) { |
| | | return request({ |
| | |
| | | <el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree" |
| | | :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false, emitPath: false }" |
| | | :show-all-levels="false" clearable filterable placeholder="请选择原辅材名称" size="small" style="width: 100%;" |
| | | :disabled="operationType === 'review' || operationType === 'submit'"> |
| | | :disabled="operationType === 'review' || operationType === 'submit'" @change="handleMaterialNameChange"> |
| | | </el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="零件号" prop="partNo"> |
| | | <el-input v-model="materialForm.partNo" placeholder="请填写零件号" |
| | | :disabled="operationType === 'review' || operationType === 'submit'"></el-input> |
| | | <el-select v-model="materialForm.partNo" placeholder="请选择" clearable filterable |
| | | :disabled="operationType === 'review' || !materialForm.materialName || operationType === 'submit'" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in materialPartNoOption" :key="item.id" :label="item.partNo" :value="item.partNo"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="审核人" prop="reviewerId"> |
| | | <el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;" |
| | |
| | | tableData: [], |
| | | typeOption: [], |
| | | partNoOption: [], // 添加产品型号选项数据 |
| | | materialPartNoOption:[], |
| | | tableLoading: false, |
| | | itemParameterData: { |
| | | cascaderField: { |
| | |
| | | } |
| | | } else { |
| | | this.materialForm = { ...row } |
| | | // 编辑时获取选中节点的ID并加载相关数据 |
| | | const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.materialName) |
| | | if (selectedNode) { |
| | | this.getMaterialPartNoOptions(selectedNode.id) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //原辅材零件号选择 |
| | | handleMaterialNameChange(value) { |
| | | if (value) { |
| | | const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, value) |
| | | if (selectedNode) { |
| | | this.getMaterialPartNoOptions(selectedNode.id) |
| | | } |
| | | } else { |
| | | this.materialPartNoOption = [] |
| | | this.materialForm.partNo = '' |
| | | } |
| | | }, |
| | | |
| | | // 获取原辅材零件号列表 |
| | | getMaterialPartNoOptions(materialId) { |
| | | if (!materialId) { |
| | | this.materialPartNoOption = [] |
| | | return |
| | | } |
| | | getPartNoList({ productId: materialId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.materialPartNoOption = res.data || [] |
| | | if (this.materialPartNoOption.length === 0) { |
| | | this.materialForm.partNo = '' |
| | | } |
| | | } |
| | | }).catch(() => { |
| | | this.materialPartNoOption = [] |
| | | this.materialForm.partNo = '' |
| | | }) |
| | | }, |
| | | // 成品信息提交 |
| | | submitProForm(state) { |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem } from "@/api/business/reliabilityPlan"; |
| | | import { selectProductItem, itemList, codeList, addOrUpdateItem, deleteItem, materialItem, materialCodeList } from "@/api/business/reliabilityPlan"; |
| | | |
| | | export default { |
| | | dicts: ["planned_frequency"], |
| | |
| | | }, |
| | | methods: { |
| | | getTableData() { |
| | | selectProductItem({ rePlanId: this.planId }).then(res => { |
| | | selectProductItem({ |
| | | rePlanId: this.planId, |
| | | type: this.planType |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.tableData = res.data || []; |
| | | } |
| | |
| | | |
| | | // 获取检验项列表 |
| | | getItemList() { |
| | | itemList({ rePlanId: this.planId }).then(res => { |
| | | const api = this.planType === '成品' ? itemList : materialItem; |
| | | api({ rePlanId: this.planId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.itemList = res.data.map(item => ({ |
| | | label: item.inspectionItem, // 修改为 inspectionItem |
| | | label: item.inspectionItem, |
| | | value: item.id, |
| | | inspectionItem: item.inspectionItem // 添加 inspectionItem 字段 |
| | | inspectionItem: item.inspectionItem |
| | | })) || []; |
| | | } |
| | | }).catch(err => { |
| | |
| | | |
| | | // 获取测试标准列表 |
| | | getCodeList() { |
| | | codeList({ rePlanId: this.planId }).then(res => { |
| | | const api = this.planType === '成品' ? codeList : materialCodeList; |
| | | api({ rePlanId: this.planId }).then(res => { |
| | | if (res.code === 200) { |
| | | this.codeList = res.data.map(item => ({ |
| | | this.codeList = res.data ? res.data.map(item => ({ |
| | | label: item.standard, |
| | | value: item.id, |
| | | standard: item.standard |
| | | })) || []; |
| | | })) : []; |
| | | } |
| | | }).catch(err => { |
| | | console.error('获取测试标准列表失败:', err); |
| | |
| | | inspectionItem: item.inspectionItem, |
| | | standard: item.standard, |
| | | frequency: item.frequency, |
| | | remark: item.remark |
| | | remark: item.remark, |
| | | type: this.planType |
| | | }; |
| | | return addOrUpdateItem(params); |
| | | }); |
| | |
| | | inspectionItem: this.addForm.name, |
| | | standard: this.addForm.standard, |
| | | frequency: this.addForm.frequency, |
| | | remark: this.addForm.remark |
| | | remark: this.addForm.remark, |
| | | type: this.planType |
| | | } |
| | | addOrUpdateItem(params).then(res => { |
| | | if (res.code === 200) { |