Files
income_payments_client/src/views/contractManagement/revenueContract/modules/RevenueContractAduitModule.vue
T

152 lines
4.3 KiB
Vue

<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="审核人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入审核人"
v-decorator="['userName',validatorRules.userName]"
:maxLength='50'
:disabled="true"
@change="e => {e.target.value = (e.target.value + '').trim()}"></a-input>
</a-form-item>
<a-form-item label="审核" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-decorator="['contractStatus', validatorRules.contractStatus]"
@change="contractAuditStatuChange">
<a-radio :value="3">通过</a-radio>
<a-radio :value="4">拒绝</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="拒绝说明" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="showExplainRemarks">
<a-textarea
placeholder="请输入拒绝说明"
v-decorator="['explainRemarks', validatorRules.explainRemarks]"
:auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import { aduitRevenueContract } from '../../../../api/incomePaymentsApi'
import { USER_INFO } from '../../../../store/mutation-types'
import Vue from 'vue'
import pick from 'lodash.pick'
export default {
name: 'RevenueContractAduitModule',
data() {
return {
title: '审核',
width: 600,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
contractId: '',
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 4 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 }
},
validatorRules: {
userName: {
rules: [{ required: true, message: '请输入审核人' }],
validateTrigger: 'blur'
},
contractStatus: {
rules: [{ required: true, message: '请选择审核状态' }],
validateTrigger: 'blur'
},
explainRemarks: {
rules: [{ required: true, message: '请输入拒绝说明' }],
validateTrigger: 'blur'
}
},
showExplainRemarks: false
}
},
methods: {
handleOk() {
console.log(this.confirmLoading)
// 触发表单验证
if (this.confirmLoading) {
return
}
this.confirmLoading = true
this.form.validateFields((err, values) => {
if (!err) {
values.contractId = this.contractId
const formData = Object.assign(this.model, values)
console.log('表单提交数据', formData)
aduitRevenueContract(formData).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.close()
},
open() {
this.showExplainRemarks = false
this.form.resetFields()
let userInfo = Vue.ls.get(USER_INFO)
console.log(userInfo)
this.model.userName = userInfo.realname
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'userName'))
})
},
close() {
this.showExplainRemarks = false
this.form.resetFields()
this.visible = false
},
/**
* 控制拒绝说明显隐
* @param e
*/
contractAuditStatuChange(e) {
console.log(e.target.value)
if (e.target.value === 3) {
this.showExplainRemarks = false
return
}
if (e.target.value === 4) {
this.showExplainRemarks = true
}
}
}
}
</script>
<style scoped>
</style>