|
|
@@ -1,6 +1,8 @@
|
|
|
import { doEndProcess, doAddSignTask, lock, unlock, suspendProcess, recoverProcess } from '@/api/platform/bpmn/bpmTask'
|
|
|
import { agree, oppose, abandon, reject, rejectToStarter, rejectToPrevious, bpmTaskSave } from '@/api/platform/bpmn/bpmTask'
|
|
|
import { startFlow, saveDraft } from '@/api/platform/bpmn/bpmInst'
|
|
|
+import { saveFormData } from '@/api/platform/data/dataTemplate'
|
|
|
+import { changeCompleteTime, replenishSnapshot } from '@/api/platform/bpmn/bpmInstHis'
|
|
|
import Print from '@/utils/print'
|
|
|
import request from '@/business/platform/form/utils/custom/joinCURD.js'
|
|
|
import { snapshoot } from '@/api/platform/file/attachment'
|
|
|
@@ -33,13 +35,12 @@ export default {
|
|
|
this.submitFormOpinion = this.getFormOpinionData()
|
|
|
switch (buttonType) {
|
|
|
case 'agree':// 同意
|
|
|
- // 判断是否最后一步流程
|
|
|
- if (this.actionTitle === '同意并结束') {
|
|
|
- this.setData('已完成')
|
|
|
- } else {
|
|
|
- this.setData()
|
|
|
- }
|
|
|
+ this.setData()
|
|
|
+ // if (this.isHide()) {
|
|
|
this.handleDirectActionEvent(actionName)
|
|
|
+ // } else {
|
|
|
+ // this.agreeDialogVisible = true
|
|
|
+ // }
|
|
|
break
|
|
|
case 'oppose':// 反对
|
|
|
this_.$confirm(
|
|
|
@@ -51,8 +52,12 @@ export default {
|
|
|
type: 'warning'
|
|
|
}
|
|
|
).then(() => {
|
|
|
+ // if (this.isHide()) {
|
|
|
this.setData('未同意')
|
|
|
this.handleDirectActionEvent(actionName)
|
|
|
+ // } else {
|
|
|
+ // this.agreeDialogVisible = true
|
|
|
+ // }
|
|
|
}).catch(() => { })
|
|
|
break
|
|
|
case 'abandon':// 弃权
|
|
|
@@ -85,7 +90,7 @@ export default {
|
|
|
this.instanceDetailVisible = true
|
|
|
break
|
|
|
case 'startFlow': // 启动流程
|
|
|
- if (this.actionTitle === '同意并结束') {
|
|
|
+ if (this.actionTitle === '同意并结束' || this.actionTitle === '提交并结束') {
|
|
|
this.setData('已完成')
|
|
|
} else {
|
|
|
this.setData('已编制')
|
|
|
@@ -101,6 +106,11 @@ export default {
|
|
|
case 'rejectToStart':// 驳回发起人
|
|
|
case 'reject':// 驳回
|
|
|
this.setData('已退回')
|
|
|
+ // if (this.isBpmOpinionHide && actionName === 'rejectToPrevious') {
|
|
|
+ // this.handleDirectActionEvent(actionName)
|
|
|
+ // } else {
|
|
|
+ // this.rejectDialogVisible = true
|
|
|
+ // }
|
|
|
this.rejectDialogVisible = true
|
|
|
break
|
|
|
case 'delegate':// 转办
|
|
|
@@ -140,6 +150,10 @@ export default {
|
|
|
case 'save':// 节点按钮设置-保存
|
|
|
// this.setData('已暂存')
|
|
|
this.handleSave()
|
|
|
+ break
|
|
|
+ case 'timeModification':// 节点按钮设置-修改时间
|
|
|
+ this.handleTimeModification()
|
|
|
+
|
|
|
break
|
|
|
default:
|
|
|
break
|
|
|
@@ -160,7 +174,7 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
if (!formData) return
|
|
|
- const replaceFormData = this.$utils.replaceNullWithEmpty(formData)
|
|
|
+ const replaceFormData = this.$common.replaceNullWithEmpty(formData)
|
|
|
bpmTaskSave({
|
|
|
taskId: this.taskId,
|
|
|
data: JSON.stringify(replaceFormData),
|
|
|
@@ -189,7 +203,7 @@ export default {
|
|
|
if (firstNodeUserAssign) {
|
|
|
const formData = this.getFormData()
|
|
|
if (!formData) return
|
|
|
- this.submitFormData = this.$utils.replaceNullWithEmpty(formData)
|
|
|
+ this.submitFormData = this.$common.replaceNullWithEmpty(formData)
|
|
|
this.startFlowDialogVisible = true
|
|
|
} else {
|
|
|
this.saveStartFlow()
|
|
|
@@ -202,10 +216,14 @@ export default {
|
|
|
saveStartFlow (params = {}) {
|
|
|
const formData = this.getFormData()
|
|
|
if (!formData) return
|
|
|
+ // 暂存后直接提交,已有数据ID
|
|
|
+ if (this.$utils.isNotEmpty(this.bizKey)) {
|
|
|
+ formData.id = this.bizKey || ''
|
|
|
+ }
|
|
|
const jsonData = {
|
|
|
defId: this.defId,
|
|
|
version: this.version || '0',
|
|
|
- data: JSON.stringify(this.$utils.replaceNullWithEmpty(formData))
|
|
|
+ data: JSON.stringify(this.$common.replaceNullWithEmpty(formData))
|
|
|
}
|
|
|
if (this.$utils.isNotEmpty(params.nodeUsers)) {
|
|
|
jsonData.nodeUsers = JSON.stringify(params.nodeUsers) || ''
|
|
|
@@ -252,10 +270,14 @@ export default {
|
|
|
const formData = this.getFormData()
|
|
|
if (!formData) return
|
|
|
|
|
|
+ if (this.$utils.isNotEmpty(this.bizKey)) {
|
|
|
+ formData.id = this.bizKey || ''
|
|
|
+ }
|
|
|
+
|
|
|
const jsonData = {
|
|
|
defId: this.defId,
|
|
|
version: this.version || '',
|
|
|
- data: JSON.stringify(this.$utils.replaceNullWithEmpty(formData))
|
|
|
+ data: JSON.stringify(this.$common.replaceNullWithEmpty(formData))
|
|
|
}
|
|
|
if (this.$utils.isNotEmpty(this.proInstId) && !this.copyFlow) {
|
|
|
jsonData.proInstId = this.proInstId || ''
|
|
|
@@ -267,6 +289,9 @@ export default {
|
|
|
})
|
|
|
saveDraft(jsonData).then(response => {
|
|
|
loading.close()
|
|
|
+ const { proInstId, bizKey } = response.variables || {}
|
|
|
+ this.proInstId = proInstId
|
|
|
+ this.bizKey = bizKey
|
|
|
this.$alert(`保存成功!`, {
|
|
|
showClose: false
|
|
|
}).then(() => {
|
|
|
@@ -276,7 +301,7 @@ export default {
|
|
|
variables: response.variables
|
|
|
}, () => {
|
|
|
// 回调上个页面
|
|
|
- this.callbackPage()
|
|
|
+ // this.callbackPage()
|
|
|
})
|
|
|
}).catch(() => { })
|
|
|
}).catch(() => {
|
|
|
@@ -315,7 +340,7 @@ export default {
|
|
|
text: this.$t('common.saving')
|
|
|
})
|
|
|
params.taskId = this.taskId
|
|
|
- params.data = JSON.stringify(this.$utils.replaceNullWithEmpty(formData))
|
|
|
+ params.data = JSON.stringify(this.$common.replaceNullWithEmpty(formData))
|
|
|
|
|
|
if (actionName === 'agree') {
|
|
|
agree(params).then(response => {
|
|
|
@@ -651,7 +676,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
const sql = `select * from t_lcidglbdbb where tablekey_ = '${code}' and ti_jiao_kuai_zhao = '是' and gui_dang_lei_xing = 'process' and (liu_cheng_xuan_ze = (select PROC_DEF_KEY_ from ibps_bpm_inst where id_ = '${instId}' limit 1) or liu_cheng_xuan_ze = (select PROC_DEF_KEY_ from ibps_bpm_inst_his where id_ = '${instId}' limit 1))`
|
|
|
- request('sql', sql).then(async res => {
|
|
|
+ this.$common.request('sql', sql).then(async res => {
|
|
|
const { data = [] } = res.variables || {}
|
|
|
// 轮询流程是否结束,流程未结束不生成快照,每2秒查询一次,最多等待10秒钟
|
|
|
let timeout = 10000
|
|
|
@@ -667,30 +692,35 @@ export default {
|
|
|
await new Promise(resolve => setTimeout(resolve, intervalTime))
|
|
|
}
|
|
|
if (!data.length) {
|
|
|
- // this.updateState(id, code, '1', null)
|
|
|
+ this.updateState(id, code, '已完成', null)
|
|
|
return
|
|
|
}
|
|
|
- const path = data[0].bao_biao_lu_jing_.split('.rpx')[0]
|
|
|
- const url = this.$getReportFile(`罗医细胞质量检测实验室/${path}`, `id_=${id}`)
|
|
|
- const now = new Date(new Date().getTime() + 28800000).toJSON().slice(0, 16).replace(/[-:T]/g, '')
|
|
|
- const fileName = name + now
|
|
|
- console.log(url, fileName)
|
|
|
+ const paths = data[0].bao_biao_lu_jing_ ? data[0].bao_biao_lu_jing_.split(',') : []
|
|
|
+ if (!paths.length) {
|
|
|
+ this.$message.error('未配置快照路径!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 延迟生成快照,避免数据获取失败
|
|
|
setTimeout(() => {
|
|
|
- snapshoot({
|
|
|
- url,
|
|
|
- name: fileName,
|
|
|
- type: 'pdf'
|
|
|
- }).then(res => {
|
|
|
- if (!res.data || !res.data.id) {
|
|
|
+ Promise.all(paths.map(path => {
|
|
|
+ const url = this.$getReportFile(path, `id_=${id}`)
|
|
|
+ const fileName = name + this.$common.getDateNow(16, 'string')
|
|
|
+ console.log(url, fileName)
|
|
|
+ return this.$common.snapshoot({
|
|
|
+ url,
|
|
|
+ name: fileName,
|
|
|
+ type: 'pdf'
|
|
|
+ })
|
|
|
+ })).then(results => {
|
|
|
+ const ids = results.map(result => result.data.id)
|
|
|
+ if (!ids.length) {
|
|
|
this.$message.error('生成快照失败!')
|
|
|
}
|
|
|
- const fileId = res.data && res.data.id ? res.data.id : ''
|
|
|
- const fileParams = fileId ? { kuai_zhao_: fileId } : {}
|
|
|
- this.updateState(id, code, '', fileParams)
|
|
|
+ const fileParams = ids.length ? { kuai_zhao_: ids.join(',') } : {}
|
|
|
+ this.updateState(id, code, '已完成', fileParams)
|
|
|
}).catch(() => {
|
|
|
- // 生成快照接口调用失败时,也需要更新状态为已完成
|
|
|
this.$message.error('提交快照生成失败!')
|
|
|
- this.updateState(id, code, '1')
|
|
|
+ this.updateState(id, code, '已完成')
|
|
|
})
|
|
|
}, 300)
|
|
|
})
|
|
|
@@ -698,13 +728,12 @@ export default {
|
|
|
// 判断流程是否结束
|
|
|
async isFinish (id) {
|
|
|
const sql = `select * from ibps_bpm_inst_his where id_ = '${id}'`
|
|
|
- const res = await request('sql', sql)
|
|
|
+ const res = await this.$common.request('sql', sql)
|
|
|
const { data = [] } = res.variables || {}
|
|
|
return data.length > 0
|
|
|
},
|
|
|
// 更新数据状态
|
|
|
updateState (id, code, state, fileParams) {
|
|
|
- const t = state ? { shi_fou_guo_shen_: state } : {}
|
|
|
const params = {
|
|
|
tableName: `t_${code}`,
|
|
|
updList: [{
|
|
|
@@ -712,12 +741,89 @@ export default {
|
|
|
id_: id
|
|
|
},
|
|
|
param: {
|
|
|
- ...t,
|
|
|
+ shi_fou_guo_shen_: state,
|
|
|
...fileParams
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
|
- request('updatesByWhere', params)
|
|
|
+ this.$common.request('update', params)
|
|
|
+ },
|
|
|
+ // 修改流程时间
|
|
|
+
|
|
|
+ async handleTimeModification () {
|
|
|
+ // 表单参数
|
|
|
+ const { code = '', name = '' } = this.getFormEL().formDefData || {}
|
|
|
+ const jsonData = {
|
|
|
+ boCode: code,
|
|
|
+ version: 0,
|
|
|
+ formKey: this.dataResultitem.formKey,
|
|
|
+ pk: this.dataResultitem.bizKey,
|
|
|
+ data: JSON.stringify(this.$common.replaceNullWithEmpty(this.getFormData()))
|
|
|
+ }
|
|
|
+ // 流程参数
|
|
|
+ const defData = this.formParams.formOpinionData.opinionList
|
|
|
+ // 快照参数
|
|
|
+
|
|
|
+ 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 {
|
|
|
+ this.timeModification_ = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存流程数据生成快照
|
|
|
+ async timeModify (data) {
|
|
|
+ await changeCompleteTime(data).then(response => {
|
|
|
+ if (response.state === 200) {
|
|
|
+ this.$message.success('修改成功!')
|
|
|
+ this.callbackPage()
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.message)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 保存表单数据生成快照
|
|
|
+ async saveData (data, sflc, defData, snapshot) {
|
|
|
+ await saveFormData(data).then(response => {
|
|
|
+ if (sflc) {
|
|
|
+ this.timeModify(defData)
|
|
|
+ } else {
|
|
|
+ this.repleceSnapshot(snapshot)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // 生成快照
|
|
|
+ async repleceSnapshot (data) {
|
|
|
+ await replenishSnapshot(data).then(response => {
|
|
|
+ if (response.state === 200) {
|
|
|
+ this.$message.success('生成快照成功!')
|
|
|
+ this.callbackPage()
|
|
|
+ } else {
|
|
|
+ this.$message.error(response.message)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|