update 会后管理流程

This commit is contained in:
danshihao
2023-12-01 19:27:41 +08:00
parent 5a4bda1bc3
commit 1df3d38352
8 changed files with 724 additions and 160 deletions
@@ -1,5 +1,5 @@
<template>
<internal-detail-page :title="pageTitle" :content-padding="0">
<internal-detail-page :title="pageTitle" :content-padding="0" :loading="loading">
<!--基本信息-->
<div class="detail-page-scroll-content" v-show="switchValue === 'base'">
<!-- 流程信息 -->
@@ -13,7 +13,7 @@
@change="event => event.target.value = event.target.value.trim()"
:maxLength="50"
:disabled="disabled || processDisabled"
v-decorator="['processName', validatorRules.processName]" />
v-decorator="['prcName', validatorRules.processName]" />
</a-form-item>
</a-col>
<a-col :span="12">
@@ -22,8 +22,8 @@
<a-date-picker :placeholder="$t('pleaseSelect') + $t('expirationDate')"
style="width: 100%"
:disabled="disabled || processDisabled"
value-format="YYYY-MM-DD"
v-decorator="['expirationDate']" />
value-format="YYYY-MM-DD hh:mm:ss"
v-decorator="['dueTime']" />
</a-form-item>
</a-col>
<a-col :span="24">
@@ -33,7 +33,7 @@
:maxLength="500"
:rows="4"
:disabled="disabled || processDisabled"
v-decorator="['processExplain']" />
v-decorator="['prcMes']" />
</a-form-item>
</a-col>
</a-row>
@@ -41,8 +41,7 @@
<!-- 业务基本信息 -->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<base-info-form/>
<base-info-form :disabled="disabled" ref="baseInfoForm"/>
<!-- 流程审批信息 -->
<div class="process-part-title">{{ $t('processApprovalInformation') }}</div>
@@ -52,26 +51,37 @@
<a-textarea :placeholder="$t('pleaseEnter') + $t('remarks')"
:maxLength="500"
:rows="4"
v-decorator="['remarks', validatorRules.remarks]" />
v-decorator="['commitText', validatorRules.remarks]" />
</a-form-item>
<!--附件-->
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('businessSupport.questionAnswer.attach')">
<j-upload v-decorator="['file']" return-id />
<j-upload v-decorator="['commitFile']" return-id />
</a-form-item>
</a-form>
</div>
<div class="detail-page-bottom-operate-box">
<a-button type="primary" :loading="loading" @click="handleSave" ghost><i class="iconfont icon-save" />{{ $t('preservation') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
<a-button type="primary" :loading="loading" @click="handleAgree" icon="check-circle">{{ $t('agree') }}</a-button>
<!--取消-->
<a-button v-if="1 & btn" type="primary" :loading="loading" ghost @click="handleCancel">{{ $t('cancel') }}</a-button>
<!--保存-->
<a-button v-if="2 & btn" type="primary" :loading="loading" @click="handleSave" ghost><i class="iconfont icon-save" />{{ $t('preservation') }}</a-button>
<!--提交-->
<a-button v-if="4 & btn" type="primary" :loading="loading" @click="handleSubmit" icon="upload">{{ $t('submit') }}</a-button>
</div>
</internal-detail-page>
</template>
<script>
import '@assets/less/common.less'
import InternalDetailPage from '@comp/InternalDetailPage'
import BaseInfoForm from '@views/workCenter/standardPromotionProcess/modules/BaseInfoForm'
import { ProcessKey, StandardPromotion } from '@/enums/commonEnums'
import {
getStandardPromotionDataById, getStandardPromotionDetail,
getStandardPromotionProjectId,
saveStandardPromotion,
startStandardPromotion
} from '@api/workCenter'
export default {
name: 'StandardPromotionProcess',
@@ -80,7 +90,6 @@ export default {
return {
loading: false,
switchValue: 'base',
disabled: false,
labelCol: {
xs: { span: 24 },
sm: { span: 4 }
@@ -97,8 +106,17 @@ export default {
xs: { span: 24 },
sm: { span: 22 }
},
currentNode: '1',
personnelInfoData: [], // 人员信息数据
// 流程key
processKey: ProcessKey.STANDARD_PROMOTION.value,
// 当前流程信息
StandardPromotion,
info: {},
formInfo: {},
currentNode: '',
currentNodeName: '',
// 项目id
projectId: '',
btn: 0,
validatorRules: {
// 流程名称
processName: {
@@ -122,37 +140,222 @@ export default {
validateTrigger: 'blur'
}
},
// 流程表单
processInfoForm: this.$form.createForm(this),
baseInfoForm: this.$form.createForm(this),
approvalInfoForm: this.$form.createForm(this),
url: {
list: '' // 人员信息右侧表的分页查询接口
}
// 流程审批信息表单
approvalInfoForm: this.$form.createForm(this)
}
},
computed: {
pageTitle () {
return this.$t('flowCenter') + this.$route.meta.title
return this.$t('flowCenter') + this.$route.meta.title + '' + this.nodeTitle + ''
},
// 节点标题
nodeTitle () {
return this.$route.query.taskName || StandardPromotion.initiate.text
},
// 禁用业务表单
disabled () {
return !this.isInitiate
},
// 流程信息禁用
processDisabled () {
return +this.currentNode > 1
return this.currentNode !== StandardPromotion.initiate.value
},
// 是否发起节点(节点1
isInitiate () {
return this.currentNode === StandardPromotion.initiate.value
}
// leaderApproval
// standardApproval
},
created () {
const { projectId, nodeId, taskName } = this.$route.query
// 发起、草稿进来没有nodeId,就默认发起节点
this.currentNode = nodeId || StandardPromotion.initiate.value
this.currentNodeName = taskName || StandardPromotion.initiate.text
this.projectId = projectId
this.btn = StandardPromotion.propertyOfValue('btn', this.currentNode) || 0
// 如果有nodeId,但是匹配不到任何节点,就是是增加的审批节点
if (nodeId && !StandardPromotion.keyOfValue(nodeId)) {
// 提交按钮
this.btn = 4
}
// 如果是待办进来,就获取详情数据
if (this.$route.query.projectId) {
this.loadPage()
return
}
// 如果是新建进来,就获取项目id
this.getProjectId()
},
methods: {
switchChange (value) {
this.switchValue = value
/**
* 获取项目id
*/
getProjectId () {
this.loading = true
// 否则就是创建一个新的流程
getStandardPromotionProjectId().then(res => {
if (res) {
this.projectId = res + ''
}
}).finally(() => {
this.loading = false
})
},
handleSave () {
// if (this.loading) return
/**
* 获取页面详情
*/
loadPage () {
const { projectId, taskId } = this.$route.query
this.loading = true
// 获取业务数据
getStandardPromotionDataById({ projectId: this.projectId }).then(res => {
if (res.success) {
const data = res.result || {}
// 保存并回显表单信息
this.formInfo = data
this.$nextTick(() => {
this.$refs.baseInfoForm.initData(data)
})
}
})
// 获取流程数据
getStandardPromotionDetail({
projectId,
taskId
}).then(res => {
if (res.success) {
const data = res.result || {}
const processAll = data.processAll || {}
const processApprovalRecord = data.processApprovalRecord || {}
this.info = data
// 页面回显
this.processInfoForm && this.processInfoForm.setFieldsValue({
prcName: processAll.prcName,
dueTime: processAll.dueTime,
prcMes: processAll.prcMes
})
this.approvalInfoForm && this.approvalInfoForm.setFieldsValue({
commitText: processApprovalRecord.commitText,
commitFile: processApprovalRecord.commitFile
})
}
}).finally(() => {
this.loading = false
})
},
// 获取页面参数
async getPageParams (isValidate = true) {
const params = {}
// 收集所有表单信息
let formDataList = []
if (isValidate) {
formDataList = await this.validateFormList(this.processInfoForm, this.approvalInfoForm)
formDataList[2] = await this.$refs.baseInfoForm.getDataValidate()
} else {
formDataList = [
this.processInfoForm.getFieldsValue(),
this.approvalInfoForm.getFieldsValue(),
this.$refs.baseInfoForm.getData()
]
}
// 开始处理信息
// 流程信息
params.processAll = Object.assign({}, this.info.processAll, formDataList[0], {
projectId: this.projectId,
taskId: this.$route.query.taskId
})
// 处理其他参数
params.map = Object.assign({}, {
initiator: this.$store.getters.userInfo.id
})
// 流程审批信息
params.processApprovalRecord = Object.assign({}, this.info.processApprovalRecord, formDataList[1], {
projectId: this.projectId
})
// 业务信息
params.processEsDeclare = Object.assign({}, formDataList[2], {
projectId: this.projectId,
id: this.formInfo.id
})
return params
},
/**
* 保存
*/
handleSave () {
if (this.loading) return
this.loading = true
this.getPageParams(false).then(res => {
console.log(res)
return saveStandardPromotion(res)
}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).catch((err) => {
console.log(err)
}).finally(() => {
this.loading = false
})
},
/**
* 提交
*/
handleSubmit () {
if (this.loading) return
this.currentNode = +this.currentNode + 1 + ''
this.loading = true
this.getPageParams().then(res => {
console.log(res)
return startStandardPromotion(res)
}).then(res => {
if (res.success) {
this.$message.success(res.message)
this.goBack()
} else {
this.$message.warn(res.message)
}
}).catch((err) => {
console.log(err)
}).finally(() => {
this.loading = false
})
},
handleAgree () {
if (this.loading) return
this.currentNode = +this.currentNode + 1 + ''
/**
* 验证所有表单
* @param formList - 多个需要校验的表单实例
*/
validateFormList (...formList) {
const promiseList = []
for (const form of formList) {
promiseList.push(
new Promise((resolve, reject) => {
form.validateFields((err, val) => {
if (!err) {
resolve(val)
} else {
reject(err)
}
})
})
)
}
return Promise.all(promiseList).catch(() => {
throw new Error('base')
})
},
handleCancel () {
this.goBack()
}
}
}