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

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

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

Loading…
Cancel
Save