|
|
@@ -178,19 +178,19 @@ export default {
|
|
|
data: JSON.stringify(replaceFormData),
|
|
|
opinion
|
|
|
}).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`已保存表单内容!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`已保存表单内容!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
// this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -240,22 +240,22 @@ export default {
|
|
|
})
|
|
|
// 1、直接启动
|
|
|
startFlow(jsonData).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`启动成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- const { bizKey = '', proInstId = '' } = response.variables || {}
|
|
|
- // this.createSnapshot(bizKey, proInstId)
|
|
|
- this.startFlowDialogVisible = false
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ const { bizKey = '', proInstId = '' } = response.variables || {}
|
|
|
+ // this.createSnapshot(bizKey, proInstId)
|
|
|
+ this.startFlowDialogVisible = false
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`启动成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
@@ -286,22 +286,22 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
saveDraft(jsonData).then(response => {
|
|
|
- loading.close()
|
|
|
const { proInstId, bizKey } = response.variables || {}
|
|
|
this.proInstId = proInstId
|
|
|
this.bizKey = bizKey
|
|
|
- this.$alert(`保存成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`保存成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
// this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
@@ -361,47 +361,48 @@ export default {
|
|
|
})
|
|
|
} else if (actionName === 'rejectToPrevious') {
|
|
|
rejectToPrevious(params).then(response => {
|
|
|
- this.handleResponse(actionName, loading, response)
|
|
|
+ this.handleResponse(actionName, loading, response, params)
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
} else if (actionName === 'rejectToStart') {
|
|
|
rejectToStarter(params).then(response => {
|
|
|
- this.handleResponse(actionName, loading, response)
|
|
|
+ this.handleResponse(actionName, loading, response, params)
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
} else if (actionName === 'reject') {
|
|
|
reject(params).then(response => {
|
|
|
- this.handleResponse(actionName, loading, response)
|
|
|
+ this.handleResponse(actionName, loading, response, params)
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- handleResponse (actionName, loading, response) {
|
|
|
- loading.close()
|
|
|
- this.$alert(response.message, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 关闭窗口
|
|
|
- if (actionName === 'agree' || actionName === 'oppose' || actionName === 'abandon') {
|
|
|
- this.agreeDialogVisible = false
|
|
|
- } else if (actionName === 'rejectToPrevious' || actionName === 'rejectToStart' || actionName === 'reject') {
|
|
|
- this.rejectDialogVisible = false
|
|
|
- }
|
|
|
- if (actionName === 'agree') {
|
|
|
- // this.createSnapshot()
|
|
|
- }
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ handleResponse (actionName, loading, response, params) {
|
|
|
+ // 关闭窗口
|
|
|
+ if (actionName === 'agree' || actionName === 'oppose' || actionName === 'abandon') {
|
|
|
+ this.agreeDialogVisible = false
|
|
|
+ } else if (actionName === 'rejectToPrevious' || actionName === 'rejectToStart' || actionName === 'reject') {
|
|
|
+ this.rejectDialogVisible = false
|
|
|
+ }
|
|
|
+ if (actionName === 'agree') {
|
|
|
+ // this.createSnapshot()
|
|
|
+ }
|
|
|
+ this.getFormEL().rejectParams = params || {}
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(response.message, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
},
|
|
|
handleEndProcess () {
|
|
|
if (this.isBpmOpinionHide) {
|
|
|
@@ -430,23 +431,23 @@ export default {
|
|
|
taskId: this.taskId ? this.taskId : this.endProcessTaskId,
|
|
|
endReason: params.opinion
|
|
|
}).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(response.message, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- this.approveDialogVisible = false
|
|
|
- // 更改数据状态为已终止
|
|
|
- const { code = '' } = this.getFormEL().formDefData || {}
|
|
|
- const { id = '' } = this.getFormEL().formData || {}
|
|
|
- if (!id || !code) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.updateState(id, code, '已终止', null)
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ this.approveDialogVisible = false
|
|
|
+ // 更改数据状态为已终止
|
|
|
+ const { code = '' } = this.getFormEL().formDefData || {}
|
|
|
+ const { id = '' } = this.getFormEL().formData || {}
|
|
|
+ if (!id || !code) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.updateState(id, code, '已终止', null)
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(response.message, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
})
|
|
|
@@ -470,16 +471,16 @@ export default {
|
|
|
messageType: params.messageType,
|
|
|
addReason: params.opinion
|
|
|
}).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(response.message, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- this.addSignTaskDialogVisible = false
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ this.addSignTaskDialogVisible = false
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(response.message, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
})
|
|
|
@@ -523,19 +524,19 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
lock({ taskId: this.taskId }).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`锁定任务成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`锁定任务成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
@@ -553,19 +554,19 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
unlock({ taskId: this.taskId }).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`解锁任务成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`解锁任务成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
@@ -583,19 +584,19 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
unlock({ taskId: this.taskId }).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`强制解锁任务成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`强制解锁任务成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
@@ -613,19 +614,19 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
suspendProcess({ taskId: this.taskId }).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`挂起任务成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`挂起任务成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
+ }).catch(() => { })
|
|
|
+ })
|
|
|
}).catch(() => {
|
|
|
loading.close()
|
|
|
})
|
|
|
@@ -645,15 +646,15 @@ export default {
|
|
|
recoverProcess({
|
|
|
taskId: this.taskId
|
|
|
}).then(response => {
|
|
|
- loading.close()
|
|
|
- this.$alert(`恢复任务成功!`, {
|
|
|
- showClose: false
|
|
|
- }).then(() => {
|
|
|
- // 后置事件
|
|
|
- this.afterScript(this.actionName, {
|
|
|
- data: response.data,
|
|
|
- variables: response.variables
|
|
|
- }, () => {
|
|
|
+ // 后置事件
|
|
|
+ this.afterScript(this.actionName, {
|
|
|
+ data: response.data,
|
|
|
+ variables: response.variables
|
|
|
+ }, () => {
|
|
|
+ loading.close()
|
|
|
+ this.$alert(`恢复任务成功!`, {
|
|
|
+ showClose: false
|
|
|
+ }).then(() => {
|
|
|
// 回调上个页面
|
|
|
this.callbackPage()
|
|
|
})
|
|
|
@@ -750,60 +751,59 @@ export default {
|
|
|
// 修改流程时间
|
|
|
|
|
|
async handleTimeModification () {
|
|
|
- // 表单参数
|
|
|
+ // 获取表单数据
|
|
|
const { code = '', name = '' } = this.getFormEL().formDefData || {}
|
|
|
+ const currentFormData = this.$common.replaceNullWithEmpty(this.getFormData())
|
|
|
const jsonData = {
|
|
|
boCode: code,
|
|
|
version: 0,
|
|
|
formKey: this.dataResultitem.formKey,
|
|
|
pk: this.dataResultitem.bizKey,
|
|
|
- data: JSON.stringify(this.$common.replaceNullWithEmpty(this.getFormData()))
|
|
|
+ data: JSON.stringify(currentFormData),
|
|
|
+ // 接口新增参数,是否记录操作日志
|
|
|
+ addLog: true
|
|
|
}
|
|
|
- // 流程参数
|
|
|
- const defData = this.formParams.formOpinionData.opinionList
|
|
|
- // 快照参数
|
|
|
|
|
|
+ // 获取流程意见数据
|
|
|
+ const { opinionList, formOpinionNodeData } = this.formParams.formOpinionData || {}
|
|
|
const snapshot = { id: this.instanceId_ }
|
|
|
|
|
|
- // console.log(JSON.stringify(this.$common.replaceNullWithEmpty(this.formDataBF)), JSON.stringify(this.$common.replaceNullWithEmpty(this.getFormData())))
|
|
|
- // console.log(this.formDataBF)
|
|
|
- if (this.timeModification_) {
|
|
|
- if (JSON.stringify(this.$common.replaceNullWithEmpty(this.formDataBF)) === JSON.stringify(this.$common.replaceNullWithEmpty(this.getFormData()))) {
|
|
|
- // console.log('aa')
|
|
|
- if (JSON.stringify(defData) === JSON.stringify(this.opinionListBF)) {
|
|
|
- // console.log('aa')
|
|
|
- } else {
|
|
|
- await this.timeModify(defData)
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (JSON.stringify(defData) === JSON.stringify(this.opinionListBF)) {
|
|
|
- await this.saveData(jsonData, false, defData, snapshot)
|
|
|
- } else {
|
|
|
- await this.saveData(jsonData, true, defData, snapshot)
|
|
|
- }
|
|
|
- }
|
|
|
- // this.timeModification_ = false
|
|
|
- } else {
|
|
|
+ if (!this.timeModification_) {
|
|
|
this.timeModification_ = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查数据变更状态
|
|
|
+ const isFormDataChanged = JSON.stringify(this.$common.replaceNullWithEmpty(this.formDataBF)) !== JSON.stringify(currentFormData)
|
|
|
+ const isOpinionChanged = JSON.stringify(opinionList) !== JSON.stringify(this.opinionListBF)
|
|
|
+
|
|
|
+ // 根据变更状态执行相应操作
|
|
|
+ if (!isFormDataChanged && isOpinionChanged) {
|
|
|
+ const opinionNodeList = Object.values(formOpinionNodeData).filter(Array.isArray).flat()
|
|
|
+ await this.timeModify(opinionNodeList)
|
|
|
+ } else if (isFormDataChanged) {
|
|
|
+ await this.saveData(jsonData, isOpinionChanged, opinionList, snapshot)
|
|
|
}
|
|
|
},
|
|
|
// 保存流程数据生成快照
|
|
|
async timeModify (data) {
|
|
|
- await changeCompleteTime(data).then(response => {
|
|
|
+ try {
|
|
|
+ const response = await changeCompleteTime(data)
|
|
|
if (response.state === 200) {
|
|
|
this.$message.success('修改成功!')
|
|
|
this.callbackPage()
|
|
|
} else {
|
|
|
this.$message.error(response.message)
|
|
|
}
|
|
|
- }).catch(() => {
|
|
|
- })
|
|
|
+ } catch (error) {
|
|
|
+ console.error('修改时间失败:', error)
|
|
|
+ }
|
|
|
},
|
|
|
// 保存表单数据生成快照
|
|
|
- async saveData (data, sflc, defData, snapshot) {
|
|
|
+ async saveData (data, sflc, opinionList, snapshot) {
|
|
|
await saveFormData(data).then(response => {
|
|
|
if (sflc) {
|
|
|
- this.timeModify(defData)
|
|
|
+ this.timeModify(opinionList)
|
|
|
} else {
|
|
|
this.repleceSnapshot(snapshot)
|
|
|
}
|