| | |
| | | </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) { |