界面优先模板、简易模板:代码打包下载功能
This commit is contained in:
@ -25,9 +25,21 @@
|
|||||||
<a-button type="primary" @click="handleStepNext" v-show="current < 5">
|
<a-button type="primary" @click="handleStepNext" v-show="current < 5">
|
||||||
{{ t('下一步') }}
|
{{ t('下一步') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" @click="handleCodeGenerator" v-show="current === 5">
|
<a-dropdown placement="bottom" :arrow="{ pointAtCenter: true }">
|
||||||
{{ t('完成') }}
|
<a-button type="primary" v-show="current === 5">
|
||||||
</a-button>
|
{{ t('完成') }}
|
||||||
|
</a-button>
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item>
|
||||||
|
<a href="javascript:;" @click="handleCodeGenerator('packAndDownload')">打包下载</a>
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item>
|
||||||
|
<a href="javascript:;" @click="handleCodeGenerator('genCodeToProject')">生成到项目中</a>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
</a-dropdown>
|
||||||
<a-button type="primary" danger @click="handleClose">{{ t('关闭') }}</a-button>
|
<a-button type="primary" danger @click="handleClose">{{ t('关闭') }}</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -57,6 +69,7 @@
|
|||||||
getCodeTemplateInfo,
|
getCodeTemplateInfo,
|
||||||
saveDraftGeneratorCode,
|
saveDraftGeneratorCode,
|
||||||
updateDraftGeneratorCode,
|
updateDraftGeneratorCode,
|
||||||
|
downloadCodes,
|
||||||
} from '/@/api/system/generator';
|
} from '/@/api/system/generator';
|
||||||
import { FormProps } from '/@/components/Form';
|
import { FormProps } from '/@/components/Form';
|
||||||
import { buildOption } from '/@/utils/helper/designHelper';
|
import { buildOption } from '/@/utils/helper/designHelper';
|
||||||
@ -73,6 +86,9 @@
|
|||||||
import DesignLogo from '/@/components/ModalPanel/src/DesignLogo.vue';
|
import DesignLogo from '/@/components/ModalPanel/src/DesignLogo.vue';
|
||||||
import AjaxErrorIcon from '/@/components/SecondDev/AjaxErrorIcon.vue';
|
import AjaxErrorIcon from '/@/components/SecondDev/AjaxErrorIcon.vue';
|
||||||
import useGlobalFlag from '/@/hooks/core/useGlobalFlag';
|
import useGlobalFlag from '/@/hooks/core/useGlobalFlag';
|
||||||
|
import { downloadByData } from '/@/utils/file/download';
|
||||||
|
import { dateUtil } from '/@/utils/dateUtil';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const StructureConfigStep = defineAsyncComponent({
|
const StructureConfigStep = defineAsyncComponent({
|
||||||
loader: () => import('/@/components/CreateCodeStep/src/StructureConfigStep.vue'),
|
loader: () => import('/@/components/CreateCodeStep/src/StructureConfigStep.vue'),
|
||||||
@ -114,7 +130,6 @@
|
|||||||
const widgetForm = ref(JSON.parse(JSON.stringify(antd.widgetForm))); //FormDesignStep -> designer和StructureConfigStep页面使用
|
const widgetForm = ref(JSON.parse(JSON.stringify(antd.widgetForm))); //FormDesignStep -> designer和StructureConfigStep页面使用
|
||||||
const mainTableName = ref('table_' + random(10000, 99999));
|
const mainTableName = ref('table_' + random(10000, 99999));
|
||||||
const emit = defineEmits(['close', 'register', 'success']);
|
const emit = defineEmits(['close', 'register', 'success']);
|
||||||
|
|
||||||
watch(current, () => {
|
watch(current, () => {
|
||||||
isEditorOpen.value = current.value === 0;
|
isEditorOpen.value = current.value === 0;
|
||||||
});
|
});
|
||||||
@ -245,7 +260,7 @@
|
|||||||
handleClose();
|
handleClose();
|
||||||
emit('success');
|
emit('success');
|
||||||
}
|
}
|
||||||
async function handleCodeGenerator() {
|
async function handleCodeGenerator(actionType:String) {
|
||||||
const isOk = await stepValidate[5]();
|
const isOk = await stepValidate[5]();
|
||||||
if (
|
if (
|
||||||
generatorConfig.formJson?.hiddenComponent &&
|
generatorConfig.formJson?.hiddenComponent &&
|
||||||
@ -268,9 +283,16 @@
|
|||||||
// await appGeneratorCode(
|
// await appGeneratorCode(
|
||||||
// buildAppCode(generatorConfig, buildAppFormProps(generatorConfig.formJson)),
|
// buildAppCode(generatorConfig, buildAppFormProps(generatorConfig.formJson)),
|
||||||
// );
|
// );
|
||||||
|
data.actionType=actionType;
|
||||||
await codeFirstGeneratorCode(data);
|
const result =await codeFirstGeneratorCode(data);
|
||||||
|
if(data.actionType=="packAndDownload"&&result){
|
||||||
|
const fileName=data.outputConfig.className+'_'+dateUtil(new Date()).format('YYYY-MM-DD_HH_mm_ss');
|
||||||
|
const res = await downloadCodes({uuid:result});
|
||||||
|
downloadByData(
|
||||||
|
res.data,
|
||||||
|
fileName+".zip"
|
||||||
|
);
|
||||||
|
}
|
||||||
handleClose();
|
handleClose();
|
||||||
emit('success');
|
emit('success');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,9 +24,21 @@
|
|||||||
<a-button type="primary" @click="handleStepNext" v-show="current < 5">
|
<a-button type="primary" @click="handleStepNext" v-show="current < 5">
|
||||||
{{ t('下一步') }}
|
{{ t('下一步') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button type="primary" @click="handleCodeGenerator" v-show="current === 5">
|
<a-dropdown placement="bottom" :arrow="{ pointAtCenter: true }">
|
||||||
{{ t('完成') }}
|
<a-button type="primary" v-show="current === 5">
|
||||||
</a-button>
|
{{ t('完成') }}
|
||||||
|
</a-button>
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item>
|
||||||
|
<a href="javascript:;" @click="handleCodeGenerator('packAndDownload')">打包下载</a>
|
||||||
|
</a-menu-item>
|
||||||
|
<a-menu-item>
|
||||||
|
<a href="javascript:;" @click="handleCodeGenerator('genCodeToProject')">生成到项目中</a>
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
</a-dropdown>
|
||||||
<a-button type="primary" danger @click="handleClose">{{ t('关闭') }}</a-button>
|
<a-button type="primary" danger @click="handleClose">{{ t('关闭') }}</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -57,6 +69,7 @@
|
|||||||
saveDraftGeneratorCode,
|
saveDraftGeneratorCode,
|
||||||
updateDraftGeneratorCode,
|
updateDraftGeneratorCode,
|
||||||
getMasterInfo,
|
getMasterInfo,
|
||||||
|
downloadCodes,
|
||||||
} from '/@/api/system/generator';
|
} from '/@/api/system/generator';
|
||||||
import { FormProps } from '/@/components/Form';
|
import { FormProps } from '/@/components/Form';
|
||||||
import { buildOption } from '/@/utils/helper/designHelper';
|
import { buildOption } from '/@/utils/helper/designHelper';
|
||||||
@ -71,6 +84,8 @@
|
|||||||
import { MenuConfig } from '/@/model/generator/menuConfig';
|
import { MenuConfig } from '/@/model/generator/menuConfig';
|
||||||
import { FormEventColumnConfig } from '/@/model/generator/formEventConfig';
|
import { FormEventColumnConfig } from '/@/model/generator/formEventConfig';
|
||||||
import DesignLogo from '/@/components/ModalPanel/src/DesignLogo.vue';
|
import DesignLogo from '/@/components/ModalPanel/src/DesignLogo.vue';
|
||||||
|
import { downloadByData } from '/@/utils/file/download';
|
||||||
|
import { dateUtil } from '/@/utils/dateUtil';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const StructureConfigStep = defineAsyncComponent({
|
const StructureConfigStep = defineAsyncComponent({
|
||||||
@ -244,7 +259,7 @@
|
|||||||
handleClose();
|
handleClose();
|
||||||
emit('success');
|
emit('success');
|
||||||
}
|
}
|
||||||
async function handleCodeGenerator() {
|
async function handleCodeGenerator(actionType:String) {
|
||||||
const isOk = await stepValidate[5]();
|
const isOk = await stepValidate[5]();
|
||||||
if (
|
if (
|
||||||
generatorConfig.formJson?.hiddenComponent &&
|
generatorConfig.formJson?.hiddenComponent &&
|
||||||
@ -263,7 +278,16 @@
|
|||||||
buildOption(generatorConfig.formJson) as FormProps,
|
buildOption(generatorConfig.formJson) as FormProps,
|
||||||
);
|
);
|
||||||
if (templateId.value) data.id = templateId.value;
|
if (templateId.value) data.id = templateId.value;
|
||||||
await codeFirstGeneratorCode(data);
|
data.actionType=actionType;
|
||||||
|
const result =await codeFirstGeneratorCode(data);
|
||||||
|
if(data.actionType=="packAndDownload"&&result){
|
||||||
|
const fileName=data.outputConfig.className+'_'+dateUtil(new Date()).format('YYYY-MM-DD_HH_mm_ss');
|
||||||
|
const res = await downloadCodes({uuid:result});
|
||||||
|
downloadByData(
|
||||||
|
res.data,
|
||||||
|
fileName+".zip"
|
||||||
|
);
|
||||||
|
}
|
||||||
handleClose();
|
handleClose();
|
||||||
emit('success');
|
emit('success');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user