Skip to content

Commit

Permalink
新增vue的bpm生成模板
Browse files Browse the repository at this point in the history
  • Loading branch information
think-gem committed Mar 30, 2022
1 parent e4b2866 commit f131788
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@
<% }else{ %>
<BasicForm @register="registerForm" />
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
<template #footer>
<BpmButton
v-model:bpmEntity="record"
bpmEntityKey="id"
formKey="${table.optionMap['bpmFormKey']}"
completeText="提交"
:loading="loadingRef"
:auth="'oa:oaLeave:edit'"
@complete="handleSubmit"
@success="handleSuccess"
@close="closeDrawer"
/>
</template>
<% } %>
</BasicDrawer>
</template>
<script lang="ts">
Expand Down Expand Up @@ -84,6 +99,9 @@ for(c in table.columnList){
<% if(areaselectExists) { %>
import { areaTreeData } from '/@/api/sys/area';
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
import { BpmButton } from '/@/components/Bpm';
<% } %>
const emit = defineEmits(['success', 'register']);
Expand All @@ -94,6 +112,10 @@ for(c in table.columnList){
icon: router.currentRoute.value.meta.icon || 'ant-design:book-outlined',
value: record.value.isNewRecord ? t('新增${functionNameSimple}') : t('编辑${functionNameSimple}'),
}));
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
const loadingRef = ref(false);
<% } %>
const inputFormSchemas: FormSchema[] = [
<% if(table.isTreeEntity){ %>
Expand Down Expand Up @@ -558,6 +580,11 @@ for (c in table.columnList){
async function handleSubmit() {
try {
const data = await validate();
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
data.bpm = record.value.bpm; // 流程信息
data.status = record.value.status; // 提交状态
loadingRef.value = true;
<% } %>
setDrawerProps({ confirmLoading: true });
const params: any = {
isNewRecord: record.value.isNewRecord,
Expand All @@ -584,9 +611,18 @@ for (c in table.columnList){
}
console.log('error', error);
} finally {
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
loadingRef.value = false;
<% } %>
setDrawerProps({ confirmLoading: false });
}
}
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
async function handleSuccess() {
emit('success');
}
<% } %>
</script>
<% %>
]]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ if(table.isTreeEntity){
</template>
</BasicTable>
<InputForm @register="registerDrawer" @success="handleSuccess" />
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
<BpmRuntimeTrace @register="registerTraceModal" />
<% } %>
</div>
</template>
<script lang="ts">
Expand Down Expand Up @@ -113,6 +116,10 @@ for(c in table.columnList){
import { areaTreeData } from '/@/api/sys/area';
<% } %>
import { useDrawer } from '/@/components/Drawer';
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
import { useModal } from '/@/components/Modal';
import { BpmRuntimeTrace } from '/@/components/Bpm';
<% } %>
import { FormProps } from '/@/components/Form';
import InputForm from './form.vue';
Expand Down Expand Up @@ -322,6 +329,9 @@ for(c in table.columnList){
confirm: handleDelete.bind(this, { ${idParam} }),
},
auth: '${permissionPrefix}:edit',
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
ifShow: () => record.status == '9',
<% } %>
},
<% } %>
<% if(table.isTreeEntity){ %>
Expand All @@ -335,6 +345,14 @@ for(c in table.columnList){
auth: '${permissionPrefix}:edit',
},
<% } %>
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
{
icon: 'fluent:flowchart-20-regular',
title: t('流程追踪'),
onClick: handleTrace.bind(this, record),
ifShow: () => record.status != '9',
},
<% } %>
],
};
Expand Down Expand Up @@ -403,6 +421,14 @@ for(c in table.columnList){
function handleSuccess() {
reload();
}
<% if(toBoolean(table.optionMap['isBpmForm'])){ %>
const [registerTraceModal, { openModal: traceModel }] = useModal();
function handleTrace(record: Recordable) {
traceModel(true, { formKey: '${table.optionMap['bpmFormKey']}', bizKey: record.id });
}
<% } %>
</script>
<% %>
]]>
Expand Down

0 comments on commit f131788

Please sign in to comment.