<template>
|
<a-modal
|
:title='title'
|
:width="650"
|
:visible='visible'
|
:maskClosable='false'
|
cancelText='关闭'
|
@cancel='handleCancel'
|
:confirmLoading='confirmLoading'
|
>
|
<!-- @ok='handleOk' -->
|
<a-spin :spinning='confirmLoading'>
|
<a-form :form="form">
|
<a-row>
|
<a-col :span='24'>
|
<a-form-item
|
label='标准编码'
|
:labelCol='labelCol'
|
:wrapperCol='wrapperCol'
|
>
|
<a-input
|
allow-clear
|
:disabled="true"
|
:placeholder="disableSubmit?'':'请输入点检标准编码'"
|
v-decorator="['num', validatorRules.num ]"
|
/>
|
</a-form-item>
|
</a-col>
|
<a-col
|
v-if="this.model.approvalStatus == '1' ||this.model.approvalStatus == '2'||this.model.approvalStatus == '4'"
|
:span='24'
|
>
|
|
<a-form-item
|
label="审核意见"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-textarea
|
rows='3'
|
placeholder='请输入审核意见'
|
v-decorator="['auditFeedback', validatorRules.auditFeedback ]"
|
></a-textarea>
|
</a-form-item>
|
</a-col>
|
<a-col
|
v-if="this.model.approvalStatus == '3' "
|
:span='24'
|
>
|
<a-form-item
|
label="审批意见"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
>
|
<a-textarea
|
rows='3'
|
placeholder='请输入审批意见'
|
v-decorator="['approvalFeedback', validatorRules.approvalFeedback ]"
|
></a-textarea>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-spin>
|
<template slot='footer'>
|
<a-popconfirm
|
@confirm="() => handleReject()"
|
title="确认将当前点检标准驳回?"
|
>
|
<a-button
|
:loading='confirmLoading'
|
:style="{marginRight: '8px'}"
|
>
|
驳回
|
</a-button>
|
</a-popconfirm>
|
<a-popconfirm
|
@confirm="() => handleOk()"
|
title="确认将当前点检标准审核通过?"
|
>
|
<a-button
|
type='primary'
|
:loading='confirmLoading'
|
:style="{marginRight: '8px'}"
|
>
|
通过
|
</a-button>
|
</a-popconfirm>
|
<!-- <a-button
|
@click='handleOk'
|
type='primary'
|
:loading='confirmLoading'
|
>通过
|
</a-button> -->
|
</template>
|
</a-modal>
|
|
</template>
|
|
<script>
|
import { httpAction, requestPut, postAction } from '@/api/manage'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
import pick from 'lodash.pick'
|
|
|
export default {
|
name: 'ApprovelModal',
|
components: {
|
Tooltip
|
},
|
data() {
|
return {
|
title: '操作',
|
visible: false,
|
disableSubmit: false,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 }
|
},
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
validatorRules: {
|
auditFeedback: {
|
rules: [
|
{ required: false, message: '请输入审核意见!' },
|
]
|
},
|
approvalFeedback: {
|
rules: [
|
{ required: false, message: '请输入审批意见!' },
|
]
|
},
|
},
|
url: {
|
auditApproval: "/eam/inspectionStandard/auditApproval",
|
},
|
}
|
},
|
|
|
methods: {
|
close() {
|
this.$emit('close')
|
this.visible = false
|
},
|
|
handleCancel() {
|
this.close()
|
},
|
showModals(record) {
|
this.form.resetFields();
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
this.$nextTick(() => {
|
this.form.setFieldsValue(pick(this.model, 'num'));
|
this.form.setFieldsValue({ auditFeedback: "" });
|
this.form.setFieldsValue({ approvalFeedback: "" });
|
}, 200);
|
},
|
|
|
|
handleReject() {
|
const that = this;
|
this.form.validateFields((err, values) => {
|
if (!err) {
|
that.confirmLoading = true;
|
let formData = Object.assign(this.model, values);
|
if (this.model.approvalStatus == '1') {
|
formData.approvalStatus = '2'
|
formData.disUda2 = "驳回"
|
} else if (this.model.approvalStatus == '3') {
|
formData.approvalStatus = '4'
|
formData.disUda3 = "驳回"
|
} else if (this.model.approvalStatus == '4') {
|
formData.approvalStatus = '2'
|
formData.disUda2 = "驳回"
|
}
|
requestPut(this.url.auditApproval, formData, { id: this.model.id }).then((res) => {
|
if (res.success) {
|
that.$message.success("驳回成功!");
|
that.$emit('ok');
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.close();
|
})
|
}
|
})
|
},
|
|
|
handleOk() {
|
const that = this;
|
that.form.validateFields((err, values) => {
|
if (!err) {
|
this.confirmLoading = true;
|
let formData = Object.assign(this.model, values);
|
if (this.model.approvalStatus == '1') {
|
formData.approvalStatus = '3'
|
formData.disUda2 = "通过"
|
} else if (this.model.approvalStatus == '2') {
|
formData.approvalStatus = '3'
|
formData.disUda2 = "通过"
|
} else if (this.model.approvalStatus == '3') {
|
formData.approvalStatus = '5'
|
formData.disUda3 = "通过"
|
} else if (this.model.approvalStatus == '4') {
|
formData.approvalStatus = '3'
|
formData.disUda2 = "通过"
|
}
|
requestPut(this.url.auditApproval, formData, { id: this.model.id }).then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.$emit('ok');
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.close();
|
})
|
}
|
})
|
},
|
}
|
|
}
|
</script>
|
|
<style lang='less' scoped>
|
/deep/ .frozenRowClass {
|
color: #c9c9c9;
|
}
|
|
.fontweight {
|
font-weight: bold;
|
}
|
|
.ant-btn {
|
padding: 0 10px;
|
margin-left: 3px;
|
}
|
|
.ant-form-item-control {
|
line-height: 0px;
|
}
|
|
/** 主表单行间距 */
|
.ant-form .ant-form-item {
|
margin-bottom: 10px;
|
}
|
|
/** Tab页面行间距 */
|
.ant-tabs-content .ant-form-item {
|
margin-bottom: 0px;
|
}
|
|
/deep/ .ant-modal-title {
|
text-align: center;
|
}
|
</style>
|