Skip to content

Commit aac873b

Browse files
committed
fix: 🐛 代码生成问题修复和优化
1 parent 1dcb892 commit aac873b

File tree

3 files changed

+143
-48
lines changed

3 files changed

+143
-48
lines changed

src/api/generator.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,21 @@ class GeneratorAPI {
5050
* @param url
5151
* @param fileName
5252
*/
53-
static download(tableName: string, fileName?: string) {
53+
static download(tableName: string) {
5454
return request({
5555
url: `${GENERATOR_BASE_URL}/${tableName}/download`,
5656
method: "get",
5757
responseType: "blob",
58-
}).then((res) => {
59-
const blob = new Blob([res.data], { type: "application/zip" });
58+
}).then((response) => {
59+
const fileName = decodeURI(
60+
response.headers["content-disposition"].split(";")[1].split("=")[1]
61+
);
62+
63+
const blob = new Blob([response.data], { type: "application/zip" });
6064
const a = document.createElement("a");
6165
const url = window.URL.createObjectURL(blob);
6266
a.href = url;
63-
a.download = fileName || "下载文件.zip";
67+
a.download = fileName;
6468
a.click();
6569
window.URL.revokeObjectURL(url);
6670
});
@@ -129,6 +133,11 @@ export interface GenConfigForm {
129133
/** 上级菜单 */
130134
parentMenuId?: number;
131135

136+
/** 后端应用名 */
137+
backendAppName?: string;
138+
/** 前端应用名 */
139+
frontendAppName?: string;
140+
132141
/** 字段配置列表 */
133142
fieldConfigs?: FieldConfig[];
134143
}

src/enums/FormTypeEnum.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export const FormTypeEnum: Record<string, OptionType> = {
99
INPUT_NUMBER: { value: 5, label: "数字输入框" },
1010
SWITCH: { value: 6, label: "开关" },
1111
TEXT_AREA: { value: 7, label: "文本域" },
12-
DATE_TIME: { value: 8, label: "日期时间框" },
13-
DATE: { value: 9, label: "日期框" },
12+
DATE: { value: 8, label: "日期框" },
13+
DATE_TIME: { value: 9, label: "日期时间框" },
1414
};

0 commit comments

Comments
 (0)