commonCertificationStatusModal.vue 3.78 KB
<template>
  <a-modal
    :title="title"
    :width="800"
    :centered="true"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleSubmit"
    @cancel="handleCancel"
    cancelText="关闭"
    :maskClosable="false"
    style="top:20px;"
    class="scope-link-man"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label="当前认证状态" :labelCol="{span:4}" :wrapperCol="{span:8}">
          <a-select
            v-decorator="['certStatusNow',{'initialValue':certStatusNow}]"
            placeholder="请选择"
            :disabled="disableSubmit"
          >
            <a-select-option
              v-for="(item, index) in creditDetailCertStatus"
              :key="index"
            >{{item.title}}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item label="人工认证状态" :labelCol="{span:4}" :wrapperCol="{span:8}">
          <a-select
            v-decorator="['certStatus',{'initialValue':4}]"
            placeholder="请选择"
            :disabled="disableSubmit"
          >
            <a-select-option
              v-for="(item, index) in creditDetailCertStatus"
              :key="index"
            >{{item.title}}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item label="备注" :labelCol="{span:4}" :wrapperCol="{span:12}">
          <a-textarea
            rows="4"
            placeholder="最多可录入500字"
            v-decorator="['remark']"
            :readOnly="onlyread && disableSubmit"
          />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
import { modifyApplyByAdmin } from '@/api/configApi'
import pick from 'lodash.pick'

export default {
  name: 'commonCertificationStatusModal',
  data() {
    return {
      creditDetailCertStatus: JSON.parse(sessionStorage.getItem('CREDIT_DETAIL_CERT_STATUS')),
      visible: false,
      confirmLoading: false,
      onlyread: false,
      disableSubmit: false,
      title: '',
      status: '',
      certStatusNow: '',
      validatorRules: {
        name: {
          rules: [
            {
              required: true,
              message: '请输入信息名称'
            }
          ]
        }
      },

      model: {},

      form: this.$form.createForm(this)
    }
  },
  methods: {
    edit(record) {
      this.form.resetFields()
      this.certStatusNow = record.certStatus
      let id = { id: record.id }
      this.model = Object.assign({}, id)
      console.log(this.model)
      this.visible = true
      this.$nextTick(() => {})
    },

    add(applyNo) {
      let data = { applyNo: applyNo }
      this.model = Object.assign({}, data)
      this.form.resetFields()
      this.visible = true
    },

    close() {
      this.$emit('close')
      this.visible = false
      this.disableSubmit = false
      this.selectedRole = []
    },
    handleSubmit() {
      // 触发表单验证
      this.form.validateFields((err, values) => {
        console.log(err, values)
        if (!err) {
          this.confirmLoading = true
          let formData = Object.assign(this.model, values)
          delete formData.certStatusNow
          modifyApplyByAdmin(formData)
            .then(res => {
              if (res.status.statusCode == 0) {
                this.$message.success(res.status.statusReason)
                this.$emit('ok')
              } else {
                this.$message.warning(res.status.statusReason)
              }
            })
            .finally(() => {
              this.confirmLoading = false
              this.close()
            })
        }
      })
    },
    handleCancel() {
      this.close()
    }
  }
}
</script>
<style>
.scope-link-man .ant-modal-body {
  overflow-y: scroll;
  overflow-x: hidden;
  min-height: 200px;
}
</style>