liding
2025-04-03 28d60ee46f2a6ee67810108809fe86b9d32e822e
可靠性计划完善
已修改3个文件
113 ■■■■ 文件已修改
src/api/business/reliabilityPlan.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/reliabilityPlan/index.vue 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/business/reliabilityPlan/plan.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/business/reliabilityPlan.js
@@ -68,6 +68,15 @@
  });
}
//获取原辅材产品检验项
export function materialItem(query) {
  return request({
    url: "/reliabilityPlanProductItem/materialItem",
    method: "get",
    params: query,
  });
}
//获取产品检验项
export function codeList(query) {
  return request({
@@ -77,6 +86,15 @@
  });
}
//获取原辅材产品检验项
export function materialCodeList(query) {
  return request({
    url: "/reliabilityPlanProductItem/materialCodeList",
    method: "get",
    params: query,
  });
}
//更新插入产品计划
export function addOrUpdateItem(query) {
  return request({
src/views/business/reliabilityPlan/index.vue
@@ -97,12 +97,16 @@
          <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%;"
@@ -159,6 +163,7 @@
      tableData: [],
      typeOption: [],
      partNoOption: [], // 添加产品型号选项数据
      materialPartNoOption:[],
      tableLoading: false,
      itemParameterData: {
        cascaderField: {
@@ -470,19 +475,56 @@
        }
      } else {
        this.materialDia = true
        if (this.operationType === 'add') {
          this.materialForm = {
            id: '',
            materialName: '',
            partNo: '',
            state: '',
            reviewerId: ''
          if (this.operationType === 'add') {
            this.materialForm = {
              id: '',
              materialName: '',
              partNo: '',
              state: '',
              reviewerId: ''
            }
          } else {
            this.materialForm = { ...row }
            // 编辑时获取选中节点的ID并加载相关数据
            const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.materialName)
            if (selectedNode) {
              this.getMaterialPartNoOptions(selectedNode.id)
            }
          }
        } else {
          this.materialForm = { ...row }
        }
      }
    },
    //原辅材零件号选择
    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) {
      this.submitProLoading = true
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) {