Files
laws_weilai/jero-web/src/views/processCenter/processForm/handshakeProcess/index.vue
T
2022-09-30 21:38:19 +08:00

355 lines
11 KiB
Java
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>
<div id="examineBox">
<headerProcess
:title="$t('regulatoryCertificationTaskConfirmation')"
/>
<div class="detail-box">
<div class="detail-content">
<projectInformation
v-if="isDisplay"
:title="$t('essentialInformation')"
:projectInformationList="projectInformationList"
:url="url"
:queryProject="queryProject"
:projectInformationId="this.queryBy.projectLibraryId"
/>
<standardContent
v-if="isDisplay"
:title="$t('TaskRequirements')"
:standardContentList="standardContentList"
:url="url"
:isConfirmationDeadline="true"
:standardContentQuery="queryProject"
/>
<standardContentListTable
v-if="isDisplay"
:standardContentListQuery="queryProject"
:url="url
"/>
<examineInformation
:isFlag="isFlag"
v-if="isDisplay"
isApprovalOpinion
:title="titleName"
:isSendBack="isSendBackOne"
ref="examineInformationRef"
:url="url"/>
<!-- @terminationProcess="terminationProcess"-->
<footerProcess
is-submit
:isSendBack="isSendBack"
@submit="submit"
@sendBack="sendBack"
/>
<circulationHistory v-if="isDisplay"/>
</div>
</div>
<JLoading :loading="loading">{{textLoading}}</JLoading>
</div>
</template>
<script>
import headerProcess from '../../components/headerProcess'
import footerProcess from '../../components/footerProcess'
import projectInformation from '../../components/projectInformation'
import standardContent from '../../components/standardContent'
import standardContentListTable from '../../components/standardContentList'
import examineInformation from '../../components/examineInformation'
import circulationHistory from '../../components/circulationHistory'
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import { mapGetters } from 'vuex'
import moment from 'moment'
export default {
name: 'handshakeProcess',
components: {
headerProcess,
projectInformation,
standardContent,
standardContentListTable,
examineInformation,
circulationHistory,
footerProcess
},
data() {
return {
projectInformationList: [
{
title: this.$t('RelatedItems'),
value: 'projectName'
},
{
title: this.$t('targetMarket'),
value: 'targetMarket_dictText'
},
{},
{
title: this.$t('standard'),
value: 'serialNumber',
type: '4'
},
{
title: this.$t('title'),
value: 'title'
},
{
title: this.$t('subtitle'),
value: 'subtitle'
},
{
title: this.$t('areaOfResponsibility'),
value: 'dutyTerritory_dictText'
},
{
title: this.$t('applicableSupplement'),
value: 'applicableSupplement'
}
],
standardContentList: [],
url: {
urlFrom: 'project/projectLibraryBase/queryById',
queryProjectLawsInventoryInfoById: 'project/projectLawsInventoryEO/queryProjectLawsInventoryInfoById',
queryTaskDetailByTaskIds: '/task/queryTaskDetailByTaskIds'
},
queryBy: {},
isDisplay: false,
queryProject: {},
loading: false,
titleName: '',
textLoading: this.$t('dataLoading')
}
},
created() {
document.title = this.$t('regulatoryCertificationTaskConfirmation')
},
mounted() {
let _this = this
this.isDisplay = false
if (this.$route.query.taskDefinitionKey == 'dreqr') {
this.titleName = this.$t('engineerReply')
} else {
this.titleName = this.$t('taskConfirmationResponsiblePerson')
}
this.queryTaskDetailByTask(function() {
_this.queryProjectLawsInventoryInfo()
})
},
computed: {
isSendBack() {
if (this.$route.query.taskDefinitionKey == 'zrrjsrw' || this.$route.query.taskDefinitionKey == 'zrrqr') {
return false
}
return true
},
isFlag() {
if (this.$route.query.taskDefinitionKey == 'dreqr') {
return false
}
return true
},
isSendBackOne() {
if (this.$route.query.taskDefinitionKey == 'zrrqr') {
return true
}
}
},
methods: {
...mapGetters(['userInfo']),
// terminationProcess(handlingTime) {
// this.textLoading = this.$t('terminationProcessing')
// this.loading = true
// this.completeTask({ flag: 2 }, handlingTime)
// },
submit(handlingTime) {
this.$refs.examineInformationRef.submit((res) => {
this.textLoading = this.$t('Submitting')
this.loading = true
if (!this.isFlag) {
res.flag = 0
}
this.completeTask(res, handlingTime)
})
},
sendBack(handlingTime) {
this.textLoading = this.$t('Returning')
this.loading = true
this.$refs.examineInformationRef.submitNoRule((res) => {
this.completeTask({ ...res, flag: 1 }, handlingTime)
})
},
queryTaskDetailByTask(callback) {
this.loading = true
getAction(this.url.queryTaskDetailByTaskIds, { taskIds: this.$route.query.taskIds }).then((res) => {
if (res instanceof String) {
this.queryBy = JSON.parse(res)
callback()
} else {
this.queryBy = res
callback()
}
})
},
rejectCauseAdd(rejectCause, ids) {
let rejectTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
let query = {
rejectUserId: this.userInfo().id,
rejectTime: rejectTime,
rejectCause: rejectCause,
projectLawsInventoryId: ids,
rejectType: '1'
}
postAction('/project/projectLawsInventoryRejectCauseEO/add', query).then((res) => {
})
},
completeTask(value, handlingTime) {
let json = Object.assign(this.queryBy, { handlingTime: handlingTime }, value)
if (json.flag == '1') {
this.rejectCauseAdd(value.approvalOpinion, this.queryBy.id)
}
Object.keys(json).forEach(res => {
if (json[res] && typeof json[res] == 'string') {
json[res] = json[res].replace(/\"/g, '“')
json[res] = json[res].replace(/\'/g, '')
}
})
let query = {
userid: this.userInfo().id,
taskId: this.$route.query.taskId || this.$route.query.taskIds,
json: JSON.stringify(json).replace(/\"/g, '\'')
}
postAction('/workFlow/completeTask', query).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
if (this.$route.query.taskDefinitionKey == 'zrrjsrw' || this.$route.query.taskDefinitionKey == 'zrrqr') {
if (value.flag == 0) {
if (this.queryProject.verifyDeliverableType) {
this.startProcessDesign(this.queryBy, 4)
}
if (this.queryProject.prehomoDeliverableType) {
this.startProcessDesign(this.queryBy, 3)
}
if (this.queryProject.designDeliverableType) {
this.startProcessDesign(this.queryBy, 2)
}
if (!this.queryProject.verifyDeliverableType && !this.queryProject.prehomoDeliverableType &&
!this.queryProject.designDeliverableType) {
setTimeout(() => {
this.loading = false
window.close()
}, 1000)
// this.$router.push({
// path: '/ProcessCenter'
// })
}
} else {
setTimeout(() => {
this.loading = false
window.close()
}, 1000)
// this.$router.push({
// path: '/ProcessCenter'
// })
}
} else {
setTimeout(() => {
this.loading = false
window.close()
}, 1000)
// this.$router.push({
// path: '/ProcessCenter'
// })
}
} else {
this.loading = false
this.$message.warning(this.$t('operationFailed'))
}
})
},
startProcessDesign(value, num) {
let query = {
type: num,
projectLawsInventoryId: value.id,
msg: JSON.stringify(value).replace(/\"/g, '\'')
}
postAction('/workFlow/startProcess', query).then((res) => {
if (res.success) {
this.completeTaskDesign(value, res.result, true)
}
})
},
deleteProcessInstanceByTask(taskId) {
getAction('/workFlow/deleteProcessInstanceByTaskId', { taskId: taskId }).then((res) => {
})
},
completeTaskDesign(value, taskId, isTrue) {
value.reviewResult = 'launch'
let operatorTime = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
value.operatorTime = operatorTime
Object.keys(value).forEach(res => {
if (value[res] && typeof value[res] == 'string') {
value[res] = value[res].replace(/\"/g, '“')
value[res] = value[res].replace(/\'/g, '')
}
})
let query = {
userid: this.userInfo().id,
taskId: taskId,
json: JSON.stringify(value).replace(/\"/g, '\'')
}
postAction('/workFlow/completeTask', query).then((res) => {
if (res.success) {
this.visible = false
setTimeout(() => {
this.loading = false
window.close()
}, 3000)
// this.$router.push({
// path: '/ProcessCenter'
// })
} else {
if (isTrue) {
this.deleteProcessInstanceByTask(taskId)
}
}
})
},
queryProjectLawsInventoryInfo() {
let query = {
id: this.queryBy.id,
operatorType: 'taskAffirmQuery'
}
getAction(this.url.queryProjectLawsInventoryInfoById, query).then((res) => {
if (res.success) {
this.queryProject = res.result[0] || {}
this.loading = false
this.isDisplay = true
} else {
this.queryProject = {}
this.loading = false
this.isDisplay = true
}
})
}
}
}
</script>
<style lang="less" scoped>
.detail-box {
padding: 67px 0 0 0;
background: #ffffff;
height: 100%;
overflow: auto;
}
#examineBox {
display: flex;
flex-direction: column;
background: #fff;
position: relative;
height: 100%;
overflow-y: auto;
}
</style>