Commit 93c837eb by 匡雅琴

导出接口

1 parent 896f7da5
......@@ -41,6 +41,11 @@ const customerApi = {
getOrderDetail(data = {}) {
data.method = `${defaultPath}detail`
return request(data)
},
// 订单列表导出
orderListExport(data = {}) {
data.method = `${defaultPath}list.export`
return request(data)
}
}
......
......@@ -9,10 +9,12 @@ import { Request as request } from 'glsx-vue-common'
import '@/styles/index.css'
// 组件
import '@/components'
import { Util } from './common/util'
// import _ from 'lodash'
// import axios from 'axios'
Vue.prototype.btn_size = 'mini'
Vue.prototype.$Utils = Util
Vue.use(ElementUI)
var mixin = {
......@@ -70,12 +72,13 @@ var mixin = {
}
}
}
const URL = 'http://oss-config.dev.glsx.com.cn/mock/5be17454f31545347559d499/config'
const URL =
'http://oss-config.dev.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/renwal-config') => {
return new Promise((resolve, reject) => {
request({ url }).then(res => {
if (res.status === 'success') {
resolve({ 'vue': Vue, 'config': JSON.parse(res.data) })
resolve({ vue: Vue, config: JSON.parse(res.data) })
} else {
reject('ERROR.')
}
......
import Vue from 'vue'
export const Util = {
getExplorer: function() {
var ua = navigator.userAgent.toLocaleLowerCase()
var browserType = null
if (ua.match(/msie/) != null || ua.match(/trident/) != null) {
browserType = 'IE'
} else if (ua.match(/firefox/) != null) {
browserType = '火狐'
} else if (ua.match(/ubrowser/) != null) {
browserType = 'UC'
} else if (ua.match(/opera/) != null) {
browserType = '欧朋'
} else if (ua.match(/bidubrowser/) != null) {
browserType = '百度'
} else if (ua.match(/metasr/) != null) {
browserType = '搜狗'
} else if (
ua.match(/tencenttraveler/) != null ||
ua.match(/qqbrowse/) != null
) {
browserType = 'QQ'
} else if (ua.match(/maxthon/) != null) {
browserType = '遨游'
} else {
browserType = '谷歌'
}
return browserType
},
exportFn: function(url) {
console.log(url)
let browserType = getExplorer()
if (browserType == 'QQ') {
window.open(url)
return
}
let iframe = document.createElement('iframe')
console.log(iframe)
iframe.style.display = 'none'
iframe.src = url
document.body.appendChild(iframe)
console.log(document.body)
}
}
export const getExplorer = Util.getExplorer
export const exportFn = Util.exportFn
......@@ -77,7 +77,7 @@ export default {
orderDateEnd: '',
businessInstitution: ''
},
orderTime: '',
orderTime: [],
// 表格参数
tableParams: {
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
......@@ -168,7 +168,31 @@ export default {
)
},
// 导出
handlerOutput() {}
handlerOutput() {
if (this.orderTime) {
this.searchForm.orderDateBegin = this.orderTime[0]
this.searchForm.orderDateEnd = this.orderTime[1]
}
const { pageNum, pageSize } = this.$refs.orderTable.page
let params = JSON.parse(JSON.stringify(this.searchForm))
params.pageNum = pageNum
params.pageSize = pageSize
customerApi.orderListExport(params).then(res => {
if (res.code == 0) {
console.log(res.data)
this.$Utils.exportFn(res.data)
// let browserType = getExplorer()
// if (browserType == 'QQ') {
// window.open(url)
// return
// }
// let iframe = document.createElement('iframe')
// iframe.style.display = 'none'
// iframe.src = url
// document.body.appendChild(iframe)
}
})
}
}
}
</script>
......
......@@ -179,19 +179,9 @@ export default {
}
},
mounted() {
// this.getCustomerList()
},
mounted() {},
methods: {
getCustomerList() {
var params = JSON.parse(JSON.stringify(this.searchForm))
params.pageNum = 1
params.pageSize = 10
integrateApi.customerList(params).then(res => {
console.log(res)
})
},
// 重置搜索框搜索
handleReset() {
this.searchForm = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!