Browse Source

chore: Optimizing

master
wangxiang 2 years ago
parent
commit
d0beaa6f51
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 231
      src/views/workflow/task/TaskForm.vue
  2. 2
      src/views/workflow/task/popups/UserPicker/index.vue

231
src/views/workflow/task/TaskForm.vue

@ -1,5 +1,5 @@
<template> <template>
<div :class="prefixCls"> <div v-loading="state.loading" :class="prefixCls">
<ALayoutContent class="m-10"> <ALayoutContent class="m-10">
<h4 class="text-center text-lg pb-2">{{ state.formTitle }}</h4> <h4 class="text-center text-lg pb-2">{{ state.formTitle }}</h4>
<ATables v-model:activeKey="state.taskSelectedTab" <ATables v-model:activeKey="state.taskSelectedTab"
@ -197,6 +197,8 @@
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
interface WindowState { interface WindowState {
//
loading: boolean;
// //
formTitle: string; formTitle: string;
// key // key
@ -267,6 +269,7 @@
const { getIsMobile } = useAppInject(); const { getIsMobile } = useAppInject();
const { getCalcContentWidth } = useMenuSetting(); const { getCalcContentWidth } = useMenuSetting();
const state = reactive<WindowState>({ const state = reactive<WindowState>({
loading: false,
formTitle: '', formTitle: '',
formKey: '', formKey: '',
formType: '', formType: '',
@ -381,48 +384,63 @@
/** 流程抄送 */ /** 流程抄送 */
async function cc(data: Recordable) { async function cc(data: Recordable) {
if (state.isCC && state.auditForm.userIds) { state.loading = true;
await auditForm.value.validate(); try {
await saveWorkflowCopy(state.auditForm.userIds.join(','), { if (state.isCC && state.auditForm.userIds) {
processDefId: state.processDefId, await auditForm.value.validate();
processInsId: data.processInsId, await saveWorkflowCopy(state.auditForm.userIds.join(','), {
processDefName: '', processDefId: state.processDefId,
processInsName: state.formTitle, processInsId: data.processInsId,
taskName: '' processDefName: '',
}); processInsName: state.formTitle,
taskName: ''
});
}
} finally {
state.loading = false;
} }
} }
/** 暂存草稿 */ /** 暂存草稿 */
function save() { function save() {
notification.warn({ state.loading = true;
message: '提示', try {
description: '功能正在开发中...' notification.warn({
}); message: '提示',
description: '功能正在开发中...'
});
} finally {
state.loading = false;
}
} }
/** 启动流程 */ /** 启动流程 */
function start(vars: Recordable) { async function start(vars: Recordable) {
// state.loading = true;
if (state.formType === '2') { try {
formPreview.value.startProcessDefinition(async (businessTable: string, businessId: string) => { //
const processInsId = await startProcessDefinition({ if (state.formType === '2') {
processDefKey: state.processDefKey, await formPreview.value.startProcessDefinition(async (businessTable: string, businessId: string) => {
businessTable: businessTable, const processInsId = await startProcessDefinition({
businessId: businessId, processDefKey: state.processDefKey,
...vars businessTable: businessTable,
businessId: businessId,
...vars
});
await cc({ processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
}); });
await cc({ processInsId }); //
await close(); } else {
await push({ path: PageEnum.TODO_TASK_PAGE }); await formPreview.value.startFormProcessDefinition({ processDefId: state.processDefId, ...vars }, async (processInsId: string) => {
}); await cc({ processInsId });
// await close();
} else { await push({ path: PageEnum.TODO_TASK_PAGE });
formPreview.value.startFormProcessDefinition({ processDefId: state.processDefId, ...vars }, async (processInsId: string) => { });
await cc({ processInsId }); }
await close(); } finally {
await push({ path: PageEnum.TODO_TASK_PAGE }); state.loading = false;
});
} }
} }
@ -504,7 +522,12 @@
/** 打印 */ /** 打印 */
function print() { function print() {
console.warn('---工作流表单打印成功,此处可以做一些打印回调逻辑处理!---'); state.loading = true;
try {
console.warn('---工作流表单打印成功,此处可以做一些打印回调逻辑处理!---');
} finally {
state.loading = false;
}
} }
/** 驳回到任意节点 */ /** 驳回到任意节点 */
@ -514,86 +537,115 @@
/** 加签 */ /** 加签 */
function addMultiInstance() { function addMultiInstance() {
// flowable,:http://www.pangubpm.com/doc58.html state.loading = true;
notification.warn({ try {
message: '提示', // flowable,:http://www.pangubpm.com/doc58.html
description: '功能正在开发中...' notification.warn({
}); message: '提示',
description: '功能正在开发中...'
});
} finally {
state.loading = false;
}
} }
/** 减签 */ /** 减签 */
function delMultiInstance () { function delMultiInstance () {
notification.warn({ state.loading = true;
message: '提示', try {
description: '功能正在开发中...' notification.warn({
}); message: '提示',
description: '功能正在开发中...'
});
} finally {
state.loading = false;
}
} }
/** 自定义按钮提交 */ /** 自定义按钮提交 */
function commit(vars?: Recordable) { async function commit(vars?: Recordable) {
// state.loading = true;
if (state.formType === '2') { try {
formPreview.value.auditTask(async () => { //
await auditTask({ if (state.formType === '2') {
await formPreview.value.auditTask(async () => {
await auditTask({
taskId: state.taskId,
taskDefKey: state.taskDefKey,
processInsId: state.processInsId,
processDefId: state.processDefId,
activityCommentInfo: state.auditForm,
assignee: state.auditForm.assignee,
vars,
});
await cc({ processInsId: state.processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
});
//
} else {
await formPreview.value.auditFormTask({
formType: '',
taskId: state.taskId, taskId: state.taskId,
taskDefKey: state.taskDefKey,
processInsId: state.processInsId, processInsId: state.processInsId,
processDefId: state.processDefId,
activityCommentInfo: state.auditForm, activityCommentInfo: state.auditForm,
assignee: state.auditForm.assignee, assignee: state.auditForm.assignee,
vars, vars
}, async () => {
await cc({ processInsId: state.processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
}); });
await cc({ processInsId: state.processInsId }); }
await close(); } finally {
await push({ path: PageEnum.TODO_TASK_PAGE }); state.loading = false;
});
//
} else {
formPreview.value.auditFormTask({
formType: '',
taskId: state.taskId,
processInsId: state.processInsId,
activityCommentInfo: state.auditForm,
assignee: state.auditForm.assignee,
vars
}, async () => {
await cc({ processInsId: state.processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
});
} }
} }
/** 处理回退到任意节点 */ /** 处理回退到任意节点 */
async function handleRollBackTask(backTaskDefKey: string) { async function handleRollBackTask(backTaskDefKey: string) {
await rejectTask({ state.loading = true;
currentTaskId: state.taskId, try {
rollBackTaskDefKey: backTaskDefKey, await rejectTask({
comment: state.auditForm currentTaskId: state.taskId,
}); rollBackTaskDefKey: backTaskDefKey,
await cc({ processInsId: state.processInsId }); comment: state.auditForm
await close(); });
await push({ path: PageEnum.TODO_TASK_PAGE }); await cc({ processInsId: state.processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
} finally {
state.loading = false;
}
} }
/** 处理转派任务 */ /** 处理转派任务 */
async function handleTransferTask(userList: KiccUser[]) { async function handleTransferTask(userList: KiccUser[]) {
await transferTask( state.taskId, userList[0].id); state.loading = true;
await cc({ processInsId: state.processInsId }); try {
await close(); await transferTask( state.taskId, userList[0].id);
await push({ path: PageEnum.TODO_TASK_PAGE }); await cc({ processInsId: state.processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
} finally {
state.loading = false;
}
} }
/** 处理任务委派 */ /** 处理任务委派 */
async function handleDelegateTask(userList: KiccUser[]) { async function handleDelegateTask(userList: KiccUser[]) {
await delegateTask(state.taskId, userList[0].id); state.loading = true;
await cc({ processInsId: state.processInsId }); try {
await close(); await delegateTask(state.taskId, userList[0].id);
await push({ path: PageEnum.TODO_TASK_PAGE }); await cc({ processInsId: state.processInsId });
await close();
await push({ path: PageEnum.TODO_TASK_PAGE });
} finally {
state.loading = false;
}
} }
async function submit(button: Partial<WorkflowButton>) { function submit(button: Partial<WorkflowButton>) {
await appStore.setPageLoadingAction(true);
// //
const vars: Recordable = {}; const vars: Recordable = {};
// //
@ -652,7 +704,6 @@
// //
default: default:
commit(vars); commit(vars);
await appStore.setPageLoadingAction(false);
} }
} }
@ -682,7 +733,7 @@
transition: inline-block 0.3s, left 0.3s, width 0.3s, margin-left 0.3s, font-size 0.3s; transition: inline-block 0.3s, left 0.3s, width 0.3s, margin-left 0.3s, font-size 0.3s;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: @page-footer-z-index; z-index: 9;
} }
} }
} }

2
src/views/workflow/task/popups/UserPicker/index.vue

@ -92,7 +92,7 @@
await handleRefreshTable(); await handleRefreshTable();
// //
state.tag = data._tag; state.tag = data._tag;
const { ids, emitEventName } = data.record as Recordable; const { ids, emitEventName } = data.record || {};
isArray(ids) && setSelectedRowKeys(ids); isArray(ids) && setSelectedRowKeys(ids);
const modalProps: Partial<ModalProps> = { title: props.title }; const modalProps: Partial<ModalProps> = { title: props.title };
state.emitEventName = emitEventName || 'success'; state.emitEventName = emitEventName || 'success';

Loading…
Cancel
Save