|
|
@@ -16,11 +16,13 @@ import {
|
|
|
bpmTaskSave
|
|
|
} from '@/api/platform/bpmn/bpmTask'
|
|
|
import { startFlow, saveDraft } from '@/api/platform/bpmn/bpmInst'
|
|
|
-import { saveFormData } from '@/api/platform/data/dataTemplate'
|
|
|
+import { removeFormData, saveFormData } from '@/api/platform/data/dataTemplate'
|
|
|
import {
|
|
|
changeCompleteTime,
|
|
|
- replenishSnapshot
|
|
|
+ replenishSnapshot,
|
|
|
+ modifyData
|
|
|
} from '@/api/platform/bpmn/bpmInstHis'
|
|
|
+import { revocation } from '@/api/platform/bpmn/bpmTask'
|
|
|
import Print from '@/utils/print'
|
|
|
|
|
|
export default {
|
|
|
@@ -178,6 +180,12 @@ export default {
|
|
|
case 'timeModification': // 节点按钮设置-修改时间
|
|
|
this.handleTimeModification()
|
|
|
|
|
|
+ break
|
|
|
+ case 'revocation': // 节点按钮设置-撤回
|
|
|
+ this.handleRevocation()
|
|
|
+ break
|
|
|
+ case 'restart': // 节点按钮设置-重新发起
|
|
|
+ this.handleRestart()
|
|
|
break
|
|
|
default:
|
|
|
break
|
|
|
@@ -249,19 +257,51 @@ export default {
|
|
|
this.saveStartFlow()
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 处理重新发起数据
|
|
|
+ */
|
|
|
+ dealReStartData(data, type) {
|
|
|
+ if (type === 'obj') {
|
|
|
+ for (const key in data) {
|
|
|
+ if (key === 'id') {
|
|
|
+ data.id = ''
|
|
|
+ } else if (key === 'shiFouGuoShen') {
|
|
|
+ data.shiFouGuoShen = ''
|
|
|
+ } else if (key === 'tenantId') {
|
|
|
+ data.tenantId = ''
|
|
|
+ } else if (key === 'parentId') {
|
|
|
+ data.parentId = ''
|
|
|
+ } else if (Array.isArray(data[key]) && data[key].length > 0) {
|
|
|
+ this.dealReStartData(data[key], 'arr')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (type === 'arr') {
|
|
|
+ data.forEach((e) => {
|
|
|
+ this.dealReStartData(e, 'obj')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 保存启动流程
|
|
|
* @param {*}
|
|
|
*/
|
|
|
saveStartFlow(params = {}) {
|
|
|
const formData = this.getFormData()
|
|
|
+ const {
|
|
|
+ formData: oldFormData,
|
|
|
+ formDefData,
|
|
|
+ params: oldParams
|
|
|
+ } = this.getFormEL() || {}
|
|
|
if (!formData) return
|
|
|
+ if (this.reSign && this.reSign === 'reStart') {
|
|
|
+ this.dealReStartData(formData, 'obj')
|
|
|
+ }
|
|
|
// 暂存后直接提交,已有数据ID
|
|
|
if (this.$utils.isNotEmpty(this.bizKey)) {
|
|
|
formData.id = this.bizKey || ''
|
|
|
}
|
|
|
const jsonData = {
|
|
|
- defId: this.defId,
|
|
|
+ defId: this.defId || this.redefId,
|
|
|
version: this.version || '0',
|
|
|
data: JSON.stringify(this.$common.replaceNullWithEmpty(formData))
|
|
|
}
|
|
|
@@ -286,6 +326,31 @@ export default {
|
|
|
const { bizKey = '', proInstId = '' } = response.variables || {}
|
|
|
// this.createSnapshot(bizKey, proInstId)
|
|
|
this.startFlowDialogVisible = false
|
|
|
+ // 重新启动历史数据处理
|
|
|
+ if (
|
|
|
+ this.reSign &&
|
|
|
+ this.reSign === 'reStart' &&
|
|
|
+ this.decision &&
|
|
|
+ this.decision === 'confirm'
|
|
|
+ ) {
|
|
|
+ modifyData({
|
|
|
+ instId: oldParams.instanceId
|
|
|
+ })
|
|
|
+ .then((responserfd) => {})
|
|
|
+ .catch(() => {})
|
|
|
+ } else if (
|
|
|
+ this.reSign &&
|
|
|
+ this.reSign === 'reStart' &&
|
|
|
+ this.decision &&
|
|
|
+ this.decision === 'cancel'
|
|
|
+ ) {
|
|
|
+ removeFormData({
|
|
|
+ formKey: formDefData.key,
|
|
|
+ ids: oldFormData.id
|
|
|
+ })
|
|
|
+ .then((responserfd) => {})
|
|
|
+ .catch(() => {})
|
|
|
+ }
|
|
|
// 后置事件
|
|
|
this.afterScript(
|
|
|
this.actionName,
|
|
|
@@ -925,8 +990,82 @@ export default {
|
|
|
}
|
|
|
this.$common.request('update', params)
|
|
|
},
|
|
|
+ // 流程撤回按钮
|
|
|
+ async handleRevocation() {
|
|
|
+ const currentFormData = this.$common.replaceNullWithEmpty(
|
|
|
+ this.getFormData()
|
|
|
+ )
|
|
|
+ const { instanceId = '' } = this.getFormEL().params || {}
|
|
|
+ currentFormData.shiFouGuoShen = '已撤回'
|
|
|
+ let param = {
|
|
|
+ data: JSON.stringify(currentFormData),
|
|
|
+ taskId: instanceId,
|
|
|
+ backHandMode: 'normal',
|
|
|
+ destination: '',
|
|
|
+ opinion: '撤回修改',
|
|
|
+ rejectMode: 'reject'
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const response = await revocation(param)
|
|
|
+ if (response.state === 200) {
|
|
|
+ const params = {
|
|
|
+ tableName: `IBPS_BPM_APPROVAL`,
|
|
|
+ updList: [
|
|
|
+ {
|
|
|
+ where: {
|
|
|
+ TASK_ID_: response.variables.data,
|
|
|
+ PROC_INST_ID_: instanceId
|
|
|
+ },
|
|
|
+ param: {
|
|
|
+ STATUS_: 'recall'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ this.$common.request('update', params).then((r) => {
|
|
|
+ this.$message.success('撤回成功!')
|
|
|
+ this.callbackPage()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.message)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('撤回失败:', error)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 重新发起
|
|
|
+ async handleRestart() {
|
|
|
+ if (!this.timeModification_) {
|
|
|
+ this.timeModification_ = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const { code = '', name = '' } = this.getFormEL().formDefData || {}
|
|
|
+ const currentFormData = this.$common.replaceNullWithEmpty(
|
|
|
+ this.getFormData()
|
|
|
+ )
|
|
|
+ const { instanceId = '' } = this.getFormEL().params || {}
|
|
|
+ let redefIdData = await this.$common.request('query', {
|
|
|
+ key: 'getReDefId',
|
|
|
+ params: [instanceId]
|
|
|
+ })
|
|
|
+ this.redefId = redefIdData.variables.data[0].PROC_DEF_ID_
|
|
|
+ this.$confirm('是否保留历史数据?', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ confirmButtonText: '是',
|
|
|
+ cancelButtonText: '否'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.reSign = 'reStart'
|
|
|
+ this.decision = 'confirm'
|
|
|
+ this.handleStartFlow()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.reSign = 'reStart'
|
|
|
+ this.decision = 'cancel'
|
|
|
+ this.handleStartFlow()
|
|
|
+ })
|
|
|
+ },
|
|
|
// 修改流程时间
|
|
|
-
|
|
|
async handleTimeModification() {
|
|
|
// 获取表单数据
|
|
|
const { code = '', name = '' } = this.getFormEL().formDefData || {}
|