初始代码
This commit is contained in:
62
TemplateCodeVue3/TemplateCode5/html/index.vue.vm
Normal file
62
TemplateCodeVue3/TemplateCode5/html/index.vue.vm
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div class="zero-content-wrapper bg-white">
|
||||
<FlowParser @register="registerFlowParser" @reload="init()" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, onMounted, toRefs} from 'vue';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { usePopup } from '@/components/Popup';
|
||||
import FlowParser from '@/views/workFlow/components/FlowParser.vue';
|
||||
import { getFlowStartFormId } from '@/api/workFlow/template';
|
||||
import { useTabs } from '@/hooks/web/useTabs';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
interface State {
|
||||
flowId: string;
|
||||
}
|
||||
|
||||
const { close } = useTabs();
|
||||
const router = useRouter();
|
||||
const { createMessage } = useMessage();
|
||||
const [registerFlowParser, { openPopup: openFlowParser }] = usePopup();
|
||||
const state = reactive<State>({
|
||||
flowId: '',//请在此处填写流程模板id
|
||||
});
|
||||
|
||||
function init() {
|
||||
const data = {
|
||||
id: '',
|
||||
flowId: state.flowId,
|
||||
opType: '-1',
|
||||
hideCancelBtn: true,
|
||||
hideSaveBtn: true,
|
||||
};
|
||||
openFlowParser(true, data);
|
||||
}
|
||||
|
||||
#if(${context.isFlow})
|
||||
function getFlowId(){
|
||||
if(!state.flowId){
|
||||
createMessage.error('流程模板的flowId未填写')
|
||||
close();
|
||||
router.replace('/404');
|
||||
return
|
||||
}
|
||||
getFlowStartFormId(state.flowId).then(res => {
|
||||
init()
|
||||
}).catch(() => {
|
||||
close();
|
||||
router.replace('/404');
|
||||
});
|
||||
}
|
||||
#end
|
||||
onMounted(() => {
|
||||
#if(${context.isFlow})
|
||||
getFlowId()
|
||||
#else
|
||||
init();
|
||||
#end
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user