|
@@ -22,7 +22,7 @@
|
|
|
<el-button type="primary" class="btn" @click="onclick">
|
|
|
<i class="el-icon-search"></i>查询
|
|
|
</el-button>
|
|
|
- <el-button type="primary" @click="exportData()"
|
|
|
+ <el-button type="primary" @click="exportAllExcel"
|
|
|
><i class="el-icon-download"></i>导出Excel</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -223,6 +223,7 @@ export default {
|
|
|
addressId: null,
|
|
|
//省市县(区)查询值
|
|
|
addresText: null,
|
|
|
+ noSettleDetailsColumn:[],
|
|
|
//达钢的干基
|
|
|
DaDryBasis: null,
|
|
|
//九江收货的干基
|
|
@@ -278,6 +279,91 @@ export default {
|
|
|
this.options2GetRequestUrl();
|
|
|
},
|
|
|
methods: {
|
|
|
+ //excel方法
|
|
|
+ exportAllExcel() {
|
|
|
+ let startTime = null;
|
|
|
+ let endTime = null;
|
|
|
+ let carrierSsoId = null;
|
|
|
+ if (getCookie("orgCode") == "chengyunshang") {
|
|
|
+ carrierSsoId = getCookie("userId");
|
|
|
+ }
|
|
|
+ if (this.startTime && this.endTime) {
|
|
|
+ startTime = sjTime(this.startTime);
|
|
|
+ endTime = sjTime(this.endTime);
|
|
|
+ }
|
|
|
+ if (this.activeName == 'first') {
|
|
|
+ console.log("进入了first")
|
|
|
+ this.tableTitle = '销售钢材汽运结算详单(未结算)'
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ '/api/v1/bms/getSteelTruckDetailsOrder?apiId=507&orderType=1&con=' +
|
|
|
+ this.input +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&status=0" +
|
|
|
+ "&i=" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ console.log("测试打印功能")
|
|
|
+ console.log()
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ } else if (this.activeName == 'second') {
|
|
|
+ console.log("进入了second")
|
|
|
+ this.tableTitle = '销售钢材汽运结算详单(已结算)'
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ '/api/v1/bms/getSteelTruckDetailsOrder?apiId=507&orderType=1&carrierSsoId=' +
|
|
|
+ this.ssoId
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.exportAllList = res.data.data
|
|
|
+ console.log("测试2")
|
|
|
+ console.log(res)
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.settleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //导出excel
|
|
|
+ exportAllReportToExcel(tableTitle, dataArr, columnData) {
|
|
|
+ var title = tableTitle
|
|
|
+ let tHeader = []
|
|
|
+ let filterVal = []
|
|
|
+ console.log("进入了导出")
|
|
|
+ console.log(columnData)
|
|
|
+ columnData.forEach(e1 => {
|
|
|
+ if (tHeader.indexOf(e1.label) === -1) {
|
|
|
+ tHeader.push(e1.label)
|
|
|
+ }
|
|
|
+ if (filterVal.indexOf(e1.prop) === -1) {
|
|
|
+ filterVal.push(e1.prop)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //导出为excel
|
|
|
+ this.downloadLoading = true
|
|
|
+ require.ensure([], () => {
|
|
|
+ const {
|
|
|
+ export_json_to_excel
|
|
|
+ } = require('@/assets/excel/Export2Excel.js') //这里必须使用绝对路径,使用@/+存放export2Excel的路径
|
|
|
+ // let list = this.$refs.excelDom.dataTabel;
|
|
|
+ let data = dataArr.map(v => filterVal.map(j => v[j])) //3.formatJson格式转换
|
|
|
+ export_json_to_excel(tHeader, data, title) // (title)导出的表格名称
|
|
|
+ })
|
|
|
+ },
|
|
|
//未结算数据
|
|
|
options1GetRequestUrl() {
|
|
|
if (getCookie("orgCode") == "chengyunshang") {
|