feat: 修改订单导出

This commit is contained in:
zhangds 2024-05-17 15:22:08 +08:00
parent 283f5c6b0d
commit fb29ad3a75
3 changed files with 50 additions and 55 deletions

View File

@ -1,13 +1,13 @@
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = "development"
process.env.NODE_ENV = "development"
process.env.BASE_URL = "http://test.marketapi.1688sup.com"
process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
// process.env.BASE_URL = "http://test.marketapi.1688sup.com"
// process.env.UNIFIED_API = "http://api.test.user.1688sup.com/v1"
// process.env.UNIFIED_URL = "http://test.user.1688sup.com/#/login"
// process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
// process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
// process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
process.env.BASE_URL = "http://pre.marketapi.1688sup.com"
process.env.UNIFIED_API = "http://api.gray.user.1688sup.com/v1"
process.env.UNIFIED_URL = "http://gray.user.1688sup.com/#/login"
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will

View File

@ -940,18 +940,30 @@ export const handlerRefund = (orderNumber, data) => {
// }
//订单下载列表-列表
export const getdownloadList = (data) => {
return req("get", download_url + `/export/excel/marketOrder/record`, data)
export const queryDownLoadList = (data) => {
return req("get", baseurl + `/order/export/list`, data)
}
//订单下载列表-数据下载
export const exportDownload = (md5) => {
return derive("get", download_url + `/export/excel/marketOrder/download/${md5}`)
// 获取订单下载地址
export const getOrderDownloadUrl = (data) => {
return req("get", baseurl + `/order/export/download-url`, data)
}
//订单下载列表-记录删除
export const deleteDownload = (md5) => {
return req("get", download_url + `/export/excel/marketOrder/delete/${md5}`)
// 删除订单导出记录
export const deleteOrderDownload = (data) => {
return req("get", baseurl + `/order/export/delete`, data)
}
// //订单下载列表-数据下载
// export const exportDownload = (md5) => {
// return derive("get", download_url + `/export/excel/marketOrder/download/${md5}`)
// }
// //订单下载列表-记录删除
// export const deleteDownload = (md5) => {
// return req("get", download_url + `/export/excel/marketOrder/delete/${md5}`)
// }
/* 钉钉审批查询 */
export const dingTaskQuery = (id) => {
return req("post", baseurl + `/approvals/${id}/query`)

View File

@ -1,4 +1,9 @@
import { deleteDownload, exportDownload, getdownloadList, handelResponse } from "@/assets/api.js"
import {
getOrderDownloadUrl,
queryDownLoadList,
handelResponse,
deleteOrderDownload
} from "@/assets/api.js"
import "@/assets/comm.css"
import Grid from "@/components/gird/main.js"
import Ipt from "@/components/input/main"
@ -53,7 +58,7 @@ export default class downloadlist extends React.Component {
this.getDownloadList()
getprocess = setInterval(() => {
this.getDownloadList()
}, 1000)
}, 2000)
}
componentWillUnmount() {
@ -61,7 +66,7 @@ export default class downloadlist extends React.Component {
}
//删除
deleteFn(e, row) {
deleteFn(row) {
let self = this
Sweetalert.confirm({
type: "warning",
@ -73,7 +78,7 @@ export default class downloadlist extends React.Component {
</p>
),
onConfirm() {
deleteDownload(row.filter_md5)
deleteOrderDownload({ task_id: row.task_id })
.then((res) => {
handelResponse(
res,
@ -119,30 +124,11 @@ export default class downloadlist extends React.Component {
}, 0)
}
exportFn(e, rowData) {
this.setState({ loading_visible: true })
exportDownload(rowData.filter_md5)
exportFn(task_id) {
// this.setState({ loading_visible: true })
getOrderDownloadUrl({ task_id })
.then((res) => {
setTimeout(() => {
this.setState({ loading_visible: false })
}, 1000)
if (res.type == "application/json") {
const reader = new FileReader() //创建一个FileReader实例
reader.readAsText(res, "utf-8") //读取文件,结果用字符串形式表示
reader.onload = function () {
const obj = JSON.parse(reader.result)
Notify.clear()
Notify.error(obj.message)
}
} else {
let bl = new Blob([res])
let fileName = rowData.file_name + ".zip" //设置文件名
var link = document.createElement("a") //创建<a>标签
link.href = window.URL.createObjectURL(bl)
link.download = fileName //下载的文件名
link.click()
window.URL.revokeObjectURL(link.href) //清除URL
}
window.location.href = res.data
})
.catch((err) => {})
}
@ -154,13 +140,16 @@ export default class downloadlist extends React.Component {
limit,
file_name
}
getdownloadList(data)
queryDownLoadList(data)
.then((res) => {
handelResponse(
res,
(response, msg) => {
this.setState({ total: response.total, orderList: response.data })
if (response.generate < 1) {
// 判断是否 完成
let is_no_arr = response.data.filter((item) => item.process !== 100)
if (is_no_arr.length === 0) {
clearInterval(getprocess)
}
},
@ -255,14 +244,10 @@ export default class downloadlist extends React.Component {
return (
<p>
<span
className={
rowData.status != 3 || rowData.process === 0
? "grid-link disabled"
: "grid-link"
}
className={rowData.process !== 100 ? "grid-link disabled" : "grid-link"}
onClick={(e) => {
if (rowData.status === 3 && rowData.process === 100) {
this.exportFn(e, rowData)
if (rowData.process === 100) {
this.exportFn(rowData.task_id)
}
}}
>
@ -271,13 +256,11 @@ export default class downloadlist extends React.Component {
<span
className={
rowData.status == 1 || rowData.process === 0
? "grid-link ml15 disabled"
: "ml15 grid-link"
rowData.process !== 100 ? "grid-link ml15 disabled" : "ml15 grid-link"
}
onClick={(e) => {
if (rowData.status === 3 && rowData.process === 100) {
this.deleteFn(e, rowData)
if (rowData.process === 100) {
this.deleteFn(rowData)
}
}}
>