feat: 增加后台管理系统包码结算列表导出
This commit is contained in:
parent
88fd85761e
commit
d1898a1917
|
@ -1038,4 +1038,11 @@ export const getPackageDetail = (id) => {
|
|||
return req("get", baseurl + "/settlement_order/detail/" + id)
|
||||
}
|
||||
|
||||
/**
|
||||
* 包码订单导出
|
||||
*/
|
||||
export const getSettlementListOrderExport = (params) => {
|
||||
return derive("get", baseurl + "/settlement_order/export", params)
|
||||
}
|
||||
|
||||
export { req }
|
||||
|
|
|
@ -4,7 +4,8 @@ import {
|
|||
getSettlementOrder,
|
||||
getSettlementType,
|
||||
handelResponse,
|
||||
queryKeyBatch
|
||||
queryKeyBatch,
|
||||
getSettlementListOrderExport
|
||||
} from "@/assets/api.js"
|
||||
import "@/assets/comm.css"
|
||||
import { nowDay, nowMonth } from "@/assets/comm.js"
|
||||
|
@ -14,10 +15,11 @@ import Grid from "@/components/gird/main.js"
|
|||
import Ipt from "@/components/input/main"
|
||||
import TabPage from "@/components/tabPage/main.js"
|
||||
import React from "react"
|
||||
import { Alert, Button, CombinedDateRangePicker, Notify, Select } from "zent"
|
||||
import { Alert, Button, CombinedDateRangePicker, Notify, Select, Sweetalert } from "zent"
|
||||
import "./list.less"
|
||||
import { Column } from "./utils"
|
||||
import { pickBy } from "lodash-es"
|
||||
import { getNowTime } from "@/tools/utils.js"
|
||||
|
||||
var moment = require("moment")
|
||||
let day = moment(nowDay()).format("YYYY-MM-DD")
|
||||
|
@ -168,6 +170,55 @@ export default class settlementList extends React.Component {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
bachExportOrder() {
|
||||
let { page, limit, search, combinedValue } = this.state
|
||||
let { key, key_batch_id, plan_id, reseller_id, type } = search
|
||||
|
||||
// 导出必须有时间和计划id
|
||||
if (!plan_id || !combinedValue) {
|
||||
Notify.error("订单导出必须有计划id和时间")
|
||||
return
|
||||
}
|
||||
|
||||
let params = {
|
||||
page,
|
||||
limit,
|
||||
begin_time: combinedValue[0],
|
||||
end_time: combinedValue[1],
|
||||
key: key ? key : "",
|
||||
key_batch_id: key_batch_id ? key_batch_id.key : "",
|
||||
plan_id: plan_id ? plan_id.key : "",
|
||||
reseller_id: reseller_id ? reseller_id.key : "",
|
||||
type: type ? type.key : ""
|
||||
}
|
||||
try {
|
||||
getSettlementListOrderExport(params).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 = "包码结算订单列表" + getNowTime() + ".xlsx" //设置文件名
|
||||
var link = document.createElement("a") //创建<a>标签
|
||||
link.href = window.URL.createObjectURL(bl)
|
||||
link.download = fileName //下载的文件名
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(link.href) //清除URL
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
//page
|
||||
pageChange(e) {
|
||||
this.setState({ selectionData: [], page: e }, () => {
|
||||
|
@ -321,7 +372,7 @@ export default class settlementList extends React.Component {
|
|||
/>
|
||||
</FormItem>
|
||||
<FormItem labelname="" required="" labelwidth="0">
|
||||
<div style={{ width: "200px" }}>
|
||||
<div style={{ width: "200px", marginLeft: "-20px" }}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
|
@ -336,9 +387,17 @@ export default class settlementList extends React.Component {
|
|||
</div>
|
||||
</FormItem>
|
||||
</Form>
|
||||
<Button
|
||||
className="exportOrder"
|
||||
type="default"
|
||||
icon="download"
|
||||
onClick={this.bachExportOrder.bind(this)}
|
||||
>
|
||||
导出订单
|
||||
</Button>
|
||||
</div>
|
||||
<div>
|
||||
{this.state.selectionData.length > 0 ? (
|
||||
{/* {this.state.selectionData.length > 0 ? (
|
||||
<Alert
|
||||
type="info"
|
||||
extraContent={
|
||||
|
@ -354,7 +413,7 @@ export default class settlementList extends React.Component {
|
|||
项,官方价金额总计¥{this.state.officialPrice.toFixed(4)}
|
||||
,成本价金额总计:¥{this.state.costPrice.toFixed(4)}
|
||||
</Alert>
|
||||
) : null}
|
||||
) : null} */}
|
||||
<Grid
|
||||
spliteColor={"#fff"}
|
||||
tableData={this.state.orderList}
|
||||
|
@ -362,7 +421,7 @@ export default class settlementList extends React.Component {
|
|||
dataCount={this.state.total}
|
||||
itemcheck={this.state.itemcheck}
|
||||
allcheck={this.state.allcheck}
|
||||
isMultiple={true}
|
||||
isMultiple={false}
|
||||
page={this.state.page}
|
||||
countbarVisible={false}
|
||||
isSwitch={false}
|
||||
|
@ -374,7 +433,7 @@ export default class settlementList extends React.Component {
|
|||
countChange={(e) => {
|
||||
this.countChange(e)
|
||||
}}
|
||||
checkChange={this.selection.bind(this)}
|
||||
// checkChange={this.selection.bind(this)}
|
||||
ComponentHandler={(com, rowData) => {
|
||||
if (com == "opearo") {
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue