作者 王勇

功能基本完善

import http from './http.js'
import axios from "axios";
let baseUrl = 'cgonms-provide'
// let baseUrl = 'http://127.0.0.1:9999/dispatch'
... ... @@ -6,4 +7,8 @@ let baseUrl = 'cgonms-provide'
export const getExitDataAnalysis = params =>{return http.get(`${baseUrl}/cgoNms/getInfo`, params);};
export const downExcel = params => { return http.post(`${baseUrl}/exit/excel`,params)};
export const createExcel = params => { return http.post(`${baseUrl}/exit/excel`,params)};
export const downExcel = params => { return axios.get(`${baseUrl}/exit/downExcel`, { params: params }); };
... ...
... ... @@ -17,12 +17,14 @@
</el-date-picker>
</el-col>
<el-col :span="10">
<el-button type="primary" @click="getExitInfoList" style="width: 160px;" icon="el-icon-search">
<el-button type="primary" @click="getExitInfoList" style="width: 160px;"
icon="el-icon-search">
数据统计查询
</el-button>
<el-button :loading="downloadLoading" type="success" icon="el-icon-s-home"
:disabled="socketResponse.socketStatus!=='200'" style="width: 160px;"
@click="downExcel">导出 Excel
style="width: 160px;"
:disabled="socketResponse.socketStatus!=='200'"
@click="downLoadExcel">导出 Excel
</el-button>
</el-col>
</el-row>
... ... @@ -34,19 +36,18 @@
style="width: 455px"></el-progress>
<el-input v-model="message" type="textarea"
:autosize="{ minRows: 6, maxRows: 10}"
style="width: 455px;"
style="width: 455px;height: 400px"
placeholder="获取数据进度" readonly>
</el-input>
</el-col>
<el-col :span="4" style="margin-left: 40px;margin-top: 20px">
<el-progress type="circle" :percentage="proportion"
:stroke-width="12"
:color="customColors"
:width="proportion>6?200:126"></el-progress>
</el-col>
</el-row>
</div>
</el-card>
</el-main>
</el-container>
... ... @@ -54,7 +55,7 @@
<script>
import {downExcel, getExitDataAnalysis} from "../../api/exit_data_analysis";
import {downExcel, createExcel, getExitDataAnalysis} from "../../api/exit_data_analysis";
import VueWebsocket from '@/utils/websocket';
export default {
... ... @@ -81,9 +82,9 @@
*/
queryInfo: {
//航班号
flightNo: 'RU186',
flightNo: 'SL965',
//航班日期
flightDate: '2019-10-31',
flightDate: '2019-04-12',
},
/* 列表加载 */
... ... @@ -95,7 +96,13 @@
{color: '#e6a23c', percentage: 60},
{color: '#5cb87a', percentage: 80},
{color: '#1989fa', percentage: 100},
]
],
/**
* 下载路径的参数
*/
fileName: "test.xls",
ipAddress: "",
url: "",
}
},
methods: {
... ... @@ -112,14 +119,47 @@
/**
* 下载excel
*/
downExcel() {
downLoadExcel() {
downExcel().then((response) => {
let res = response.data;
if (res.code !== '200') {
return this.$message.error('下载失败');
}
// console.log(res.msg)
//获取地址
this.ipAddress = res.msg;
this.url = this.ipAddress + this.fileName;
console.log(this.url)
// console.log(this.ipAddress)
this.down();
}).catch(error => {
console.log(error.toString())
this.$message.error(error.toString());
});
},
down() {
// 创建a标签
const link = document.createElement('a')
// download属性
link.setAttribute('download', 'excel.xls')
// href链接
link.setAttribute('href', this.url)
document.body.appendChild(link)
// 自执行点击事件
link.click()
},
/**
* 生成excel
*/
downExcelExit() {
downExcel(this.socketResponse.socketDataList).then((response) => {
generateExcel() {
createExcel(this.socketResponse.socketDataList).then((response) => {
let res = response.data;
if (res.code !== '200') {
return this.$message.error('生成excel失败');
}
this.fileName = res.msg;
console.log(this.fileName)
this.$message.success("Excel准备就绪")
}).catch(error => {
this.$message.error(error.toString());
... ... @@ -143,7 +183,7 @@
}
if (this.socketResponse.socketCurrentNum === this.socketResponse.socketTotalNum &&
this.socketResponse.socketTotalNum !== 0 && this.socketResponse.socketCurrentNum !== 0) {
this.downExcelExit();
this.generateExcel();
}
},
socket_onopen: function (e) {
... ...
... ... @@ -147,7 +147,7 @@
tableList: [],
total: 0,
pageNum: 1,
pageSize: 100,
pageSize: 1000,
listLoading: false,
sels: [],//列表选中列
//编辑界面是否显示
... ...