Files
income_payments_client/src/views/financialManagement/arriveAndInvoicing/modules/AuditProofModule.vue
T
2021-12-16 17:31:36 +08:00

243 lines
6.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
okText="保存"
cancelText="关闭">
<div class="project-name">{{ model.chargeProject }}</div>
<a-form :form="form">
<h3 class="title">凭证信息</h3>
<div>
<div class="info-item">
<label>缴费金额</label>
<div>{{ proofInfo.amountReceived }}</div>
</div>
<div class="info-item">
<label>缴费日期</label>
<div>{{ proofInfo.paymentDate }}</div>
</div>
<div class="info-item">
<label>申请人</label>
<div>{{ proofInfo.applicantName }}</div>
</div>
<div class="info-item">
<label>缴费凭证</label>
<div class="proof-img">
<img :src="proofSrc(proofInfo.proof)">
</div>
</div>
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea
placeholder="请输入备注"
v-decorator="['remark']"
:auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</div>
<h3 class="title">审核</h3>
<div>
<a-form-item label="审核人" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入审核人"
v-decorator="['reviewerName',validatorRules.reviewerName]"
: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="['paymentStatus', validatorRules.paymentStatus]" @change="paymentStatusChange">
<a-radio value="completed">同意</a-radio>
<a-radio value="rejected">拒绝</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="说明" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="showInstructions">
<a-textarea
placeholder="请输入说明"
v-decorator="['reviewInstructions', validatorRules.reviewInstructions]"
:auto-size="{ minRows: 3, maxRows: 6 }"
:maxLength='200'
@change="e => {e.target.value = (e.target.value + '').trim()}"/>
</a-form-item>
</div>
</a-form>
</j-modal>
</template>
<script>
import pick from 'lodash.pick'
import { postAction } from '../../../../api/manage'
import Vue from 'vue'
import { USER_INFO } from '../../../../store/mutation-types'
import { getLastProofInfo } from '../../../../api/incomePaymentsApi'
export default {
name: 'AuditProofModule',
data() {
return {
title: '来款信息',
width: 600,
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 3 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 21 }
},
validatorRules: {
reviewerName: {
rules: [{ required: true, message: '请输入审核人' }],
validateTrigger: 'blur'
},
paymentStatus: {
rules: [{ required: true, message: '请选择审核状态' }],
validateTrigger: 'blur'
},
reviewInstructions: {
rules: [{ required: true, message: '请输入说明' }],
validateTrigger: 'blur'
}
},
// 项目缴费凭证信息
proofInfo: {},
// 是否显示说明
showInstructions: false,
auditUrl: '/paymentCheck/payPaymentCheck/check'
}
},
methods: {
open(record) {
this.getProofInfo(record)
this.form.resetFields()
let userInfo = Vue.ls.get(USER_INFO)
// 默认隐藏说明
this.showInstructions = false
this.model = Object.assign({}, record)
this.model.reviewerName = userInfo.realname
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'reviewerName'))
})
},
/**
* 获取项目缴费凭证相关信息
* @param record
*/
getProofInfo(record) {
if (record && record.id) {
getLastProofInfo({ projectId: record.id }).then(res => {
if (res.success) {
this.proofInfo = res.result
}
})
}
},
handleOk() {
if (this.confirmLoading) {
return
}
this.confirmLoading = true
this.form.validateFields((err, values) => {
if (!err) {
values.projectId = this.model.id
values.projectType = this.model.projectType
const formData = Object.assign(this.proofInfo, values)
postAction(this.auditUrl, formData).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warn(res.message)
}
}).finally(() => {
setTimeout(() => {
this.confirmLoading = false
}, 1000)
})
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.close()
},
close() {
this.visible = false
},
/**
* 审核通过拒绝变化
* @param value
*/
paymentStatusChange(e) {
if (e.target.value === 'rejected') {
this.showInstructions = true
} else {
this.showInstructions = false
}
},
/**
* 缴费凭证 src
*/
proofSrc(imgId) {
return `${ window._CONFIG['domianURL'] }/sys/common/download/${ imgId }`
},
}
}
</script>
<style scoped lang="less">
.project-name {
font-size: 16px;
font-weight: 700;
padding-bottom: 20px;
}
h3 {
position: relative;
}
h3.title::before {
position: absolute;
top: 4px;
left: -10px;
content: "";
height: 20px;
width: 2px;
background: #069f99;
}
.info-item {
display: flex;
padding: 5px 0;
label {
color: #666666;
flex-shrink: 0;
}
div {
color: black;
}
.proof-img {
width: calc(100% - 6rem);
img {
max-width: 100%;
}
}
}
</style>