|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import { getFormByProcessId, getFormByProcessDefKey, startProcess, detail, completeTask, transferTask, delegateTask, rollbackTask, terminateProcess, addMultiInstance, withdrawTask } from '@/api/plugin/workflow/process' |
|
|
|
|
import { getFormByProcessId, getFormByProcessDefKey, startProcess, startProcessByKey, detail, completeTask, transferTask, delegateTask, rollbackTask, terminateProcess, addMultiInstance, withdrawTask } from '@/api/plugin/workflow/process' |
|
|
|
|
|
|
|
|
|
import Layout from '@/page/index/' |
|
|
|
|
import defaultValues from './default-values' |
|
|
|
|
@ -37,31 +37,31 @@ export default { |
|
|
|
|
processDefKey |
|
|
|
|
})).toString('base64') |
|
|
|
|
|
|
|
|
|
if (formKey && formKey.startsWith('wf_ex_')) { |
|
|
|
|
if (formUrl) { // 配置了自定义路由
|
|
|
|
|
this.$router.push(formUrl + `?p=${param}`) |
|
|
|
|
} else { // 动态添加路由
|
|
|
|
|
this.$router.addRoutes([{ |
|
|
|
|
path: `/workflow/process/external`, |
|
|
|
|
component: Layout, |
|
|
|
|
children: [{ |
|
|
|
|
path: `${formKey.substring(6)}/${type}`, |
|
|
|
|
name: type == 'start' ? '发起流程' : '流程详情', |
|
|
|
|
component: () => |
|
|
|
|
import( /* webpackChunkName: "views" */ `@/views/plugin/workflow/process/external/${formKey.substring(6)}/${type}.vue`), |
|
|
|
|
}] |
|
|
|
|
}]) |
|
|
|
|
this.$router.push(`/workflow/process/external/${formKey.substring(6)}/${type}?p=${param}`) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (async) { |
|
|
|
|
return new Promise((resolve) => { |
|
|
|
|
resolve({ row, type, param }) |
|
|
|
|
}) |
|
|
|
|
return new Promise((resolve) => { |
|
|
|
|
if (formKey && formKey.startsWith('wf_ex_')) { |
|
|
|
|
if (formUrl) { // 配置了自定义路由
|
|
|
|
|
this.$router.push(formUrl + `?p=${param}`) |
|
|
|
|
} else { // 动态添加路由
|
|
|
|
|
this.$router.addRoutes([{ |
|
|
|
|
path: `/workflow/process/external`, |
|
|
|
|
component: Layout, |
|
|
|
|
children: [{ |
|
|
|
|
path: `${formKey.substring(6)}/${type}`, |
|
|
|
|
name: type == 'start' ? '发起流程' : '流程详情', |
|
|
|
|
component: () => |
|
|
|
|
import( /* webpackChunkName: "views" */ `@/views/plugin/workflow/process/external/${formKey.substring(6)}/${type}.vue`), |
|
|
|
|
}] |
|
|
|
|
}]) |
|
|
|
|
this.$router.push(`/workflow/process/external/${formKey.substring(6)}/${type}?p=${param}`) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.$router.push(`/workflow/process/${type}/${param}`) |
|
|
|
|
if (async) { |
|
|
|
|
resolve({ row, type, param }) |
|
|
|
|
} else { |
|
|
|
|
this.$router.push(`/workflow/process/${type}/${param}`) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 根据可读可写,过滤avue column
|
|
|
|
|
filterAvueColumn(column, taskForm, isExForm = false, props = { label: 'label', prop: 'prop' }) { |
|
|
|
|
@ -74,15 +74,8 @@ export default { |
|
|
|
|
column.forEach(col => { |
|
|
|
|
let c = taskForm.find(s => s.id == col[props.prop]) |
|
|
|
|
if (c && c.readable) { |
|
|
|
|
// /**
|
|
|
|
|
// * @deprecated 与节点配置可读可写冲突
|
|
|
|
|
// */
|
|
|
|
|
// if (!c) { // 未重新点击节点设计表单字段可读可写。
|
|
|
|
|
// if ((this.process.isOwner && this.process.status == 'todo') || !this.process.hasOwnProperty('isOwner')) c = { readable: true, writable: true }
|
|
|
|
|
// else c = { readable: true, writable: false }
|
|
|
|
|
// }
|
|
|
|
|
if (!isExForm) { // 非外置表单 处理事件
|
|
|
|
|
let event = ['change', 'blur', 'click', 'focus'] |
|
|
|
|
let event = ['change', 'blur', 'click', 'focus', 'lazyLoad'] |
|
|
|
|
event.forEach(e => { |
|
|
|
|
if (col[e]) col[e] = eval((col[e] + '').replace(/this/g, '_this')) |
|
|
|
|
}) |
|
|
|
|
@ -168,9 +161,48 @@ export default { |
|
|
|
|
form = { ...form, copyUser, assignee } |
|
|
|
|
} |
|
|
|
|
if (valid) { |
|
|
|
|
startProcess(form).then(() => { |
|
|
|
|
startProcess(form).then(res => { |
|
|
|
|
if (isExForm === true) { |
|
|
|
|
resolve(res, done) |
|
|
|
|
} else { |
|
|
|
|
this.$message.success("发起成功") |
|
|
|
|
this.handleCloseTag('/plugin/workflow/process/send') |
|
|
|
|
done() |
|
|
|
|
this.loading = false |
|
|
|
|
} |
|
|
|
|
}).catch(() => { |
|
|
|
|
done() |
|
|
|
|
this.loading = false |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
done() |
|
|
|
|
this.loading = false |
|
|
|
|
if (msg) { |
|
|
|
|
const key = Object.keys(msg)[0] |
|
|
|
|
const rules = msg[key] |
|
|
|
|
this.$message.error(rules.map(r => r.message).join(' | ')) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
|
* 发起流程 |
|
|
|
|
* @param form {"processDefKey": "流程定义key", ...表单自定义字段变量} |
|
|
|
|
*/ |
|
|
|
|
handleStartProcessByKey(isExForm = false) { |
|
|
|
|
return new Promise((resolve) => { |
|
|
|
|
this.loading = true |
|
|
|
|
this.$refs.form.validate((valid, done, msg) => { |
|
|
|
|
let form = this.deepClone(this.form) |
|
|
|
|
if (this.$refs.examineForm && this.$refs.examineForm.examineForm) { |
|
|
|
|
const { copyUser, assignee } = this.$refs.examineForm.examineForm |
|
|
|
|
form = { ...form, copyUser, assignee } |
|
|
|
|
} |
|
|
|
|
if (valid) { |
|
|
|
|
startProcessByKey(form).then(res => { |
|
|
|
|
if (isExForm === true) { |
|
|
|
|
resolve(done) |
|
|
|
|
resolve(res, done) |
|
|
|
|
} else { |
|
|
|
|
this.$message.success("发起成功") |
|
|
|
|
this.handleCloseTag('/plugin/workflow/process/send') |
|
|
|
|
|