作者 朱兆平

进港统计导出增加字段

@@ -30,8 +30,9 @@ module.exports = { @@ -30,8 +30,9 @@ module.exports = {
30 assetsPublicPath: '/', 30 assetsPublicPath: '/',
31 proxyTable: { 31 proxyTable: {
32 '/api':{ 32 '/api':{
33 - target: 'http://192.168.1.53:12343',//设置你调用的接口域名和端口号 别忘了加http  
34 - // target: 'http://localhost:12343',//设置你调用的接口域名和端口号 别忘了加http 33 + // target: 'http://192.168.1.53:12343',//设置你调用的接口域名和端口号 别忘了加http
  34 + // target: 'http://127.0.0.1:12343',//设置你调用的接口域名和端口号 别忘了加http
  35 + target: 'http://10.50.3.82:22343',//设置你调用的接口域名和端口号 别忘了加http
35 changeOrigin: true, 36 changeOrigin: true,
36 pathRewrite: { 37 pathRewrite: {
37 '^/api/': '/'//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可 38 '^/api/': '/'//这里理解成用‘/api’代替target里面的地址,后面组件中我们掉接口时直接用api代替 比如我要调用'http://40.00.100.100:3002/user/add',直接写‘/api/user/add’即可
@@ -240,6 +240,8 @@ @@ -240,6 +240,8 @@
240 aside { 240 aside {
241 flex:0 0 230px; 241 flex:0 0 230px;
242 width: 230px; 242 width: 230px;
  243 + overflow-y: scroll;
  244 + background: #606060;
243 // position: absolute; 245 // position: absolute;
244 // top: 0px; 246 // top: 0px;
245 // bottom: 0px; 247 // bottom: 0px;
@@ -14,51 +14,13 @@ @@ -14,51 +14,13 @@
14 placeholder="结束航班日期" 14 placeholder="结束航班日期"
15 ></el-date-picker> 15 ></el-date-picker>
16 </el-form-item> 16 </el-form-item>
17 - <el-form-item>  
18 - <el-button :loading="listLoading" style="margin:0 0 20px 20px;" type="primary" icon="document" @click="fetchData">查询</el-button>  
19 - </el-form-item>  
20 - <el-tag  
21 - :key="note.message"  
22 - :type="note.type">  
23 - {{note.message}}  
24 - </el-tag> 17 + <FilenameOption v-model="filename" />
  18 + <el-button :loading="downloadLoading" style="margin:0 0 20px 20px;" type="primary" icon="document" @click="exportExcel">导出 Excel</el-button>
25 </el-form> 19 </el-form>
26 </el-col> 20 </el-col>
27 - <div>  
28 - <FilenameOption v-model="filename" />  
29 - <AutoWidthOption v-model="autoWidth" />  
30 - <BookTypeOption v-model="bookType" />  
31 - <el-button :loading="downloadLoading" style="margin:0 0 20px 20px;" type="primary" icon="document" @click="handleDownload">导出 Excel</el-button>  
32 - </div>  
33 -  
34 - <el-table v-loading="listLoading" element-loading-text="拼命加载中" border fit highlight-current-row>  
35 - <el-table-column align="center" label="Id" width="95">  
36 - <template slot-scope="scope">  
37 - {{ scope.$index }}  
38 - </template>  
39 - </el-table-column>  
40 - <el-table-column label="运单号">  
41 - <template slot-scope="scope">  
42 - {{ scope.row.autoid }}  
43 - </template>  
44 - </el-table-column>  
45 - <el-table-column label="承运人" width="110" align="center">  
46 - <template slot-scope="scope">  
47 - <el-tag>{{ scope.row.totalpiece }}</el-tag>  
48 - </template>  
49 - </el-table-column>  
50 - <el-table-column label="航班号" width="115" align="center">  
51 - <template slot-scope="scope">  
52 - {{ scope.row.manifesttotalpiece }}  
53 - </template>  
54 - </el-table-column>  
55 - <el-table-column align="center" label="航班日期" width="220" :formatter="dateFormat">  
56 - <template slot-scope="scope">  
57 - <i class="el-icon-time"/>  
58 - <span>{{ scope.row.manifesttotalweight | parseTime('{y}-{m}-{d}')}}</span>  
59 - </template>  
60 - </el-table-column>  
61 - </el-table> 21 + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  22 + <span>导出进度:{{downloadSize}}</span>
  23 + </el-col>
62 </div> 24 </div>
63 </template> 25 </template>
64 26
@@ -68,12 +30,9 @@ import { parseTime } from '@/utils' @@ -68,12 +30,9 @@ import { parseTime } from '@/utils'
68 30
69 // options components 31 // options components
70 import FilenameOption from './components/FilenameOption' 32 import FilenameOption from './components/FilenameOption'
71 -import AutoWidthOption from './components/AutoWidthOption'  
72 -import BookTypeOption from './components/BookTypeOption'  
73 -import Export2Excel from '@/vendor/Export2Excel'  
74 export default { 33 export default {
75 name: 'ExportExcel', 34 name: 'ExportExcel',
76 - components: { FilenameOption, AutoWidthOption, BookTypeOption }, 35 + components: { FilenameOption },
77 data() { 36 data() {
78 return { 37 return {
79 list: [], 38 list: [],
@@ -90,7 +49,8 @@ export default { @@ -90,7 +49,8 @@ export default {
90 note: { 49 note: {
91 type: 'info', 50 type: 'info',
92 message: '' 51 message: ''
93 - } 52 + },
  53 + downloadSize: 0
94 54
95 } 55 }
96 }, 56 },
@@ -105,125 +65,42 @@ export default { @@ -105,125 +65,42 @@ export default {
105 var t=new Date(row.updateTime);//row 表示一行数据, updateTime 表示要格式化的字段名称 65 var t=new Date(row.updateTime);//row 表示一行数据, updateTime 表示要格式化的字段名称
106 return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate(); 66 return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate();
107 }, 67 },
108 - fetchData() {  
109 - this.listLoading = true  
110 - getAnalysisList(this.searchText).then(response => {  
111 - this.list = response.data.data  
112 - this.listLoading = false  
113 - this.$message({  
114 - message: '数据查询成功,可以下载excel',  
115 - type: 'success'  
116 - });  
117 - this.note.message = '数据查询成功,可以下载excel;共'+this.list.length+'条数据';  
118 - this.note.type = 'success';  
119 - })  
120 - },  
121 - handleDownload() {  
122 - this.downloadLoading = true  
123 - import('@/vendor/Export2Excel').then(excel => {  
124 - const tHeader = ['运单号',  
125 - '航空托运人名称',  
126 - '航空销售代理人名称',  
127 - '航协编号',  
128 - '航空公司运输证明',  
129 - '运输条件鉴定书',  
130 - '承运人',  
131 - '航班号',  
132 - '航班日期',  
133 - '航班起始站',  
134 - '航班目的站',  
135 - '运单件数',  
136 - '运单重量',  
137 - '操作时间',  
138 - '关区',  
139 - '预配品名',  
140 - '收货人公司',  
141 - '收货人地址',  
142 - '收货人城市',  
143 - '收货人电话',  
144 - '收货人国家',  
145 - '收货人名称',  
146 - '发货人名称',  
147 - '发货人地址',  
148 - '发货人城市',  
149 - '发货人国家',  
150 - '发货人电话',  
151 - '发货人名称',  
152 - '海关回执状态',  
153 - '海关回执信息',  
154 - '发货人编码',  
155 - '收货人编码',  
156 - '货物品名',  
157 - '二级类名称',  
158 - '一级类名称',  
159 - '代理人三字码',  
160 - '代理人全称',  
161 - '代理人类别',  
162 - '代理联系人',  
163 - '代理联系人电话'  
164 - ]  
165 - const filterVal = [  
166 - 'autoid',  
167 - 'waybillnomaster',  
168 - 'segment',  
169 - 'originatingstation',  
170 - 'destinationstation',  
171 - 'totalweight',  
172 - 'totalpiece',  
173 - 'manifesttotalpiece',  
174 - 'manifesttotalweight',  
175 - 'flightno',  
176 - 'productname',  
177 - 'customsstatus',  
178 - 'carrier1',  
179 - 'arrivalstation1',  
180 - 'carrier2',  
181 - 'arrivalstation2',  
182 - 'carrier3',  
183 - 'arrivalstation3',  
184 - 'paymode',  
185 - 'customscode',  
186 - 'specialgoodscode',  
187 - 'shippername',  
188 - 'shipperaddress',  
189 - 'consigneename',  
190 - 'consigneeaddress',  
191 - 'receiptinformation',  
192 - 'specificConsigneePhone',  
193 - 'consigneePhone',  
194 - 'status',  
195 - 'isbatch',  
196 - 'originatingstationBill',  
197 - 'destinationstationBill',  
198 - 'reportorder',  
199 - 'islast',  
200 - 'shipperCode',  
201 - 'shipperCountrycode',  
202 - 'shipperPhone',  
203 - 'shipperFax',  
204 - 'consigneeCode',  
205 - 'consigneeCountrycode'  
206 - ]  
207 - const list = this.list  
208 - const data = this.formatJson(filterVal, list)  
209 - excel.export_json_to_excel({  
210 - header: tHeader,  
211 - data,  
212 - filename: this.filename,  
213 - autoWidth: this.autoWidth,  
214 - bookType: this.bookType  
215 - })  
216 - this.downloadLoading = false 68 + exportExcel(){
  69 + let _this = this
  70 + this.$loading({
  71 + fullscreen: true,
  72 + text: '正在导出',
  73 + spinner: 'el-icon-loading',
  74 + background: 'rgba(0, 0, 0, 0.6)'
217 }) 75 })
218 - },  
219 - formatJson(filterVal, jsonData) {  
220 - return jsonData.map(v => filterVal.map(j => {  
221 - if (j === 'timestamp') {  
222 - return parseTime(v[j])  
223 - } else {  
224 - return v[j] 76 + this.$axios({
  77 + method:"get",
  78 + url: "/analysis-agent/agent/analysis",
  79 + responseType: 'blob',
  80 + headers: {
  81 + 'Content-Type': 'application/x-www-form-urlencoded'
  82 + },
  83 + params:this.searchText,
  84 + onDownloadProgress: function (progressEvent) {
  85 + _this.downloadSize = progressEvent.loaded
  86 + console.log(progressEvent.loaded)
225 } 87 }
226 - })) 88 + }).then(
  89 + res=>{
  90 + let data = res.data;
  91 + let url = window.URL.createObjectURL(new Blob([data]));
  92 + let link = document.createElement('a');
  93 + link.style.display = 'none';
  94 + link.href = url;
  95 + this.filename = this.filename == '' ? 'export' : this.filename
  96 + link.setAttribute('download', this.filename+'.xls');
  97 + document.body.appendChild(link);
  98 + link.click()
  99 + this.$loading().close()
  100 + },err =>{
  101 + this.$loading().close()
  102 + });
  103 +
227 } 104 }
228 } 105 }
229 } 106 }