Browse Source

chore: Microapp Value Transfer

master
wangxiang 2 years ago
parent
commit
6008a85f42
No known key found for this signature in database
GPG Key ID: 1BA7946AB6B232E4
  1. 75
      src/views/workflow/task/TaskForm.vue
  2. 28
      src/views/workflow/task/WorkflowPreviewForm.vue

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

@ -139,7 +139,7 @@
</a-card> </a-card>
</ALayoutContent> </ALayoutContent>
<footer class="workflow-form__footer" :style="getWrapFormFooterStyle"> <footer class="workflow-form__footer" :style="getWrapFormFooterStyle">
<a-button size="large" type="primary" @click="test">审批</a-button> <a-button size="large" type="primary" @click="commit">审批</a-button>
<a-button size="large" type="primary" danger>驳回</a-button> <a-button size="large" type="primary" danger>驳回</a-button>
</footer> </footer>
<UserPicker :title="state.userPickerProps.title" <UserPicker :title="state.userPickerProps.title"
@ -182,6 +182,7 @@
import UserPicker from './popups/UserPicker/index.vue'; import UserPicker from './popups/UserPicker/index.vue';
import { ApiSelect } from '/@/components/Form'; import { ApiSelect } from '/@/components/Form';
import { listUser } from '/@/api/platform/system/controller/user'; import { listUser } from '/@/api/platform/system/controller/user';
import { ActivityCommentInfo } from '/@/api/platform/workflow/entity/activityCommentInfo';
/** 类型规范统一声明定义区域 */ /** 类型规范统一声明定义区域 */
interface WindowState { interface WindowState {
@ -225,15 +226,12 @@
// //
isAssign: boolean; isAssign: boolean;
// //
auditForm: { auditForm: ActivityCommentInfo & {
message: string;
mesCode: string;
mesName: string;
// ID // ID
userIds: string[]; userIds: string[];
// ID // ID
assignee: string; assignee: string;
}, };
rulesRef: Recordable; rulesRef: Recordable;
userPickerProps: { userPickerProps: {
title: string; title: string;
@ -281,6 +279,7 @@
message: '', message: '',
mesCode: '', mesCode: '',
mesName: '', mesName: '',
mesLevel: '',
userIds: [], userIds: [],
assignee: '' assignee: ''
}, },
@ -366,19 +365,16 @@
} }
/** 流程抄送 */ /** 流程抄送 */
function cc(data: Recordable) { async function cc(data: Recordable) {
if (state.isCC && state.auditForm.userIds) { if (state.isCC && state.auditForm.userIds) {
//this.$refs['auditForm'].validate((valid) => { await auditForm.value.validate();
//if (valid) { await saveWorkflowCopy(state.auditForm.userIds.join(','), {
saveWorkflowCopy(state.auditForm.userIds.join(','), { processDefId: state.processDefId,
processDefId: state.processDefId, processInsId: data.processInsId,
processInsId: data.processInsId, processDefName: '',
processDefName: '', processInsName: state.formTitle,
processInsName: state.formTitle, taskName: ''
taskName: '' });
});
//}
//});
} }
} }
@ -396,7 +392,7 @@
if (state.formType === '2') { if (state.formType === '2') {
formPreview.value.startProcessDefinition(async (businessTable: string, businessId: string) => { formPreview.value.startProcessDefinition(async (businessTable: string, businessId: string) => {
const processInsId = await startProcessDefinition({ const processInsId = await startProcessDefinition({
processDefKey: this.processDefKey, processDefKey: state.processDefKey,
businessTable: businessTable, businessTable: businessTable,
businessId: businessId, businessId: businessId,
...vars ...vars
@ -407,7 +403,7 @@
}); });
// //
} else { } else {
formPreview.value.startFormProcessDefinition({ processDefId: this.processDefId, ...vars }, (processInsId: string) => { formPreview.value.startFormProcessDefinition({ processDefId: state.processDefId, ...vars }, (processInsId: string) => {
close(); close();
push({ path: '/workflow/task/index' }); push({ path: '/workflow/task/index' });
cc({ processInsId }); cc({ processInsId });
@ -483,7 +479,7 @@
title: '警告', title: '警告',
content: '确定终止流程吗?', content: '确定终止流程吗?',
onOk: async () => { onOk: async () => {
await stopProcessInstance(this.processInsId, this.auditForm.message); await stopProcessInstance(state.processInsId, state.auditForm.message);
await close(); await close();
await push({path: '/workflow/task/index'}); await push({path: '/workflow/task/index'});
cc({processInsId: state.processInsId}); cc({processInsId: state.processInsId});
@ -498,7 +494,7 @@
/** 驳回到任意节点 */ /** 驳回到任意节点 */
function rollBack() { function rollBack() {
openRollBackTask(true,{ taskId: this.taskId }); openRollBackTask(true,{ taskId: state.taskId });
} }
/** 加签 */ /** 加签 */
@ -524,12 +520,12 @@
if (state.formType === '2') { if (state.formType === '2') {
formPreview.value.auditTask(async () => { formPreview.value.auditTask(async () => {
await auditTask({ await auditTask({
taskId: this.taskId, taskId: state.taskId,
taskDefKey: this.taskDefKey, taskDefKey: state.taskDefKey,
processInsId: this.processInsId, processInsId: state.processInsId,
processDefId: this.processDefId, processDefId: state.processDefId,
activityCommentInfo: this.auditForm, activityCommentInfo: state.auditForm,
assignee: this.auditForm.assignee, assignee: state.auditForm.assignee,
vars, vars,
}); });
await close(); await close();
@ -539,11 +535,12 @@
// //
} else { } else {
formPreview.value.auditFormTask({ formPreview.value.auditFormTask({
taskId: this.taskId, formType: '',
processInsId: this.processInsId, taskId: state.taskId,
activityCommentInfo: this.auditForm, processInsId: state.processInsId,
assignee: this.auditForm.assignee, activityCommentInfo: state.auditForm,
vars, assignee: state.auditForm.assignee,
vars
}, () => { }, () => {
close(); close();
push({ path: '/workflow/task/index' }); push({ path: '/workflow/task/index' });
@ -555,9 +552,9 @@
/** 处理回退到任意节点 */ /** 处理回退到任意节点 */
async function handleRollBackTask(backTaskDefKey: string) { async function handleRollBackTask(backTaskDefKey: string) {
await rejectTask({ await rejectTask({
currentTaskId: this.taskId, currentTaskId: state.taskId,
rollBackTaskDefKey: backTaskDefKey, rollBackTaskDefKey: backTaskDefKey,
comment: this.auditForm comment: state.auditForm
}); });
await close(); await close();
await push({ path: '/workflow/task/index' }); await push({ path: '/workflow/task/index' });
@ -566,7 +563,7 @@
/** 处理转派任务 */ /** 处理转派任务 */
async function handleTransferTask(userList: KiccUser[]) { async function handleTransferTask(userList: KiccUser[]) {
await transferTask( this.taskId, userList[0].id); await transferTask( state.taskId, userList[0].id);
await close(); await close();
await push({ path: '/workflow/task/index' }); await push({ path: '/workflow/task/index' });
cc({ processInsId: state.processInsId }); cc({ processInsId: state.processInsId });
@ -574,7 +571,7 @@
/** 处理任务委派 */ /** 处理任务委派 */
async function handleDelegateTask(userList: KiccUser[]) { async function handleDelegateTask(userList: KiccUser[]) {
await delegateTask(this.taskId, userList[0].id); await delegateTask(state.taskId, userList[0].id);
await close(); await close();
await push({ path: '/workflow/task/index' }); await push({ path: '/workflow/task/index' });
cc({ processInsId: state.processInsId }); cc({ processInsId: state.processInsId });
@ -658,10 +655,6 @@
} }
} }
function test() {
auditForm.value.validate();
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@prefix-cls: ~'@{namespace}-task-form'; @prefix-cls: ~'@{namespace}-task-form';

28
src/views/workflow/task/WorkflowPreviewForm.vue

@ -43,6 +43,9 @@
options: {}, options: {},
disabled: false, disabled: false,
readonly: false, readonly: false,
value: state.formData,
handleValueChange: (formData: Recordable) =>
formDesignProps.value = state.formData = formData
}; };
const microAppStore = useMicroAppStore(); const microAppStore = useMicroAppStore();
const { createMessage } = useMessage(); const { createMessage } = useMessage();
@ -56,6 +59,18 @@
const data = await getFormDefinitionJson(formJsonId); const data = await getFormDefinitionJson(formJsonId);
if (!data.json) throw Error('当前数据没有json结构体'); if (!data.json) throw Error('当前数据没有json结构体');
formDesignProps.options = eval('(' + data.json + ')'); formDesignProps.options = eval('(' + data.json + ')');
const disableIds: string[] = [], showIds: string[] = [];
props.taskFormData.forEach((item) => {
if (item.value !== undefined) {
state.formData[item.id] = item.value;
}
if (item.readable === true) {
showIds.push(item.id);
}
if (item.writable === false) {
disableIds.push(item.id);
}
});
state.formDesignApp?.unmount(); state.formDesignApp?.unmount();
state.formDesignApp = loadMicroApp(Object.assign({} , apps.find(item => item.name == 'form-design'), { state.formDesignApp = loadMicroApp(Object.assign({} , apps.find(item => item.name == 'form-design'), {
container: '#formPreview', container: '#formPreview',
@ -67,19 +82,6 @@
} }
}), { sandbox: { experimentalStyleIsolation: true }}); }), { sandbox: { experimentalStyleIsolation: true }});
state.formDesignApp.mountPromise.then(() => { state.formDesignApp.mountPromise.then(() => {
const disableIds:string[] = [];
const showIds:string[] = [];
props.taskFormData.forEach((item) => {
if (item.value !== undefined) {
state.formData[item.id] = item.value;
}
if (item.readable === true) {
showIds.push(item.id);
}
if (item.writable === false) {
disableIds.push(item.id);
}
});
const formPreviewApp: Recordable = microAppStore.getFormDesignApp(FORM_DESIGN_APP_COMPONENTS.PREVIEW), const formPreviewApp: Recordable = microAppStore.getFormDesignApp(FORM_DESIGN_APP_COMPONENTS.PREVIEW),
formRef: Recordable = formPreviewApp.getRef().$refs['form-preview']; formRef: Recordable = formPreviewApp.getRef().$refs['form-preview'];
formRef.setShowIds(showIds); formRef.setShowIds(showIds);

Loading…
Cancel
Save