cuijian
2023-11-03 5eb201663c723d215014106c69b093a304e932b6
src/views/eam/modules/operationCertificateApply/OperationCertificateApplyForm.vue
@@ -6,7 +6,7 @@
        <a-row>
          <a-col :span='12'>
            <a-form-model-item label='申请单编号' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='num'>
              <a-input v-model='model.num' placeholder='请输入申请单编号'></a-input>
              <a-input v-model='model.num' placeholder="将由系统生成" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span='12'>
@@ -28,6 +28,12 @@
            <a-form-model-item label='申请人' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='applicant'>
              <j-dict-select-tag type='list' v-model='model.applicant' dictCode='sys_user,realname,id'
                                 placeholder='请选择申请人' disabled />
            </a-form-model-item>
          </a-col>
          <a-col :span='12'>
            <a-form-model-item label='办理人' :labelCol='labelCol' :wrapperCol='wrapperCol' prop='handlePerson'>
              <j-dict-select-tag type='list' v-model='model.handlePerson' dictCode='sys_user,realname,id'
                                 placeholder='请选择办理人'  />
            </a-form-model-item>
          </a-col>
          <a-col :span='12'>
@@ -82,7 +88,6 @@
  },
  data() {
    return {
      isAchievement:false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
@@ -99,9 +104,9 @@
      // 新增时子表默认添加几行空数据
      addDefaultRowNum: 1,
      validatorRules: {
        num: [
          { required: true, message: '请输入申请单编号!' }
        ],
        // num: [
        //   { required: true, message: '请输入申请单编号!' }
        // ],
        auditStatus: [
          { required: true, message: '请输入审核状态!' }
        ]
@@ -117,7 +122,8 @@
          {
            title: '用户',
            key: 'userId',
            type: JVXETypes.userSelect,
            type: JVXETypes.selectSearch,
            dictCode: 'sys_user,realname,id ',
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: '',
@@ -136,7 +142,7 @@
          {
            title: '设备统一编码',
            key: 'equipmentIds',
            type: JVXETypes.selectSearch,
            type: JVXETypes.selectMultiple,
            dictCode: 'mom_eam_equipment,num,id ',
            width: '200px',
            placeholder: '请输入${title}',
@@ -153,7 +159,7 @@
            validateRules: [{ required: true, message: '${title}不能为空' }]
          },
          {
            title: '补办原因',
            title: '申请/补办原因',
            key: 'replaceReason',
            type: JVXETypes.input,
            width: '200px',
@@ -175,7 +181,7 @@
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: '',
            disabled:false
            disabled:'achievementDisabled'
          },
          {
            title: '实操成绩',
@@ -184,17 +190,17 @@
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: '',
            disabled:false
            disabled:'achievementDisabled'
          },
          {
            title: '考试结论',
            key: 'examinationConclusion',
            type: JVXETypes.checkbox,
            customValue: ['Y', 'N'],
            type: JVXETypes.select,
            dictCode:'examination_conclusion',
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: '',
            disabled:false
            disabled:'achievementDisabled'
          },
          // {
          //   title: '状态',
@@ -203,7 +209,7 @@
          //   width: '200px',
          //   placeholder: '请输入${title}',
          //   defaultValue: ''
          // }
          // }
        ]
      },
      url: {
@@ -213,7 +219,8 @@
        queryById: '/eam/operationCertificateApply/queryById',
        operationCertificateApplyDetail: {
          list: '/eam/operationCertificateApply/queryOperationCertificateApplyDetailByMainId'
        }
        },
        getNum: '/eam/sysIdentity/getNumNew',
      }
    }
  },
@@ -224,15 +231,24 @@
      default: false,
      required: false
    },
    achievement: {
      type: Boolean,
      default: false,
      required: false
    },
  },
  computed: {
    formDisabled() {
      return this.disabled
    },
    achievementDisabled() {
      return this.achievement
    }
  },
  created() {
  },
  methods: {
    addBefore() {
      this.operationCertificateApplyDetailTable.dataSource = []
    },
@@ -248,6 +264,12 @@
      if (this.model.id) {
        let params = { id: this.model.id }
        this.requestSubTableData(this.url.operationCertificateApplyDetail.list, params, this.operationCertificateApplyDetailTable)
      }else{
        getAction(this.url.getNum, { type: 'OperationCertificateApply', length: '4' }).then((res) => {
            if (res.success) {
              this.model.num = res.message
            }
          })
      }
    },
    //校验所有一对一子表表单
@@ -286,13 +308,15 @@
      console.log("formData===>",formData);
      httpAction(url, formData, method).then((res) => {
        if (res.success) {
          httpAction(this.url.addOperationCertificate, formData.operationCertificateApplyDetailList, 'post').then((res) => {
            if (res.success) {
              this.$message.success(res.message)
            }else {
              this.$message.warning(res.message)
            }
          })
          if(this.achievementDisabled){
            httpAction(this.url.addOperationCertificate, formData.operationCertificateApplyDetailList, 'post').then((res) => {
              if (res.success) {
                this.$message.success(res.message)
              }else {
                this.$message.warning(res.message)
              }
            })
          }
          this.$message.success(res.message)
          this.$emit('ok')
          this.close()