feat:新增订单下载列表删除,下载,查询接口联调

This commit is contained in:
Apple 2023-01-04 11:20:31 +08:00
parent 20932d07dd
commit 2edb5a4296
4 changed files with 89 additions and 64 deletions

View File

@ -416,7 +416,6 @@ module.exports = function (webpackEnv) {
}
]
],
plugins: [
[
require.resolve('babel-plugin-named-asset-import'),
@ -698,7 +697,6 @@ module.exports = function (webpackEnv) {
const entrypointFiles = entrypoints.main.filter(
(fileName) => !fileName.endsWith('.map')
)
return {
files: manifestFiles,
entrypoints: entrypointFiles

View File

@ -4,6 +4,7 @@ import { Notify } from "zent"
// const Version = "v1.3.0";
// window.baseurl = 'http://pre.marketapi.1688sup.com'
let baseurl = ""
let download_url='http://192.168.6.193:8091'
if (process.env.NODE_ENV == "test" || process.env.NODE_ENV == "development") {
// 测试环境
baseurl = "http://192.168.6.75"
@ -441,7 +442,7 @@ export const getOrderDetails = (id) => {
}
//订单导出
export const getOrderExport = (params) => {
return derive("get", baseurl + "/order/export", params)
return req("get", baseurl + "/order/export", params)
}
//订单改为成功
export const putOrderSuccess = (id) => {
@ -969,4 +970,21 @@ export const handlerRefund = (orderNumber, data) => {
return req("put", baseurl + `/order/hand_refund/${orderNumber}`, data)
}
//订单管理-导出订单
// export const batchSend = (data) => {
// return req("post", baseurl + `/keys/batchSend`, data)
// }
//订单下载列表-列表
export const getdownloadList = (id) => {
return req("get", download_url + `/export/excel/marketOrder/record`)
}
//订单下载列表-数据下载
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 { req }

View File

@ -1,24 +1,26 @@
import React from "react"
import {
Sweetalert,
Progress
Progress,
Notify
} from "zent"
import "@/assets/comm.css"
import Ipt from "@/components/input/main"
import Grid from "@/components/gird/main.js"
import TabPage from "@/components/tabPage/main.js"
import {getdownloadList,exportDownload,deleteDownload,handelResponse} from "@/assets/api.js"
const Column=[
{
title: '订单文件名称',
name: 'name',
prop:'name',
name: 'file_name',
prop:'file_name',
type: "normal",
width:'40%'
width:'50%'
}, {
title: '生成进度条',
prop:'progress',
name: 'progress',
width:'40%',
width:'30%',
type: "slot",
}, {
title: '操作',
@ -34,31 +36,7 @@ export default class downloadlist extends React.Component {
super(props)
this.state = {
tabList: [{ title: "订单下载列表" }],
orderList: [{
name:'yxxt2022-12-29 17:43:55',
progress:'50',
status:1
},{
name:'yxxt2022-12-29 17:43:55',
progress:'80',
status:3
},{
name:'yxxt2022-12-29 17:43:55',
progress:'100',
status:2
},{
name:'yxxt2022-12-29 17:43:55',
progress:'50',
status:1
},{
name:'yxxt2022-12-29 17:43:55',
progress:'80',
status:3
},{
name:'yxxt2022-12-29 17:43:55',
progress:'100',
status:2
}],
orderList: [],
tableHeight: 500,
page: 1,
limit: 10,
@ -69,18 +47,27 @@ export default class downloadlist extends React.Component {
componentWillMount() {
this.setState({ tableHeight: window.innerHeight - 430 })
}
componentDidMount(){
this.getDownloadList();
}
//删除
deleteFn(e, row) {
let self = this
Sweetalert.confirm({
type: "warning",
closeBtn: true,
title: "确认操作",
content: (
<p>是否删除<b>[{row.name}]</b></p>
<p>是否删除<b>[{row.file_name}]</b></p>
),
onConfirm() {
console.log('删除');
deleteDownload(row.filter_md5).then(res=>{
handelResponse(res,(response,msg)=>{
Notify.clear();
Notify.success(msg);
},(err)=>{
Notify.error(err)
})
}).catch()
},
onCancel() {},
className: "questModal",
@ -99,9 +86,45 @@ export default class downloadlist extends React.Component {
sureFn() {
this.setState({ page: 1 })
}
exportFn(){
exportFn(e,rowData){
exportDownload(rowData.filter_md5)
.then((res) => {
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
}
})
.catch(err => {})
}
getDownloadList(){
let {page,limit}=this.state;
let data={
page,
limit
}
getdownloadList().then(res=>{
handelResponse(res,(response,msg)=>{
this.setState({total:response.total,orderList:response.data});
},(err)=>{
Notify.error(err)
})
}
).catch(err=>{});
}
statuStyle(val){
let result;
if(val<'70'){
@ -115,10 +138,6 @@ export default class downloadlist extends React.Component {
}
return result;
}
componentWillMount() {
}
//过滤表格枚举状态
render() {
return (
@ -164,12 +183,12 @@ export default class downloadlist extends React.Component {
ComponentHandler={(com, rowData) => {
if(com == "progress")
{
return <Progress percent={rowData.progress} status={this.statuStyle(rowData.progress)} width={180} strokeWidth={5} strokeLinecap={'round'}/>
return <Progress percent={rowData.process} status={this.statuStyle(rowData.process)} width={180} strokeWidth={5} strokeLinecap={'round'}/>
}
if(com == "operation")
{
return <p>
<span className={rowData.status!=2?'grid-link disabled':'grid-link'} onClick={(e)=>this.exportFn(e,rowData)}>下载</span>
<span className={rowData.status!=3?'grid-link disabled':'grid-link'} onClick={(e)=>this.exportFn(e,rowData)}>下载</span>
<span className={rowData.status==1?'grid-link ml15 disabled':'ml15 grid-link'} onClick={(e)=>this.deleteFn(e,rowData)}>删除</span>
</p>
}

View File

@ -220,27 +220,17 @@ export default class orderlist extends React.Component {
title: "确认操作",
content: <p>是否导出订单</p>,
onConfirm() {
getOrderExport(data)
.then((res) => {
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 = "订单管理" + _self.getnow() + ".xlsx" //设置文件名
var link = document.createElement("a") //创建<a>标签
link.href = window.URL.createObjectURL(bl)
link.download = fileName //下载的文件名
link.click()
window.URL.revokeObjectURL(link.href) //清除URL
}
getOrderExport(data).then((res) => {
handelResponse(res,(response,msg)=>{
Notify.clear();
Notify.success(msg);
},(err)=>{
Notify.error(err)
})
})
.catch((err) => {
Notify.error(err.message);
})
.catch((err) => {})
},
onCancel() {},