spring
2025-04-11 fe2c38273024c74f28e59c24c867eb67c841be16
src/views/business/reliabilityPlan/plan.vue
@@ -83,7 +83,7 @@
</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"],
@@ -115,7 +115,10 @@
  },
  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 || [];
        }
@@ -126,12 +129,13 @@
    // 获取检验项列表
    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 => {
@@ -141,13 +145,14 @@
    // 获取测试标准列表
    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);
@@ -176,7 +181,8 @@
          inspectionItem: item.inspectionItem,
          standard: item.standard,
          frequency: item.frequency,
          remark: item.remark
          remark: item.remark,
          type: this.planType
        };
        return addOrUpdateItem(params);
      });
@@ -212,7 +218,8 @@
            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) {