作者 朱兆平

进出港统计分析部分

@@ -1972,9 +1972,9 @@ @@ -1972,9 +1972,9 @@
1972 } 1972 }
1973 }, 1973 },
1974 "cfb": { 1974 "cfb": {
1975 - "version": "1.1.3",  
1976 - "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.1.3.tgz",  
1977 - "integrity": "sha512-joXBW0nMuwV9no7UTMiyVJnQL6XIU3ThXVjFUDHgl9MpILPOomyfaGqC290VELZ48bbQKZXnQ81UT5HouTxHsw==", 1975 + "version": "1.1.4",
  1976 + "resolved": "https://registry.npmjs.org/cfb/-/cfb-1.1.4.tgz",
  1977 + "integrity": "sha512-rwFkl3aFO3f+ljR27YINwC0x8vPjyiEVbYbrTCKzspEf7Q++3THdfHVgJYNUbxNcupJECrLX+L40Mjm9hm/Bgw==",
1978 "requires": { 1978 "requires": {
1979 "adler-32": "~1.2.0", 1979 "adler-32": "~1.2.0",
1980 "commander": "^2.16.0", 1980 "commander": "^2.16.0",
@@ -6313,7 +6313,7 @@ @@ -6313,7 +6313,7 @@
6313 }, 6313 },
6314 "normalize-wheel": { 6314 "normalize-wheel": {
6315 "version": "1.0.1", 6315 "version": "1.0.1",
6316 - "resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz", 6316 + "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
6317 "integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU=" 6317 "integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
6318 }, 6318 },
6319 "npm": { 6319 "npm": {
@@ -10548,7 +10548,8 @@ @@ -10548,7 +10548,8 @@
10548 "raw-loader": { 10548 "raw-loader": {
10549 "version": "0.5.1", 10549 "version": "0.5.1",
10550 "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz", 10550 "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz",
10551 - "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=" 10551 + "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=",
  10552 + "dev": true
10552 }, 10553 },
10553 "read-pkg": { 10554 "read-pkg": {
10554 "version": "1.1.0", 10555 "version": "1.1.0",
@@ -11355,6 +11356,7 @@ @@ -11355,6 +11356,7 @@
11355 "version": "0.7.2", 11356 "version": "0.7.2",
11356 "resolved": "https://registry.npmjs.org/script-loader/-/script-loader-0.7.2.tgz", 11357 "resolved": "https://registry.npmjs.org/script-loader/-/script-loader-0.7.2.tgz",
11357 "integrity": "sha512-UMNLEvgOAQuzK8ji8qIscM3GIrRCWN6MmMXGD4SD5l6cSycgGsCo0tX5xRnfQcoghqct0tjHjcykgI1PyBE2aA==", 11358 "integrity": "sha512-UMNLEvgOAQuzK8ji8qIscM3GIrRCWN6MmMXGD4SD5l6cSycgGsCo0tX5xRnfQcoghqct0tjHjcykgI1PyBE2aA==",
  11359 + "dev": true,
11358 "requires": { 11360 "requires": {
11359 "raw-loader": "~0.5.1" 11361 "raw-loader": "~0.5.1"
11360 } 11362 }
@@ -11769,9 +11771,9 @@ @@ -11769,9 +11771,9 @@
11769 "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" 11771 "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
11770 }, 11772 },
11771 "ssf": { 11773 "ssf": {
11772 - "version": "0.10.2",  
11773 - "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.10.2.tgz",  
11774 - "integrity": "sha512-rDhAPm9WyIsY8eZEKyE8Qsotb3j/wBdvMWBUsOhJdfhKGLfQidRjiBUV0y/MkyCLiXQ38FG6LWW/VYUtqlIDZQ==", 11774 + "version": "0.10.3",
  11775 + "resolved": "https://registry.npmjs.org/ssf/-/ssf-0.10.3.tgz",
  11776 + "integrity": "sha512-pRuUdW0WwyB2doSqqjWyzwCD6PkfxpHAHdZp39K3dp/Hq7f+xfMwNAWIi16DyrRg4gg9c/RvLYkJTSawTPTm1w==",
11775 "requires": { 11777 "requires": {
11776 "frac": "~1.1.2" 11778 "frac": "~1.1.2"
11777 } 11779 }
@@ -13105,6 +13107,11 @@ @@ -13105,6 +13107,11 @@
13105 "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", 13107 "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=",
13106 "dev": true 13108 "dev": true
13107 }, 13109 },
  13110 + "wmf": {
  13111 + "version": "1.0.2",
  13112 + "resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
  13113 + "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
  13114 + },
13108 "wordwrap": { 13115 "wordwrap": {
13109 "version": "1.0.0", 13116 "version": "1.0.0",
13110 "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", 13117 "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
@@ -13180,17 +13187,18 @@ @@ -13180,17 +13187,18 @@
13180 } 13187 }
13181 }, 13188 },
13182 "xlsx": { 13189 "xlsx": {
13183 - "version": "0.15.1",  
13184 - "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.15.1.tgz",  
13185 - "integrity": "sha512-z+o4+QPMc32EPboLCzJAz94o0Zyy+8jrmWTsVpfzwknFln9qDO6/HN1KrGGVC4//sGA7dh4R3HA4fhbGIKCDOA==", 13190 + "version": "0.15.6",
  13191 + "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.15.6.tgz",
  13192 + "integrity": "sha512-7vD9eutyLs65iDjNFimVN+gk/oDkfkCgpQUjdE82QgzJCrBHC4bGPH7fzKVyy0UPp3gyFVQTQEFJaWaAvZCShQ==",
13186 "requires": { 13193 "requires": {
13187 "adler-32": "~1.2.0", 13194 "adler-32": "~1.2.0",
13188 - "cfb": "^1.1.3", 13195 + "cfb": "^1.1.4",
13189 "codepage": "~1.14.0", 13196 "codepage": "~1.14.0",
13190 "commander": "~2.17.1", 13197 "commander": "~2.17.1",
13191 "crc-32": "~1.2.0", 13198 "crc-32": "~1.2.0",
13192 "exit-on-epipe": "~1.0.1", 13199 "exit-on-epipe": "~1.0.1",
13193 - "ssf": "~0.10.2" 13200 + "ssf": "~0.10.3",
  13201 + "wmf": "~1.0.1"
13194 } 13202 }
13195 }, 13203 },
13196 "xtend": { 13204 "xtend": {
@@ -22,12 +22,11 @@ @@ -22,12 +22,11 @@
22 "moment": "^2.24.0", 22 "moment": "^2.24.0",
23 "npm": "^6.8.0", 23 "npm": "^6.8.0",
24 "nprogress": "^0.2.0", 24 "nprogress": "^0.2.0",
25 - "script-loader": "^0.7.2",  
26 "vue": "^2.2.2", 25 "vue": "^2.2.2",
27 "vue-i18n": "^8.14.0", 26 "vue-i18n": "^8.14.0",
28 "vue-router": "^2.3.0", 27 "vue-router": "^2.3.0",
29 "vuex": "^2.0.0-rc.6", 28 "vuex": "^2.0.0-rc.6",
30 - "xlsx": "^0.15.1" 29 + "xlsx": "^0.15.6"
31 }, 30 },
32 "devDependencies": { 31 "devDependencies": {
33 "autoprefixer": "^6.7.2", 32 "autoprefixer": "^6.7.2",
@@ -64,6 +63,7 @@ @@ -64,6 +63,7 @@
64 "qs": "^6.7.0", 63 "qs": "^6.7.0",
65 "rimraf": "^2.6.0", 64 "rimraf": "^2.6.0",
66 "sass-loader": "^6.0.0", 65 "sass-loader": "^6.0.0",
  66 + "script-loader": "^0.7.2",
67 "semver": "^5.3.0", 67 "semver": "^5.3.0",
68 "shelljs": "^0.7.6", 68 "shelljs": "^0.7.6",
69 "url-loader": "^0.5.8", 69 "url-loader": "^0.5.8",
  1 +import http from '../http.js'
  2 +let baseUrl = '/analysis-agent/agent'
  3 +
  4 +
  5 +export const getAnalysisList = params => { return http.get(`${baseUrl}/analysis`,params) };
  6 +export const getNmmsAnalysisList = params => { return http.get(`/analysis-nmms/nmmsAnalysis/analysis`,params) };
  7 +
@@ -18,6 +18,7 @@ export default { @@ -18,6 +18,7 @@ export default {
18 method: 'GET', 18 method: 'GET',
19 url: url, 19 url: url,
20 params: params, 20 params: params,
  21 + timeout: 30000,
21 headers: { 22 headers: {
22 'Content-Type': 'application/x-www-form-urlencoded' 23 'Content-Type': 'application/x-www-form-urlencoded'
23 } 24 }
@@ -65,6 +65,7 @@ router.beforeEach((to, from, next) => { @@ -65,6 +65,7 @@ router.beforeEach((to, from, next) => {
65 65
66 const message = Vue.prototype.$message; 66 const message = Vue.prototype.$message;
67 axios.defaults.baseURL = '/api'; 67 axios.defaults.baseURL = '/api';
  68 +axios.defaults.timeout = 120000;
68 axios.interceptors.response.use( 69 axios.interceptors.response.use(
69 res => { 70 res => {
70 //对响应数据做些事 71 //对响应数据做些事
@@ -119,6 +120,14 @@ axios.interceptors.response.use( @@ -119,6 +120,14 @@ axios.interceptors.response.use(
119 path: "/error/502" 120 path: "/error/502"
120 }); 121 });
121 } 122 }
  123 + if (error.response.status === 503) {
  124 + message({
  125 + // 饿了么的消息弹窗组件
  126 + message: '503相关服务服务未找到',
  127 + type: "error"
  128 + });
  129 + }
  130 +
122 if (error.response.status === 404) { 131 if (error.response.status === 404) {
123 message({ 132 message({
124 // 饿了么的消息弹窗组件 133 // 饿了么的消息弹窗组件
@@ -48,6 +48,8 @@ import ComeCar from './views/staff/come_car.vue' @@ -48,6 +48,8 @@ import ComeCar from './views/staff/come_car.vue'
48 import OnDuty from './views/staff/on_duty.vue' 48 import OnDuty from './views/staff/on_duty.vue'
49 import WaterStationsPatrol from './views/water/water_stations_patrol.vue' 49 import WaterStationsPatrol from './views/water/water_stations_patrol.vue'
50 import Location from './views/empt/Location.vue' 50 import Location from './views/empt/Location.vue'
  51 +import AgentExcelExport from './views/excel/exportExcel-agent'
  52 +import NMMSExcelExport from './views/excel/exportExcel-NMMS'
51 53
52 let routes = [ 54 let routes = [
53 { 55 {
@@ -100,6 +102,16 @@ let routes = [ @@ -100,6 +102,16 @@ let routes = [
100 ] 102 ]
101 }, 103 },
102 { 104 {
  105 + path: '/analysis',
  106 + component: Home,
  107 + name: '统计分析',
  108 + iconCls: 'fa fa-id-card-o',
  109 + children: [
  110 + { path: '/agentexport', component: AgentExcelExport, name: '出港统计' },
  111 + { path: '/nmmsexport', component: NMMSExcelExport, name: '进港统计' },
  112 + ]
  113 + },
  114 + {
103 path: '/output', 115 path: '/output',
104 component: Home, 116 component: Home,
105 name: '出港业务申报', 117 name: '出港业务申报',
  1 +<template>
  2 + <div style="display:inline-block;">
  3 + <label class="radio-label">导出是否自动适配列宽: </label>
  4 + <el-radio-group v-model="autoWidth">
  5 + <el-radio :label="true" border>True</el-radio>
  6 + <el-radio :label="false" border>False</el-radio>
  7 + </el-radio-group>
  8 + </div>
  9 +</template>
  10 +
  11 +<script>
  12 +export default {
  13 + props: {
  14 + value: {
  15 + type: Boolean,
  16 + default: true
  17 + }
  18 + },
  19 + computed: {
  20 + autoWidth: {
  21 + get() {
  22 + return this.value
  23 + },
  24 + set(val) {
  25 + this.$emit('input', val)
  26 + }
  27 + }
  28 + }
  29 +}
  30 +</script>
  1 +<template>
  2 + <div style="display:inline-block;">
  3 + <label class="radio-label">导出类型: </label>
  4 + <el-select v-model="bookType" style="width:120px;" >
  5 + <el-option
  6 + v-for="item in options"
  7 + :key="item"
  8 + :label="item"
  9 + :value="item"/>
  10 + </el-select>
  11 + </div>
  12 +</template>
  13 +
  14 +<script>
  15 +export default {
  16 + props: {
  17 + value: {
  18 + type: String,
  19 + default: 'xlsx'
  20 + }
  21 + },
  22 + data() {
  23 + return {
  24 + options: ['xlsx', 'csv', 'txt']
  25 + }
  26 + },
  27 + computed: {
  28 + bookType: {
  29 + get() {
  30 + return this.value
  31 + },
  32 + set(val) {
  33 + this.$emit('input', val)
  34 + }
  35 + }
  36 + }
  37 +}
  38 +</script>
  1 +<template>
  2 + <div style="display:inline-block;">
  3 + <!-- $t is vue-i18n global function to translate lang -->
  4 + <label class="radio-label" style="padding-left:0;">导出文件名: </label>
  5 + <el-input placeholder="非必填,默认导出文件名为excel-list.xlsx" v-model="filename" style="width:340px;" prefix-icon="el-icon-document"/>
  6 + </div>
  7 +</template>
  8 +
  9 +<script>
  10 +export default {
  11 + props: {
  12 + value: {
  13 + type: String,
  14 + default: ''
  15 + }
  16 + },
  17 + computed: {
  18 + filename: {
  19 + get() {
  20 + return this.value
  21 + },
  22 + set(val) {
  23 + this.$emit('input', val)
  24 + }
  25 + }
  26 + }
  27 +}
  28 +</script>
  1 +<template>
  2 + <!-- $t is vue-i18n global function to translate lang -->
  3 + <div class="app-container">
  4 + <!--工具条-->
  5 + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  6 + <el-form :inline="true" :model="searchText">
  7 + <el-form-item>
  8 + <el-date-picker v-model="searchText.startdate" value-format="yyyy-MM-dd" type="date"
  9 + placeholder="开始航班日期"
  10 + ></el-date-picker>
  11 + </el-form-item>
  12 + <el-form-item>
  13 + <el-date-picker v-model="searchText.enddate" value-format="yyyy-MM-dd" type="date"
  14 + placeholder="结束航班日期"
  15 + ></el-date-picker>
  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>
  25 + </el-form>
  26 + </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.waybillnomaster }}
  43 + </template>
  44 + </el-table-column>
  45 + <el-table-column label="航班号" width="115" align="center">
  46 + <template slot-scope="scope">
  47 + {{ scope.row.flightno }}
  48 + </template>
  49 + </el-table-column>
  50 + <el-table-column align="center" label="航班日期" width="220" :formatter="dateFormat">
  51 + <template slot-scope="scope">
  52 + <i class="el-icon-time"/>
  53 + <span>{{ scope.row.flightDate | parseTime('{y}-{m}-{d}')}}</span>
  54 + </template>
  55 + </el-table-column>
  56 + <el-table-column label="航段" width="110" align="center">
  57 + <template slot-scope="scope">
  58 + <el-tag>{{ scope.row.segment }}</el-tag>
  59 + </template>
  60 + </el-table-column>
  61 + </el-table>
  62 + </div>
  63 +</template>
  64 +
  65 +<script>
  66 +import { getNmmsAnalysisList } from '@/api/agent-excel'
  67 +import { parseTime } from '@/utils'
  68 +
  69 +// options components
  70 +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 {
  75 + name: 'ExportExcelNMMS',
  76 + components: { FilenameOption, AutoWidthOption, BookTypeOption },
  77 + data() {
  78 + return {
  79 + list: [],
  80 + fetchList: [],
  81 + listLoading: false,
  82 + downloadLoading: false,
  83 + filename: '',
  84 + autoWidth: true,
  85 + bookType: 'xlsx',
  86 + searchText: {
  87 + startdate: undefined,
  88 + enddate: undefined
  89 + },
  90 + note: {
  91 + type: 'info',
  92 + message: ''
  93 + }
  94 +
  95 + }
  96 + },
  97 + created() {
  98 + // this.fetchData()
  99 + },
  100 + filters: {
  101 + parseTime: parseTime
  102 + },
  103 + methods: {
  104 + dateFormat:function(row,column){
  105 + var t=new Date(row.updateTime);//row 表示一行数据, updateTime 表示要格式化的字段名称
  106 + return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate();
  107 + },
  108 + fetchData() {
  109 + this.listLoading = true
  110 + getNmmsAnalysisList(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 + const filterVal = [
  144 + 'flightno',
  145 + 'flightDate',
  146 + 'segment',
  147 + 'waybillnomaster',
  148 + 'waybillnosecondary',
  149 + 'totalpiece',
  150 + 'totalweight',
  151 + 'manifesttotalpiece',
  152 + 'manifesttotalweight',
  153 + 'productname',
  154 + 'originatingstation',
  155 + 'originatingstationcn',
  156 + 'destinationstation',
  157 + 'destinationstationcn',
  158 + 'shipperCountrycode',
  159 + 'countrydescchn',
  160 + 'areadescchn'
  161 + ]
  162 + const list = this.list
  163 + const data = this.formatJson(filterVal, list)
  164 + excel.export_json_to_excel({
  165 + header: tHeader,
  166 + data,
  167 + filename: this.filename,
  168 + autoWidth: this.autoWidth,
  169 + bookType: this.bookType
  170 + })
  171 + this.downloadLoading = false
  172 + })
  173 + },
  174 + formatJson(filterVal, jsonData) {
  175 + return jsonData.map(v => filterVal.map(j => {
  176 + if (j === 'timestamp') {
  177 + return parseTime(v[j])
  178 + } else {
  179 + return v[j]
  180 + }
  181 + }))
  182 + }
  183 + }
  184 +}
  185 +</script>
  186 +
  187 +<style>
  188 +.radio-label {
  189 + font-size: 14px;
  190 + color: #606266;
  191 + line-height: 40px;
  192 + padding: 0 12px 0 30px;
  193 +}
  194 +</style>
  195 +
  1 +<template>
  2 + <!-- $t is vue-i18n global function to translate lang -->
  3 + <div class="app-container">
  4 + <!--工具条-->
  5 + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  6 + <el-form :inline="true" :model="searchText">
  7 + <el-form-item>
  8 + <el-date-picker v-model="searchText.startdate" value-format="yyyy-MM-dd" type="date"
  9 + placeholder="开始航班日期"
  10 + ></el-date-picker>
  11 + </el-form-item>
  12 + <el-form-item>
  13 + <el-date-picker v-model="searchText.enddate" value-format="yyyy-MM-dd" type="date"
  14 + placeholder="结束航班日期"
  15 + ></el-date-picker>
  16 + </el-form-item>
  17 + <el-form-item>
  18 + <el-button :loading="downloadLoading" style="margin:0 0 20px 20px;" type="primary" icon="document" @click="fetchData">查询</el-button>
  19 + </el-form-item>
  20 + </el-form>
  21 + </el-col>
  22 + <div>
  23 + <FilenameOption v-model="filename" />
  24 + <AutoWidthOption v-model="autoWidth" />
  25 + <BookTypeOption v-model="bookType" />
  26 + <el-button :loading="downloadLoading" style="margin:0 0 20px 20px;" type="primary" icon="document" @click="handleDownload">导出 Excel</el-button>
  27 + </div>
  28 +
  29 + <el-table v-loading="listLoading" :data="list" element-loading-text="拼命加载中" border fit highlight-current-row>
  30 + <el-table-column align="center" label="Id" width="95">
  31 + <template slot-scope="scope">
  32 + {{ scope.$index }}
  33 + </template>
  34 + </el-table-column>
  35 + <el-table-column label="运单号">
  36 + <template slot-scope="scope">
  37 + {{ scope.row.autoid }}
  38 + </template>
  39 + </el-table-column>
  40 + <el-table-column label="承运人" width="110" align="center">
  41 + <template slot-scope="scope">
  42 + <el-tag>{{ scope.row.totalpiece }}</el-tag>
  43 + </template>
  44 + </el-table-column>
  45 + <el-table-column label="航班号" width="115" align="center">
  46 + <template slot-scope="scope">
  47 + {{ scope.row.manifesttotalpiece }}
  48 + </template>
  49 + </el-table-column>
  50 + <el-table-column align="center" label="航班日期" width="220" :formatter="dateFormat">
  51 + <template slot-scope="scope">
  52 + <i class="el-icon-time"/>
  53 + <span>{{ scope.row.manifesttotalweight | parseTime('{y}-{m}-{d}')}}</span>
  54 + </template>
  55 + </el-table-column>
  56 + </el-table>
  57 + </div>
  58 +</template>
  59 +
  60 +<script>
  61 +import { getAnalysisList } from '@/api/agent-excel'
  62 +import { parseTime } from '@/utils'
  63 +
  64 +// options components
  65 +import FilenameOption from './components/FilenameOption'
  66 +import AutoWidthOption from './components/AutoWidthOption'
  67 +import BookTypeOption from './components/BookTypeOption'
  68 +import Export2Excel from '@/vendor/Export2Excel'
  69 +export default {
  70 + name: 'ExportExcel',
  71 + components: { FilenameOption, AutoWidthOption, BookTypeOption },
  72 + data() {
  73 + return {
  74 + list: [],
  75 + fetchList: [],
  76 + listLoading: false,
  77 + downloadLoading: false,
  78 + filename: '',
  79 + autoWidth: true,
  80 + bookType: 'xlsx',
  81 + searchText: {
  82 + startdate: undefined,
  83 + enddate: undefined
  84 + }
  85 +
  86 + }
  87 + },
  88 + created() {
  89 + // this.fetchData()
  90 + },
  91 + filters: {
  92 + parseTime: parseTime
  93 + },
  94 + methods: {
  95 + dateFormat:function(row,column){
  96 + var t=new Date(row.updateTime);//row 表示一行数据, updateTime 表示要格式化的字段名称
  97 + return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate();
  98 + },
  99 + fetchData() {
  100 + this.listLoading = true
  101 + getAnalysisList(this.searchText).then(response => {
  102 + this.list = response.data.data
  103 + this.listLoading = false
  104 + })
  105 + },
  106 + handleDownload() {
  107 + this.downloadLoading = true
  108 + import('@/vendor/Export2Excel').then(excel => {
  109 + const tHeader = ['运单号',
  110 + '航空托运人名称',
  111 + '航空销售代理人名称',
  112 + '航协编号',
  113 + '航空公司运输证明',
  114 + '运输条件鉴定书',
  115 + '承运人',
  116 + '航班号',
  117 + '航班日期',
  118 + '航班起始站',
  119 + '航班目的站',
  120 + '运单件数',
  121 + '运单重量',
  122 + '操作时间',
  123 + '关区',
  124 + '预配品名',
  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 + const filterVal = [
  151 + 'autoid',
  152 + 'waybillnomaster',
  153 + 'segment',
  154 + 'originatingstation',
  155 + 'destinationstation',
  156 + 'totalweight',
  157 + 'totalpiece',
  158 + 'manifesttotalpiece',
  159 + 'manifesttotalweight',
  160 + 'flightno',
  161 + 'productname',
  162 + 'customsstatus',
  163 + 'carrier1',
  164 + 'arrivalstation1',
  165 + 'carrier2',
  166 + 'arrivalstation2',
  167 + 'carrier3',
  168 + 'arrivalstation3',
  169 + 'paymode',
  170 + 'customscode',
  171 + 'specialgoodscode',
  172 + 'shippername',
  173 + 'shipperaddress',
  174 + 'consigneename',
  175 + 'consigneeaddress',
  176 + 'receiptinformation',
  177 + 'specificConsigneePhone',
  178 + 'consigneePhone',
  179 + 'status',
  180 + 'isbatch',
  181 + 'originatingstationBill',
  182 + 'destinationstationBill',
  183 + 'reportorder',
  184 + 'islast',
  185 + 'shipperCode',
  186 + 'shipperCountrycode',
  187 + 'shipperPhone',
  188 + 'shipperFax',
  189 + 'consigneeCode',
  190 + 'consigneeCountrycode'
  191 + ]
  192 + const list = this.list
  193 + const data = this.formatJson(filterVal, list)
  194 + excel.export_json_to_excel({
  195 + header: tHeader,
  196 + data,
  197 + filename: this.filename,
  198 + autoWidth: this.autoWidth,
  199 + bookType: this.bookType
  200 + })
  201 + this.downloadLoading = false
  202 + })
  203 + },
  204 + formatJson(filterVal, jsonData) {
  205 + return jsonData.map(v => filterVal.map(j => {
  206 + if (j === 'timestamp') {
  207 + return parseTime(v[j])
  208 + } else {
  209 + return v[j]
  210 + }
  211 + }))
  212 + }
  213 + }
  214 +}
  215 +</script>
  216 +
  217 +<style>
  218 +.radio-label {
  219 + font-size: 14px;
  220 + color: #606266;
  221 + line-height: 40px;
  222 + padding: 0 12px 0 30px;
  223 +}
  224 +</style>
  225 +