approvalModal.vue 3.12 KB
<template>
<a-modal
      :visible="visible"
      :title="title"
      :maskClosable="false" 
      :centered='true'
      :confirmLoading="confirmLoading"
      @ok="handleSubmit"
      @cancel="close"
      cancelText="关闭"
      okText="提交"
    >
    <a-spin :spinning="confirmLoading">
      <div class="approval">
          <a-form :form="form" >
       
          <a-form-item label="审批结果">
            <a-radio-group
              v-decorator="['approvalResult', validatorRules.approvalResult]"
            >
              <a-radio :value="1">通过</a-radio>
              <a-radio :value="2">拒绝</a-radio>
              <a-radio :value="3">审批退回</a-radio>
            </a-radio-group>
          </a-form-item>
          <a-form-item label="审批意见">
            <a-textarea
              v-decorator="['approvalNote', validatorRules.approvalNote]"
              placeholder="输入审批意见"
              :autosize="{ minRows: 2, maxRows: 6 }"
            />
          </a-form-item>
         
     
      </a-form>
      </div>
    
    </a-spin>
</a-modal>

</template>
<script>
  import { submitApprovalTrans } from '@/api/insys'
  export default {
    name: "repayFlowUploadModal",
    data () {
      return {
        visible: false,
        confirmLoading: false,
        title: '授信审批',
        labelCol: {
          xs: { span: 24 },
          sm: { span: 8 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        form: this.$form.createForm(this),
        validatorRules:{
          approvalResult:{
            rules: [{
              required: true, message: '请选择审批结果',
            }]
          },
          approvalNote:{
            rules: [{
              required: true, message: '请输入审批意见',
            }]
          }
        },
        model: {},
      }
    },
    methods: {
      add (val) {
        this.model = val
        this.form.resetFields();
        this.visible = true;
        this.$nextTick(() => {
          this.form.setFieldsValue();
        });
      },
      close () {
        this.$emit('close');
        this.visible = false;
        this.form.setFieldsValue();
      },
      handleSubmit() {
        let that = this
        this.form.validateFields((err, values) => {
          if (!err) {
            this.confirmLoading = true
            let p = {
              id: this.model.id,
              ...values
            };
            submitApprovalTrans(p).then(res => {
              if (res.status.statusCode == 0) {
                this.$message.success(res.status.statusReason)
                this.form.resetFields()
                this.$nextTick(() => {
                  this.form.setFieldsValue()
                })
              } else {
                this.$message.warning(res.status.statusReason)
              }
              })
            .finally(() => {
              that.confirmLoading = false
              that.close()
              this.$emit('ok', 'approvalModalOk')
            })
          }
        })
      },
   
    }
  }
</script>
<style scoped>

.approval{
  padding: 0 40px;

}

</style>