新增通用方法简化下载使用

This commit is contained in:
RuoYi
2021-09-27 10:38:29 +08:00
parent 02b95f95a8
commit ded99502ae
20 changed files with 70 additions and 82 deletions

View File

@ -515,7 +515,7 @@ export default {
this.exportLoading = true;
return exportJob(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -298,7 +298,7 @@ export default {
this.exportLoading = true;
return exportJobLog(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -221,7 +221,7 @@ export default {
this.exportLoading = true;
return exportLogininfor(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -308,7 +308,7 @@ export default {
this.exportLoading = true;
return exportOperlog(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -339,7 +339,7 @@ export default {
this.exportLoading = true;
return exportConfig(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
},

View File

@ -385,7 +385,7 @@ export default {
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -343,7 +343,7 @@ export default {
this.exportLoading = true;
return exportType(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
},

View File

@ -310,7 +310,7 @@ export default {
this.exportLoading = true;
return exportPost(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -618,7 +618,7 @@ export default {
this.exportLoading = true;
return exportRole(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
}

View File

@ -648,7 +648,7 @@ export default {
this.exportLoading = true;
return exportUser(queryParams);
}).then(response => {
this.download(response.msg);
this.$download.name(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
@ -660,7 +660,7 @@ export default {
/** 下载模板操作 */
importTemplate() {
importTemplate().then(response => {
this.download(response.msg);
this.$download.name(response.msg);
});
},
// 文件上传中处理

View File

@ -137,23 +137,13 @@
<script>
import draggable from 'vuedraggable'
import { saveAs } from 'file-saver'
import beautifier from 'js-beautify'
import ClipboardJS from 'clipboard'
import render from '@/utils/generator/render'
import RightPanel from './RightPanel'
import {
inputComponents,
selectComponents,
layoutComponents,
formConf
} from '@/utils/generator/config'
import {
exportDefault, beautifierConf, isNumberStr, titleCase
} from '@/utils/index'
import {
makeUpHtml, vueTemplate, vueScript, cssStyle
} from '@/utils/generator/html'
import { inputComponents, selectComponents, layoutComponents, formConf } from '@/utils/generator/config'
import { beautifierConf, titleCase } from '@/utils/index'
import { makeUpHtml, vueTemplate, vueScript, cssStyle } from '@/utils/generator/html'
import { makeUpJs } from '@/utils/generator/js'
import { makeUpCss } from '@/utils/generator/css'
import drawingDefalut from '@/utils/generator/drawingDefalut'
@ -161,7 +151,6 @@ import logo from '@/assets/logo/logo.png'
import CodeTypeDialog from './CodeTypeDialog'
import DraggableItem from './DraggableItem'
const emptyActiveData = { style: {}, autosize: {} }
let oldActiveId
let tempActiveData
@ -287,7 +276,7 @@ export default {
execDownload(data) {
const codeStr = this.generateCode()
const blob = new Blob([codeStr], { type: 'text/plain;charset=utf-8' })
saveAs(blob, data.fileName)
this.$download.saveAs(blob, data.fileName)
},
execCopy(data) {
document.getElementById('copyNode').click()

View File

@ -180,7 +180,6 @@
<script>
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
import importTable from "./importTable";
import { downLoadZip } from "@/utils/zipdownload";
import hljs from "highlight.js/lib/highlight";
import "highlight.js/styles/github-gist.css";
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
@ -270,7 +269,7 @@ export default {
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
});
} else {
downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
this.$download.zip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
}
},
/** 同步数据库操作 */