|
@@ -16,7 +16,6 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
<el-button style="margin-left: 10px;" @click="DownloadTemplate">查询模板下载</el-button>
|
|
|
- <el-button type="primary" @click="exportExcel">导出报表</el-button>
|
|
|
</el-upload>
|
|
|
|
|
|
</div>
|
|
@@ -32,6 +31,7 @@
|
|
|
<el-date-picker v-model="formCondition.aclTimeBegin" type="datetimerange" value-format="yyyy-MM-dd HH:mm:SS" range-separator="至" start-placeholder="申请开票时间始" end-placeholder="申请开票时间止"></el-date-picker>
|
|
|
<el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
|
|
|
<el-button type="success" style="margin-left: 1%;" @click="update">更新</el-button>
|
|
|
+ <el-button type="primary" @click="exportExcel">导出报表</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -133,6 +133,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script type="text/javascript">
|
|
|
+import CsvExportor from "csv-exportor";
|
|
|
import FileSaver from "file-saver";
|
|
|
import XLSX from "xlsx";
|
|
|
export default {
|
|
@@ -314,7 +315,7 @@ import XLSX from "xlsx";
|
|
|
this.current = val;
|
|
|
this.loadData();
|
|
|
},
|
|
|
- async exportExcel() {
|
|
|
+ async exportExcel1() {
|
|
|
const loading = this.$loading({
|
|
|
lock: true,
|
|
|
text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
|
|
@@ -357,7 +358,85 @@ import XLSX from "xlsx";
|
|
|
loading.close();
|
|
|
return wbout;
|
|
|
},
|
|
|
- }
|
|
|
+ async exportExcel() {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+ var recodes = [];
|
|
|
+ debugger;
|
|
|
+ for(var j=1;j<=this.total/10000+1;j++){
|
|
|
+
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('current', j);
|
|
|
+ formData.append('size', 10000);
|
|
|
+ for(var i in this.formCondition){
|
|
|
+ formData.append(i,this.formCondition[i]);
|
|
|
+ }
|
|
|
+ const response = await this.$http.post('selfCar/findTrades', formData);
|
|
|
+ if (response.data.code === 0) {
|
|
|
+ recodes = recodes.concat(response.data.data.records);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置当前日期
|
|
|
+ let time = new Date();
|
|
|
+ let year = time.getFullYear();
|
|
|
+ let month = time.getMonth() + 1;
|
|
|
+ let day = time.getDate();
|
|
|
+ let name = "自有车交易查询列表_"+year + "" + month + "" + day;
|
|
|
+ let cloums = [
|
|
|
+ {"title":"企业编号","key":"companyNum"},
|
|
|
+ {"title":"公司名称","key":"companyName"},
|
|
|
+ {"title":"公司税号","key":"companyReferencenum"},
|
|
|
+ {"title":"交易Id","key":"tradeId"},
|
|
|
+ {"title":"etc卡号","key":"cardId"},
|
|
|
+
|
|
|
+ {"title":"交易费用","key":"fee"},
|
|
|
+ {"title":"交易时间","key":"exTime"},
|
|
|
+ {"title":"申请开票时间","key":"aclTime"},
|
|
|
+ {"title":"状态","key":"status"}
|
|
|
+ ];
|
|
|
+ this.exportExcelComm(cloums,recodes,name,loading)
|
|
|
+
|
|
|
+ },
|
|
|
+ // 导出Excel
|
|
|
+ exportExcelComm(columns,list,excelName,loading){
|
|
|
+ let tHeader = []
|
|
|
+ let filterVal = []
|
|
|
+ columns.forEach(item =>{
|
|
|
+ tHeader.push(item.title)
|
|
|
+ filterVal.push(item.key)
|
|
|
+ })
|
|
|
+
|
|
|
+ const data = this.formatJson(filterVal,list);
|
|
|
+ data.unshift(tHeader);
|
|
|
+ CsvExportor.downloadCsv(data, { tHeader }, excelName+".csv");
|
|
|
+ loading.close();
|
|
|
+ },
|
|
|
+ formatJson (filterVal, jsonData) {
|
|
|
+ return jsonData.map(v => filterVal.map(j => {
|
|
|
+ if(j == 'status'){
|
|
|
+ if(v[j] == 1){
|
|
|
+ return "待开票";
|
|
|
+ } else if(v[j] == 2){
|
|
|
+ return "开票中";
|
|
|
+ }else if(v[j] == 3){
|
|
|
+ return "开票完成";
|
|
|
+ }
|
|
|
+ }else if(j =='fee'){
|
|
|
+ return v[j]/100;
|
|
|
+ }else if(j=='companyReferencenum' || j=='cardId' ){
|
|
|
+ return v[j]+'\t';
|
|
|
+ }else{
|
|
|
+ return v[j];
|
|
|
+ }
|
|
|
+
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|