|
@@ -1,24 +1,13 @@
|
|
|
<template>
|
|
|
- <div class="billWay_container">
|
|
|
+ <div class="billWay_container">
|
|
|
<div class="title">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<div class="top">
|
|
|
- <div class="top" >
|
|
|
- <span style="margin-top: 10px;margin-bottom: 10px;">导入文件:</span>
|
|
|
-
|
|
|
- <el-upload
|
|
|
- class="upload-demo"
|
|
|
- ref="upload"
|
|
|
- style="margin-bottom: 10px"
|
|
|
- action="http://invoice.back.jkcredit.com/dishonestuser/upload"
|
|
|
- :on-preview="handlePreview"
|
|
|
- :on-remove="handleRemove"
|
|
|
- :on-change="handleSuccess"
|
|
|
- :auto-upload="false">
|
|
|
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
|
|
- <el-button style="margin-left: 10px;" size="small" type="success" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">批量查询</el-button>
|
|
|
- <el-select style="margin-left: 30px;" v-model="formCondition.status" placeholder="交易状态">
|
|
|
+ <div class="demo-input-suffix" style="margin-left: 10px;">
|
|
|
+ <el-upload :action="url" :http-request="importExcel" list-type="text" :show-file-list="false" >
|
|
|
+ <el-button type="primary">导入参数</el-button>
|
|
|
+ <el-select style="margin-left: 110px;" v-model="formCondition.status" placeholder="交易状态">
|
|
|
<el-option
|
|
|
v-for="item in tradeStatus"
|
|
|
:key="item.value"
|
|
@@ -26,13 +15,12 @@
|
|
|
:value="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- <el-button style="margin-left: 230px;" @click="DownloadTemplate">查询模板下载</el-button>
|
|
|
- <el-button type="primary" style="margin-left: 1%;" @click="exportExcel">导出报表</el-button>
|
|
|
-
|
|
|
- </el-upload>
|
|
|
-
|
|
|
+ <el-button style="margin-left: 10px;" @click="DownloadTemplate">查询模板下载</el-button>
|
|
|
+ <el-button type="primary" @click="exportExcel">导出报表</el-button>
|
|
|
+ </el-upload>
|
|
|
+
|
|
|
</div>
|
|
|
- <div class="demo-input-suffix">
|
|
|
+ <div class="demo-input-suffix" style="margin-top: 5px;">
|
|
|
<el-input placeholder="公司名称" class="input-demo" v-model="formCondition.companyName"></el-input>
|
|
|
<el-input placeholder="etc卡号" class="input-demo" v-model="formCondition.cardId"></el-input>
|
|
|
<el-input placeholder="税号" class="input-demo" v-model="formCondition.companyReferencenum"></el-input>
|
|
@@ -143,6 +131,8 @@ import XLSX from "xlsx";
|
|
|
multipleSelection:[],
|
|
|
formCondition:{
|
|
|
status:'',
|
|
|
+ cardId:'',
|
|
|
+ tradeId:''
|
|
|
},
|
|
|
formUserList: {
|
|
|
"file": ""
|
|
@@ -156,7 +146,7 @@ import XLSX from "xlsx";
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.heightt = tableHeight-100;
|
|
|
+ this.heightt = tableHeight-90;
|
|
|
this.loadData();
|
|
|
},
|
|
|
filters: {
|
|
@@ -195,6 +185,66 @@ import XLSX from "xlsx";
|
|
|
this.total = response.data.data.total;
|
|
|
}
|
|
|
},
|
|
|
+ importExcel (content) {
|
|
|
+ const file = content.file
|
|
|
+ // let file = file.files[0] // 使用传统的input方法需要加上这一步
|
|
|
+ const types = file.name.split('.')[1]
|
|
|
+ const fileType = ['xlsx', 'xlc', 'xlm', 'xls', 'xlt', 'xlw', 'csv'].some(item => item === types)
|
|
|
+ if (!fileType) {
|
|
|
+ this.$message('格式错误!请重新选择')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.file2Xce(file).then(tabJson => {
|
|
|
+ var tradeIds = '';
|
|
|
+ var etcIds = '';
|
|
|
+ if (tabJson && tabJson.length > 0) {
|
|
|
+ this.xlsxJson = tabJson
|
|
|
+ this.fileList = this.xlsxJson[0].sheet
|
|
|
+ let n = '匹配的字段'
|
|
|
+ this.fileList.forEach((item, index, arr) => {
|
|
|
+ if(item['etc卡号']!=null && item['etc卡号']!='' && typeof item['etc卡号']!='undefined'){
|
|
|
+ etcIds+= item['etc卡号']+',';
|
|
|
+ }
|
|
|
+ if(item['交易id']!=null && item['交易id']!='' && typeof item['交易id']!='undefined'){
|
|
|
+ tradeIds+= item['交易id']+',';
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ if(etcIds!=''){
|
|
|
+ this.formCondition.cardId =etcIds.substring(0,etcIds.length-1);
|
|
|
+ }
|
|
|
+ if(tradeIds!=null){
|
|
|
+ this.formCondition.tradeId = tradeIds.substring(0,tradeIds.length-1) ;
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ file2Xce (file) {
|
|
|
+ return new Promise(function (resolve, reject) {
|
|
|
+ const reader = new FileReader()
|
|
|
+ reader.onload = function (e) {
|
|
|
+ const data = e.target.result
|
|
|
+ this.wb = XLSX.read(data, {
|
|
|
+ type: 'binary'
|
|
|
+ })
|
|
|
+ const result = []
|
|
|
+ console.log((this.wb.Sheets.Sheet1)['!ref'])
|
|
|
+ var are = (this.wb.Sheets.Sheet1)['!ref'];
|
|
|
+ var areRe = are.replace('A1','A2');
|
|
|
+ (this.wb.Sheets.Sheet1)['!ref'] = areRe;
|
|
|
+ this.wb.SheetNames.forEach((sheetName) => {
|
|
|
+ result.push({
|
|
|
+ sheetName: sheetName,
|
|
|
+ sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
|
|
|
+ })
|
|
|
+ })
|
|
|
+ resolve(result)
|
|
|
+ }
|
|
|
+ // reader.readAsBinaryString(file.raw)
|
|
|
+ reader.readAsBinaryString(file) // 传统input方法
|
|
|
+ })
|
|
|
+ },
|
|
|
handleSelectionChange(value){
|
|
|
this.multipleSelection = value;
|
|
|
console.log(this.multipleSelection);
|