前端代码生成增加下载功能

This commit is contained in:
izory 2021-09-23 09:20:01 +08:00
parent 62407707a5
commit e75caefb13

View File

@ -77,6 +77,8 @@
<script> <script>
import { codeGenerator, getGenTable, delTable } from "@/api/tool/gen"; import { codeGenerator, getGenTable, delTable } from "@/api/tool/gen";
import { downLoadZip } from "@/utils/zipdownload.js";
import importTable from "./importTable"; import importTable from "./importTable";
import { Loading } from "element-ui"; import { Loading } from "element-ui";
@ -120,7 +122,7 @@ export default {
// //
tableIds: [], tableIds: [],
// //
multiple: true multiple: true,
}; };
}, },
created() { created() {
@ -186,13 +188,11 @@ export default {
codeGenerator(seachdata) codeGenerator(seachdata)
.then((res) => { .then((res) => {
if (res.code == 200) { const { code, data } = res;
// downloadFile( if (code == 200) {
// defaultSettings.fileUrl + res.ResData[0],
// res.ResData[1]
// );
this.showGenerate = false; this.showGenerate = false;
this.msgSuccess("恭喜你,代码生成完成!"); this.msgSuccess("恭喜你,代码生成完成!");
downLoadZip(data.zipPath, '');
} else { } else {
this.msgError(res.msg); this.msgError(res.msg);
} }
@ -231,18 +231,18 @@ export default {
}, },
handleDelete(row) { handleDelete(row) {
const tableIds = row.tableId || this.tableIds; const tableIds = row.tableId || this.tableIds;
delTable(tableIds.toString()).then(res => { delTable(tableIds.toString()).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.msgSuccess('删除成功') this.msgSuccess("删除成功");
this.handleSearch(); this.handleSearch();
} }
}) });
}, },
handleSelectionChange(section) { handleSelectionChange(section) {
this.tableIds = section.map((item) => item.tableId); this.tableIds = section.map((item) => item.tableId);
this.multiple = !section.length; this.multiple = !section.length;
console.log(this.tableIds) console.log(this.tableIds);
}, },
}, },
}; };