|
|
@@ -37,6 +37,9 @@
|
|
|
<script>
|
|
|
import IbpsLinkData from '@/business/platform/data/templaterender/link-data'
|
|
|
import IbpsCustomDialog from '@/business/platform/data/templaterender/custom-dialog'
|
|
|
+import { formatDate } from '@/utils/date'
|
|
|
+import ActionUtils from '@/utils/action'
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
IbpsLinkData,
|
|
|
@@ -100,6 +103,7 @@ export default {
|
|
|
updLists.push(dataWhere)
|
|
|
}
|
|
|
const param = { tableName: 't_lhjczb', updList: updLists }
|
|
|
+ this.reassign(this_, template, projectIds, this.jianCeYuan)
|
|
|
this_.$curdPost('updatesByWhere', JSON.stringify(param)).then(() => {
|
|
|
template.$message.success('重新分配成功。')
|
|
|
template.search()
|
|
|
@@ -108,6 +112,110 @@ export default {
|
|
|
template.$message.error('分配失败,请重新再试。')
|
|
|
this.closeDialog()
|
|
|
})
|
|
|
+ },
|
|
|
+ getTaskData (this_, businessKey) {
|
|
|
+ const order = businessKey.replace(/,/g, "','")
|
|
|
+ const sql = `select a.businesskey_ as businessKey, b.task_id_ as taskId,b.proc_inst_id_ as procInstId, b.node_id_ as nodeId from ibps_bpm_bus_rel a left join ibps_bpm_tasks b on a.proc_inst_id_ = b.proc_inst_id_ where find_in_set(a.businesskey_, '${businessKey}') order by field(a.businesskey_, '${order}')`
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ this_.$curdPost('sql', sql).then(res => {
|
|
|
+ const { data = [] } = res.variables || {}
|
|
|
+ const taskIds = data.filter(i => i && i.taskId)
|
|
|
+ resolve(taskIds)
|
|
|
+ }).catch(error => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async reassign (this_, template, idList, targetId) {
|
|
|
+ const { name, userList } = template.$store.getters
|
|
|
+ const ids = idList.join(',')
|
|
|
+ const taskIds = await this.getTaskData(this_, ids)
|
|
|
+ const currentDate = new Date()
|
|
|
+ // updateAssignParams = []
|
|
|
+ // updateProjectParams = []
|
|
|
+ // 转派人,写死金通
|
|
|
+ // const targetId = '702117247933480960'
|
|
|
+ if (taskIds.length) {
|
|
|
+ for (const i of taskIds) {
|
|
|
+ const executorName = userList.find(item => item.userId === targetId)?.userName
|
|
|
+ this_.$request({
|
|
|
+ url: '/business/v3/bpm/task/change/save',
|
|
|
+ method: 'post',
|
|
|
+ data: {
|
|
|
+ pk: '',
|
|
|
+ name: null,
|
|
|
+ ip: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: formatDate(currentDate, 'yyyy-MM-dd HH:mm:ss'),
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ tenantId: null,
|
|
|
+ dataStatus: null,
|
|
|
+ deleted: null,
|
|
|
+ dbType: null,
|
|
|
+ dsAlias: null,
|
|
|
+ id: null,
|
|
|
+ taskId: i.taskId,
|
|
|
+ taskSubject: `用户:${name}于${formatDate(currentDate, 'yyyy-MM-dd')}重新分配检测员为:${executorName}`,
|
|
|
+ taskName: '发起人',
|
|
|
+ procInstId: i.procInstId,
|
|
|
+ nodeId: i.nodeId,
|
|
|
+ changeType: 'shift',
|
|
|
+ status: 'running',
|
|
|
+ ownerId: '1',
|
|
|
+ executorId: null,
|
|
|
+ comment: `用户:${name}于${formatDate(currentDate, 'yyyy-MM-dd')}重新分配检测员为:${executorName}`,
|
|
|
+ completeTime: null,
|
|
|
+ cancelTime: null,
|
|
|
+ delBeforeSave: true,
|
|
|
+ bpmTaskChangeAssignPoList: [
|
|
|
+ {
|
|
|
+ 'type': 'employee',
|
|
|
+ 'executor': targetId,
|
|
|
+ 'executorName': executorName
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ ownerName: '管理员',
|
|
|
+ executorName: null,
|
|
|
+ icon: null,
|
|
|
+ iconBgColor: null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // taskIds.forEach(item => {
|
|
|
+ // updateAssignParams.push({
|
|
|
+ // where: {
|
|
|
+ // task_id_: item.taskId
|
|
|
+ // },
|
|
|
+ // param: {
|
|
|
+ // executor_: targetId
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // updateProjectParams.push({
|
|
|
+ // where: {
|
|
|
+ // id_: item.businessKey
|
|
|
+ // },
|
|
|
+ // param: {
|
|
|
+ // jian_ce_yuan_: targetId
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // const updateAssign = {
|
|
|
+ // tableName: 'ibps_bpm_task_assign',
|
|
|
+ // updList: updateAssignParams
|
|
|
+ // }
|
|
|
+ // const updateProject = {
|
|
|
+ // tableName: 't_lhjczb',
|
|
|
+ // updList: updateProjectParams
|
|
|
+ // }
|
|
|
+ // // 更新assign表执行人和检测表检测员,刷新列表数据
|
|
|
+ // this.$curdPost('updatesByWhere', updateAssign).then(() => {
|
|
|
+ // this.$curdPost('updatesByWhere', updateProject).then(() => {
|
|
|
+ // this.$template.handleAction('search', {}, [], [], 0, {button_type: 'search'})
|
|
|
+ // })
|
|
|
+ // })
|
|
|
}
|
|
|
|
|
|
}
|