初始代码
This commit is contained in:
1
TemplateCodeVue3/TemplateCode5/app/form.vue.vm
Normal file
1
TemplateCodeVue3/TemplateCode5/app/form.vue.vm
Normal file
@@ -0,0 +1 @@
|
||||
#parse("TemplateCode2/app/form.vue.vm")
|
||||
60
TemplateCodeVue3/TemplateCode5/app/index.vue.vm
Normal file
60
TemplateCodeVue3/TemplateCode5/app/index.vue.vm
Normal file
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<view class="zero-wrap zero-wrap-form">
|
||||
<FlowBox v-if="flowVisible" ref="FlowBox" ></FlowBox>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FlowBox from '@/pages/workFlow/flowBefore/index.vue'
|
||||
import {
|
||||
getFlowStartFormId
|
||||
} from "@/api/workFlow/flowEngine";
|
||||
export default {
|
||||
components: {
|
||||
FlowBox,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
flowId : '',//请在此处填写流程id
|
||||
flowVisible:false,
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.getFlowId()
|
||||
},
|
||||
methods: {
|
||||
getFlowId(){
|
||||
if(!this.flowId)return this.$u.toast("流程模板的flowId未填写")
|
||||
getFlowStartFormId(this.flowId).then(res=>{
|
||||
this.flow()
|
||||
}).catch(()=>{
|
||||
})
|
||||
},
|
||||
flow() {
|
||||
const config = {
|
||||
flowId: this.flowId,
|
||||
opType: '-1',
|
||||
hideSaveBtn: true,
|
||||
}
|
||||
if (!this.flowId) return this.$u.toast("该功能未配置流程不可用!")
|
||||
this.flowVisible = true
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.FlowBox.handleCodeGeneration(config)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
height: 100%;
|
||||
/* #ifdef MP-ALIPAY */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
}
|
||||
</style>
|
||||
111
TemplateCodeVue3/TemplateCode5/html/Form.vue.vm
Normal file
111
TemplateCodeVue3/TemplateCode5/html/Form.vue.vm
Normal file
@@ -0,0 +1,111 @@
|
||||
#parse("PublicMacro/FormMarco.vm")
|
||||
<template>
|
||||
<div class="flow-form ${context.formStyle}">
|
||||
<a-form :colon="false" size="${context.size}" layout=#if(${context.labelPosition}=="top") "vertical" #else "horizontal" #end
|
||||
labelAlign=#if(${context.labelPosition}=="right") "right" #else "left" #end
|
||||
#if(${context.labelPosition}!="top") :labelCol="{ style: { width: '${context.labelWidth}px' } }" #end
|
||||
:model="dataForm" :rules="dataRule" ref="formRef" :disabled="config.disabled">
|
||||
<a-row :gutter="#if(${context.formStyle}=='word-form')0#else${context.gutter}#end">
|
||||
<!-- 具体表单 -->
|
||||
#FormRendering()
|
||||
<!-- 表单结束 -->
|
||||
</a-row>
|
||||
</a-form>
|
||||
#if($isSelectDialog == true)
|
||||
<SelectModal :config="state.currTableConf" :formData="state.dataForm" ref="selectModal" @select="addForSelect"/>
|
||||
#end
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, toRefs, onMounted, ref , unref , computed, nextTick, toRaw, inject} from 'vue';
|
||||
import { useFlowForm } from '@/views/workFlow/workFlowForm/hooks/useFlowForm';
|
||||
import type { FormInstance } from 'ant-design-vue';
|
||||
import { ZeroRelationForm } from '@/components/Zero';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
#if($isSelectDialog == true)
|
||||
import SelectModal from '@/components/CommonModal/src/SelectModal.vue';
|
||||
#end
|
||||
import { thousandsFormat , getDateTimeUnit, getTimeUnit} from '@/utils/zero';
|
||||
import { getDictionaryDataSelector } from '@/api/systemData/dictionary';
|
||||
import { getDataInterfaceRes } from '@/api/systemData/dataInterface';
|
||||
import dayjs from 'dayjs';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { buildUUID } from '@/utils/uuid';
|
||||
import { CaretRightOutlined } from '@ant-design/icons-vue';
|
||||
import { useI18n } from '@/hooks/web/useI18n';
|
||||
|
||||
interface State {
|
||||
#createStateParam("any")
|
||||
}
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
const { t } = useI18n();
|
||||
const props = defineProps(['config']);
|
||||
const emit = defineEmits(['setPageLoad', 'eventReceiver']);
|
||||
const getLeftTreeActiveInfo: (() => any) | null = inject('getLeftTreeActiveInfo', null);
|
||||
const formRef = ref<FormInstance>();
|
||||
const state = reactive<State>({
|
||||
#createStateParam()
|
||||
});
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
const { dataForm, dataRule, optionsObj, ableAll, maskConfig } = toRefs(state);
|
||||
const { init, judgeShow, judgeWrite,judgeRequired, dataFormSubmit } = useFlowForm({
|
||||
config: props.config,
|
||||
selfState: state,
|
||||
emit,
|
||||
formRef,
|
||||
selfInit,
|
||||
selfGetInfo,
|
||||
});
|
||||
|
||||
defineExpose({ dataFormSubmit });
|
||||
##新增初始化数据
|
||||
function selfInit() {
|
||||
#EditGetOption(false)
|
||||
#InitActiveValue()
|
||||
state.childIndex = -1;
|
||||
if (getLeftTreeActiveInfo) state.dataForm = {...state.dataForm, ...(getLeftTreeActiveInfo() || {}) };
|
||||
}
|
||||
##编辑和详情初始化数据
|
||||
function selfGetInfo(dataForm) {
|
||||
#EditGetOption(true)
|
||||
#InitActiveValue()
|
||||
}
|
||||
onMounted(() => {
|
||||
init();
|
||||
});
|
||||
|
||||
#if($isSelectDialog == true)
|
||||
// 子表弹窗数据
|
||||
const selectModal = ref(null);
|
||||
#end
|
||||
#GetChildTableColumns()
|
||||
##数据联动changeData方法
|
||||
#ChangeData()
|
||||
##子表其他方法
|
||||
#CreateChildTableMethod()
|
||||
##子表弹窗数据方法
|
||||
#if($isSelectDialog == true)
|
||||
#ChildDialogMethod()
|
||||
#end
|
||||
##合计方法
|
||||
#if($childSummary==true)
|
||||
//子表合计方法
|
||||
function getCmpValOfRow(row, key, summaryField) {
|
||||
if (!summaryField.length) return '';
|
||||
const isSummary = key => summaryField.includes(key);
|
||||
const target = row[key];
|
||||
if (!target) return '';
|
||||
let data = isNaN(target) ? 0 : Number(target);
|
||||
if (isSummary(key)) return data || 0;
|
||||
return '';
|
||||
}
|
||||
#end
|
||||
##数据选项--数据字典和远端数据初始化方法
|
||||
#GetDataOptionsMethod()
|
||||
##动态时间处理
|
||||
#GetRelationDate()
|
||||
</script>
|
||||
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