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

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

@ -43,6 +43,9 @@ @@ -43,6 +43,9 @@
options: {},
disabled: false,
readonly: false,
value: state.formData,
handleValueChange: (formData: Recordable) =>
formDesignProps.value = state.formData = formData
};
const microAppStore = useMicroAppStore();
const { createMessage } = useMessage();
@ -56,6 +59,18 @@ @@ -56,6 +59,18 @@
const data = await getFormDefinitionJson(formJsonId);
if (!data.json) throw Error('当前数据没有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 = loadMicroApp(Object.assign({} , apps.find(item => item.name == 'form-design'), {
container: '#formPreview',
@ -67,19 +82,6 @@ @@ -67,19 +82,6 @@
}
}), { sandbox: { experimentalStyleIsolation: true }});
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),
formRef: Recordable = formPreviewApp.getRef().$refs['form-preview'];
formRef.setShowIds(showIds);

Loading…
Cancel
Save