|
@@ -15,7 +15,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
|
|
|
>
|
|
|
<span style="margin-left: 1rem;">合计时间:</span>
|
|
@@ -105,6 +105,203 @@ export default {
|
|
|
this.options2GetRequestUrl();
|
|
|
},
|
|
|
methods: {
|
|
|
+ exportAllExcel() {
|
|
|
+ let startTime = null;
|
|
|
+ let endTime = null;
|
|
|
+ if (this.startTime) {
|
|
|
+ startTime = sjTime(this.startTime);
|
|
|
+ }
|
|
|
+ if (this.endTime) {
|
|
|
+ endTime = sjTime(this.endTime);
|
|
|
+ }
|
|
|
+ if (this.activeName == 'first') {
|
|
|
+ this.tableTitle = '未结算计费详单'
|
|
|
+ if (startTime && endTime) {
|
|
|
+ if (startTime < endTime) {
|
|
|
+ if (
|
|
|
+ getCookie("orgCode") == "dagangadmin" ||
|
|
|
+ getCookie("orgCode") == "zidonghuabu" ||
|
|
|
+ getCookie("orgCode") == "wuliuchuyunzhongxin"
|
|
|
+ ) {
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0" +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&i" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }else if (getCookie("orgCode") == "chengyunshang"){
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0&carrierSsoId=" +
|
|
|
+ getCookie("userId") +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&i" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=0&userId=" +
|
|
|
+ getCookie("orgCode") +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&i" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ this.startTime = null;
|
|
|
+ this.endTime = null;
|
|
|
+ this.$message.warning("开始时间要比结束时间早");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ } else if (this.activeName == 'second') {
|
|
|
+ this.tableTitle = '已结算计费详单'
|
|
|
+ if (startTime && endTime) {
|
|
|
+ if (startTime < endTime) {
|
|
|
+ if (
|
|
|
+ getCookie("orgCode") == "dagangadmin" ||
|
|
|
+ getCookie("orgCode") == "zidonghuabu" ||
|
|
|
+ getCookie("orgCode") == "wuliuchuyunzhongxin"
|
|
|
+ ) {
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1" +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&i" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }else if (getCookie("orgCode") == "chengyunshang"){
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1&carrierSsoId=" +
|
|
|
+ getCookie("userId") +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&i" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ this.axios
|
|
|
+ .post(
|
|
|
+ "/api/v1/bms/getInwardWeightDetailsOrder?apiId=465&orderType=21&detailStatus=1&userId=" +
|
|
|
+ getCookie("orgCode") +
|
|
|
+ "&startTime=" +
|
|
|
+ startTime +
|
|
|
+ "&endTime=" +
|
|
|
+ endTime +
|
|
|
+ "&i" +
|
|
|
+ new Date()
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res.data.data)
|
|
|
+ this.exportAllList = res.data.data.list
|
|
|
+ this.noSettleDetailsColumn=res.data.data.columnData
|
|
|
+ this.exportAllReportToExcel(
|
|
|
+ this.tableTitle,
|
|
|
+ this.exportAllList,
|
|
|
+ this.noSettleDetailsColumn
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ this.startTime = null;
|
|
|
+ this.endTime = null;
|
|
|
+ this.$message.warning("开始时间要比结束时间早");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //导出excel
|
|
|
+ exportAllReportToExcel(tableTitle, dataArr, columnData) {
|
|
|
+ var title = tableTitle
|
|
|
+ let tHeader = []
|
|
|
+ let filterVal = []
|
|
|
+ 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") {
|