feat: 代码生成支持路径方式生成
This commit is contained in:
parent
bc6818f531
commit
5e7aeaf12e
@ -1,3 +1,9 @@
|
|||||||
|
# 1.2.2
|
||||||
|
|
||||||
|
**FEATURES**
|
||||||
|
|
||||||
|
- 代码生成支持路径方式生成
|
||||||
|
|
||||||
# 1.2.1
|
# 1.2.1
|
||||||
|
|
||||||
# BUG FIXES
|
# BUG FIXES
|
||||||
|
@ -77,8 +77,8 @@ export function genDownload(tableId: ID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 生成代码(自定义路径)
|
// 生成代码(自定义路径)
|
||||||
export function genDownloadWithPath(tableId: ID) {
|
export function genWithPath(tableId: ID) {
|
||||||
return requestClient.get(`${Api.download}/${tableId}`);
|
return requestClient.get<void>(`${Api.genCode}/${tableId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步数据库
|
// 同步数据库
|
||||||
|
@ -18,6 +18,7 @@ import {
|
|||||||
batchGenCode,
|
batchGenCode,
|
||||||
generatedList,
|
generatedList,
|
||||||
genRemove,
|
genRemove,
|
||||||
|
genWithPath,
|
||||||
getDataSourceNames,
|
getDataSourceNames,
|
||||||
syncDb,
|
syncDb,
|
||||||
} from '#/api/tool/gen';
|
} from '#/api/tool/gen';
|
||||||
@ -139,8 +140,15 @@ async function handleBatchGen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleDownload(record: Recordable<any>) {
|
async function handleDownload(record: Recordable<any>) {
|
||||||
const hideLoading = message.loading('下载中...');
|
const hideLoading = message.loading('加载中...');
|
||||||
try {
|
try {
|
||||||
|
// 路径生成
|
||||||
|
if (record.genType === '1' && record.genPath) {
|
||||||
|
await genWithPath(record.tableId);
|
||||||
|
message.success(`生成成功: ${record.genPath}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// zip生成
|
||||||
const blob = await batchGenCode(record.tableId);
|
const blob = await batchGenCode(record.tableId);
|
||||||
const filename = `代码生成_${record.tableName}_${dayjs().valueOf()}.zip`;
|
const filename = `代码生成_${record.tableName}_${dayjs().valueOf()}.zip`;
|
||||||
downloadByData(blob, filename);
|
downloadByData(blob, filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user