Files
laws-sinotruk-mobile/src/views/workCenter/enterpriseStandardRevision/EnterpriseStandardRevision.vue
T

537 lines
19 KiB
Vue

<template>
<process-common-layout
ref="processCommonLayout"
class="page-box"
:processKey="ProcessKey.ES_EDIT.value"
:canChooseFields="personInfoCanChooseFields"
:loading="loading">
<template v-slot:process>
<!-- 流程信息 -->
<div class="process-part">
<div class="process-part-title">{{ $t('processInformation') }}</div>
<van-form
ref="form"
input-align="right"
error-message-align="right"
:readonly="readonly"
>
<!-- 流程名称 -->
<van-field
:label="$t('processName')"
:placeholder="$t('pleaseEnter') + $t('processName')"
readonly
type="textarea"
rows="1"
autosize
v-model="processInfoForm.prcName" />
<!-- 截止日期 -->
<calendar-field
:label="$t('expirationDate')"
v-model="processInfoForm.dueTime"
type="date"
readonly
/>
<!-- 流程说明 -->
<van-field
v-model="processInfoForm.prcMes"
:label="$t('processExplain')"
type="textarea"
autosize
disabled
rows="2"
:placeholder="$t('pleaseEnter')+$t('processExplain')"
:border="false"
input-align="left"
class="vertical-form-item"/>
</van-form>
</div>
<!-- 4标准化审核节点 -->
<standardization-check-base-info
v-if="currentNode === 4"
ref="baseInfoRef"
@standardizationAuditIsMeeting="standardizationAuditIsMeeting"
></standardization-check-base-info>
<!-- 5评分人打分 -->
<scorer-mark-base-info
v-else-if="currentNode === 5"
ref="baseInfoRef"
></scorer-mark-base-info>
<!-- 6标准化确认是否开启征求意见 -->
<confirm-whether-comment-base-info
v-else-if="currentNode === 6"
ref="baseInfoRef"
></confirm-whether-comment-base-info>
<!-- 7部所联络人下发 -->
<depart-liaison-issue-base-info
v-else-if="currentNode === 7"
ref="baseInfoRef"
></depart-liaison-issue-base-info>
<!-- 13其他起草人校对 -->
<!-- 14主管级领导审批 -->
<!-- 15标准化审批 -->
<!-- 16相关部门领导会签 -->
<!-- 17总工程师审批 -->
<only-online-edit-base-info
v-else
ref="baseInfoRef"
></only-online-edit-base-info>
<!-- 流程审批信息 -->
<div class="process-part">
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
<van-form
ref="processForm"
input-align="right"
error-message-align="right"
:readonly="readonly">
<!-- 备注 -->
<van-field
v-model="processInfoForm.commitText"
:rules="processInfoRules.commitText"
:label="$t('remark')"
name="commitText"
type="textarea"
autosize
rows="2"
:placeholder="$t('pleaseEnter')+$t('remark')"
:border="false"
input-align="left"
class="vertical-form-item"/>
</van-form>
</div>
</template>
<template v-slot:operation>
<!-- 转办 -->
<van-button class="operation-common-btn" @click="handleTurnTo">
<template #icon>
<van-icon class="iconfont" class-prefix="icon" name="xunhuan" />
</template>
{{ $t('turnTo') }}
</van-button>
<!-- 节点5,6,7 转办保存提交 -->
<template v-if="[5,6,7].includes(currentNode)">
<!-- 保存 -->
<van-button class="operation-common-btn light-color-button" @click="handleSave">
<template #icon>
<van-icon class="iconfont" class-prefix="icon" name="baocun" />
</template>
{{ $t('save') }}
</van-button>
<!-- 提交 -->
<van-button class="operation-common-btn" type="primary" @click="handleSubmit">
<template #icon>
<van-icon class="iconfont" class-prefix="icon" name="check" />
</template>
{{ $t('submit') }}
</van-button>
</template>
<template v-else>
<!-- 同意 -->
<van-button class="operation-common-btn" type="primary" @click="handleAgree" :disabled="agreeBtnDisabled">
<template #icon>
<van-icon class="iconfont" class-prefix="icon" name="check" />
</template>
{{ $t('agree') }}
</van-button>
<!-- 驳回 -->
<van-button class="operation-common-btn light-color-button" @click="handleReject" :disabled="rejectBtnDisabled">
<template #icon>
<van-icon class="iconfont" class-prefix="icon" name="close" />
</template>
{{ $t('reject') }}
</van-button>
</template>
</template>
<select-user ref="selectUserRef" @selected-change="selectUserChange"></select-user>
</process-common-layout>
</template>
<script>
import ProcessCommonLayout from '@/components/ProcessCommonLayout'
import SelectUser from '@/components/SelectUser'
import CalendarField from '@/components/CalendarField'
import StandardizationCheckBaseInfo
from '@/views/workCenter/enterpriseStandardRevision/module/StandardizationCheckBaseInfo'
import { EsRevisionNodes, ProcessKey } from '@/enums/commonEnums'
import {
enStandardEditSave,
enStandardEditTurnTo,
enStandardEditAgree,
enStandardEditReject,
enStandardEditGetDataById
} from '@/api/api'
import ScorerMarkBaseInfo from '@/views/workCenter/enterpriseStandardRevision/module/ScorerMarkBaseInfo'
import ConfirmWhetherCommentBaseInfo
from '@/views/workCenter/enterpriseStandardRevision/module/ConfirmWhetherCommentBaseInfo'
import DepartLiaisonIssueBaseInfo
from '@/views/workCenter/enterpriseStandardRevision/module/DepartLiaisonIssueBaseInfo'
import OnlyOnlineEditBaseInfo from '@/views/workCenter/enterpriseStandardRevision/module/OnlyOnlineEditBaseInfo'
export default {
name: 'EnterpriseStandardRevision',
components: {
OnlyOnlineEditBaseInfo,
DepartLiaisonIssueBaseInfo,
ConfirmWhetherCommentBaseInfo,
ScorerMarkBaseInfo,
StandardizationCheckBaseInfo,
ProcessCommonLayout,
SelectUser,
CalendarField
},
computed: {
personInfoCanChooseFields () {
return this.currentNode === 7 ? ['adviceUserList'] : []
}
},
mounted () {
// 初始化节点
const nodeId = this.$route.query.nodeId
if (nodeId) {
if (nodeId === EsRevisionNodes.mainDrafterSend.value) {
// 主起草人起草分发
this.currentNode = 1
} else if (nodeId === EsRevisionNodes.otherDrafterUploadStandard.value) {
// 其他起草人上传企标
this.currentNode = 2
} else if (nodeId === EsRevisionNodes.mainDrafterAllUploadMinute.value) {
// 主起草人汇总上传会议纪要
this.currentNode = 3
} else if (nodeId === EsRevisionNodes.standardizationAudit.value) {
// 标准化审核
this.currentNode = 4
} else if (nodeId === EsRevisionNodes.scorerMark.value) {
// 评分人打分
this.currentNode = 5
} else if (nodeId === EsRevisionNodes.standardizationConfirmIsStartAdvice.value) {
// 标准化确认是否开启征求意见
this.currentNode = 6
} else if (nodeId === EsRevisionNodes.contactSend.value) {
// 部所联络人下发
this.currentNode = 7
} else if (nodeId === EsRevisionNodes.takeAdviceObjectEnterAdvice.value) {
// 征求意见对象填写意见
this.currentNode = 8
} else if (nodeId === EsRevisionNodes.contactAll.value) {
// 部所联络人汇总数据
this.currentNode = 9
} else if (nodeId === EsRevisionNodes.contactLeaderApproval.value) {
// 部门联络人主管级领导审批
this.currentNode = 10
} else if (nodeId === EsRevisionNodes.mainDrafterAll.value) {
// 主起草人汇总
this.currentNode = 11
} else if (nodeId === EsRevisionNodes.mainDrafterUploadMinute.value) {
// 主起草人上传会议纪要
this.currentNode = 12
} else if (nodeId === EsRevisionNodes.otherDrafterProofread.value) {
// 其他起草人校对
this.currentNode = 13
} else if (nodeId === EsRevisionNodes.leaderApproval.value) {
// 主管级领导审批
this.currentNode = 14
} else if (nodeId === EsRevisionNodes.standardizationApproval.value) {
// 标准化审批
this.currentNode = 15
} else if (nodeId === EsRevisionNodes.relatedDeptLeaderCountersign.value) {
// 相关部门领导会签
this.currentNode = 16
} else if (nodeId === EsRevisionNodes.allEngineerApproval.value) {
// 总工程师审批
this.currentNode = 17
} else if (nodeId === EsRevisionNodes.mainDrafterPublish.value) {
// 主起草人发布
this.currentNode = 18
} else {
// 预留加签节点
this.currentNode = 999
}
}
this.initData()
},
data () {
return {
ProcessKey,
currentNode: 1,
readonly: false,
loading: false,
rejectBtnDisabled: false, // 驳回按钮不可点击
agreeBtnDisabled: false, // 同意按钮不可点击
processInfoForm: {}, // 流程信息表单
// 流程信息校验
processInfoRules: {
commitText: [
{ required: false, message: this.$t('pleaseEnter') + this.$t('remark') }
]
},
baseInfoForm: {}
}
},
methods: {
// 初始化数据
initData () {
this.loading = true
enStandardEditGetDataById(this.$route.query.taskId).then(res => {
if (res.success) {
const result = res.result
// 有草稿json按草稿进来的回显
if (result.infoJsonStr) {
// 初始化流程信息
const prcObj = Object.assign({}, result)
prcObj.dueTime = result.processDueDate
prcObj.prcMes = result.processDescription
// 初始化流程审批信息
prcObj.commitText = result.handleText
prcObj.commitFile = result.handleFile
this.processInfoForm = Object.assign({}, prcObj)
result.data = JSON.parse(result.infoJsonStr).data
// 如果是节点7的保存回显人员信息
if (this.currentNode === 7) {
this.$refs.processCommonLayout.$nextTick(() => {
this.$refs.processCommonLayout.draftInitPersonInfo(JSON.parse(result.infoJsonStr).personnelObj)
})
}
console.log(result.data)
} else {
this.processInfoForm = result.common
}
this.baseInfoForm = result.data
this.$nextTick(() => {
this.$refs.baseInfoRef.initData(this.baseInfoForm)
})
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 标准化审核节点是否可进行评审会修改,需要修改备注的是否必填和同意、驳回按钮是否可用
standardizationAuditIsMeeting (value) {
// 选是的话,驳回按钮置灰,不可点击;选否,备注变成必填,内容自动带入“驳回”,下方同意按钮置灰,不可点击
if (value === '1') {
// 选了是
this.processInfoRules.commitText[0].required = false
this.rejectBtnDisabled = true
this.agreeBtnDisabled = false
} else {
// 选了否
this.processInfoRules.commitText[0].required = true
this.rejectBtnDisabled = false
this.agreeBtnDisabled = true
this.processInfoForm.commitText = '驳回'
}
},
// 转交
handleTurnTo () {
if (this.loading) return
// 点击显示选人组件
this.$refs.selectUserRef.open()
},
// 转交选完人的回调
selectUserChange (userIds) {
this.loading = true
const param = {}
param.userId = userIds
param.taskId = this.$route.query.taskId
enStandardEditTurnTo(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 保存
handleSave () {
if (this.loading) return
const personnelObj = this.$refs.processCommonLayout.getDataObj()
// 需要传给后端的
const paramObj = {}
// 流程信息
paramObj.basicProcessInfoDTO = Object.assign({}, this.processInfoForm)
paramObj.basicProcessInfoDTO.processName = paramObj.basicProcessInfoDTO.prcName
paramObj.basicProcessInfoDTO.processDueDate = paramObj.basicProcessInfoDTO.dueTime
paramObj.basicProcessInfoDTO.processDescription = paramObj.basicProcessInfoDTO.prcMes
paramObj.basicProcessInfoDTO.processInstanceId = this.$route.query.processInstanceId
// 流程审批信息
paramObj.basicTaskInfoDTO = {}
paramObj.basicTaskInfoDTO.handleText = paramObj.basicProcessInfoDTO.commitText
paramObj.basicTaskInfoDTO.handleFile = paramObj.basicProcessInfoDTO.commitFile
paramObj.basicTaskInfoDTO.taskId = this.$route.query.taskId
// 业务基本信息
if (this.$refs.baseInfoRef) {
// 业务基本信息
const baseInfo = this.$refs.baseInfoRef.getData()
const param = { ...this.processInfoForm, ...baseInfo }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
} else {
console.log(personnelObj)
// 业务基本信息和人员信息
paramObj.infoJsonStr = JSON.stringify({
data: Object.assign({}, baseInfo),
personnelObj: personnelObj
})
}
} else {
// 需要外层信息至少填了一项
const param = { ...this.processInfoForm }
const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) {
// 提示至少填写一项
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
}
this.loading = true
// 保存到草稿
enStandardEditSave(paramObj).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
},
// 同意
handleAgree () {
if (this.loading) return
this.processInfoRules.commitText[0].required = false
if (!this.processInfoForm.commitText) {
this.processInfoForm.commitText = '同意'
}
this.$refs.processForm.validate().then(async () => {
if (this.currentNode === 4 || this.currentNode === 10) {
const data = await this.$refs.baseInfoRef.getDataValidate()
if (data) {
this.loading = true
const param = {}
param.common = Object.assign({}, this.processInfoForm)
param.common.taskId = this.$route.query.taskId
param.data = data
enStandardEditAgree(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
}
} else {
this.loading = true
const param = {}
param.common = Object.assign({}, this.processInfoForm)
param.common.taskId = this.$route.query.taskId
enStandardEditAgree(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
}
}).catch((errorInfo) => {
console.log(errorInfo)
})
},
// 驳回
handleReject () {
if (this.loading) return
this.processInfoRules.commitText[0].required = true
this.$refs.processForm.validate().then(() => {
this.loading = true
const param = {}
param.common = Object.assign({}, this.processInfoForm)
param.common.taskId = this.$route.query.taskId
enStandardEditReject(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
this.processInfoRules.commitText[0].required = false
})
}).catch((errorInfo) => {
console.log(errorInfo)
this.$refs.processCommonLayout.activeTab = 'basic'
if (errorInfo.find(item => item.name === 'commitText')) {
// 没通过校验的有备注,弹窗提示输入备注
this.$message(this.$t('pleaseEnterRemarks'))
}
})
},
// 提交
handleSubmit () {
if (this.loading) return
let personnelObj = {}
if (this.currentNode === 7) {
// 说明是部所联络人下发节点,需要传人员信息
personnelObj = this.$refs.processCommonLayout.getDataObjVerify()
if (!personnelObj) {
this.$refs.processCommonLayout.activeTab = 'person'
return
}
}
this.$refs.processForm.validate().then(async () => {
const data = await this.$refs.baseInfoRef.getDataValidate()
if (data) {
const param = {} // 需要传给后端的数据
param.common = Object.assign({}, this.processInfoForm)
param.common.taskId = this.$route.query.taskId
param.data = data
if (this.currentNode === 7) {
param.flowUser = personnelObj
}
this.loading = true
enStandardEditAgree(param).then(res => {
if (res.success) {
this.$message(res.message)
this.goBack()
} else {
this.$message(res.message)
}
}).finally(() => {
this.loading = false
})
} else {
this.$refs.processCommonLayout.activeTab = 'basic'
}
})
},
goBack () {
this.$router.go(-1)
}
},
// 组件内路由拦截
beforeRouteEnter (to, from, next) {
// 如果不是移动端支持的节点,就跳转NoMobile
if (!EsRevisionNodes.propertyOfValue('isMobile', to.query.nodeId)) {
next({ path: '/noMobile' })
}
next()
}
}
</script>
<style scoped>
</style>