|
@@ -127,6 +127,12 @@
|
|
import FileImportLogModal from './modules/FileImportLogModal'
|
|
import FileImportLogModal from './modules/FileImportLogModal'
|
|
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
|
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
|
|
import { getFileAccessHttpUrl, downloadFile } from '@/api/manage'
|
|
import { getFileAccessHttpUrl, downloadFile } from '@/api/manage'
|
|
|
|
+ import store from '@/store'
|
|
|
|
+ import Vue from 'vue'
|
|
|
|
+ import signMd5Utils from '@/utils/encryption/signMd5Utils'
|
|
|
|
+ import { axios } from '@/utils/request'
|
|
|
|
+ import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
+ const key = 'updatable';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'FileImportLogList',
|
|
name: 'FileImportLogList',
|
|
@@ -137,6 +143,7 @@
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
description: '导入并下载管理页面',
|
|
description: '导入并下载管理页面',
|
|
|
|
+ websock: null,
|
|
// 表头
|
|
// 表头
|
|
columns: [
|
|
columns: [
|
|
{
|
|
{
|
|
@@ -191,7 +198,9 @@
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.getSuperFieldList();
|
|
|
|
|
|
+ // 初始化websocket
|
|
|
|
+ this.initWebSocket()
|
|
|
|
+ this.getSuperFieldList();
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
importExcelUrl: function(){
|
|
importExcelUrl: function(){
|
|
@@ -212,7 +221,71 @@
|
|
exportExcel(record){
|
|
exportExcel(record){
|
|
let url = getFileAccessHttpUrl(record.fileAddress);
|
|
let url = getFileAccessHttpUrl(record.fileAddress);
|
|
downloadFile(url, record.fileName)
|
|
downloadFile(url, record.fileName)
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ // websocket
|
|
|
|
+ initWebSocket () { // 初始化weosocket(必须)
|
|
|
|
+ var userId = 'e9ca23d68d884d4ebb19d07889727dae';
|
|
|
|
+ if (store && store.getters && store.getters.userInfo && store.getters.userInfo.id) {
|
|
|
|
+ userId=store.getters.userInfo.id;
|
|
|
|
+ }
|
|
|
|
+ var wsuri = window._CONFIG['domianURL'].replace("https://","wss://").replace("http://","ws://")+"/websocket/"+userId;
|
|
|
|
+ console.log("地址", wsuri)
|
|
|
|
+ // var wsuri = 'ws://192.168.2.247:8866/websocket';
|
|
|
|
+ // console.log(wsuri);
|
|
|
|
+ //update-begin-author:taoyan date:2022-4-22 for: v2.4.6 的 websocket 服务端,存在性能和安全问题。 #3278
|
|
|
|
+ let token = Vue.ls.get(ACCESS_TOKEN)
|
|
|
|
+ // 大屏免登录,去掉token
|
|
|
|
+ // this.websock = new WebSocket(wsuri);
|
|
|
|
+ this.websock = new WebSocket(wsuri, [token]);
|
|
|
|
+ // 新建一个webstock对象
|
|
|
|
+ // this.websock = new WebSocket(wsuri)
|
|
|
|
+ this.websock.onmessage = this.websocketonmessage
|
|
|
|
+ this.websock.onopen = this.websocketonopen
|
|
|
|
+ this.websock.onerror = this.websocketonerror
|
|
|
|
+ this.websock.onclose = this.websocketclose
|
|
|
|
+ },
|
|
|
|
+ // 数据接收
|
|
|
|
+ websocketonmessage (e) {
|
|
|
|
+ console.log("-----接收消息-------",e);
|
|
|
|
+ const redata = JSON.parse(e.data)
|
|
|
|
+ console.log(redata);
|
|
|
|
+ this.initData(redata);
|
|
|
|
+ },
|
|
|
|
+ initData(redata) {
|
|
|
|
+ console.log('接收的数据',redata)
|
|
|
|
+ var data = redata.msgTxt
|
|
|
|
+ // this.$refs.modalForm.newPercent = data
|
|
|
|
+ // this.$refs.modalForm.sendnewPercent();
|
|
|
|
+ if (data != 0) {
|
|
|
|
+ this.$notification.open({
|
|
|
|
+ key,
|
|
|
|
+ message: '上传进度',
|
|
|
|
+ description:(
|
|
|
|
+ <a-progress percent={data} status="active" />
|
|
|
|
+ ),
|
|
|
|
+ duration: 0,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // websocket连接后发送数据(send发送)
|
|
|
|
+ websocketonopen () {
|
|
|
|
+ console.log("WebSocket连接成功");
|
|
|
|
+ // let actions = {} // 请根据实际项目需要进行修改
|
|
|
|
+ // this.websocketsend()
|
|
|
|
+ },
|
|
|
|
+ // 数据发送
|
|
|
|
+ websocketsend (d) {
|
|
|
|
+ this.websock.send(d)
|
|
|
|
+ console.log(d)
|
|
|
|
+ },
|
|
|
|
+ // 连接建立失败重连
|
|
|
|
+ websocketonerror () {
|
|
|
|
+ this.initWebSocket()
|
|
|
|
+ },
|
|
|
|
+ // 关闭
|
|
|
|
+ websocketclose (e) {
|
|
|
|
+ console.log('断开连接', e)
|
|
|
|
+ },
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|