spring
2025-04-02 f8d17ac2666198f513a4d5f83dce1135a911f2ee
src/views/business/reliabilityPlan/index.vue
@@ -79,7 +79,7 @@
      <div slot="footer" class="foot">
        <el-button v-if="operationType !== 'review'" @click="closeProDia">取 消</el-button>
        <el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
          :loading="submitProLoading" @click="submitProForm">保
          :loading="submitProLoading" @click="submitProForm(0)">保
          存</el-button>
        <el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
          @click="submitProForm(1)">提 交</el-button>
@@ -95,9 +95,10 @@
      <el-form :model="materialForm" ref="materialForm" :rules="materialRules" label-width="90px" size="small">
        <el-form-item label="原辅材名称" prop="materialName">
          <el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree"
            :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false }" :show-all-levels="false"
            clearable filterable placeholder="请选择原辅材名称" size="small" style="width: 100%;"
            :disabled="operationType === 'review' || operationType === 'submit'"></el-cascader>
            :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'">
          </el-cascader>
        </el-form-item>
        <el-form-item label="零件号" prop="partNo">
          <el-input v-model="materialForm.partNo" placeholder="请填写零件号"
@@ -115,7 +116,7 @@
        <el-button v-if="operationType !== 'review'" @click="closeMaterialRulesDia">取
          消</el-button>
        <el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
          :loading="submitMatLoading" @click="submitMaterialRulesForm">保 存</el-button>
          :loading="submitMatLoading" @click="submitMaterialRulesForm(0)">保 存</el-button>
        <el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
          @click="submitMaterialRulesForm(1)">提 交</el-button>
        <el-button v-if="operationType === 'review'" :loading="submitMatLoading"
@@ -448,9 +449,6 @@
    // 打开新增弹框
    openAddDia(type, row) {
      this.operationType = type
      this.getTypeOptions()
      this.getPartNoOptions()
      // this.getUserList()
      if (this.tabIndex === 0) {
        this.proPlanDia = true
        if (this.operationType === 'add') {
@@ -463,6 +461,12 @@
          }
        } else {
          this.proPlanForm = { ...row }
          // 编辑时获取选中节点的ID并加载相关数据
          const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.productName)
          if (selectedNode) {
            this.getTypeOptions(selectedNode.id)
            this.getPartNoOptions(selectedNode.id)
          }
        }
      } else {
        this.materialDia = true
@@ -482,12 +486,15 @@
    // 成品信息提交
    submitProForm(state) {
      this.submitProLoading = true
      if (this.operationType === 'add') {
        this.proPlanForm.state = ''
      } else {
        this.proPlanForm.state = state
      // 获取选中节点的ID
      const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.proPlanForm.productName)
      const params = {
        ...this.proPlanForm,
        state: state === undefined ? null : parseInt(state),
        productId: selectedNode?.id
      }
      addOrUpdateProduct(this.proPlanForm).then(res => {
      addOrUpdateProduct(params).then(res => {
        if (res.code === 200) {
          this.closeProDia()
          this.$message.success('操作成功')
@@ -507,12 +514,14 @@
    // 原辅材信息提交
    submitMaterialRulesForm(state) {
      this.submitMatLoading = true
      if (this.operationType === 'add') {
        this.materialForm.state = ''
      } else {
        this.materialForm.state = state
      // 获取选中节点的ID
      const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.materialForm.materialName)
      const params = {
        ...this.materialForm,
        state: state === undefined ? null : parseInt(state),
        materialId: selectedNode?.id
      }
      addOrUpdateMaterial(this.materialForm).then(res => {
      addOrUpdateMaterial(params).then(res => {
        if (res.code === 200) {
          this.closeMaterialRulesDia()
          this.$message.success('操作成功')