From 2edb5a4296ff62043ef42f42277a3f52aadf2a14 Mon Sep 17 00:00:00 2001 From: Apple <> Date: Wed, 4 Jan 2023 11:20:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=88=97=E8=A1=A8=E5=88=A0=E9=99=A4=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/webpack.config.js | 2 - src/assets/api.js | 20 +++++- src/pages/order/downloadList/list.js | 101 ++++++++++++++++----------- src/pages/order/list/list.js | 30 +++----- 4 files changed, 89 insertions(+), 64 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 92d3e5c3..aefde0a3 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -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 diff --git a/src/assets/api.js b/src/assets/api.js index 26bae8b8..0dc3e997 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -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 } diff --git a/src/pages/order/downloadList/list.js b/src/pages/order/downloadList/list.js index f886c489..3d2524c2 100644 --- a/src/pages/order/downloadList/list.js +++ b/src/pages/order/downloadList/list.js @@ -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: ( -
是否删除[{row.name}]?
+是否删除[{row.file_name}]?
), 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,8 +86,44 @@ 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") //创建标签 + 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; @@ -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