diff --git a/src/api/generator.ts b/src/api/generator.ts index c9396e87..a6888c7c 100644 --- a/src/api/generator.ts +++ b/src/api/generator.ts @@ -50,17 +50,21 @@ class GeneratorAPI { * @param url * @param fileName */ - static download(tableName: string, fileName?: string) { + static download(tableName: string) { return request({ url: `${GENERATOR_BASE_URL}/${tableName}/download`, method: "get", responseType: "blob", - }).then((res) => { - const blob = new Blob([res.data], { type: "application/zip" }); + }).then((response) => { + const fileName = decodeURI( + response.headers["content-disposition"].split(";")[1].split("=")[1] + ); + + const blob = new Blob([response.data], { type: "application/zip" }); const a = document.createElement("a"); const url = window.URL.createObjectURL(blob); a.href = url; - a.download = fileName || "下载文件.zip"; + a.download = fileName; a.click(); window.URL.revokeObjectURL(url); }); @@ -129,6 +133,11 @@ export interface GenConfigForm { /** 上级菜单 */ parentMenuId?: number; + /** 后端应用名 */ + backendAppName?: string; + /** 前端应用名 */ + frontendAppName?: string; + /** 字段配置列表 */ fieldConfigs?: FieldConfig[]; } diff --git a/src/enums/FormTypeEnum.ts b/src/enums/FormTypeEnum.ts index 32cb9608..583c33ae 100644 --- a/src/enums/FormTypeEnum.ts +++ b/src/enums/FormTypeEnum.ts @@ -9,6 +9,6 @@ export const FormTypeEnum: Record = { INPUT_NUMBER: { value: 5, label: "数字输入框" }, SWITCH: { value: 6, label: "开关" }, TEXT_AREA: { value: 7, label: "文本域" }, - DATE_TIME: { value: 8, label: "日期时间框" }, - DATE: { value: 9, label: "日期框" }, + DATE: { value: 8, label: "日期框" }, + DATE_TIME: { value: 9, label: "日期时间框" }, }; diff --git a/src/views/generator/index.vue b/src/views/generator/index.vue index 89a012fd..fe0c0b41 100644 --- a/src/views/generator/index.vue +++ b/src/views/generator/index.vue @@ -93,16 +93,23 @@
- + - + - + @@ -110,13 +117,16 @@ - + @@ -126,12 +136,18 @@ - + - + @@ -140,7 +156,7 @@ - + - + - + - + - + - + - + +