1 files deleted
1 files added
5 files modified
| | |
| | | .append(percentEncodedFileName);
|
| | |
|
| | | response.setHeader("Content-disposition", contentDispositionValue.toString());
|
| | | response.setHeader("download-filename", percentEncodedFileName);
|
| | | }
|
| | |
|
| | | /**
|
| New file |
| | |
| | | import { saveAs } from 'file-saver'
|
| | | import axios from 'axios'
|
| | | import { getToken } from '@/utils/auth'
|
| | |
|
| | | const baseURL = process.env.VUE_APP_BASE_API
|
| | |
|
| | | export default {
|
| | | zip(url, name) {
|
| | | var url = baseURL + url
|
| | | axios({
|
| | | method: 'get',
|
| | | url: url,
|
| | | responseType: 'blob',
|
| | | headers: { 'Authorization': 'Bearer ' + getToken() }
|
| | | }).then(res => {
|
| | | const blob = new Blob([res.data], { type: 'application/zip' })
|
| | | this.saveAs(blob, name)
|
| | | })
|
| | | },
|
| | | saveAs(text, name, opts) {
|
| | | saveAs(text, name, opts);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import cache from './cache'
|
| | | import modal from './modal'
|
| | | import download from './download'
|
| | |
|
| | | export default {
|
| | | install(Vue) {
|
| | |
| | | Vue.prototype.$cache = cache
|
| | | // 模态框对象
|
| | | Vue.prototype.$modal = modal
|
| | | // 下载文件
|
| | | Vue.prototype.$download = download
|
| | | }
|
| | | }
|
| | |
| | | import axios from 'axios'
|
| | | import { Notification, MessageBox, Message } from 'element-ui'
|
| | | import { Notification, MessageBox, Message, Loading } from 'element-ui'
|
| | | import store from '@/store'
|
| | | import { getToken } from '@/utils/auth'
|
| | | import errorCode from '@/utils/errorCode'
|
| | | import { tansParams } from "@/utils/ruoyi";
|
| | | import { saveAs } from 'file-saver'
|
| | |
|
| | | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
| | | let downloadLoadingInstance;
|
| | |
|
| | | axios.defaults.headers['Conntent-Type'] = 'application/json;charset=utf-8'
|
| | | // 创建axios实例
|
| | | const service = axios.create({
|
| | | // axios中请求配置有baseURL选项,表示请求URL公共部分
|
| | |
| | |
|
| | | // 通用下载方法
|
| | | export function download(url, params, filename) {
|
| | | downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍后", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
|
| | | return service.post(url, params, {
|
| | | transformRequest: [(params) => {
|
| | | return tansParams(params)
|
| | | }],
|
| | | headers: {
|
| | | 'Content-Type': 'application/x-www-form-urlencoded'
|
| | | },
|
| | | transformRequest: [(params) => { return tansParams(params) }],
|
| | | headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
| | | responseType: 'blob'
|
| | | }).then((data) => {
|
| | | const content = data
|
| | | const blob = new Blob([content])
|
| | | if ('download' in document.createElement('a')) {
|
| | | const elink = document.createElement('a')
|
| | | elink.download = filename
|
| | | elink.style.display = 'none'
|
| | | elink.href = URL.createObjectURL(blob)
|
| | | document.body.appendChild(elink)
|
| | | elink.click()
|
| | | URL.revokeObjectURL(elink.href)
|
| | | document.body.removeChild(elink)
|
| | | } else {
|
| | | navigator.msSaveBlob(blob, filename)
|
| | | }
|
| | | saveAs(blob, filename)
|
| | | downloadLoadingInstance.close();
|
| | | }).catch((r) => {
|
| | | console.error(r)
|
| | | Message.error('下载文件出现错误,请联系管理员!')
|
| | | downloadLoadingInstance.close();
|
| | | })
|
| | | }
|
| | |
|
| | |
| | |
|
| | | <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'
|
| | |
| | | import CodeTypeDialog from './CodeTypeDialog'
|
| | | import DraggableItem from './DraggableItem'
|
| | |
|
| | | const emptyActiveData = { style: {}, autosize: {} }
|
| | | let oldActiveId
|
| | | let tempActiveData
|
| | |
|
| | |
| | | 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()
|
| | |
| | | <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")); |
| | |
| | | this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath); |
| | | }); |
| | | } else { |
| | | downLoadZip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi"); |
| | | this.$download.zip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi"); |
| | | } |
| | | }, |
| | | /** 同步数据库操作 */ |