Commit ae323571 by cwq0219

导出

1 parent 7c4a85ce
...@@ -31,6 +31,52 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max ...@@ -31,6 +31,52 @@ function limitPrice(newValue, oldValue, intergerDigit, pointDigit, minValue, max
} }
} }
function getExplorer() {
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
}
function exportFn(url) {
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)
}
// function aToExport(url) {
// var a = document.createElement('a')
// a.setAttribute('id', 'exportToExport')
// a.setAttribute('href', url)
// a.setAttribute('target', '_blank')
// document.body.appendChild(a)
// a.click()
// }
const orderManageStatusList = [ const orderManageStatusList = [
{ confId: '1', confName: '未支付' }, { confId: '1', confName: '未支付' },
{ confId: '2', confName: '已支付' }, { confId: '2', confName: '已支付' },
...@@ -151,6 +197,9 @@ const stateList = [{ ...@@ -151,6 +197,9 @@ const stateList = [{
export { export {
limitPrice, limitPrice,
getExplorer,
exportFn,
// aToExport,
orderManageStatusList, orderManageStatusList,
orderSourceList, orderSourceList,
deliveryTypeList, deliveryTypeList,
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
<script> <script>
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
export default { export default {
name: 'coupon', name: 'coupon',
data() { data() {
...@@ -349,11 +350,7 @@ export default { ...@@ -349,11 +350,7 @@ export default {
handleExport(row) { handleExport(row) {
var params = this.getParams() var params = this.getParams()
this.$apis.couponManage.couponExportApi(params).then(res => { this.$apis.couponManage.couponExportApi(params).then(res => {
var a = document.createElement('a') exportFn(res)
a.setAttribute('href', res)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}) })
}, },
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<script> <script>
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { exportFn } from '@/common/constant'
export default { export default {
name: 'writeOffDetail', name: 'writeOffDetail',
data() { data() {
...@@ -258,11 +259,7 @@ export default { ...@@ -258,11 +259,7 @@ export default {
handleExport(row) { handleExport(row) {
var params = this.getParams() var params = this.getParams()
this.$apis.couponManage.verificationExportApi(params).then(res => { this.$apis.couponManage.verificationExportApi(params).then(res => {
var a = document.createElement('a') exportFn(res)
a.setAttribute('href', res)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}) })
}, },
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</template> </template>
<script> <script>
import { orderTypesList, orderStatusList } from '@/common/constant' import { orderTypesList, orderStatusList, exportFn } from '@/common/constant'
import url from '@/assets/empty.png' import url from '@/assets/empty.png'
import { getOrderListApi, orderExportApi } from '@/api/modules/order' import { getOrderListApi, orderExportApi } from '@/api/modules/order'
export default { export default {
...@@ -215,11 +215,7 @@ export default { ...@@ -215,11 +215,7 @@ export default {
handleExport(row) { handleExport(row) {
var params = this.getParams() var params = this.getParams()
orderExportApi(params).then(res => { orderExportApi(params).then(res => {
var a = document.createElement('a') exportFn(res)
a.setAttribute('href', res)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}) })
}, },
......
...@@ -63,6 +63,7 @@ import glsxDialog from '@/components/glsx-dialog' ...@@ -63,6 +63,7 @@ import glsxDialog from '@/components/glsx-dialog'
import { getRecordListApi,getVerificationCode,verificationExportApi } from '@/api/modules/record' import { getRecordListApi,getVerificationCode,verificationExportApi } from '@/api/modules/record'
import url from "@/assets/empty.png" import url from "@/assets/empty.png"
import { dateFormat } from '@/utils/index.js' import { dateFormat } from '@/utils/index.js'
import { exportFn } from '@/common/constant'
export default { export default {
name: 'record', name: 'record',
components: { components: {
...@@ -241,11 +242,7 @@ export default { ...@@ -241,11 +242,7 @@ export default {
handleExport(row) { handleExport(row) {
var params = this.getParams() var params = this.getParams()
verificationExportApi(params).then(res => { verificationExportApi(params).then(res => {
var a = document.createElement('a') exportFn(res)
a.setAttribute('href', res)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}) })
}, },
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
<script> <script>
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import url from "@/assets/empty.png" import url from "@/assets/empty.png"
import { orderManageStatusList, orderSourceList, deliveryTypeList } from '@/common/constant' import { orderManageStatusList, orderSourceList, deliveryTypeList, exportFn } from '@/common/constant'
export default { export default {
name: 'orderManage', name: 'orderManage',
data() { data() {
...@@ -654,12 +654,7 @@ export default { ...@@ -654,12 +654,7 @@ export default {
handleExport(row) { handleExport(row) {
var params = this.getParams() var params = this.getParams()
this.$apis.orderManage.orderExportApi(params).then(res => { this.$apis.orderManage.orderExportApi(params).then(res => {
// window.open(res) exportFn(res)
var a = document.createElement('a')
a.setAttribute('href', res)
a.setAttribute('target', '_blank')
document.body.appendChild(a)
a.click()
}) })
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!