Files
laws_weilai/jero-web/src/views/toDoCenter/taskConfirmation/components/batchProcessing.vue
T
2022-10-18 15:50:46 +08:00

250 lines
7.5 KiB
Java

<template>
<div>
<a-modal
:title="$t('batchProcessing')"
:width="700"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
>
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24" v-if="taskDefinitionKey != 'dreqr'">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"></span>
</div>
<a-form-model-item class="itemModel" prop="flag">
<a-radio-group style="margin-top: 2px" @change="flagChange" class="box-input" v-model="formInline.flag">
<a-radio value="0">
{{$t('accept')}}
</a-radio>
<a-radio value="1">
{{$t('disagree')}}
</a-radio>
<a-radio value="3" v-if="taskDefinitionKey == 'zrrjsrw'">
{{$t('inquiry')}}
</a-radio>
<a-radio value="4" v-if="taskDefinitionKey == 'zrrqr'">
{{$t('sendBack')}}
</a-radio>
</a-radio-group>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24" v-if="isTrue">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('selectInquiry')">{{$t('selectInquiry')}}</span>
</div>
<a-form-model-item class="itemModel" prop="dreUserIdName">
<PersonnelSelection class="box-input"
:personneQuery="formInline"
:query="{db_field_name:'dreUserId',db_field_txt:$t('selectInquiry')}"
:isInput="true"
:isSingleChoice="true"
@change="PersonnelSelectionChange"
v-model="formInline.dreUserIdName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('feedbackMessage')">{{$t('feedbackMessage')}}</span>
</div>
<a-form-model-item class="itemModel" prop="approvalOpinion">
<a-textarea :placeholder="$t('pleaseEnter')+$t('feedbackMessage')" v-model="formInline.approvalOpinion"
:rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-modal>
</div>
</template>
<script>
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import PersonnelSelection from '@/components/PersonnelSelection/index'
import moment from 'moment'
import { mapGetters } from 'vuex'
export default {
name: 'batchProcessing',
components: {
PersonnelSelection
},
data() {
return {
formInline: {},
rules: {
flag: [
{
required: true,
message: this.$t('reviewResults') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
dreUserIdName: [
{
required: true,
message: this.$t('selectInquiry') + this.$t('cannotEmpty'),
trigger: 'change'
}
],
approvalOpinion: [
{
max: 300,
message: this.$t('feedbackMessage') + this.$t('cannotExceed') + 300 + this.$t('Characters'),
trigger: 'blur'
}
]
},
confirmLoading: false,
visible: false,
selectedRowKeys: [],
issue: false,
isTrue: false,
taskDefinitionKey: '',
taskIds: [],
projectLawsInventoryIds: []
}
},
methods: {
...mapGetters(['userInfo']),
getData(data) {
this.selectedRowKeys = data
this.taskDefinitionKey = this.selectedRowKeys[0].taskDefinitionKey
this.taskIds = []
this.projectLawsInventoryIds = []
this.selectedRowKeys.forEach(res => {
this.taskIds.push(res.taskId)
this.projectLawsInventoryIds.push(res.projectLawsInventoryId)
})
this.confirmLoading = false
this.visible = true
this.isTrue = false
this.$nextTick(() => {
this.formInline = {}
this.$refs.ruleForm.clearValidate()
})
},
flagChange(event) {
if (event.target.value == 3) {
this.isTrue = true
} else {
this.isTrue = false
}
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
addBatch() {
let rejectTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
let query = {
rejectUserId: this.userInfo().id,
rejectTime: rejectTime,
rejectCause: this.formInline.approvalOpinion,
taskIds: this.taskIds.join(','),
rejectType: '1'
}
postAction('/project/projectLawsInventoryRejectCauseEO/addBatch', query).then((res) => {
})
},
handleOk() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let handlingTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
let query = {
...this.formInline,
taskIds: this.taskIds.join(','),
userId: this.userInfo().id,
taskDefinitionKey: this.taskDefinitionKey,
handlingTime: handlingTime,
projectLawsInventoryIds: this.projectLawsInventoryIds.join(',')
}
if (this.formInline.flag == '1') {
this.addBatch()
}
if (!this.formInline.flag) {
query.flag = '0'
}
this.confirmLoading = true
postAction('/workFlow/completeTaskBatch', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.confirmLoading = false
this.$emit('batchProcessingForm')
} else {
this.confirmLoading = false
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
handleCancel() {
this.visible = false
}
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
}
.title-text {
width: 84px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
}
.Required {
color: red;
margin-right: 4px;
}
</style>