diff --git a/fuintAdmin/src/main.js b/fuintAdmin/src/main.js
index 43b4aa1..828b5b9 100644
--- a/fuintAdmin/src/main.js
+++ b/fuintAdmin/src/main.js
@@ -12,7 +12,7 @@ import store from './store'
import router from './router'
import directive from './directive' // directive
import plugins from './plugins' // plugins
-import { download } from '@/utils/request'
+import { download,download1,download2 } from '@/utils/request'
import './assets/icons' // icon
import './permission' // permission control
@@ -42,14 +42,19 @@ import Print from 'vue-print-nb'
import TreeSelect from '@/components/TreeSelect'
// 会员选择组件
import UserSelect from '@/components/UserSelect'
+import { selectDictLabel, selectDictLabels} from "@/utils/ruoyi";
// 全局方法挂载
Vue.prototype.getConfigKey = getConfigKey
+Vue.prototype.selectDictLabel = selectDictLabel
+Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.getName = getName
Vue.prototype.download = download
+Vue.prototype.download1 = download1
+Vue.prototype.download2 = download2
Vue.prototype.handleTree = handleTree
// 全局组件挂载
diff --git a/fuintAdmin/src/utils/request.js b/fuintAdmin/src/utils/request.js
index 178388b..8836f6a 100644
--- a/fuintAdmin/src/utils/request.js
+++ b/fuintAdmin/src/utils/request.js
@@ -1,14 +1,15 @@
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/fuint";
import cache from '@/plugins/cache'
-
+import request from '@/utils/request'
+import { blobValidate } from "@/utils/ruoyi";
// 是否显示重新登录
export let isRelogin = { show: false };
-
+let downloadLoadingInstance;
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
@@ -135,6 +136,42 @@ export function download(url, params) {
window.open(url, '_blank')
}
+// 通用下载方法
+export function download1(url, params) {
+ return request({
+ url: url + '?token='+ getToken() + '&'+ param(params),
+ method: 'get'
+ })
+ // url = process.env.VUE_APP_BASE_API + url + '?token='+ getToken() + '&'+ param(params)
+ // window.open(url, '_blank')
+}
+// 通用下载方法
+export function download2(url, params, filename, config) {
+ 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' },
+ responseType: 'blob',
+ ...config
+ }).then(async (data) => {
+ const isBlob = blobValidate(data);
+ if (isBlob) {
+ const blob = new Blob([data])
+ saveAs(blob, filename)
+ } else {
+ const resText = await data.text();
+ const rspObj = JSON.parse(resText);
+ const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
+ Message.error(errMsg);
+ }
+ downloadLoadingInstance.close();
+ }).catch((r) => {
+ console.error(r)
+ Message.error('下载文件出现错误,请联系管理员!')
+ downloadLoadingInstance.close();
+ })
+}
+
// 组织参数
export function param(data) {
let url = ''
diff --git a/fuintAdmin/src/views/order/index.vue b/fuintAdmin/src/views/order/index.vue
index aa1a7a5..d10a9bc 100644
--- a/fuintAdmin/src/views/order/index.vue
+++ b/fuintAdmin/src/views/order/index.vue
@@ -91,6 +91,13 @@