Vue3实战难点
# 在线预览Word
# word安装
npm i --save docx-preview@0.1.4
npm i --save jszip@3.10.1
# pdf安装
npm i --save pdfjs-dist@2.0.943
# 使用
<!-- 预览报告模板 -->
<a-modal class="file-modal" v-model:visible="visibleFile" title="文件预览" :width="900" @ok="visibleFile = false">
<template slot="footer">
<a-button @click="visibleFile = false">确定</a-button>
</template>
<div ref="file"></div>
</a-modal>
<!-- 预览文件 -->
<a-modal class="file-modal" v-model:visible="isShow" title="文件预览" :width="900" @ok="isShow = false">
<template slot="footer">
<a-button @click="isShow = false">确定</a-button>
</template>
<div ref="showFile" v-if="fileType == 'doc'"></div>
<img :src="fileUrl" alt="" v-if="fileType == 'jpg'" class="fileUrl">
<div id="printDom" ref="printDom" v-if="fileType == 'pdf'">
<div v-for="item in state.numPages" :key="item">
<canvas :id="`pdfCanvas-${item}`" :ref="`pdfCanvas-${item}`" />
</div>
</div>
</a-modal>
// word
import axios from 'axios';
const docx = require('docx-preview');
window.JSZip = require('jszip')
// pdf
import * as pdfjsLib from 'pdfjs-dist'
// 预览总结报告模板
const showFileModal = (url) => {
// 显示Word
if (url.includes('.doc') || url.includes('.docx')) {
visibleFile.value = true;
axios({
method: 'get',
responseType: 'blob', // 设置响应文件格式
url: url
}).then(({ data }) => {
docx.renderAsync(data, proxy.$refs.file) // 渲染到页面预览
})
}
// 显示PDF
if(url.includes('pdf')) {
showFile.isShow = true
showFile.fileUrl = url
showFile.fileType = 'pdf'
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.js'
const loadingTask = pdfjsLib.getDocument({
url: url, //这里的pdfUrl即pdf的链接地址
cMapUrl: '../../../../static/cmaps/',
cMapPacked: true
})
loadingTask.promise.then(pdf => {
// console.log('页数', pdf.numPages)
state.numPages = pdf.numPages
state.pdfCtx = pdf
nextTick(() => {
renderPdf()
})
})
}
}
// 预览滚动样式
.file-modal {
/deep/ .ant-modal {
.ant-modal-body {
max-height: calc(90vh - 150px);
overflow-y: auto;
&::-webkit-scrollbar {
width: 6px;
/*高宽分别对应横竖滚动条的尺寸*/
height: 1px;
}
&::-webkit-scrollbar-thumb {
background: #e3e3e6;
border-radius: 6px;
}
&::-webkit-scrollbar-track {
background: transparent;
border-radius: 5px;
}
}
}
canvas {
max-width: 850px !important;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# 下载在线文档
- 本接口以word为例,接口以流的方式返回
- 需要对请求接口进行处理,对接口返回的响应头
content-disposition
进行处理 - 安装
npm i file-saver -S
// http.js
import request from '@/api/request'
import {encodeUrlParams} from "@/utils/utils";
const http = {
get(url, params) {
const config = {
method: 'get',
url: url
} /*这里如果GET请求有参数,则携带上传入的参数,在
URL中以?的方式放在请求链接中*/
if (params) {
if (params.page && Number.isSafeInteger(params.page) && params.page > 0) {
params.pageNo = params.page;
delete params.page;
}
encodeUrlParams(params);
config.params = params
}
return request(config)
},
post(url, params) {
const config = {
method: 'post',
url: url
}/*同理也是传入用户需要发送到后台的参数,这些参数
放在报文中,载体表达标准是JSON*/
if (params) config.data = params
return request(config)
},
postOf(url, params) {
const config = {
method: 'post',
url: url,
responseType: 'blob'
}/*同理也是传入用户需要发送到后台的参数,这些参数
放在报文中,载体表达标准是JSON*/
if (params) config.data = params
return request(config)
},
put(url, params) {
const config = {
method: 'put',
url: url
}/*同理也是传入用户需要发送到后台的参数,这些参数
放在报文中,载体表达标准是JSON*/
if (params) config.data = params
return request(config)
},
del(url, params) {
const config = {
method: 'delete',
url: url
}/*这里如果DELETE请求有参数,则携带上传入的参数,在
URL中以?的方式放在请求链接中*/
if (params) config.params = params
return request(config)
},
}
//暴露接口,允许Vue文件或其他js,ts文件使用http结构体中的方法
export default http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// requeset.js
import axios from 'axios';
import { message } from 'ant-design-vue';
import { removeStorage } from "@/utils/localStorage";
import store from '@/store/store'
// 创建一个自定义的Axios对象
const Axios = axios.create({
baseURL: process.env.NODE_ENV === 'development' ? '/' : process.env.VUE_APP_API_HOST,
timeout: 1000*30,
/*也可以不设置Content-Type,影响是在你发送请求时
Vue会先发送OPTIONS包探测路由是否存在,需要后端也做设置响应OPTIONS
方法,否则会报跨域错误;我这里用的Beego2,路由里不响应OPTIONS方法,
所以我在这块设置Content-Type*/
// headers: {
// 'Content-Type': 'application/x-www-form-urlencoded',
// },
/*这个配置很重要,允许axios携带用户Cookie到后端,不设置这个的话
Set-Cookie是无效的,除此之外,Chrome默认开启了SameSite检查,如果
后端不主动设置SameSite = none,Set-Cookie是无效的。*/
// withCredentials: true
});
Axios.interceptors.request.use(req => {
const token = sessionStorage.getItem('accessToken')
if (token) {
req.headers['X-Access-Token'] = token // 让每个请求携带自定义 token 请根据实际情况自行修改
}
// 请求拦截处理
// console.log('这里是请求拦截器,我拦截了请求', req);
return req;
}, err => {
console.log('在发送请求时发生错误,错误为', err);
//这里不能直接放回err,需要按照官方说明返回一个Promise
return Promise.reject(err);
})
Axios.interceptors.response.use(res => {
//token是否超过有效期
let tokens = JSON.parse(sessionStorage.getItem('tokenTimes'))
if(tokens&&tokens.termOfValidity){
let nowTime = new Date();
// console.log("得很好:",parseInt(nowTime-new Date(tokens.currentTime))/1000/60)
// console.log("得很好:",new Date(tokens.currentTime))
let timeDiff = parseInt(nowTime-new Date(tokens.currentTime))/1000/60;
if(Math.ceil(timeDiff)>9){
// console.log("需要刷新token了")
}
}
// 获取文件名
if(res.headers['content-disposition'])res.data['content-disposition'] = res.headers['content-disposition']
// 响应拦截处理
return res.data;
}, error => {
const err = error.toString();
//按照实际的响应包进行解析,通过关键字匹配的方式
if (error.response?.message === 'Token失效,请重新登录'||error.response?.data.message === 'Token失效,请重新登录') {
if (store.state.errIndex === 0) {
message.error('很抱歉,登录已过期,请重新登录')
store.commit('SET_ERR_INDEX', 1)
}
removeStorage();
setTimeout(() => {
window.location.replace(process.env.VUE_APP_API_HOST2);
window.name="'一体化平台'"
}, 1500)
return;
}
// switch (true) {
// case err.indexOf('Network') !== -1:
// console.log('后端服务器无响应或者URL错误', err);
// message.error('后端服务器无响应或者URL错误');
// break;
// case err.indexOf('timeout') !== -1:
// console.log('请求后端服务器超时!', err);
// message.error('请求后端服务器超时!');
// break;
// default:
// message.error(error.response.data.message||'接口请求出错!');
// break
// }
if(error.message.indexOf('Network') !== -1) {
console.log('后端服务器无响应或者URL错误', err);
message.error('后端服务器无响应或者URL错误');
}else if (error.message.indexOf('timeout') !== -1) {
console.log('请求后端服务器超时!', err);
message.error('请求后端服务器超时!');
}else {
message.error(error.response?.data.message||'接口请求出错!');
}
return Promise.reject(error);
})
//暴露Axios实例化对象,允许所有文件调用Axios
export default Axios;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import FileSaver from 'file-saver'
const exportDayReportFn = () => {
exportDayReport({
reportDate: dayjs(searchDate.value).format(dateFormat),
sysOrgCode: sysOrgCode.value,
}).then((res) => {
let name = res['content-disposition'] ? decodeURIComponent(res['content-disposition'].split('=')[1].replace(/"/g,'')) : '无文件名'
const blob = new Blob([res], { type: "application/octet-stream" });
FileSaver.saveAs(blob, `${name}.docx`);
}).catch((err) => {
console.error(err);
})
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
主要是这里的配置
postOf(url, params) {
const config = {
method: 'post',
url: url,
responseType: 'blob'
}/*同理也是传入用户需要发送到后台的参数,这些参数
放在报文中,载体表达标准是JSON*/
if (params) config.data = params
return request(config)
}
Axios.interceptors.response.use(res => {
//token是否超过有效期
let tokens = JSON.parse(sessionStorage.getItem('tokenTimes'))
if(tokens&&tokens.termOfValidity){
let nowTime = new Date();
// console.log("得很好:",parseInt(nowTime-new Date(tokens.currentTime))/1000/60)
// console.log("得很好:",new Date(tokens.currentTime))
let timeDiff = parseInt(nowTime-new Date(tokens.currentTime))/1000/60;
if(Math.ceil(timeDiff)>9){
// console.log("需要刷新token了")
}
}
// 获取文件名
if(res.headers['content-disposition'])res.data['content-disposition'] = res.headers['content-disposition']
// 响应拦截处理
return res.data;
},error => {})
// 通过这个方法进行下载
FileSaver.saveAs(blob, `${name}.docx`);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 预览图片水印
<!-- 预览图片水印功能 -->
<div v-if="picVisible" class="pic-Modal" id="pic-Modal" @click="closePicModal" @mousewheel.prevent="handerPictu">
<div id="pic-wrap"></div>
<img ref="oImg" :src="picUrl" :style="{ width: picWidth, height: picHeight, zIndex: -1 }" alt=""/>
<canvas id="picCanvas" />
</div>
<div class="pic-box">
<a-image
:src="item.filePath"
:preview="false"
/>
<div class="pic-content" @click="() => addWaterMark(true , index , item.filePath)" >
<img src="@/assets/images/template/preview-default.png">
<span>预览</span>
</div>
</div>
// 现场情况图片预览水印
let picVisible = ref(false)
let imgCanvans = ''
let picCanvas = ''
let picIndex = ref(0)
let picUrl = ref('')
const addWaterMark = (value , index, url) => {
picVisible.value = value;
picUrl.value = url
if (typeof index === 'number') {
picIndex.value = index
}
if (picVisible.value) {
nextTick(()=> {
document.getElementById('pic-Modal').style.width = document.body.clientWidth + 'px'
document.getElementById('pic-Modal').style.height = document.body.clientHeight + 'px'
document.body.parentNode.style.overflow = 'hidden'
imgCanvans = document.getElementById('pic-wrap')
picCanvas = document.getElementById('picCanvas')
picCanvas.width = 600
picCanvas.height = 200
picCanvas.style.display = 'none'
const ctx = picCanvas.getContext('2d')
ctx.font = '16px Microsoft JhengHei'
ctx.fillStyle = 'rgba(255, 255, 255, 0.7)'
ctx.rotate(-0.35)
ctx.fillText(`${dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss')} ${store.state.userInfo.realname}`, 125, picCanvas.height / 1)
ctx.fillText(`协同调度系统`, 0 , picCanvas.height / 1)
const img = picCanvas.toDataURL('image/png')
const style = `background-image:url(${img})`
imgCanvans.setAttribute('style', style)
})
} else {
imgCanvans.style.display = 'none'
}
}
// 预览图片resize监听
const picChangeResize = () => {
if (picVisible.value) {
document.getElementById('pic-Modal').style.width = document.body.clientWidth + 'px'
document.getElementById('pic-Modal').style.height = document.body.clientHeight + 'px'
}
}
// 预览图片放大缩小图片
let picWidth = ref('fit-content')
let picHeight = ref('fit-content')
const handerPictu = (e) => {
let transforms = proxy.$refs.oImg.style.transform
let zoom = transforms.indexOf("scale") != -1 ? +transforms.split("(")[1].split(")")[0] : 1
zoom += e.wheelDelta / 1200
if (zoom > 0.1 && zoom < 2) {
proxy.$refs.oImg.style.transform = "scale(" + zoom + ")"
}
}
const closePicModal = () => {
picVisible.value = false
document.body.parentNode.style.overflow = 'auto'
picWidth.value = 'fit-content'
picHeight.value = 'fit-content'
}
onMounted(()=>{
window.addEventListener("resize", picChangeResize)
});
onUnmounted(()=> {
window.removeEventListener('resize', picChangeResize)
})
return{
// 图片预览水印
picVisible,
picIndex,
addWaterMark,
closePicModal,
handerPictu,
picWidth,
picHeight,
picUrl,
}
// 图片水印
.pic-scene-box {
width: 100%;
height: 100%;
/deep/ .ant-image {
width: 100%;
height: 100%;
img {
width: 100%;
height: 100%;
}
}
}
.pic-box {
position: relative;
&:hover {
cursor: pointer;
}
&:hover .pic-content {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
background-color: rgba(127,127,127,0.5);
z-index: 9999;
width: 100%;
height: 100%;
color: #fff;
img {
width: 26px;
height: 26px;
margin-right: 5px;
}
}
}
.pic-content {
display: none;
width: 100%;
height: 100%;
}
.pic-Modal {
position: fixed;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.45);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
#pic-wrap {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
}
img {
min-width: 30px !important;
min-height: 30px !important;
max-width: 1240px !important;
max-height: 1240px !important;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# 预览视频水印
npm i vue3-video-play
(1.3.1-beta.6)
<!-- 预览视频水印Canvas -->
<canvas id="videoCanvans"></canvas>
<template v-for="(item,index) in globalData.eventDetailsObj.videoAttachment" :key="item.id">
<!-- 视频预览水印 -->
<div class="fileItem" v-if="globalData.sceneTypeTabKey == 0 || globalData.sceneTypeTabKey == 2 || (globalData.sceneTypeTabKey == 4 && item.resourceType == 1)">
<video-play
v-bind="options"
:src="item.filePath"
@play="onPlay(index)"
/>
</div>
</template>
<!-- 视频 -->
<div v-else-if="ele.videoUrl" class="videoBox">
<video-play
v-bind="options"
:src="ele.videoUrl"
@play="onPlaySend(ele.videoTotal)"
/>
</div>
import { videoPlay } from 'vue3-video-play'
components: {
videoPlay,
}
const options = reactive({
width: '100%', //播放器高度
height: '100%', //播放器高度
// color: "#409eff", //主题色
muted: false, //静音
webFullScreen: false,
speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //播放倍速
autoPlay: false, //自动播放
loop: false, //循环播放
mirror: false, //镜像画面
ligthOff: false, //关灯模式
volume: 0.3, //默认音量大小
control: true, //是否显示控制器
controlBtns: [
"audioTrack",
"quality",
"speedRate",
"volume",
"setting",
"fullScreen",
], //显示所有按钮,
title: '', //视频名称
// src: "http://vjs.zencdn.net/v/oceans.mp4", //视频源
poster: '', //封面
})
// 监听视频是否处于全屏状态并设置当前水印时间
let nowDate = ''
let videoActiveIndex = ref('')
const checkIsFullScreen = () => {
var isFullScreen = document.fullscreen || document.mozFullScreen || document.webkitIsFullScreen;
return isFullScreen == undefined ? false : isFullScreen;
}
const fullScreenChange = () => {
if (checkIsFullScreen()) {
console.log("进入全屏");
nowDate = dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss')
if (videoActiveIndex.value !== '') {
document.querySelectorAll('.d-player-control')[videoActiveIndex.value].style.setProperty('height', '50px', 'important');
}
// 获取所有类名为 top-title 的 p 元素
const pElements = document.querySelectorAll('p.top-title');
if (pElements.length !== 0) {
// 遍历 p 元素列表,并移除类名为 top-title 的元素
pElements.forEach((pElement) => {
pElement.remove()
});
}
} else {
console.log("退出全屏");
if (videoActiveIndex.value !== '') {
document.querySelectorAll('.d-player-control')[videoActiveIndex.value].style.setProperty('height', '30px', 'important');
}
}
}
// 视频预览水印
const onPlay = (index) => {
if (!nowDate) {
nowDate = dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss')
}
imgCanvans = document.getElementsByClassName('d-player-state')[index]
picCanvas = document.getElementById('videoCanvans')
picCanvas.width = 600
picCanvas.height = 200
picCanvas.style.display = 'none'
const ctx = picCanvas.getContext('2d')
ctx.font = '16px Microsoft JhengHei'
ctx.fillStyle = 'rgba(255, 255, 255, 0.7)'
ctx.rotate(-0.35)
ctx.fillText(`${nowDate} ${store.state.userInfo.realname}`, 125, picCanvas.height / 1)
ctx.fillText(`协同调度系统`, 0 , picCanvas.height / 1)
const img = picCanvas.toDataURL('image/png')
const style = `background-image:url(${img})`
imgCanvans.setAttribute('style', style)
}
// 协同处置视频预览水印
let videoTotal = ref(0)
const onPlaySend = (videoTotal) => {
videoActiveIndex.value = videoTotal
if (!nowDate) {
nowDate = dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss')
}
imgCanvans = document.getElementsByClassName('d-player-state')[videoTotal]
picCanvas = document.getElementById('videoCanvans')
picCanvas.width = 600
picCanvas.height = 200
picCanvas.style.display = 'none'
const ctx = picCanvas.getContext('2d')
ctx.font = '16px Microsoft JhengHei'
ctx.fillStyle = 'rgba(255, 255, 255, 0.7)'
ctx.rotate(-0.35)
ctx.fillText(`${nowDate} ${store.state.userInfo.realname}`, 125, picCanvas.height / 1)
ctx.fillText(`协同调度系统`, 0 , picCanvas.height / 1)
const img = picCanvas.toDataURL('image/png')
const style = `background-image:url(${img})`
imgCanvans.setAttribute('style', style)
}
onMounted(()=>{
window.addEventListener('fullscreenchange', fullScreenChange)
});
onUnmounted(()=> {
window.removeEventListener('fullscreenchange', fullScreenChange)
})
return{
// 视频预览水印
options,
onPlay,
onPlaySend,
info,
isLoading,
isAlreadyEventType,
eventDetailsLoadings,
isActivated,
debounce2,
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
# 内嵌非菜单tab
import Layout from '@/views/layout'
export default {
path: '/amc/order-mgt',
component: Layout,
redirect: '/amc/order-mgt/order-list',
name: 'AmcOrderMgt',
meta: {
title: '订单管理',
icon: 'supplier-goods-mgt',
onBar: false // onBar控制是否显示出来
},
children: [
{
path: 'order-list',
name: 'AmcOrderList',
component: () => import('@/views/amc/order-mgt/order-list.vue'),
meta: { title: '订单管理' }
},
{
path: 'order-detail',
name: 'AmcOrderDetail',
component: () => import('@/views/amc/order-mgt/order-detail.vue'),
hidden: true,
meta: {
title: '订单详情',
insertRoute: {
name: 'AmcOrderList',
path: '/amc/order-mgt/order-list',
meta: { title: '订单管理' }
}
}
},
{
path: 'aftersale-list-v2',
name: 'AmcAftersaleListV2',
component: () =>
import('@/views/amc/order-mgt/aftersale-list-v2.vue'),
meta: { title: '售后管理' }
},
{
path: 'aftersale-detail-v2',
name: 'AmcAftersaleDetailV2',
component: () =>
import('@/views/amc/order-mgt/aftersale-detail-v2.vue'),
hidden: true,
meta: {
title: '售后详情',
insertRoute: {
name: 'AmcAftersaleListV2',
path: '/omc/order-mgt/aftersale-list-v2',
meta: { title: '售后管理' }
}
}
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 动态KeepAlive
- 解决keepAlive关闭tab页面再次打开依旧有缓存问题
- 以include的方式动态进行缓存
<router-view
v-slot="{ Component }"
:class="{
'right-box': !collapseds && indexObj.isSideMenuShow.bool == true,
'right-box right-box2': (collapseds && indexObj.isSideMenuShow.bool == true) || isReload,
'other-box3': routerName === 'home',
'other-box5': routerName === 'eventDetails2',
}">
<keep-alive :include="$store.state.keepAlive">
<component :is="Component"/>
</keep-alive>
</router-view>
// store.js
const store = createStore({
state: {
keepAlive: ['roadOverviewNew'],
},
mutations: {
SET_KEEPALIVE(state,obj){
state.keepAlive = obj
},
REMOVE_KEEPALIVE(state,obj){
const index = state.keepAlive.indexOf(obj[0])
index > -1 && state.keepAlive.splice(index, 1)
},
ADD_KEEPALIVE(state,obj){
state.keepAlive.push(obj[0])
}
}
})
// permisson.js 每次打开需要重新初始化
store.commit("SET_KEEPALIVE", ['roadOverviewNew'])
// utils.js
// 缓存菜单路由数据
export const menuObj = {
'通知对象管理': 'tbNoticeChannelInfo',
'事件评价项目管理': 'tbEventEvaluateProject',
'事件类型管理': 'tbEventCategory',
'事件评价标签管理': 'tbEventEvaluateLabel',
'处置模型管理': 'tbDisposalModelV2',
'值班人员管理': 'operator',
'班次规则设置': 'electronicFence',
'我的消息': 'MyMessage',
'日常工作总结': 'dailyWorkReport',
'事件信息': 'eventInformation2',
'事件信息统计': 'dataStatistics',
'人工日月报表': 'DailyMonthWorkReport',
'处置节点基础信息': 'tbDisposalNodeInfo',
'评价项目': 'tbEventEvaluateProject',
'评价标签': 'tbEventEvaluateLabel'
}
// index.vue
import { menuObj } from "@/utils/utils";
const getMenuTabs = (res) => {
console.log('--点击左菜单--', res)
// 添加需要缓存的菜单路由
let list = []
if (res.meta.title && menuObj.hasOwnProperty(res.meta.title) && res.meta.title !== '路况总览' && !store.state.keepAlive.includes(menuObj[res.meta.title])) {
list.push(menuObj[res.meta.title])
store.commit('ADD_KEEPALIVE', list)
list = []
}
}
// GlobalHeader.vue
import { menuObj } from "@/utils/utils";
const tabCloseClick = (item, index) => {
// 移出需要缓存的菜单路由
let list = []
if (item.path && !item.path.includes('eventDetails2') && menuObj.hasOwnProperty(item.meta.title) && item.meta.title !== '路况总览') {
list.push(menuObj[item.meta.title])
store.commit('REMOVE_KEEPALIVE', list)
list = []
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 高德地图
npm i @amap/amap-jsapi-loader -S
(^1.0.1)- 打点
Marker
- 点聚合
MarkerClusterer
- 全局挂载
index.html
:挂载完window
会自动暴露一个AMap
变量,之后进行引用即可 - 功能:点标记、点聚合、路段渲染、轨迹动画(无感刷新)
注意:高德地图不要用响应式数据去存储,响应式数据会造成意想不到的bug
<script type="text/javascript">
window._AMapSecurityConfig = {
securityJsCode:'709c59ab035b7c6f660a8e731d709c99',
}
</script>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.5&key=7420458a9eaeb41505d4e45016e3adb9&plugin=AMap.PolyEditor,AMap.CircleEditor,AMap.MarkerClusterer,AMap.Geocoder"></script>
<script>
1
2
3
4
5
6
7
2
3
4
5
6
7
<template>
<div class="scrollbar-y">
<div :class="isVisualization ? 'visualization' : 'container-box pr'">
<!-- 提示 -->
<a-spin :spinning="mapObj.mapLoading" tip="高速公路大脑为您加速">
<div id="container" class="pa"></div>
</a-spin>
<!-- 大屏插槽 -->
<slot name="mainTop"></slot>
<!-- 左侧栏 -->
<!-- <transition name="fade" mode="in-out"> -->
<div class="eventList-box pa">
<div :class="{ 'eventList2': collapsed }" class="eventList pa pr">
<div :class="{ 'dn': collapsed }" class="event-list-close pa dn">
<div class="event-list-close-arrow-box">
<div class="arrow-left2"></div>
<div class="arrow-left1"></div>
</div>
</div>
<div :class="{ 'dn': collapsed }" class="eventList-title df aic">
<div class="flex-div">
<div class="eventList-title-icon1"></div>
<div class="eventList-title-icon2"></div>
<div class="eventList-title-text unification-title">事件列表</div>
</div>
<div class="eventList--enter" @click="addEventDetail">
<span>事件新增</span>
<span>></span>
</div>
</div>
<div :class="{ 'dn': collapsed }" class="eventList-title-center">
<a-input-search
class="inputSearchValue mt_20"
v-model:value="mapObj.inputSearchValue"
placeholder="请输入事件名"
enter-button
@search="inputSearchFn"
@change="inputChangeFn"
/>
<div class="select-box df mt_10">
<!-- 事件状态 -->
<span>事件状态:</span>
<a-select
allowClear
v-model:value="mapObj.eventStatus"
show-search
:getPopupContainer="triggerNode => {return triggerNode.parentNode}"
@change="handleSearchSelect"
dropdownClassName="mySelect"
>
<a-select-option
v-for="(v, i) in statusOptions"
:key="i + ''"
:value="v.value"
>{{ v.title }}</a-select-option
>
</a-select>
</div>
</div>
<div :class="{ 'dn': collapsed }" class="eventList-main scrollbar-y pt_10" id="eventListScrollbarY">
<div
class="eventList-main-content-box cp pr"
v-for="(item, index) in mapObj.eventList"
v-if="mapObj.eventList.length > 0"
:key="index"
@click="toEventDetailsFn(item, index)"
>
<div
v-if="item.unreadMessage && item.unreadMessage > 0"
class="pa"
style="top: -10px; right: 5px; z-index: 10"
>
<a-badge :count="item.unreadMessage"></a-badge>
</div>
<div
class="eventList-main-content mb_12 pt_5 pl_10 pr_10 neweventList"
:class="
item.dotLevelId == 1
? 'eventList-main-content-background1'
: item.dotLevelId == 2
? 'eventList-main-content-background2'
: item.dotLevelId == 3
? 'eventList-main-content-background3'
: item.dotLevelId == 4
? 'eventList-main-content-background4'
: item.dotLevelId == 5
? 'eventList-main-content-background5'
:''
"
>
<div class="eventList-left-box" >
<div class="eventList-left-top" :class="
item.dotLevelId == 1
? 'series-background1'
: item.dotLevelId == 2
? 'series-background2'
: item.dotLevelId == 3
? 'series-background3'
: item.dotLevelId == 4
? 'series-background4'
: item.dotLevelId == 5
? 'series-background5'
: ''
">
<a-tooltip>
<template #title>{{ item.categoryName || '其它' }}</template>
<div class="overflowText2">{{ item.categoryName || '其它' }}</div>
</a-tooltip>
</div>
<a-tooltip >
<template #title>
<!-- {{ item.status ===0 ? '已确认':item.status ===1 ? '未处置': item.status ===2 ? '处置中':'未知'}} -->
{{ getStatus(item.status) || '未知'}}
</template>
<div class="eventList-left-bot">
<!--{{ item.sourceName }-->
<!-- <div class="isLevelMove" :class="item.isMove>70?'levelMove':''">{{ item.status ===0 ? '已确认':item.status ===1 ? '未处置': item.status ===2 ? '处置中':'未知'}}</div> -->
<div class="isLevelMove" :class="item.isMove>70?'levelMove':''">{{ getStatus(item.status) || '未知'}}</div>
</div>
</a-tooltip>
</div>
<div class="eventList-right-box">
<div class="eventList-right-topBox">
<div class="eventList-right-top overflowText">
<a-tooltip >
<template #title>
{{ item.positionDesc || '未知'}}
<!-- {{ item.chaiageNum || '未知'}}<span v-if="item.highwayDirection">({{
item.highwayDirection == 1
? '东行'
: item.highwayDirection == 2
? '西行'
: item.highwayDirection == 3
? '南行'
: item.highwayDirection == 4
? '北行'
: ''
}})</span> -->
</template>
{{ item.positionDesc || '未知'}}
<!-- {{ item.chaiageNum || '未知'}}<span v-if="item.highwayDirection">({{
item.highwayDirection == 1
? '东行'
: item.highwayDirection == 2
? '西行'
: item.highwayDirection == 3
? '南行'
: item.highwayDirection == 4
? '北行'
: ''
}})</span> -->
</a-tooltip>
</div>
<!-- <div class="eventList-right-center"> -->
<a-tooltip>
<template #title>{{ item.highwayName || '未知'}}</template>
<div class="overflowText eventList-right-center">{{ item.highwayName || '未知' }}</div>
</a-tooltip>
<a-tooltip>
<template #title>{{ item.sourceName || '未知' }}</template>
<div class="eventList-right-center overflowText">{{ item.sourceName || '未知' }}{{item.sourceStatus =='1' && item.createBy_dictText ? `(${item.createBy_dictText})` : ''}}</div>
</a-tooltip>
<!-- </div> -->
</div>
<div v-if=" item.eventTime" class="eventList-right-bot">
{{ item.eventTime }}
</div>
</div>
</div>
</div>
<div class="nothing" v-else>
<img src="~@/assets/images/roadOverview/nothing.png" alt="" />
<div>
<div>暂无内容</div>
<div>您还没有相关信息</div>
</div>
</div>
</div>
</div>
<div :class="{ 'collapsed-box2': collapsed }" class="collapsed-box" @click="toggleCollapsed">
<img
v-if="!collapsed"
src="@/assets/images/roadOverview/event-left-arrow.png"
alt="缩起"
/>
<img
v-if="collapsed"
src="@/assets/images/roadOverview/event-right-arrow.png"
alt="伸开"
/>
</div>
</div>
<!-- 右侧列表 -->
<div class="roadOverview-right pa pr" :class="isLeftMoveBtn ? 'moveClose' : 'moveOpen'">
<!-- 常用设置 -->
<div v-if="toggleDeviceStatus" class="road-right-setup">
<div class="road-right-setup__item" v-for="(item, index) in mapObj.userCoverAll" :key="item.value" @click="handleDeviceSelect(item)">
<div v-if="item.value - 1 < 4" class="road-right-setup__item--wrap">
<!-- 1到4级类型 -->
<div class="road-right-setup__item--left">
<img class="road-right-setup__item--pic" :src="statusIcon[item.value - 1]" alt="">
<div class="road-right-setup__item--name">{{ item.label }}</div>
</div>
<div class="road-right-setup__item--right">
<a-tooltip>
<template #title>是否设置为常用图层</template>
<div class="road-right-setup__item--box">
<div :class="item.view === '1' ? 'activeSelect' : ''"></div>
</div>
</a-tooltip>
<div>
<a-tooltip>
<template #title>是否设置为默认选中</template>
<a-switch class="switch-type" :checked="item.checked === '1' ? true : false" size="small" @click="(checked, event) => handleSwitch(checked, event, item)" />
</a-tooltip>
</div>
</div>
</div>
<!-- 其他类型 -->
<div v-else class="road-right-setup__item--wrap">
<div
:class="item.value == '10'
? 'bg-dispost'
: item.value == '5'
? 'bg-known'
: item.value == '6'
? 'bg-work'
: ''"
class="road-right-setup__item--left">
<div>{{ item.label }}</div>
</div>
<div class="road-right-setup__item--right">
<a-tooltip>
<template #title>是否设置为常用图层</template>
<div class="road-right-setup__item--box">
<div :class="item.view === '1' ? 'activeSelect' : ''"></div>
</div>
</a-tooltip>
<div>
<a-tooltip>
<template #title>是否设置为默认选中</template>
<a-switch class="switch-type" :checked="item.checked === '1' ? true : false" size="small" @click="(checked, event) => handleSwitch(checked, event, item)" />
</a-tooltip>
</div>
</div>
</div>
</div>
<!-- 按钮 -->
<div class="road-right-setup__btn">
<div class="road-right-setup__btn--cancel" @click="handleSepupCancel">取消</div>
<div class="road-right-setup__btn--confirm" @click="handleSepupConfirm">确认</div>
</div>
</div>
<!-- 资源设备 -->
<div v-if="toggleResouceStatus" class="road-right-resouce" @mouseleave="mouseleave">
<div class="road-right-resouce__item" @click="rightBlueIcon3Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device01.png" alt="">
<div class="road-right-resouce__item--name">服务区</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightBuleIcon3Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rightBlueIcon4Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device02.png" alt="">
<div class="road-right-resouce__item--name">隧道</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightBuleIcon4Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="bridgeClick">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device03.png" alt="">
<div class="road-right-resouce__item--name">桥梁</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightBuleIcon1Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rightBlueIcon2Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device04.png" alt="">
<div class="road-right-resouce__item--name">收费站</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightBuleIcon2Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rightGreenIcon2Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device05.png" alt="">
<div class="road-right-resouce__item--name">门架</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightGreenIcon2Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rightGreenIcon4Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device06.png" alt="">
<div class="road-right-resouce__item--name">里程桩</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightGreenIcon4Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rightGreenIcon3Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device07.png" alt="">
<div class="road-right-resouce__item--name">情报板</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightGreenIcon3Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rightGreenIcon1Click">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device08.png" alt="">
<div class="road-right-resouce__item--name">摄像枪</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightGreenIcon1Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="rescueCarClick">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/rs-rescue-car.png" alt="">
<div class="road-right-resouce__item--name">救援车</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightPurpleIcon3Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="roadCarClick">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/rs-road-car.png" alt="">
<div class="road-right-resouce__item--name">路政车</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightPurpleIcon1Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__item" @click="personnelClick">
<div class="flex-div">
<img class="road-right-resouce__item--pic" src="~@/assets/images/roadOverview/device10.png" alt="">
<div class="road-right-resouce__item--name">人员</div>
</div>
<div class="road-right-resouce__item--box">
<div :class="mapObj.isRightPurpleIcon2Boole == true ? 'activeSelect' : ''"></div>
</div>
</div>
<div class="road-right-resouce__btn" @click="handleDevice">
<img src="~@/assets/images/roadOverview/device-btn.png" alt="">
<div>常用设置</div>
</div>
</div>
<!-- 总图层 -->
<div class="road-right-wrap">
<!-- 事件处置中 -->
<slot name="layerTitleTop"></slot>
<!-- 机构 -->
<slot name="layerOrganTop"></slot>
<div v-show="!isVisualization" class="road-layer-btn-box">
<!-- 卫星地图 -->
<!-- <div :class="{'activelogo' : isSatelliteLayer }" class="road-right-wrap__satellite" @click="toggleMapLayer" v-show="!isVisualization">
<img src="~@/assets/images/eventDetails/satellite.png" alt="" v-show="!isSatelliteLayer" class="satellite-icon">
<img src="~@/assets/images/eventDetails/satellite-active.png" alt="" v-show="isSatelliteLayer" class="satellite-icon">
<div :class="{'active-satellite' : isSatelliteLayer}" class="satellite-title">卫星</div>
</div> -->
<div class="road-right-wrap__satellite" @click="toggleMapLayer">
<img src="~@/assets/images/eventDetails/satellite.png" alt="" v-show="!isSatelliteLayer" class="satellite-icon">
<img src="~@/assets/images/eventDetails/satellite-active.png" alt="" v-show="isSatelliteLayer" class="satellite-icon">
<div :class="{'active-satellite' : isSatelliteLayer}" class="satellite-title">卫星</div>
</div>
<!-- 分割线 -->
<div class="road-layer-boder"></div>
<!-- 还原 -->
<div class="road-layer-reset-btn" @click="initMapLayer">
<img class="satellite-icon" src="~@/assets/images/roadOverview/layer-reset-icon.png" alt="">
<div>还原</div>
</div>
</div>
<!-- 图层 -->
<div :class="{ 'road-right-wrap__layer-visualization': toggleLayerStatus && isVisualization }" class="road-right-wrap__layer" @click="toggleLayer" style="margin-top:6px;">
<template v-if="!toggleLayerStatus">
<img v-if="!isVisualization" class="road-right-wrap__layer--pic1" src="~@/assets/images/roadOverview/right-arrow.png" alt="">
<img class="road-right-wrap__layer--pic2" :src="layerLogo" alt="">
</template>
<template v-else>
<img v-if="!isVisualization" class="road-right-wrap__layer--pic1" src="~@/assets/images/roadOverview/right-arrow-active.png" alt="">
<img class="road-right-wrap__layer--pic2" :src="layerLogo" alt="">
</template>
<div :class="{'road-right-wrap__layer--name-active' : toggleLayerStatus}" class="road-right-wrap__layer--name">图层</div>
</div>
<div class="road-right-wrap__level">
<div :class="item.checked === '1' ? 'activelogo' : ''" class="road-right-wrap__item" v-for="(item, index) in mapObj.userCoverView" :key="item.value" @click="accidentFn1(item)">
<!-- 1到4级类型 -->
<div v-if="item.value - 1 < 4" class="flex-div">
<div class="road-right-wrap__item--box">
<img class="grade-logo" :src="statusIcon[item.value - 1]" alt="" />
<span class="grade-name">{{ item.label }}</span>
</div>
<div
:class="
item.value == '1'
? 'red-name'
: item.value == '2'
? 'org-name'
: item.value == '3'
? 'yel-name'
: item.value == '4'
? 'blue-name'
: ''"
class="grade-num">{{ item.count || 0 }}</div>
</div>
<!-- 其他类型 -->
<div v-else class="flex-div">
<div
:class="item.value == '10'
? 'bg-dispost'
: item.value == '5'
? 'bg-known'
: item.value == '6'
? 'bg-work'
: ''"
class="road-right-wrap__item--box">
<span>{{ item.label }}</span>
</div>
<div
:class="item.value == '10'
? 'color-dispost'
: item.value == '5'
? 'color-known'
: item.value == '6'
? 'color-work'
: ''"
class="grade-num">{{ item.count || 0 }}</div>
</div>
</div>
</div>
</div>
</div>
<div v-if="yiGouObj.isMileageDetailShow" class="yigou-component01 hvc pa">
<MileageDetail
style="width: 100%"
:mileageId="yiGouObj.mileageId"
@handleCancel="yiGouObj.isMileageDetailShow = false"
></MileageDetail>
</div>
<div v-if="yiGouObj.isInfoDetailShow" class="yigou-component02 hvc pa info" style="top:0;position: relative;">
<InfoDetail :infoId="yiGouObj.infoId" close @handleClose="closeInfoDetailFn" style="width: 100%;"></InfoDetail>
</div>
<div v-if="yiGouObj.isGantryDetailsShow" class="yigou-component02 hvc pa">
<GantryDetails
:gantryId="yiGouObj.gantryId"
@handleCancel="yiGouObj.isGantryDetailsShow = false"
style="width: 100%"
></GantryDetails>
</div>
<div v-if="yiGouObj.isVideoWindowShow" class="yigou-component02 hvc pa" style="height:640px;top:0;position: relative;">
<VideoWindow
:cameraNum="yiGouObj.cameraNum"
close
control
@handleClose="yiGouObj.isVideoWindowShow = false"
style="width: 100%"
></VideoWindow>
</div>
<!-- 救援车点聚合信息窗体 -->
<div class="clusterWindowBox" ref="clusterRescueCarWindowBoxRef" :style="{width:clusterRescueCarArr.length == 1?'211px':''}">
<div class="clusterWindowItem" :class="clusterRescueCarArr.length == 1?'oneCluster':''" v-for="(item,index) in clusterRescueCarArr" :key="index" >
<p :title="item.vlp"><span>车牌号:</span>{{item.vlp}}</p>
<p :title="item.code"><span>车辆编号:</span>{{item.code}}</p>
<p :title="item.jobType"><span>类型:</span>{{item.jobType}}</p>
<p :title="item.state"><span>状态:</span>{{item.state === 'dispose' ? '忙碌': '空闲'}}</p>
<p :title="item.direction"><span>方向:</span>{{item.direction}}</p>
<p :title="item.curentUserName"><span>绑定人员:</span>{{item.curentUserName || ''}}</p>
<p :title="item.gpsTime"><span>GPS时间:</span>{{item.gpsTime || ''}}</p>
</div>
</div>
<!-- 人员点聚合信息窗体 -->
<div class="clusterWindowBox" ref="clusterWindowBoxRef" :style="{width:clusterArr.length == 1?'211px':''}">
<div class="clusterWindowItem" :class="clusterArr.length == 1?'oneCluster':''" v-for="(item,index) in clusterArr" :key="index" >
<p :title="item.orgName"><span>部门:</span>{{item.orgName}}</p>
<p :title="item.realName"><span>姓名:</span>{{item.realName}}</p>
<p :title="item.workStatus_dictText"><span>状态:</span>{{item.workStatus_dictText}}</p>
<p :title="item.phone"><span>电话:</span>{{item.phone}}</p>
</div>
</div>
<!-- 路政车点聚合信息窗体 -->
<div class="clusterWindowBox" ref="clusterRoadCarWindowBoxRef" :style="{width:clusterRoadCarArr.length == 1?'211px':''}">
<div class="clusterWindowItem" :class="clusterRoadCarArr.length == 1?'oneCluster':''" v-for="(item,index) in clusterRoadCarArr" :key="index" >
<p :title="item.vlp"><span>车牌号:</span>{{item.vlp}}</p>
<p :title="item.code"><span>车辆编号:</span>{{item.code}}</p>
<p :title="item.jobType"><span>类型:</span>{{item.jobType}}</p>
<p :title="item.state"><span>状态:</span>{{item.state === 'dispose' ? '忙碌': '空闲'}}</p>
<p :title="item.direction"><span>方向:</span>{{item.direction}}</p>
<p :title="item.curentUserName"><span>绑定人员:</span>{{item.curentUserName || ''}}</p>
<p :title="item.gpsTime"><span>GPS时间:</span>{{item.gpsTime || ''}}</p>
</div>
</div>
<!-- 事件点聚合信息窗体 -->
<div class="clusterWindowBox" ref="clusterEventWindowBoxRef" :style="{width:clusterEventArr.length == 1?'211px':''}">
<div class="clusterWindowItem clusterEventWindowItem" :class="clusterEventArr.length == 1?'oneCluster':''" v-for="(item,index) in clusterEventArr" :key="index" @click="toEventDetailsFn(item)">
<p class="clusterEventWindowItem-name" :title="item.name">{{item.name}}</p>
<p :title="item.eventTime"><span>时间:</span>{{item.eventTime}}</p>
<p :title="item.categoryName"><span>类型:</span>{{item.categoryName}}</p>
<p :title="item.locationDesc"><span>位置:</span>{{item.locationDesc}}</p>
<!-- <p :title="item.chaiageNum"><span>桩号:</span>{{item}}</p> -->
<!-- <p :title="item.trafficState"><span>交通状况:</span>{{item.trafficState}}</p> -->
</div>
</div>
<!-- 易购事件点聚合信息窗体 -->
<div class="clusterWindowBox" ref="clusterYiGouEventWindowBoxRef" :style="{width:clusterEventArr.length == 1?'211px':''}">
<div class="clusterWindowItem clusterEventWindowItem" :class="clusterYiGouEventArr.length == 1?'oneCluster':''" v-for="(item,index) in clusterYiGouEventArr" :key="index" @click="toYiGouEventDetailsFn(item)">
<p class="clusterEventWindowItem-name" :title="item.voiceInfo">{{item.voiceInfo}}</p>
<p :title="item.createdAt"><span>时间:</span>{{item.createdAt}}</p>
<p :title="item.alarmDesc"><span>类型:</span>{{item.alarmDesc}}</p>
<p :title="item.locationDesc"><span>位置:</span>{{item.locationDesc}}</p>
<!-- <p :title="item.alarmLevel"><span>告警等级:</span>{{item.alarmLevel}}</p> -->
</div>
</div>
</div>
<!-- 打开事件新增弹窗 -->
<EventDetailModal ref="eventDetailModalRef" />
</div>
</template>
<script>
import {
ref,
onMounted,
reactive,
watch,
onActivated,
onDeactivated,
getCurrentInstance,
defineAsyncComponent,
nextTick,
computed
} from 'vue'
// import AMapLoader from '@amap/amap-jsapi-loader'
// import mockData from '@/utils/mockData.json'
import router from '@/router/router'
import store from '@/store/store'
import MileageDetail from '@/components/other/MileageDetail'
import InfoDetail from '@/components/other/InfoDetail'
import GantryDetails from '@/components/other/GantryDetails'
import VideoWindow from '@/components/other/VideoWindow'
import {
getSectionInfoApi,
getInfoApi,
getFacilitiesApi,
queryConfirmedEventApi,
confirmEventApi,
getHighwaySectionApi,
getOperatorLocationListApi,
getRescueCarListApi,
getRoadCarListApi,
getUserCoverApi,
setUserCoverApi,
queryEventInfoV2Api
} from '@/api/roadOverviewApi.js'
import { getYiGouEventDataApi } from '@/api/api'
import { getDict, getTwoArrNum, compareArrChange, changeLabel } from '@/utils/utils'
import { setStorage, getStorage } from "@/utils/localStorage";
import { message } from 'ant-design-vue'
const EventDetailModal = defineAsyncComponent(() => import(/* webpackChunkName: "eventDetailModal" */'@/components/eventDetailModal.vue'))
export default {
name: 'roadOverviewNew',
components: {
MileageDetail,
InfoDetail,
GantryDetails,
VideoWindow,
EventDetailModal
},
props:{
isVisualization:{type:Boolean,default:false},//是否大屏
// gdStyle:{type:String,default:'amap://styles/whitesmoke'},//地图风格
// gdStyle:{type:String,default:'amap://styles/8e5dee6173f70cc308d300aa641bc3a9'},//地图风格
gdStyle:{type:String,default:'amap://styles/02fd07714a3aac53f6cdf9b02998f192'},//地图风格
isLeftMoveBtn:{type:Boolean,default:false},//是否关闭卡片
sysCodeVal:{type:String,default:''}//是否关闭卡片
},
setup(props,{emit}) {
const { proxy } = getCurrentInstance()
const statusOptions = getDict("page_event_status")
console.log('statusOptions', statusOptions)
const getStatus = status =>{
return statusOptions.filter(i=>{
return i.value == status
})[0]?.title
}
const eventList = ref([
{ series: 1 },
{ series: 2 },
{ series: 3 },
{ series: 1 },
{ series: 2 },
{ series: 3 },
{ series: 1 },
{ series: 2 },
{ series: 3 },
])
let GDMap = null
let rescueCarClusterer = null
let roadCarClusterer = null
let personMarkerClusterer = null
let eventMarkerClusterer1 = null
let eventMarkerClusterer2 = null
let eventMarkerClusterer3 = null
let eventMarkerClusterer4 = null
let eventMarkerClusterer5 = null
let eventMarkerClusterer6 = null
let eventMarkerClusterer10 = null
let mapDetailObj = {
mapIconArr1: [],
mapIconArr2: [],
mapIconArr3: [],
mapIconArr4: [],
mapIconArr5: [],
mapIconArr6: [],
mapIconArr7: [],
mapIconArr8: [],
mapIconArr9: [],
mapIconArr10: [],
mapIconArr11: [],
roadOverviewMarker: null,
roadOverviewMarkerDialog: null,
roadOverviewMarkerDialogArr: [],
polylineArr: [], //路线数组
// 存放救援车、路政、人员数据中经纬度有变化的点数据
rescueLineMarkerArr: [],
roadLineMarkerArr: [],
personnelMarkerArr: [],
}
let loopFnTimerArr = []
let resourceTimerArr = []
let accidentMarkerArr1 = []
let accidentMarkerArr2 = []
let accidentMarkerArr3 = []
let accidentMarkerArr4 = []
let accidentMarkerArr5 = []
let accidentMarkerArr6 = []
let accidentMarkerArr10 = []
let typeDataArr = []
let clusterInfoWindow = null
const clusterArr = ref([])
const clusterRescueCarArr = ref([])
const clusterRoadCarArr = ref([])
const clusterEventArr = ref([])
const clusterYiGouEventArr = ref([])
const clusterWindowBoxRef = ref(null)
const clusterRescueCarWindowBoxRef = ref(null)
const clusterRoadCarWindowBoxRef = ref(null)
const clusterEventWindowBoxRef = ref(null)
const clusterYiGouEventWindowBoxRef = ref(null)
const mapIconList = ref([
require('@/assets/images/roadOverview/right-blue-icon1.png'),
require('@/assets/images/roadOverview/right-blue-icon2.png'),
require('@/assets/images/roadOverview/right-blue-icon3.png'),
require('@/assets/images/roadOverview/right-blue-icon4.png'),
require('@/assets/images/roadOverview/right-green-icon1.png'),
require('@/assets/images/roadOverview/right-green-icon2.png'),
require('@/assets/images/roadOverview/right-green-icon3.png'),
require('@/assets/images/roadOverview/right-green-icon4.png'),
require('@/assets/images/roadOverview/rs-road-car-arrow.png'),
require('@/assets/images/roadOverview/right-purple.png'),
require('@/assets/images/roadOverview/rs-rescue-car-arrow.png'),
require('@/assets/images/roadOverview/rs-road-car-arrow-black.png'),
require('@/assets/images/roadOverview/rs-rescue-car-arrow-black.png'),
])
const mapObj = reactive({
isRightBuleIcon1Boole: false,
isRightBuleIcon2Boole: false,
isRightBuleIcon3Boole: false,
isRightBuleIcon4Boole: false,
isRightGreenIcon1Boole: false,
isRightGreenIcon2Boole: false,
isRightGreenIcon3Boole: false,
isRightGreenIcon4Boole: false,
isRightPurpleIcon1Boole: false,
isRightPurpleIcon2Boole: false,
isRightPurpleIcon3Boole: false,
sectionIdArr: [],
informationArr1: [],//桥梁
informationArr2: [],//收费站
informationArr3: [],//服务区
informationArr4: [],//隧道
equipmentArr1: [],//摄像枪
equipmentArr2: [],//门架
equipmentArr3: [],//情报板
equipmentArr4: [],//里程桩
rescueCarData: [], //救援车
roadCarData: [], //路政车
personnelData: [], //人员
eventList: [],
newEventList: [], // websocket推送后获取当前状态所有事件列表数据
oldEventList: [], // 初始化所获取的所有事件列表数据
inputSearchValue: '',
eventStatus: '10', // 事件状态
selectValue1: undefined,
selectValue2: undefined,
mapLoading: false,
mapLineData: [],
userCoverView: [], // 当前能操作的图层
userCoverAll: [], // 所有图层
eventLeveloOrStatusList: [], // 所有图层的打点数据
levelClusterer: '', // 当前打开点聚合弹窗的是哪个等级
isWebsockSign: false, // 是否有websocket推送消息过来
lockReconnect:false,
websockSign: {},
addList: [], // websocket连接中要新增的点数据
delList: [], // websocket连接中要删除的点数据
numList: [], // websocket连接中要变更的点总数数据
levelIdCheckedArr: [false, false, false, false, false, false, false], // 每个图层的选中状态
centerPoint: '', // 设置地图中心点
maxDistance: '', // 设置地图层级
})
const yiGouObj = reactive({
isMileageDetailShow: false,
mileageId: '',
isInfoDetailShow: false,
infoId: '',
isGantryDetailsShow: false,
gantryId: '',
isVideoWindowShow: false,
cameraNum: '',
})
const statusIcon = ref([
require('@/assets/images/roadOverview/logo-1.png'),
require('@/assets/images/roadOverview/logo-2.png'),
require('@/assets/images/roadOverview/logo-3.png'),
require('@/assets/images/roadOverview/logo-4.png'),
require('@/assets/images/roadOverview/logo-grade5.png'),
])
const typeIcon = ref([
require('@/assets/images/roadOverview/logo-type-1.png'),
require('@/assets/images/roadOverview/logo-type-2.png'),
require('@/assets/images/roadOverview/logo-type-3.png'),
require('@/assets/images/roadOverview/logo-type-4.png'),
require('@/assets/images/roadOverview/logo-type-5.png'),
require('@/assets/images/roadOverview/logo-type-6.png'),
require('@/assets/images/roadOverview/logo-type-7.png'),
])
// 初始化点聚合弹窗数据
const initClusterInfoWindow = (type = 'default') => {
if(clusterInfoWindow){
if (type === 'default') {
clusterInfoWindow.close()
clusterArr.value = []
clusterRoadCarArr.value = []
clusterEventArr.value = []
clusterYiGouEventArr.value = []
}
if (type === 'rescue' && clusterRescueCarArr.value.length !== 0) {
clusterInfoWindow.close()
clusterRescueCarArr.value = []
}
if (type === 'road' && clusterRoadCarArr.value.length !== 0) {
clusterInfoWindow.close()
clusterRoadCarArr.value = []
}
if (type === 'person' && clusterArr.value.length !== 0) {
clusterInfoWindow.close()
clusterArr.value = []
}
if (type === 'marker' && clusterEventArr.value.length !== 0 || clusterYiGouEventArr.value.length !== 0) {
clusterInfoWindow.close()
clusterEventArr.value = []
clusterYiGouEventArr.value = []
}
if(type === 'del-marker' && clusterEventArr.value.length !==0 || clusterYiGouEventArr.value.length !== 0) {
clusterInfoWindow.close()
clusterEventArr.value = []
clusterYiGouEventArr.value = []
}
if (type === 'event' && clusterEventArr.value.length !==0) {
clusterInfoWindow.close()
clusterEventArr.value = []
}
if (type === 'alarm' && clusterYiGouEventArr.value.length !== 0) {
clusterInfoWindow.close()
clusterYiGouEventArr.value = []
}
}
}
// 地图初始化
const initMap = () => {
GDMap = new window.AMap.Map('container', {
// 设置地图样式
features: ['bg', 'road', 'building'], // 显示背景、道路和建筑物
center: [113.338552, 23.076839],
expandZoomRange: true, //最大层级拓展
zooms: [3,20],
zoom: 13,
viewMode: '3D',
pitch: 45, // 地图俯仰角度,有效范围 0 度- 83 度
mapStyle: props.gdStyle,//地图风格
})
GDMap.on('complete', (e) => {
mapObj.mapLoading = false
getSectionInfoApiFn() //画线路
queryEventInfoV2ApiFn() //地图加载重大交通事故地点图标位置
})
GDMap.on('mousewheel', (e) => {
initClusterInfoWindow()
})
// 地图标尺
GDMap.plugin(["AMap.ToolBar"], () => {
//加载工具条
const tool = new AMap.ToolBar({
offset: new AMap.Pixel(30, 673),
zIndex: 1,
position: 'RT',
locate: false,
// direction: true
});
GDMap.addControl(tool)
})
GDMap.on('zoomchange', (e) => {
console.log('当前缩放级别:', GDMap.getZoom());;
if (GDMap.getZoom() !== 20) {
initClusterInfoWindow()
}
})
}
// 动态计算zoom值
const getZoom = (distance,map) => {
// const earthRadius = 6378137; // 地球半径,单位:米
// const pixelWidth = 256; // 地图显示区域的宽度,单位:像素
// const minZoom = 3; // 最小的zoom值
// const maxZoom = 18; // 最大的zoom值
// let newZoom
// for (let zoom = minZoom; zoom <= maxZoom; zoom++) {
// const resolution = earthRadius * 2 * Math.PI / (pixelWidth * Math.pow(2, zoom)); // 每个像素表示的距离,单位:米
// if ((distance)<= resolution * pixelWidth) {
// newZoom = zoom
// }
// console.log('看看zoom',zoom);
// let tes = (156543.03392 * Math.cos(0)) / Math.pow(2, zoom)*1100
// console.log('看看距离',tes);
// }
// if(newZoom>= 10) {
// newZoom += 2.8
// }else if (newZoom == 9) {
// newZoom += 2.5
// } else if (newZoom == 8) {
// newZoom += 2.8
// } else if (newZoom <= 7) {
// newZoom += 2.8
// }
// 计算当前层级每像素代表的距离乘当前展示的像素大小,比较路线距离。比较到小数两位的层级为止
let width = document.getElementById('container').offsetWidth - 660 // 减去遮挡物
let zoom1,zoom2,zoom3
for (let zoomLevel = 3; zoomLevel <= 18; zoomLevel++) {
let pxDistance = (156543.03392 * Math.cos(0)) / Math.pow(2, zoomLevel)*width
if(distance <= pxDistance) zoom1 = zoomLevel
}
for (let zoomLevel = zoom1 ; zoomLevel <= zoom1 + 1; zoomLevel += 0.1) {
let pxDistance = (156543.03392 * Math.cos(0)) / Math.pow(2, zoomLevel)*width
if(distance <= pxDistance) zoom2 = zoomLevel
}
for (let zoomLevel = Math.ceil(zoom2 * 10) / 10 ; zoomLevel <= Math.ceil(zoom2 * 10) / 10 + 0.1; zoomLevel += 0.01) {
let pxDistance = (156543.03392 * Math.cos(0)) / Math.pow(2, zoomLevel)*width
if(distance <= pxDistance) {
zoom3 = zoomLevel
}
}
map.setZoom(zoom3);
}
// 计算公式
const toRadians = (degrees) => {
return degrees * (Math.PI / 180);
}
// 通过经纬度计算距离
const calculateDistance = (lat1, lon1, lat2, lon2) => {
const earthRadius = 6371; // 地球半径(单位:千米)
const dLat = toRadians(lat2 - lat1);
const dLon = toRadians(lon2 - lon1);
const a =
Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
const distance = earthRadius * c;
return distance;
}
// 动态计算点聚合的zoom值
const getClustererZoom = (data) => {
let positions = [],maxDistance = 0
data.markers.forEach((item) => {
positions.push(item.getPosition())
})
positions.forEach((positionOne,index) => {
positions.forEach((positionTwo,idx) => {
if(idx > index) {
let distance = calculateDistance(positionOne.lat,positionOne.lng,positionTwo.lat,positionTwo.lng) * 1000
if(distance > maxDistance) maxDistance = distance
}
})
})
let res = false
if(maxDistance < 10) {
GDMap.setZoom(20)
res = true
} else if(10 < maxDistance && maxDistance < 100) {
// getZoom(maxDistance,GDMap)
GDMap.setZoom(20)
res = false
}
return res
}
let accidentBool = ref([])
const accidentFn1 = (item) => {
// console.log('item', item)
mapObj.userCoverView.forEach((coverItem, index) => {
if (coverItem.value === item.value) {
// 点击成激活选项
if (item.checked == '0') {
coverItem.checked = '1'
accidentBool.value[index] = true
} else {
// 点击成非激活选项
coverItem.checked = '0'
accidentBool.value[index] = false
// 处理关闭点聚合弹窗
if (mapObj.levelClusterer === Number(item.value)) {
if(item.value === '5' || item.value === '6' || item.value === '10') {
initClusterInfoWindow('event')
} else {
initClusterInfoWindow('alarm')
}
}
}
}
})
// 处理打点数据
handleEventLeveloOrStatusList()
}
const closeInfoDetailFn = () => {
yiGouObj.isInfoDetailShow = false
}
// 统一处理点击点聚合处理展开弹窗数据
const toggleClickClusterMarker = (ele, levelId) => {
mapObj.levelClusterer = levelId
if (GDMap.getZoom() === 20) {
let eventType = false
if (levelId === 5 || levelId === 6 || levelId === 10) {
eventType = true
} else {
eventType = false
}
if (!eventType) {
clusterYiGouEventArr.value.length = 0
ele.markers.forEach((item)=>{
clusterYiGouEventArr.value.push(item.getExtData())
})
} else {
clusterEventArr.value.length = 0
ele.markers.forEach((item)=>{
clusterEventArr.value.push(item.getExtData())
})
}
clusterInfoWindow = new AMap.InfoWindow({
offset:new AMap.Pixel(0,-10),
anchor:'bottom-center',
content:!eventType ? clusterYiGouEventWindowBoxRef.value : clusterEventWindowBoxRef.value,
isCustom:true
})
clusterInfoWindow.open(GDMap, [ele.lnglat.lng,ele.lnglat.lat])
}
}
// 点聚合
function addCluster(markerArr, type, levelId){
// console.log('markerArr', markerArr)
let typeClusterStyle = ''
let typeEventClusterStyle = ''
if (type === 'person') {
typeClusterStyle = 'renderClusterBox'
typeEventClusterStyle = 'renderClusterCount'
} else if (type === 'roadCar' || type === 'rescueCar') {
typeClusterStyle = 'renderEventClusterBox3'
typeEventClusterStyle = 'renderEventClusterCount3'
} else {
if (levelId === 1) {
typeClusterStyle = 'renderEventClusterBox1'
typeEventClusterStyle = 'renderEventClusterCount1'
}
if (levelId === 2) {
typeClusterStyle = 'renderEventClusterBox2'
typeEventClusterStyle = 'renderEventClusterCount2'
}
if (levelId === 3) {
typeClusterStyle = 'renderEventClusterBox3'
typeEventClusterStyle = 'renderEventClusterCount3'
}
if (levelId === 4) {
typeClusterStyle = 'renderEventClusterBox4'
typeEventClusterStyle = 'renderEventClusterCount4'
}
if (levelId === 5) {
typeClusterStyle = 'renderEventClusterBox5'
typeEventClusterStyle = 'renderEventClusterCount5'
}
if (levelId === 6) {
typeClusterStyle = 'renderEventClusterBox2'
typeEventClusterStyle = 'renderEventClusterCount2'
}
if (levelId === 10) {
typeClusterStyle = 'renderEventClusterBox4'
typeEventClusterStyle = 'renderEventClusterCount4'
}
}
let _renderClusterMarker = function(context){
let content=`<div class="renderAnyClusterBox ${typeClusterStyle}">
<div class="renderAnyClusterCount ${typeEventClusterStyle}">${context.count}</div></div>`
context.marker.setOffset(new AMap.Pixel(-21, -21));
context.marker.setContent(content)
context.marker.on('mouseover', function(e) {
let eventType = false
if (levelId === 5 || levelId === 6 || levelId === 10) {
eventType = true
} else {
eventType = false
}
if (!eventType) {
clusterYiGouEventArr.value.length = 0
context.markers.forEach((item)=>{
clusterYiGouEventArr.value.push(item.getExtData())
})
} else {
clusterEventArr.value.length = 0
context.markers.forEach((item)=>{
clusterEventArr.value.push(item.getExtData())
})
}
clusterInfoWindow = new AMap.InfoWindow({
offset:new AMap.Pixel(0,-10),
anchor:'bottom-center',
content:!eventType ? clusterYiGouEventWindowBoxRef.value : clusterEventWindowBoxRef.value,
isCustom:true
})
clusterInfoWindow.open(GDMap, [context.markers[0].getExtData().longitude,context.markers[0].getExtData().latitude])
});
context.marker.on('mouseout', function(e) {
clusterInfoWindow.close()
})
}
let _renderMarker = function(context) {
let content = `<div class="markerBox">
<img src="${mapIconList.value[9]}" class="markerImage"/>
<div class="markerContent">
<p>${context.data[0].realName}</p>
</div>
</div>`
var offset = new AMap.Pixel(0,0);
context.marker.setContent(content)
context.marker.setOffset(offset)
context.marker.setAnchor('bottom-center')
}
if(!personMarkerClusterer && type === 'person'){
personMarkerClusterer = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
// clusterByZoomChange:true,
}
)
personMarkerClusterer.on('click',(ele)=>{
// 2.0版本的使用
// clusterArr.value = ele.clusterData
// clusterInfoWindow = new AMap.InfoWindow({
// offset:ele.clusterData.length>1 ? new AMap.Pixel(0,-36) : new AMap.Pixel(0, -36),
// anchor:'bottom-center',
// content:clusterWindowBoxRef.value,
// isCustom:true
// })
// clusterInfoWindow.open(GDMap, [ele.lnglat.lng,ele.lnglat.lat])
// 1.4.15版本的使用
let res = getClustererZoom(ele)
if (GDMap.getZoom() === 20 && res && (clusterInfoWindow == null || !clusterInfoWindow.getIsOpen())) {
clusterArr.value.length = 0
ele.markers.forEach((item)=>{
clusterArr.value.push(item.getExtData())
})
clusterInfoWindow = new AMap.InfoWindow({
offset:new AMap.Pixel(0,-36),
anchor:'bottom-center',
content:clusterWindowBoxRef.value,
isCustom:true
})
clusterInfoWindow.open(GDMap, [ele.lnglat.lng,ele.lnglat.lat])
}else {
clusterInfoWindow.close()
}
})
}
if(!rescueCarClusterer && type === 'rescueCar'){
rescueCarClusterer = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
// clusterByZoomChange:true,
}
)
rescueCarClusterer.on('click',(ele)=>{
let res = getClustererZoom(ele)
if (GDMap.getZoom() === 20 && res && (clusterInfoWindow == null || !clusterInfoWindow.getIsOpen())) {
clusterRescueCarArr.value.length = 0
ele.markers.forEach((item)=>{
clusterRescueCarArr.value.push(item.getExtData())
})
clusterInfoWindow = new AMap.InfoWindow({
offset:new AMap.Pixel(0,-36),
anchor:'bottom-center',
content:clusterRescueCarWindowBoxRef.value,
isCustom:true
})
clusterInfoWindow.open(GDMap, [ele.lnglat.lng,ele.lnglat.lat])
}else {
clusterInfoWindow.close()
}
})
}
if(!roadCarClusterer && type === 'roadCar'){
roadCarClusterer = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
// clusterByZoomChange:true,
}
)
roadCarClusterer.on('click',(ele)=>{
let res = getClustererZoom(ele)
if (GDMap.getZoom() === 20 && res && (clusterInfoWindow == null || !clusterInfoWindow.getIsOpen())) {
clusterRoadCarArr.value.length = 0
ele.markers.forEach((item)=>{
clusterRoadCarArr.value.push(item.getExtData())
})
clusterInfoWindow = new AMap.InfoWindow({
offset:new AMap.Pixel(0,-36),
anchor:'bottom-center',
content:clusterRoadCarWindowBoxRef.value,
isCustom:true
})
clusterInfoWindow.open(GDMap, [ele.lnglat.lng,ele.lnglat.lat])
}else {
clusterInfoWindow.close()
}
})
}
if(!eventMarkerClusterer1 && type === 'levelId' && levelId === 1){
eventMarkerClusterer1 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer1.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
if(!eventMarkerClusterer2 && type === 'levelId' && levelId === 2){
eventMarkerClusterer2 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer2.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
if(!eventMarkerClusterer3 && type === 'levelId' && levelId === 3){
eventMarkerClusterer3 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer3.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
if(!eventMarkerClusterer4 && type === 'levelId' && levelId === 4){
eventMarkerClusterer4 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer4.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
if(!eventMarkerClusterer5 && type === 'levelId' && levelId === 5){
eventMarkerClusterer5 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer5.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
if(!eventMarkerClusterer6 && type === 'levelId' && levelId === 6){
eventMarkerClusterer6 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer6.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
if(!eventMarkerClusterer10 && type === 'levelId' && levelId === 10){
eventMarkerClusterer10 = new AMap.MarkerClusterer(
GDMap,
markerArr,
{
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
gridSize: 0, //聚合计算时网格的像素大小
maxZoom: 20, //最大的聚合级别
zoomOnClick:true,
}
)
eventMarkerClusterer10.on('click',(ele)=>{
let res = getClustererZoom(ele)
if(res) toggleClickClusterMarker(ele, levelId)
})
}
}
//地图加载重大交通事故地点图标位置
const accidentMarkerFn = (data, marker = 'default') => {
if(GDMap) {
if (marker === 'default') {
GDMap.remove(accidentMarkerArr1)
GDMap.remove(accidentMarkerArr2)
GDMap.remove(accidentMarkerArr3)
GDMap.remove(accidentMarkerArr4)
GDMap.remove(accidentMarkerArr5)
GDMap.remove(accidentMarkerArr6)
GDMap.remove(accidentMarkerArr10)
accidentMarkerArr1 = []
accidentMarkerArr2 = []
accidentMarkerArr3 = []
accidentMarkerArr4 = []
accidentMarkerArr5 = []
accidentMarkerArr6 = []
accidentMarkerArr10 = []
// 每次打点都需要清除点聚合对象
if (eventMarkerClusterer1) {
GDMap.remove(eventMarkerClusterer1)
eventMarkerClusterer1 = null
}
if (eventMarkerClusterer2) {
GDMap.remove(eventMarkerClusterer2)
eventMarkerClusterer2 = null
}
if (eventMarkerClusterer3) {
GDMap.remove(eventMarkerClusterer3)
eventMarkerClusterer3 = null
}
if (eventMarkerClusterer4) {
GDMap.remove(eventMarkerClusterer4)
eventMarkerClusterer4 = null
}
if (eventMarkerClusterer5) {
GDMap.remove(eventMarkerClusterer5)
eventMarkerClusterer5 = null
}
if (eventMarkerClusterer6) {
GDMap.remove(eventMarkerClusterer6)
eventMarkerClusterer6 = null
}
if (eventMarkerClusterer10) {
GDMap.remove(eventMarkerClusterer10)
eventMarkerClusterer10 = null
}
}
// data.push({ //测试数据测试点位置是否准确
// name:'海珠广场',
// latitude:'23.115241',
// longitude:'113.265813',
// levelId:5
// })
data.forEach((e, i) => {
// 告警事件点的经纬度需要转换
if(e.lon && e.lat) {
e.longitude = e.lon
e.latitude = e.lat
}
if (e.longitude && e.latitude) {
// 图标嵌入式
let content = ''
if(e.categoryIcon){
content = `<div>
<img src="${require(`@/assets/images/roadOverview/map-event-icon${e.dotLevelId}.png`)}"/>
<img style="position: absolute;top: 2%;left: 22%;width: 18px;height:18px;" src="${e.categoryIcon}"/>
</div>`
} else {
content = `<div>
<img src="${require(`@/assets/images/roadOverview/map-event-icon${e.dotLevelId}.png`)}"/>
</div>`
}
let accidentMarker = new AMap.Marker({
// icon:icon,
content:content,
size:new AMap.Size(36,36),
offset: new AMap.Pixel(0,0),
anchor:'bottom-center',
position: [e.longitude, e.latitude],
extData: e
})
// 信息窗(会有部分点无法展示展示窗的bug)
// let infoWindow = new AMap.InfoWindow({
// offset: new AMap.Pixel(0, -36),
// })
let infoWindowObj = e
if (infoWindowObj.trafficState == '1') {
infoWindowObj.trafficState = '畅通'
} else if (infoWindowObj.trafficState == '2') {
infoWindowObj.trafficState = '缓行'
} else if (infoWindowObj.trafficState == '3') {
infoWindowObj.trafficState = '拥堵'
} else if (infoWindowObj.trafficState == '4') {
infoWindowObj.trafficState = '严重拥堵'
}
// 易购事件与事件等级打点处理
if (infoWindowObj.alarmId) {
// 标记点的头部label,用于替代infoWindow
accidentMarker.setLabel({
direction:'top',
// offset: new AMap.Pixel(110,-100), //设置文本标注偏移量
content: `<div id='test${infoWindowObj.alarmId}' class='accidentLabel'><div class="roadOverviewMarkerDialog-title">${infoWindowObj.voiceInfo}</div>
<div class="roadOverviewMarkerDialog-content mt_10">时间:${infoWindowObj.createdAt}</div>
<div class="roadOverviewMarkerDialog-content mt_10">类型:${
infoWindowObj.alarmDesc == null ? '' : infoWindowObj.alarmDesc
}</div>
<div class="roadOverviewMarkerDialog-content mt_10">位置:${
infoWindowObj.locationDesc == null ? '' : infoWindowObj.locationDesc
}</div>
</div>`,
});
} else {
// 标记点的头部label,用于替代infoWindow
accidentMarker.setLabel({
direction:'top',
// offset: new AMap.Pixel(110,-100), //设置文本标注偏移量
content: `<div id='test${infoWindowObj.id}' class='accidentLabel'><div class="roadOverviewMarkerDialog-title">${infoWindowObj.name}</div>
<div class="roadOverviewMarkerDialog-content mt_10">时间:${infoWindowObj.eventTime}</div>
<div class="roadOverviewMarkerDialog-content mt_10">类型:${
infoWindowObj.categoryName == null ? '' : infoWindowObj.categoryName
}</div>
<div class="roadOverviewMarkerDialog-content mt_10">位置:${
infoWindowObj.locationDesc == null ? '' : infoWindowObj.locationDesc
}</div>
</div>`,
});
}
let top,left
let markerId = infoWindowObj.alarmId ? infoWindowObj.alarmId :infoWindowObj.id
// 鼠标移入
accidentMarker.on('mouseover', function (e) {
// 对label样式修改并进行展示
document.getElementById(`test${markerId}`).parentNode.style='display:block;position:absolute;top:-140px;left:-90px;'
top = document.getElementById(`test${markerId}`).parentNode.parentNode.style.top
left = document.getElementById(`test${markerId}`).parentNode.parentNode.style.left
document.getElementById(`test${markerId}`).parentNode.parentNode.style=`z-index:101;top:${top};left:${left}`
// 注册infoWindow内容并展示
// if(clusterInfoWindow){
// clusterInfoWindow.close()
// }
// let infoWindowContent = `<div ><div class="roadOverviewMarkerDialog-title">${infoWindowObj.name}</div>
// <div class="roadOverviewMarkerDialog-content mt_10">事件时间:${infoWindowObj.eventTime}</div>
// <div class="roadOverviewMarkerDialog-content mt_10">分 类:${
// infoWindowObj.categoryName == null ? '' : infoWindowObj.categoryName
// }</div>
// <div class="roadOverviewMarkerDialog-content mt_10">桩 号:${
// infoWindowObj.chaiageNum == null ? '' : infoWindowObj.chaiageNum
// }</div>
// <div class="roadOverviewMarkerDialog-content mt_10">交通状况:${infoWindowObj.trafficState}</div>
// </div>`
// console.log('进入',GDMap,infoWindowContent,e.target.getPosition());
// infoWindow.setContent(infoWindowContent)
// infoWindow.open(GDMap, e.target.getPosition())
})
// 鼠标移出
accidentMarker.on('mouseout', function (e) {
// 隐藏label
document.getElementById(`test${markerId}`).parentNode.style='display:none'
document.getElementById(`test${markerId}`).parentNode.parentNode.style=`z-index:100;top:${top};left:${left}`
// 关闭infoWindow
// infoWindow.close(GDMap, accidentMarker.getPosition())
})
// 易购事件与事件等级点击跳转事件详情
if (infoWindowObj.alarmId) {
accidentMarker.on('click', function (e) {
toYiGouEventDetailsFn(accidentMarker.getExtData())
})
} else {
accidentMarker.on('click', function (e) {
if(clusterInfoWindow){
clusterInfoWindow.close()
}
toEventDetailsFn(accidentMarker.getExtData())
})
}
if (e.levelOrStatus == 1) {
accidentMarkerArr1.push(accidentMarker)
} else if (e.levelOrStatus == 2) {
accidentMarkerArr2.push(accidentMarker)
} else if (e.levelOrStatus == 3) {
accidentMarkerArr3.push(accidentMarker)
} else if (e.levelOrStatus == 4) {
accidentMarkerArr4.push(accidentMarker)
} else if (e.levelOrStatus == 5) {
accidentMarkerArr5.push(accidentMarker)
} else if (e.levelOrStatus == 6) {
accidentMarkerArr6.push(accidentMarker)
} else if (e.levelOrStatus == 10) {
accidentMarkerArr10.push(accidentMarker)
}
// 处理ws推送过来新增的点
if (marker === 'addWebSocketMarker') {
mapObj.userCoverView.forEach((item) => {
if (item.value === '1') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[0] = true
} else {
mapObj.levelIdCheckedArr[0] = false
}
}
if(item.value === '2') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[1] = true
} else {
mapObj.levelIdCheckedArr[1] = false
}
}
if (item.value === '3') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[2] = true
} else {
mapObj.levelIdCheckedArr[2] = false
}
}
if (item.value === '4') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[3] = true
} else {
mapObj.levelIdCheckedArr[3] = false
}
}
if (item.value === '5') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[4] = true
} else {
mapObj.levelIdCheckedArr[4] = false
}
}
if (item.value === '6') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[5] = true
} else {
mapObj.levelIdCheckedArr[5] = false
}
}
if (item.value === '10') {
if (item.checked === '1') {
mapObj.levelIdCheckedArr[6] = true
} else {
mapObj.levelIdCheckedArr[6] = false
}
}
})
if (e.levelOrStatus === '1' && mapObj.levelIdCheckedArr[0]) {
GDMap.add(accidentMarker)
eventMarkerClusterer1.addMarker(accidentMarker)
}
if (e.levelOrStatus === '2' && mapObj.levelIdCheckedArr[1]) {
GDMap.add(accidentMarker)
eventMarkerClusterer2.addMarker(accidentMarker)
}
if (e.levelOrStatus === '3' && mapObj.levelIdCheckedArr[2]) {
GDMap.add(accidentMarker)
eventMarkerClusterer3.addMarker(accidentMarker)
}
if (e.levelOrStatus === '4' && mapObj.levelIdCheckedArr[3]) {
GDMap.add(accidentMarker)
eventMarkerClusterer4.addMarker(accidentMarker)
}
if (e.levelOrStatus === '5' && mapObj.levelIdCheckedArr[4]) {
GDMap.add(accidentMarker)
eventMarkerClusterer5.addMarker(accidentMarker)
}
if (e.levelOrStatus === '6' && mapObj.levelIdCheckedArr[5]) {
GDMap.add(accidentMarker)
eventMarkerClusterer6.addMarker(accidentMarker)
}
if (e.levelOrStatus === '10' && mapObj.levelIdCheckedArr[6]) {
GDMap.add(accidentMarker)
eventMarkerClusterer10.addMarker(accidentMarker)
}
}
}
})
if (marker === 'default') {
GDMap.add(accidentMarkerArr1)
GDMap.add(accidentMarkerArr2)
GDMap.add(accidentMarkerArr3)
GDMap.add(accidentMarkerArr4)
GDMap.add(accidentMarkerArr5)
GDMap.add(accidentMarkerArr6)
GDMap.add(accidentMarkerArr10)
// 点击事件点聚合功能
addCluster(accidentMarkerArr1, 'levelId', 1)
addCluster(accidentMarkerArr2, 'levelId', 2)
addCluster(accidentMarkerArr3, 'levelId', 3)
addCluster(accidentMarkerArr4, 'levelId', 4)
addCluster(accidentMarkerArr5, 'levelId', 5)
addCluster(accidentMarkerArr6, 'levelId', 6)
addCluster(accidentMarkerArr10, 'levelId', 10)
}
}
}
// 地图资源设备打点
const drawRoadOverviewMarkerFn = (data, type) => {
if (data.length > 0) {
// 每次打点初始化数据,并且都需要清除点聚合对象
if (mapDetailObj.mapIconArr11.length !== 0 && !mapObj.isRightPurpleIcon3Boole) {
mapDetailObj.mapIconArr11 = []
}
if (mapDetailObj.mapIconArr9.length !== 0 && !mapObj.isRightPurpleIcon1Boole) {
mapDetailObj.mapIconArr9 = []
}
if (rescueCarClusterer && !mapObj.isRightPurpleIcon3Boole) {
GDMap.remove(rescueCarClusterer)
rescueCarClusterer = null
}
if (roadCarClusterer && !mapObj.isRightPurpleIcon1Boole) {
GDMap.remove(roadCarClusterer)
roadCarClusterer = null
}
if (mapDetailObj.mapIconArr10.length !== 0 && !mapObj.isRightPurpleIcon2Boole) {
mapDetailObj.mapIconArr10 = []
}
if (personMarkerClusterer && !mapObj.isRightPurpleIcon2Boole) {
GDMap.remove(personMarkerClusterer)
personMarkerClusterer = null
}
data.forEach((e, i) => {
if (e.longitude && e.latitude) {
let size = new AMap.Size(36,36)
let icon = new AMap.Icon({
image:e.birdgeName != undefined
? mapIconList.value[0]
: e.tollGateName != undefined
? mapIconList.value[1]
: e.serviceAreaName != undefined
? mapIconList.value[2]
: e.tunnelName != undefined
? mapIconList.value[3]
: e.cameraName != undefined
? mapIconList.value[4]
: e.portalName != undefined
? mapIconList.value[5]
: e.vmsName != undefined
? mapIconList.value[6]
: e.chainageName != undefined
? mapIconList.value[7]
: e.jobType === '路政'
? mapIconList.value[8]
: e.realName != undefined
? mapIconList.value[9]
: e.jobType === '拯救'
? mapIconList.value[10]
: '', // Icon的图像
imageSize: size, // 根据所设置的大小拉伸或压缩图片
imageOffset:new AMap.Pixel(0,0),
})
let name = e.birdgeName != undefined
? e.birdgeName
: e.tollGateName != undefined
? e.tollGateName
: e.serviceAreaName != undefined
? e.serviceAreaName
: e.tunnelName != undefined
? e.tunnelName
: e.cameraName != undefined
? e.cameraName
: e.portalName != undefined
? e.portalName
: e.vmsName != undefined
? e.vmsName
: e.chainageName != undefined
? e.chainageName:''
if (e.jobType === '路政'){
let content = `<div class="markerBox">
<img src="${e.accState == '熄火' ? mapIconList.value[11] : mapIconList.value[8]}" class="markerImage"/>
</div>`
mapDetailObj.roadOverviewMarker = new AMap.Marker({
content: content,
position: [e.longitude, e.latitude],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(-20,-40),
// anchor:'bottom-center',
zIndex: 10,
extData: e,
})
// 10秒刷新获取路政接口轨迹动画,lineArrLength等于4则经纬度有变化
const lineArr = mapDetailObj.roadOverviewMarker.De.extData.lineArr
const lineArrLength = getTwoArrNum(mapDetailObj.roadOverviewMarker.De.extData.lineArr)
if (lineArrLength === 4) {
console.log('路政:有经纬度变化')
const marker = new AMap.Marker({
content: content,
position: lineArr[0],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(-20,-40),
zIndex: 10,
extData: e,
})
mapDetailObj.roadLineMarkerArr.push(marker)
GDMap.add(marker)
// 移动资源点并删除旧的坐标点
mapDetailObj.roadOverviewMarker.moveAlong(mapDetailObj.roadOverviewMarker.De.extData.lineArr, 1000)
mapObj.roadCarData.forEach(item => {
if (item.code === mapDetailObj.roadOverviewMarker.De.extData.code) {
item.lineArr = [item.lnglat]
}
})
// 每次打完资源点需要设置数据到缓存区中,便于下次对比经纬度进行轨迹动画
sessionStorage.setItem('roadCarData', JSON.stringify(mapObj.roadCarData))
}
} else if (e.realName != undefined) {
let content = `<div class="markerBox">
<img src="${mapIconList.value[9]}" class="markerImage"/>
</div>`
// let content = `<div class="personnel-map-box pr"><span class="personnel-map-box-item pa">${e.realName}</span></div>`
mapDetailObj.roadOverviewMarker = new AMap.Marker({
content: content,
position: [e.longitude, e.latitude],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(-20,-40),
// anchor:'bottom-center',
zIndex: 10,
extData: e,
})
// 10秒刷新获取人员接口轨迹动画,lineArrLength等于4则经纬度有变化
const lineArr = mapDetailObj.roadOverviewMarker.De.extData.lineArr
const lineArrLength = getTwoArrNum(mapDetailObj.roadOverviewMarker.De.extData.lineArr)
if (lineArrLength === 4) {
console.log('人员:有经纬度变化')
const marker = new AMap.Marker({
content: content,
position: lineArr[0],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(-20,-40),
zIndex: 10,
extData: e,
})
mapDetailObj.personnelMarkerArr.push(marker)
GDMap.add(marker)
// 移动资源点并删除旧的坐标点
mapDetailObj.roadOverviewMarker.moveAlong(mapDetailObj.roadOverviewMarker.De.extData.lineArr, 1000)
mapObj.personnelData.forEach(item => {
if (item.realName === mapDetailObj.roadOverviewMarker.De.extData.realName) {
item.lineArr = [item.lnglat]
}
})
// 每次打完资源点需要设置数据到缓存区中,便于下次对比经纬度进行轨迹动画
sessionStorage.setItem('personnelData', JSON.stringify(mapObj.personnelData))
}
} else if (e.jobType === '拯救'){
let content = `<div class="markerBox">
<img src="${e.accState == '熄火' ? mapIconList.value[12] : mapIconList.value[10]}" class="markerImage"/>
</div>`
mapDetailObj.roadOverviewMarker = new AMap.Marker({
content: content,
position: [e.longitude, e.latitude],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(-20,-40),
// anchor:'bottom-center',
zIndex: 10,
extData: e,
})
// 10秒刷新获取救援车接口轨迹动画,lineArrLength等于4则经纬度有变化
const lineArr = mapDetailObj.roadOverviewMarker.De.extData.lineArr
const lineArrLength = getTwoArrNum(mapDetailObj.roadOverviewMarker.De.extData.lineArr)
if (lineArrLength === 4) {
console.log('救援车:有经纬度变化')
const marker = new AMap.Marker({
content: content,
position: lineArr[0],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(-20,-40),
zIndex: 10,
extData: e,
})
mapDetailObj.rescueLineMarkerArr.push(marker)
GDMap.add(marker)
// 移动资源点并删除旧的坐标点
mapDetailObj.roadOverviewMarker.moveAlong(mapDetailObj.roadOverviewMarker.De.extData.lineArr, 1000)
mapObj.rescueCarData.forEach(item => {
if (item.code === mapDetailObj.roadOverviewMarker.De.extData.code) {
item.lineArr = [item.lnglat]
}
})
// 每次打完资源点需要设置数据到缓存区中,便于下次对比经纬度进行轨迹动画
sessionStorage.setItem('rescueCarData', JSON.stringify(mapObj.rescueCarData))
}
} else {
mapDetailObj.roadOverviewMarker = new AMap.Marker({
icon: icon,
position: [e.longitude, e.latitude],
size:new AMap.Size(36,36),
offset: new AMap.Pixel(0,0),
anchor:'bottom-center',
zIndex: 10,
extData: e,
})
}
let labelObj = e
let labelContent = ''
if (labelObj.realName != undefined) {
labelContent = `<div class="theLabel ${changeLabel(labelObj.realName)}">
<div class="roadOverviewMarkerDialog-content">${labelObj.realName}</div>
</div>`
} else if (labelObj.jobType === '路政' || labelObj.jobType === '拯救') {
labelContent = `<div class="${changeLabel(labelObj.code)} theLabel">
<div class="roadOverviewMarkerDialog-content">${labelObj.code}</div>
</div>`
} else{
labelContent = `<div class="theLabel"><div class="roadOverviewMarkerDialog-content">${name}</div>
</div>`
}
mapDetailObj.roadOverviewMarker.setLabel({
offset: new AMap.Pixel(0, 0), //设置文本标注偏移量
content: labelContent, //设置文本标注内容
direction: 'top', //设置文本标注方位
});
let infoWindow = new AMap.InfoWindow({ offset: new AMap.Pixel(0, -36) })
let infoWindowObj = e
mapDetailObj.roadOverviewMarker.on('mouseover', function (e) {
let infoWindowContent = ''
if (infoWindowObj.realName != undefined) {
infoWindowContent = `<div>
<div class="roadOverviewMarkerDialog-content">部门:${infoWindowObj.orgName}</div>
<div class="roadOverviewMarkerDialog-content mt_6">姓名:${infoWindowObj.realName}</div>
<div class="roadOverviewMarkerDialog-content mt_6">状态:${infoWindowObj.workStatus_dictText}</div>
<div class="roadOverviewMarkerDialog-content mt_6">电话:${infoWindowObj.phone}</div>
</div>`
}else if (infoWindowObj.jobType === '路政' || infoWindowObj.jobType === '拯救') {
infoWindowContent = `<div>
<div class="roadOverviewMarkerDialog-content">车牌号:${infoWindowObj.vlp}</div>
<div class="roadOverviewMarkerDialog-content mt_6">车辆编号:${infoWindowObj.code}</div>
<div class="roadOverviewMarkerDialog-content mt_6">类型:${infoWindowObj.jobType}</div>
<div class="roadOverviewMarkerDialog-content mt_6">状态:${infoWindowObj.state === 'dispose' ? '忙碌': '空闲'}</div>
<div class="roadOverviewMarkerDialog-content mt_6">方向:${infoWindowObj.direction}</div>
<div class="roadOverviewMarkerDialog-content mt_6">绑定人员:${infoWindowObj.curentUserName || ''}</div>
<div class="roadOverviewMarkerDialog-content mt_6">GPS时间:${infoWindowObj.gpsTime || ''}</div>
<div class="roadOverviewMarkerDialog-content mt_6">acc状态:${infoWindowObj.accState == '点火' ? '点火' : infoWindowObj.accState == '熄火' ? '熄火' : '暂无车辆状态'}</div>
</div>`
}else{
infoWindowContent = `<div ><div class="roadOverviewMarkerDialog-title">${name}</div>
</div>`
}
infoWindow.setContent(infoWindowContent)
infoWindow.open(GDMap, e.target.getPosition())
})
mapDetailObj.roadOverviewMarker.on('mouseout', function (e) {
infoWindow.close(GDMap, mapDetailObj.roadOverviewMarker.getPosition())
})
mapDetailObj.roadOverviewMarker.on('click', (e) => {
const extData = e.target.getExtData()
////console.log('extData:', extData)
if (extData.chainageName != undefined) {
yiGouObj.isMileageDetailShow = true
yiGouObj.mileageId = extData.chainageCode
////console.log('chainageCode:', yiGouObj.mileageId)
} else if (extData.vmsName != undefined) {
yiGouObj.isInfoDetailShow = true
yiGouObj.infoId = extData.vmsCode
} else if (extData.portalName != undefined) {
yiGouObj.isGantryDetailsShow = true
yiGouObj.gantryId = extData.portalCode
} else if (extData.cameraName != undefined) {
yiGouObj.isVideoWindowShow = true
yiGouObj.cameraNum = extData.cameraCode
}
})
GDMap.add(mapDetailObj.roadOverviewMarker)
if (e.birdgeName != undefined) {
mapDetailObj.mapIconArr1.push(mapDetailObj.roadOverviewMarker)
} else if (e.tollGateName != undefined) {
mapDetailObj.mapIconArr2.push(mapDetailObj.roadOverviewMarker)
} else if (e.serviceAreaName != undefined) {
mapDetailObj.mapIconArr3.push(mapDetailObj.roadOverviewMarker)
} else if (e.tunnelName != undefined) {
mapDetailObj.mapIconArr4.push(mapDetailObj.roadOverviewMarker)
} else if (e.cameraName != undefined) {
mapDetailObj.mapIconArr5.push(mapDetailObj.roadOverviewMarker)
} else if (e.portalName != undefined) {
mapDetailObj.mapIconArr6.push(mapDetailObj.roadOverviewMarker)
} else if (e.vmsName != undefined) {
mapDetailObj.mapIconArr7.push(mapDetailObj.roadOverviewMarker)
} else if (e.chainageName != undefined) {
mapDetailObj.mapIconArr8.push(mapDetailObj.roadOverviewMarker)
} else if (e.jobType === '路政') {
mapDetailObj.mapIconArr9.push(mapDetailObj.roadOverviewMarker)
} else if (e.realName != undefined) {
mapDetailObj.mapIconArr10.push(mapDetailObj.roadOverviewMarker)
} else if (e.jobType === '拯救') {
mapDetailObj.mapIconArr11.push(mapDetailObj.roadOverviewMarker)
}
}
})
if (type == 'gateInfo') {
let middleIndex = Math.ceil(data.length / 2)
GDMap.setCenter([data[middleIndex].longitude, data[middleIndex].latitude])
// GDMap.setZoom(10.36)
GDMap.setZoom(11.97)
}
// 点击路政车聚合功能
if (type === 9) {
// addCluster(mapDetailObj.mapIconArr9, 'roadCar')
}
// 点击人员点聚合功能
if (type === 10) {
// addCluster(mapDetailObj.mapIconArr10, 'person')
}
// 点击救援车聚合功能
if (type === 11) {
// addCluster(mapDetailObj.mapIconArr11, 'rescueCar')
}
}
}
// 点击资源设备分段打点
const getPartDrawMarker = (resourceData, type) => {
let resourceDataLength = parseInt(resourceData.length / 100)
for (let i=0;i < resourceDataLength;i++) {
let resourceTimer = setTimeout(() => {
drawRoadOverviewMarkerFn(resourceData.slice(i * 100, (i + 1) * 100), type)
}, 200)
resourceTimerArr.push(resourceTimer)
}
drawRoadOverviewMarkerFn(resourceData.slice(resourceDataLength * 100, resourceData.length), type)
}
// 清除资源设备分段打点定时器
const clearPartDrawMarkerTimer = () => {
if (resourceTimerArr.length !== 0) {
resourceTimerArr.forEach(item =>{
clearTimeout(item)
})
resourceTimerArr = []
}
}
// 桥梁
const bridgeClick = () => {
mapObj.isRightBuleIcon1Boole = !mapObj.isRightBuleIcon1Boole
////console.log('isRightBuleIcon1Boole:', mapObj.isRightBuleIcon1Boole)
if (mapObj.isRightBuleIcon1Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.informationArr1)
} else {
GDMap.remove(mapDetailObj.mapIconArr1)
}
}
// 收费站
const rightBlueIcon2Click = () => {
mapObj.isRightBuleIcon2Boole = !mapObj.isRightBuleIcon2Boole
if (mapObj.isRightBuleIcon2Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.informationArr2)
} else {
GDMap.remove(mapDetailObj.mapIconArr2)
}
}
// 服务区
const rightBlueIcon3Click = () => {
mapObj.isRightBuleIcon3Boole = !mapObj.isRightBuleIcon3Boole
if (mapObj.isRightBuleIcon3Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.informationArr3)
} else {
GDMap.remove(mapDetailObj.mapIconArr3)
}
}
// 隧道
const rightBlueIcon4Click = () => {
mapObj.isRightBuleIcon4Boole = !mapObj.isRightBuleIcon4Boole
if (mapObj.isRightBuleIcon4Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.informationArr4)
} else {
GDMap.remove(mapDetailObj.mapIconArr4)
}
}
// 摄像枪
const rightGreenIcon1Click = () => {
mapObj.isRightGreenIcon1Boole = !mapObj.isRightGreenIcon1Boole
if (mapObj.isRightGreenIcon1Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.equipmentArr1)
} else {
GDMap.remove(mapDetailObj.mapIconArr5)
}
}
// 门架
const rightGreenIcon2Click = () => {
mapObj.isRightGreenIcon2Boole = !mapObj.isRightGreenIcon2Boole
if (mapObj.isRightGreenIcon2Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.equipmentArr2)
} else {
GDMap.remove(mapDetailObj.mapIconArr6)
}
}
// 情报板
const rightGreenIcon3Click = () => {
mapObj.isRightGreenIcon3Boole = !mapObj.isRightGreenIcon3Boole
if (mapObj.isRightGreenIcon3Boole == true) {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.equipmentArr3)
} else {
GDMap.remove(mapDetailObj.mapIconArr7)
}
}
// 里程桩
const rightGreenIcon4Click = () => {
mapObj.isRightGreenIcon4Boole = !mapObj.isRightGreenIcon4Boole
if (mapObj.isRightGreenIcon4Boole == true) {
// drawRoadOverviewMarkerFn(mapObj.equipmentArr4)
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.equipmentArr4)
} else {
GDMap.remove(mapDetailObj.mapIconArr8)
}
}
// 救援车
const rescueCarClick = () => {
mapObj.isRightPurpleIcon3Boole = !mapObj.isRightPurpleIcon3Boole
if (mapObj.isRightPurpleIcon3Boole == true) {
getRescueCarListApiFn() // 地图增加救援车定位信息
} else {
clearRescueCarData()
}
}
// 路政车
const roadCarClick = () => {
mapObj.isRightPurpleIcon1Boole = !mapObj.isRightPurpleIcon1Boole
if (mapObj.isRightPurpleIcon1Boole == true) {
getRoadCarListApiFn() // 地图增加路政车定位信息
} else {
clearRoadCarData()
}
}
// 人员
const personnelClick = () => {
mapObj.isRightPurpleIcon2Boole = !mapObj.isRightPurpleIcon2Boole
if (mapObj.isRightPurpleIcon2Boole == true) {
getOperatorLocationListApiFn() // 获取app人员定位信息
} else {
clearPersonnelData()
}
}
// 跳转到事件详情页面
const toEventDetailsFn = (item, index) => {
if(!props.isVisualization) {
console.log('item', item)
// 事件状态为已知、执勤/作业、消散、误报点击列表和打点跳回告警弹窗
if ([5, 6, 7, 8, 9, -1, 11].includes(item.status)) {
let paramas = item.id
if (item.status === 5 && item.rescueNumber !== null) {
paramas = item.rescueNumber
}
getYiGouEventDataApi(paramas).then((data) => {
if (data.code == 200 && data.result !== null) {
const eventData = data.result
toYiGouEventDetailsFn(eventData)
} else {
message.warning('告警弹窗数据对象为空')
}
}).catch((error) => {
console.log('error', error)
})
return
}
setStorage("isClickMenu", true);
setStorage("isClickEvent", true);
let menuTba = store.state.menuTba.length === 1 ? store.state.menuTba : getStorage('tabMenuDatas').Panes
let eventDetailRoute = {
key: menuTba.length + 1,
title: item.name,
id: item.id,
path: `/scheduling-page/eventDetails2?eventId=${item.id}&name=${item.name}`,
i: 'a',
index: 0
}
let isCun = false
// 删除所有的activeKey
menuTba.forEach((item) => {
delete item.activeKey
})
menuTba.forEach((menuItem, menuIndex) => {
delete menuItem.activeKey
if (item.id === menuItem.id) {
eventDetailRoute.key = menuIndex + 1
eventDetailRoute['activeKey'] = menuIndex + 1
setStorage("eventActiveKey", menuIndex + 1)
menuTba.splice(menuIndex, 1)
isCun = true
}
})
if (isCun) {
menuTba.splice(eventDetailRoute.key - 1, 0, eventDetailRoute)
} else {
menuTba.push(eventDetailRoute)
}
router.push(eventDetailRoute.path);
store.dispatch("setMenuTba", menuTba)
} else {
// 大屏打开事件详情
emit("eventDetailsData", {id:item.id,name:item.name});
}
}
// 跳转到告警弹窗的事件详情页面
const toYiGouEventDetailsFn = (item) => {
let detail = JSON.parse(JSON.stringify(item))
console.log('detail', detail)
window.openEventDetailBySourceData(detail)
}
// 事件列表搜索
const inputSearchFn = (e) => {
eventPageNo.value = 1
mapObj.eventList = []
queryConfirmedEventApiFn()
}
const inputChangeFn = (e) => {
////console.log('inputChangeFn-e:', e.target.value)
mapObj.inputSearchValue = e.target.value
}
//根据路段画线路
const _drawPolylineFn = (tmcs, type) => { //画地图线路
// console.log('触发了多次?');
// let tmcsLength = 0
// tmcsLength = tmcs.length
let colorArr = ['#04D099', '#FFCC00', '#FF0033', '#660033']
// pathArr = []
if (tmcs.length > 0) {
// tmcs.forEach(item => {
// item.forEach((el,index) =>{
// let polylineColor =
// el.tmc_status == '畅通'
// ? colorArr[0]
// : el.tmc_status == '缓行'
// ? colorArr[1]
// : el.tmc_status == '拥堵'
// ? colorArr[2]
// : el.tmc_status == '严重拥堵'
// ? colorArr[3]
// : colorArr[0]
// if (el.tmc_polyline_arr.length > 0) {
// let polyline = new AMap.Polyline({
// path: el.tmc_polyline_arr,
// borderWeight: 2, // 描边的宽度,默认为1
// strokeWeight: 5, // 线条宽度
// strokeColor: polylineColor, // 线条颜色
// lineJoin: 'round', // 折线拐点连接处样式
// lineCap: 'round', //圆头
// isOutline: true, // 线条是否带描边
// outlineColor: polylineColor, //线条描边颜色
// zIndex: 10,
// })
// mapObj.polylineArr.push(polyline)
// }
// })
// });
// GDMap.add(mapObj.polylineArr)
for (let i = 0; i < tmcs.length; i++) {
let polylineColor =
tmcs[i].tmc_status == '畅通'
? colorArr[0]
: tmcs[i].tmc_status == '缓行'
? colorArr[1]
: tmcs[i].tmc_status == '拥堵'
? colorArr[2]
: tmcs[i].tmc_status == '严重拥堵'
? colorArr[3]
: colorArr[0]
if (tmcs[i].tmc_polyline_arr.length > 0) {
var polyline = new AMap.Polyline({
path: tmcs[i].tmc_polyline_arr,
borderWeight: 2, // 描边的宽度,默认为1
strokeWeight: 5, // 线条宽度
strokeColor: polylineColor, // 线条颜色
lineJoin: 'round', // 折线拐点连接处样式
lineCap: 'round', //圆头
isOutline: true, // 线条是否带描边
outlineColor: polylineColor, //线条描边颜色
zIndex: 10,
strokeOpacity: 0.3
})
mapDetailObj.polylineArr.push(polyline)
GDMap.add(mapDetailObj.polylineArr)
}
}
type++
let loopFnTimer = setTimeout(function () {
_loopFn(mapObj.mapLineData[`${type}`], type) //分段渲染 先渲染一部分 避免数据量过大 导致地图卡顿
if (type === mapObj.mapLineData.length) {
loopFnTimerArr.forEach((item) => {
clearTimeout(item)
})
loopFnTimerArr = []
}
}, 200)
loopFnTimerArr.push(loopFnTimer)
}
}
function _loopFn(lineRoadData, type) {
if (type < mapObj.mapLineData.length) {
_drawPolylineFn(lineRoadData, type)
}
}
// 默认所有机构的sysOrgCode
let sysOrgCode = store.state.userInfo.orgBeanList.map((item) => {
return item.orgCode
}).join(',')
// 如果大屏多机构默认选第一个
if(props.isVisualization){
sysOrgCode = props.sysCodeVal
console.log(props.sysCodeVal);
}
// 监听大屏机构变化
watch(() => props.sysCodeVal,(val,old)=>{
sysOrgCode = val
// 获取地图编码、打点数据、事件列表数据
reFreshEventList()
// 每次更换机构重新获取路线数据
getSectionInfoApiFn()
// 清除上一个定时器重新5分钟刷新一次路线接口
circulateSection()
})
// 1.1.协同调度平台-获取地图信息 画线路
const getSectionInfoApiFn = () => {
getSectionInfoApi({ sysOrgCode: sysOrgCode }).then(
(data) => {
// console.log('getSectionInfoApi-data:', data)
let result = data.result
if (data.code == 200) {
// 初始化路线数据
if (mapDetailObj.polylineArr.length !== 0) {
GDMap.remove(mapDetailObj.polylineArr)
mapDetailObj.polylineArr = []
}
// mapObj.mapLineData = result.tmcs
// mapObj.mapLineData = sliceArrFn(result.tmcs,100)
mapObj.mapLineData = result.tmcsList
if (mapObj.mapLineData.length > 0) {//画线路
_loopFn(mapObj.mapLineData[0], 0)
}
////console.log('mapObj.mapLineData:', mapObj.mapLineData)
// 设置中心点
mapObj.centerPoint = data.result.centerPoint
GDMap.setCenter(data.result.centerPoint)
// 设置zoom值
mapObj.maxDistance = data.result.maxDistance
getZoom(data.result.maxDistance, GDMap)
// GDMap.setZoom(11)
} else {
}
},
(error) => {
console.log('error', error)
}
)
}
// 1.3.协同调度平台-确认事件
const confirmEventApiFn = (id) => {
let parameter = {
id: id,
}
confirmEventApi(parameter).then((data) => {
////console.log('confirmEventApiFn-data:', data)
let result = data.result
})
}
// 1.4.协同调度平台-获取已确认事件信息
const queryConfirmedEventApiFn = (pageNo,pageSize) => {
let parameter = {
highwayCode: mapObj.sectionIdArr,
orgCode: sysOrgCode,
name: mapObj.inputSearchValue,
eventStatus: mapObj.eventStatus,
// pageNo: eventPageNo.value,
// pageSize: 20,
pageNo: mapObj.isWebsockSign ? 1 : eventPageNo.value,
pageSize: mapObj.isWebsockSign ? eventPageNo.value * 20 : 20,
}
queryConfirmedEventApi(parameter).then((data) => {
// console.log('queryConfirmedEventApiFn-data:',data)
if (data.code == 200) {
let result = data.result
console.log('mapObj.isWebsockSign', mapObj.isWebsockSign)
if (!mapObj.isWebsockSign) {
mapObj.eventList = [...mapObj.eventList, ...result.records]
eventTotal.value = result.total
} else {
// 查看当前状态下
mapObj.newEventList = result.records
if (eventPageNo.value > Math.ceil(result.total / 20)) {
eventPageNo.value = Math.ceil(result.total / 20)
}
console.log('eventPageNo.value', eventPageNo.value)
let flag = true
// 判断事件列表数据是否有变化,有则flag为false并重新渲染列表
flag = compareArr(mapObj.eventList, mapObj.newEventList)
console.log('flag', flag)
if (!flag) {
mapObj.eventList = mapObj.newEventList
}
// 事件相同id的需要替换右上角消息总数
mapObj.eventList.forEach(oldItem => {
mapObj.newEventList.forEach(newItem => {
if (oldItem.id === newItem.id) {
oldItem.unreadMessage = newItem.unreadMessage
}
})
})
mapObj.isWebsockSign = false
}
nextTick(()=> {
// 获取水平移动的标签的长度
let doms = document.getElementsByClassName("isLevelMove")
mapObj.eventList.map((item,index)=>{
item.isMove = doms?doms[index]?.offsetWidth : 0
})
})
}
})
}
// 1.5.协同调度平台-统计事件信息
const queryEventInfoV2ApiFn = () => {
// 新版首页获取打点数据
queryEventInfoV2Api(mapObj.sectionIdArr).then((data) => {
if (data.code == 200) {
mapObj.eventLeveloOrStatusList = data.result.eventLeveloOrStatusList
// console.log('mapObj.eventLeveloOrStatusList', mapObj.eventLeveloOrStatusList)
handleEventLeveloOrStatusList()
} else {
message.warning(data.message)
}
}).catch((error) => {
console.log('error', error)
})
}
// 1.6.协同调度平台-获取信息资源基础信息(地图打点)
const getInfoApiFn = () => {
let parameter = {
highwayCode: mapObj.sectionIdArr,
orgCode: sysOrgCode,
}
getInfoApi(parameter).then((data) => {
////console.log('getInfoApiFn-data:', data)
if (data.code == 200) {
let result = data.result
mapObj.informationArr1 = result.bridgeInfo //桥梁
mapObj.informationArr2 = result.gateInfo //收费站
mapObj.informationArr3 = result.serviceAreaInfo //服务区
mapObj.informationArr4 = result.tunnelInfo //隧道
}
})
}
// 1.7.协同调度平台-获取设施设备基础信息
const getFacilitiesApiFn = () => {
let parameter = {
highwayCode: mapObj.sectionIdArr,
orgCode: sysOrgCode,
}
getFacilitiesApi(parameter).then((data) => {
////console.log('getFacilitiesApiFn-data:', data)
if (data.code == 200) {
let result = data.result
mapObj.equipmentArr1 = result.cameraInfo //摄像枪
mapObj.equipmentArr2 = result.portalInfo //门架
mapObj.equipmentArr3 = result.vmsInfo //情报板
mapObj.equipmentArr4 = result.chainageInfo //里程桩
}
})
}
// 地图增加app人员定位信息
let personnelTimer = ref(null)
const getOperatorLocationListApiFn = (type) => {
// let parameter = {
// highwayCode: mapObj.sectionIdArr,
// orgCode: sysOrgCode
// }
getOperatorLocationListApi({sysOrgCode:sysOrgCode}).then((data) => {
////console.log('getOperatorLocationListApiFn-data:', data)
if (data.code == 200) {
let result = data.result.records
if(result.length > 0){
result.map(item=>{
item.lnglat = [item.lng,item.lat]
})
mapObj.personnelData = result.filter(x=>x.realName) // 人员
// 遍历人员数据,统一经纬度字段
const personnelData = JSON.parse(sessionStorage.getItem('personnelData')) ? JSON.parse(sessionStorage.getItem('personnelData')) : []
// 判断是否经纬度有更新的数据
mapObj.personnelData.forEach(item => {
item.longitude = item.lng
item.latitude = item.lat
item.lineArr = [item.lnglat]
personnelData.forEach(oldItem => {
if (item.realName === oldItem.realName) {
if (item.lng !== oldItem.lng || item.lat !== oldItem.lat) {
item.lineArr = [oldItem.lnglat, item.lnglat]
// 每次进来都要检查数据中的数据是否有经纬度的变化,变化了则需要轨迹动画
mapDetailObj.mapIconArr10.forEach((markerItem, markerIndex) => {
if (markerItem.De.extData.realName == item.realName) {
GDMap.remove(mapDetailObj.mapIconArr10[markerIndex])
mapDetailObj.mapIconArr10[markerIndex].setMap(null)
mapDetailObj.mapIconArr10.splice(markerIndex, 1)
// 重新进行打点
clearPartDrawMarkerTimer()
getPartDrawMarker([item], 10)
}
})
}
}
})
})
// 10s轮询需要对比数据是否有发生变化
if (type === 'Polling') {
let oldCodeArr = []
let newCodeArr = []
personnelData.forEach(item => {
oldCodeArr.push(item.realName)
})
result.forEach(item => {
if (item.realName) {
newCodeArr.push(item.realName)
}
})
const changeCodeArr = compareArrChange(oldCodeArr, newCodeArr)
const addArr = changeCodeArr.add
const delArr = changeCodeArr.del
// 新获取的数组新增了数据,需要更新缓存及新增地图坐标点
if (addArr.length !== 0) {
result.forEach(item => {
addArr.forEach(addItem => {
if (item.realName == addItem) {
mapObj.personnelData.push(item)
clearPartDrawMarkerTimer()
getPartDrawMarker([item], 10)
}
})
})
}
// 新获取的数组少了删除数据,需要更新缓存及删除地图坐标点
if (delArr !== 0) {
mapObj.personnelData.forEach((item, index) => {
delArr.forEach(delItem => {
if (item.realName == delItem) {
// 地图上找出该点进行删除
mapDetailObj.mapIconArr10.forEach((markerItem, markerIndex) => {
if (markerItem.De.extData.realName == delItem) {
GDMap.remove(mapDetailObj.mapIconArr10[markerIndex])
mapDetailObj.mapIconArr10[markerIndex].setMap(null)
mapDetailObj.mapIconArr10.splice(markerIndex, 1)
}
})
mapObj.personnelData.splice(index, 1)
}
})
})
}
console.log('人员changeRealNameArr:', changeCodeArr)
} else {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.personnelData,10)
}
// 每次打完资源点需要设置数据到缓存区中,便于下次对比经纬度进行轨迹动画
sessionStorage.setItem('personnelData', JSON.stringify(mapObj.personnelData))
}
// 以防止接口请求过慢时用户取消了勾选数据还显示在页面上
clearPersonnelData()
// 旧数据人员有数据10秒刷新一次请求
if (personnelTimer.value !== null) {
clearTimeout(personnelTimer.value)
personnelTimer.value = null
}
personnelTimer.value = setTimeout(() => {
if (personMarkerClusterer && mapObj.isRightPurpleIcon2Boole) {
mapObj.personnelData = []
mapDetailObj.mapIconArr10 = []
GDMap.remove(personMarkerClusterer)
personMarkerClusterer = null
}
getOperatorLocationListApiFn('Polling') // 获取app人员定位信息
}, 10000)
}else{
mapObj.personnelData = []
}
}).catch((error) => {
console.log('error', error)
})
}
// 地图增加救援车定位信息
let rescueCarTimer = ref(null)
const getRescueCarListApiFn = (type) => {
getRescueCarListApi(sysOrgCode).then((data) => {
if (data.code == 200) {
let result = data.result
if(result.length > 0){
result.map(item=>{
item.lnglat = [item.lng,item.lat]
})
mapObj.rescueCarData = result.filter(x=>x.code) // 救援车
// 遍历救援车数据,统一经纬度字段
const rescueCarData = JSON.parse(sessionStorage.getItem('rescueCarData')) ? JSON.parse(sessionStorage.getItem('rescueCarData')) : []
// 判断是否经纬度有更新的数据
mapObj.rescueCarData.forEach(item => {
item.longitude = item.lng
item.latitude = item.lat
item.lineArr = [item.lnglat]
rescueCarData.forEach(oldItem => {
if (item.code === oldItem.code) {
// 每次进来都要检查数据中的数据是否有经纬度的变化,变化了则需要轨迹动画
if (item.lng !== oldItem.lng || item.lat !== oldItem.lat) {
item.lineArr = [oldItem.lnglat, item.lnglat]
mapDetailObj.mapIconArr11.forEach((markerItem, markerIndex) => {
if (markerItem.De.extData.code == item.code) {
GDMap.remove(mapDetailObj.mapIconArr11[markerIndex])
mapDetailObj.mapIconArr11[markerIndex].setMap(null)
mapDetailObj.mapIconArr11.splice(markerIndex, 1)
// 重新进行打点
clearPartDrawMarkerTimer()
getPartDrawMarker([item], 11)
}
})
}
}
})
})
// 10s轮询需要对比数据是否有发生变化
if (type === 'Polling') {
let oldCodeArr = []
let newCodeArr = []
rescueCarData.forEach(item => {
oldCodeArr.push(item.code)
})
result.forEach(item => {
if (item.code) {
newCodeArr.push(item.code)
}
})
const changeCodeArr = compareArrChange(oldCodeArr, newCodeArr)
const addArr = changeCodeArr.add
const delArr = changeCodeArr.del
// 新获取的数组新增了数据,需要更新缓存及新增地图坐标点
if (addArr.length !== 0) {
result.forEach(item => {
addArr.forEach(addItem => {
if (item.code == addItem) {
mapObj.rescueCarData.push(item)
clearPartDrawMarkerTimer()
getPartDrawMarker([item], 11)
}
})
})
}
// 新获取的数组少了删除数据,需要更新缓存及删除地图坐标点
if (delArr !== 0) {
mapObj.rescueCarData.forEach((item, index) => {
delArr.forEach(delItem => {
if (item.code == delItem) {
// 地图上找出该点进行删除
mapDetailObj.mapIconArr11.forEach((markerItem, markerIndex) => {
if (markerItem.De.extData.code == delItem) {
GDMap.remove(mapDetailObj.mapIconArr11[markerIndex])
mapDetailObj.mapIconArr11[markerIndex].setMap(null)
mapDetailObj.mapIconArr11.splice(markerIndex, 1)
}
})
mapObj.rescueCarData.splice(index, 1)
}
})
})
}
console.log('救援车changeCodeArr:', changeCodeArr)
} else {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.rescueCarData, 11)
}
// 每次打完资源点需要设置数据到缓存区中,便于下次对比经纬度进行轨迹动画
sessionStorage.setItem('rescueCarData', JSON.stringify(mapObj.rescueCarData))
}
// 以防止接口请求过慢时用户取消了勾选数据还显示在页面上
clearRescueCarData()
// 旧数据救援车有数据10秒刷新一次请求
if (rescueCarTimer.value !== null) {
clearTimeout(rescueCarTimer.value)
rescueCarTimer.value = null
}
rescueCarTimer.value = setTimeout(() => {
if (rescueCarClusterer && mapObj.isRightPurpleIcon3Boole) {
mapObj.rescueCarData = []
mapDetailObj.mapIconArr11 = []
GDMap.remove(rescueCarClusterer)
rescueCarClusterer = null
}
getRescueCarListApiFn('Polling') // 地图增加救援车定位信息
}, 10000)
}else{
mapObj.rescueCarData = []
}
}).catch((error) => {
console.log('error', error)
})
}
// 地图增加路政车定位信息
let roadCarTimer = ref(null)
const getRoadCarListApiFn = (type) => {
getRoadCarListApi(sysOrgCode).then((data) => {
if (data.code == 200) {
let result = data.result
if(result.length > 0){
result.map(item=>{
item.lnglat = [item.lng,item.lat]
})
mapObj.roadCarData = result.filter(x=>x.code) // 路政车
// 遍历路政车数据,统一经纬度字段
const roadCarData = JSON.parse(sessionStorage.getItem('roadCarData')) ? JSON.parse(sessionStorage.getItem('roadCarData')) : []
// 判断是否经纬度有更新的数据
mapObj.roadCarData.forEach(item => {
item.longitude = item.lng
item.latitude = item.lat
item.lineArr = [item.lnglat]
roadCarData.forEach(oldItem => {
if (item.code === oldItem.code) {
if (item.lng !== oldItem.lng || item.lat !== oldItem.lat) {
item.lineArr = [oldItem.lnglat, item.lnglat]
// 每次进来都要检查数据中的数据是否有经纬度的变化,变化了则需要轨迹动画
mapDetailObj.mapIconArr9.forEach((markerItem, markerIndex) => {
if (markerItem.De.extData.code == item.code) {
GDMap.remove(mapDetailObj.mapIconArr9[markerIndex])
mapDetailObj.mapIconArr9[markerIndex].setMap(null)
mapDetailObj.mapIconArr9.splice(markerIndex, 1)
// 重新进行打点
clearPartDrawMarkerTimer()
getPartDrawMarker([item], 9)
}
})
}
}
})
})
// 10s轮询需要对比数据是否有发生变化
if (type === 'Polling') {
let oldCodeArr = []
let newCodeArr = []
roadCarData.forEach(item => {
oldCodeArr.push(item.code)
})
result.forEach(item => {
if (item.code) {
newCodeArr.push(item.code)
}
})
const changeCodeArr = compareArrChange(oldCodeArr, newCodeArr)
const addArr = changeCodeArr.add
const delArr = changeCodeArr.del
// 新获取的数组新增了数据,需要更新缓存及新增地图坐标点
if (addArr.length !== 0) {
result.forEach(item => {
addArr.forEach(addItem => {
if (item.code == addItem) {
mapObj.roadCarData.push(item)
clearPartDrawMarkerTimer()
getPartDrawMarker([item], 9)
}
})
})
}
// 新获取的数组少了删除数据,需要更新缓存及删除地图坐标点
if (delArr !== 0) {
mapObj.roadCarData.forEach((item, index) => {
delArr.forEach(delItem => {
if (item.code == delItem) {
// 地图上找出该点进行删除
mapDetailObj.mapIconArr9.forEach((markerItem, markerIndex) => {
if (markerItem.De.extData.code == delItem) {
GDMap.remove(mapDetailObj.mapIconArr9[markerIndex])
mapDetailObj.mapIconArr9[markerIndex].setMap(null)
mapDetailObj.mapIconArr9.splice(markerIndex, 1)
}
})
mapObj.roadCarData.splice(index, 1)
}
})
})
}
console.log('路政车changeCodeArr:', changeCodeArr)
} else {
clearPartDrawMarkerTimer()
getPartDrawMarker(mapObj.roadCarData, 9)
}
// 每次打完资源点需要设置数据到缓存区中,便于下次对比经纬度进行轨迹动画
sessionStorage.setItem('roadCarData', JSON.stringify(mapObj.roadCarData))
}
// 以防止接口请求过慢时用户取消了勾选数据还显示在页面上
clearRoadCarData()
// 旧数据路政车有数据10秒刷新一次请求
if (roadCarTimer.value !== null) {
clearTimeout(roadCarTimer.value)
roadCarTimer.value = null
}
roadCarTimer.value = setTimeout(() => {
if (roadCarClusterer && mapObj.isRightPurpleIcon1Boole) {
mapObj.roadCarData = []
mapDetailObj.mapIconArr9 = []
GDMap.remove(roadCarClusterer)
roadCarClusterer = null
}
getRoadCarListApiFn('Polling') // 地图增加路政车定位信息
}, 10000)
}else{
mapObj.roadCarData = []
}
}).catch((error) => {
console.log('error', error)
})
}
// 1.15.协同调度平台-通过机构编码获取路段信息
const getHighwaySectionApiFn = async () => {
let parameter = {
sysOrgCode: sysOrgCode,
}
mapObj.sectionIdArr = []
const data = await getHighwaySectionApi(parameter)
// console.log('getHighwaySectionApiFn-data:', data)
let result = data.result
let sectionIdArr = []
if (data.code == 200) {
if (result && result.length > 0) {
result.forEach((e) => {
sectionIdArr.push(e.sectionId)
})
mapObj.sectionIdArr = sectionIdArr.join(',')
initMap() // 地图初始化
getFacilitiesApiFn() //获取(摄像枪等)设施设备信息
queryConfirmedEventApiFn() //获取已确认事件信息
getInfoApiFn()//获取桥梁等设备信息
// 默认显示路政车、救援车、人员数据
rescueCarClick()
roadCarClick()
personnelClick()
}
} else {
////console.log(data.message)
}
}
// 5分钟刷新一次路线接口
let facilitiesAndSectionInfoTimer = ref(null)
const circulateSection = () => {
facilitiesAndSectionInfoTimer.value = setTimeout(() => {
// 画线路
getSectionInfoApi({ sysOrgCode: sysOrgCode }).then(
(data) => {
if (data.code == 200) {
clearTimeout(facilitiesAndSectionInfoTimer.value)
// 初始化路线数据
if (mapDetailObj.polylineArr.length !== 0) {
GDMap.remove(mapDetailObj.polylineArr)
mapDetailObj.polylineArr = []
}
mapObj.mapLineData = data.result.tmcsList
if (mapObj.mapLineData.length > 0) {
_loopFn(mapObj.mapLineData[0], 0)
}
// 获取中心点
mapObj.centerPoint = data.result.centerPoint
// 获取zoom值
mapObj.maxDistance = data.result.maxDistance
circulateSection()
}
},
(error) => {
console.log('error', error)
}
)
}, 300000)
}
// 30秒刷新一次路况接口及右侧统计接口
let facilitiesAndEventInfoTimer = ref(null)
const circulateEvent = () => {
facilitiesAndEventInfoTimer.value = setTimeout(() => {
let parameter = {
sysOrgCode: sysOrgCode,
}
mapObj.sectionIdArr = []
getHighwaySectionApi(parameter).then((data) => {
//console.log('getHighwaySectionApiFn-data:', data)
let result = data.result
let sectionIdArr = []
if (data.code == 200) {
clearTimeout(facilitiesAndEventInfoTimer.value)
if (result && result.length > 0) {
result.forEach((e) => {
sectionIdArr.push(e.sectionId)
})
mapObj.sectionIdArr = sectionIdArr.join(',')
mapObj.eventList = []
eventPageNo.value = 1
queryEventInfoV2ApiFn()
queryConfirmedEventApiFn()
}
circulateEvent()
} else {
//console.log(data.message)
}
})
}, 30000)
}
// 下拉滚动获取事件列表数据,监听元素滚动
let eventPageNo = ref(1)
let eventTotal = ref(20)
const handleEventScroll = () => {
if ((document.getElementById("eventListScrollbarY").scrollTop > 1100 * eventPageNo.value) && (mapObj.eventList.length < eventTotal.value)) {
eventPageNo.value = eventPageNo.value + 1
queryConfirmedEventApiFn()
}
}
// 监听滚动
const handlerNodeScroll = () => {
document.getElementById("eventListScrollbarY").addEventListener('scroll', handleEventScroll)
}
// 事件新增
const addEventDetail = () => {
proxy.$refs.eventDetailModalRef.btnClick()
}
// eventBus派发告警弹窗删除告警事件点标记
proxy.$mybus.on('*', (type, data) => {
console.log('type', type)
// 删除告警事件点标记
// const eventData = JSON.parse(data)
if (type === 'del-marker') {
initClusterInfoWindow('del-marker')
}
})
// 刷新事件列表和等级统计接口
proxy.$mybus.on('onRefreshEventList', () => {
reFreshEventList('cancel-get-event-list')
})
// 刷新左侧列表和等级统计数据
const reFreshEventList = async (type = '') => {
// 初始化事件列表数据
mapObj.inputSearchValue = ''
mapObj.selectValue1 = undefined
mapObj.selectValue2 = undefined
eventPageNo.value = 1
mapObj.eventList = []
let parameter = {
sysOrgCode: sysOrgCode,
}
mapObj.sectionIdArr = []
await getUserCoverApiFn() // 获取用户图层信息
getHighwaySectionApi(parameter).then((data) => {
//console.log('getHighwaySectionApiFn-data:', data)
let result = data.result
let sectionIdArr = []
if (data.code == 200) {
if (result && result.length > 0) {
result.forEach((e) => {
sectionIdArr.push(e.sectionId)
})
mapObj.sectionIdArr = sectionIdArr.join(',')
if (type !== 'cancel-get-event-list') {
queryConfirmedEventApiFn()
}
queryEventInfoV2ApiFn()
}
} else {
//console.log(data.message)
}
})
}
// 对比两个数组数据是否相同
const compareArr = (oldArr, newArr) => {
let flag = true; //false证明数组发生变化 true无变化
//如果前后两个数组长度不一致,证明数组发生的变化,将flag赋值为false
if (oldArr.length != newArr.length) {
flag = false;
} else {
//数组长度没变化,则进行轮询检查新数组的QuestionID是否都存在前一个数组之中
for (let i = 0; i < newArr.length; i++) {
flag = oldArr.some((item) => {
return (
item.id === newArr[i].id
)
});
if (flag == false) break;
}
}
return flag
}
// 点击事件状态select获取数据
const handleSearchSelect = () => {
mapObj.eventList = []
eventPageNo.value = 1
queryConfirmedEventApiFn()
}
// 处理新版首页显示在地图上的打点数据
const handleEventLeveloOrStatusList = () => {
let result = []
mapObj.userCoverView.forEach((coverItem) => {
mapObj.eventLeveloOrStatusList.forEach((eventItem) => {
// 设置打点数
if (coverItem.value === eventItem.value) {
coverItem.count = eventItem.count
// 设置初始打点数据
if (coverItem.checked === '1'){
result.push(...eventItem.info)
}
}
})
})
console.log('result', result)
accidentMarkerFn(result)
// 建立连接实时获取变动的打点数据及事件列表数据
initWebSocket()
}
// 图层图标
const layerLogo = computed(() => {
if (props.isVisualization && !toggleLayerStatus.value) {
return require('@/assets/images/roadOverview/right-white-box.png')
}
if(!props.isVisualization && !toggleLayerStatus.value) {
return require('@/assets/images/roadOverview/right-box.png')
}
if (props.isVisualization && toggleLayerStatus.value) {
return require('@/assets/images/roadOverview/right-white-box.png')
}
if (!props.isVisualization && toggleLayerStatus.value) {
return require('@/assets/images/roadOverview/right-box-active.png')
}
})
// 地图图层返回初始状态
const initMapLayer = () => {
// 设置中心点
GDMap.setCenter(mapObj.centerPoint)
// 设置zoom值
getZoom(mapObj.maxDistance, GDMap)
}
// 切换图层状态
let toggleLayerStatus = ref(false)
const toggleLayer = () => {
toggleLayerStatus.value = !toggleLayerStatus.value
if (toggleLayerStatus.value) {
toggleResouceStatus.value = true
} else {
toggleResouceStatus.value = false
toggleDeviceStatus.value = false
}
}
// 点击资源设备
let toggleResouceStatus = ref(false)
// 点击常用设置按钮
let toggleDeviceStatus = ref(false)
const handleDevice = () => {
toggleResouceStatus.value = false
toggleDeviceStatus.value = !toggleDeviceStatus.value
}
// 图层是否要设置选中状态
const handleSwitch = (checked, event, item) => {
event.stopPropagation()
mapObj.userCoverAll.forEach(coverItem => {
if (coverItem.value === item.value) {
if (checked === true) {
coverItem.checked = '1'
coverItem.view = '1'
} else {
coverItem.checked = '0'
}
}
})
// console.log('mapObj.userCoverAll', mapObj.userCoverAll)
}
// 点击常用设置取消
const handleSepupCancel = () => {
toggleLayerStatus.value = false
toggleDeviceStatus.value = false
}
// 点击常用设置确认
const handleSepupConfirm = () => {
const params = {
userId: store.state.userInfo.id,
params: mapObj.userCoverAll
}
// console.log('params', params)
setUserCoverApi(params).then((data) => {
if (data.code == 200) {
message.success("操作成功!")
getUserCoverApiFn()
queryEventInfoV2ApiFn()
toggleLayerStatus.value = false
toggleDeviceStatus.value = false
} else {
message.warning(data.message)
}
}).catch((error) => {
console.log('error', error)
})
}
// 点击常用设置中的某项
const handleDeviceSelect = (item) => {
mapObj.userCoverAll.forEach(coverItem => {
if (coverItem.value === item.value) {
if (item.view == '0') {
coverItem.view = '1'
} else {
coverItem.view = '0'
coverItem.checked = '0'
}
}
})
}
// 查询用户图层信息
const getUserCoverApiFn = () => {
getUserCoverApi(store.state.userInfo.id).then((data) => {
if (data.code == 200) {
mapObj.userCoverView = data.result.userCoverView
mapObj.userCoverAll = data.result.userCoverAll
// console.log('mapObj.userCoverView', mapObj.userCoverView)
// console.log('mapObj.userCoverAll', mapObj.userCoverAll)
accidentBool.value = Array(mapObj.userCoverView.length).fill(false)
mapObj.userCoverView.forEach((item, index) => {
accidentBool.value[index] = item.checked === '1' ? true : false
})
} else {
message.warning(data.message)
}
}).catch((error) => {
console.log('error', error)
})
}
// 移出资源图层时隐藏
const mouseleave = () => {
toggleResouceStatus.value = false
toggleLayerStatus.value = false
}
// 未勾选状态时清除救援车所有数据及点聚合功能,并清除经纬度变化轨迹移动的点
const clearRescueCarData = () => {
if(!mapObj.isRightPurpleIcon3Boole) {
sessionStorage.removeItem('rescueCarData')
initClusterInfoWindow('rescue')
mapObj.rescueCarData = []
if (rescueCarTimer.value) {
clearTimeout(rescueCarTimer.value)
rescueCarTimer.value = null
}
if(rescueCarClusterer) {
GDMap.remove(rescueCarClusterer)
rescueCarClusterer = null
}
GDMap.remove(mapDetailObj.mapIconArr11)
mapDetailObj.mapIconArr11 = []
}
if (mapDetailObj.rescueLineMarkerArr.length !== 0) {
mapDetailObj.rescueLineMarkerArr.forEach((item) => {
item.setMap(null)
})
mapDetailObj.rescueLineMarkerArr = []
}
}
// 未勾选状态时清除路政车所有数据及点聚合功能,并清除经纬度变化轨迹移动的点
const clearRoadCarData = () => {
if(!mapObj.isRightPurpleIcon1Boole) {
sessionStorage.removeItem('roadCarData')
initClusterInfoWindow('road')
mapObj.roadCarData = []
if (roadCarTimer.value) {
clearTimeout(roadCarTimer.value)
roadCarTimer.value = null
}
if(roadCarClusterer) {
GDMap.remove(roadCarClusterer)
roadCarClusterer = null
}
GDMap.remove(mapDetailObj.mapIconArr9)
mapDetailObj.mapIconArr9 = []
}
if (mapDetailObj.roadLineMarkerArr.length !== 0) {
mapDetailObj.roadLineMarkerArr.forEach((item) => {
item.setMap(null)
})
mapDetailObj.roadLineMarkerArr = []
}
}
// 未勾选状态时清除人员所有数据及点聚合功能,并清除经纬度变化轨迹移动的点
const clearPersonnelData = () => {
if(!mapObj.isRightPurpleIcon2Boole) {
sessionStorage.removeItem('personnelData')
initClusterInfoWindow('person')
mapObj.personnelData = []
if (personnelTimer.value) {
clearTimeout(personnelTimer.value)
personnelTimer.value = null
}
if(personMarkerClusterer) {
GDMap.remove(personMarkerClusterer)
personMarkerClusterer = null
}
GDMap.remove(mapDetailObj.mapIconArr10)
mapDetailObj.mapIconArr10 = []
}
if (mapDetailObj.personnelMarkerArr.length !== 0) {
mapDetailObj.personnelMarkerArr.forEach((item) => {
item.setMap(null)
})
mapDetailObj.personnelMarkerArr = []
}
}
/*******获取群聊websocket推送消息*/
let alreadyDelId = ref(false) // 记录是否一次性推了删除点重复的id,true为重复了,反之
let alreadyAddId = ref(false) // 记录是否一次性推了新增点重复的id,true为重复了,反之
function initWebSocket() {
const userId = store.state.userInfo.id;
const url = (process.env.VUE_APP_WS_API_HOST).replace("https://","wss://").replace("http://","ws://")+"websocket/page/dot/v2/" + userId + '/' + new Date().getTime()
if(mapObj.websockSign !== null && mapObj.websockSign.readyState == 1){
//避免重复链接
console.log("websocket 连接已存在...");
}else{
mapObj.websockSign = new WebSocket(url);
mapObj.websockSign.onopen = (e)=>websocketOnopen(e);
mapObj.websockSign.onerror = (e)=>websocketOnerror(e);
mapObj.websockSign.onmessage =(e)=>websocketOnmessage(e);
mapObj.websockSign.onclose = (e)=>websocketOnclose(e);
}
}
const websocketOnopen = (e) => {
console.log("WebSocket连接成功");
}
const websocketOnerror = (e) => {
console.log('WebSocket连接发生错误: ' + e.code + ' ' + e.reason + ' ' + e.wasClean)
if(e.code !== 1000){
console.log("websocket 非正常断开重连...");
reconnect();
}
}
const websocketOnmessage = (e) => {
console.log('websocketOnmessage', JSON.parse(e.data))
const { data: data } = JSON.parse(e.data)
mapObj.numList = data.numList
// 对地图打点数据进行处理
if (data?.addList?.length) {
console.log('addList', data.addList)
mapObj.addList = data.addList
addMarkerWebSocket()
}
if (data?.delList?.length) {
console.log('delList', data.delList)
mapObj.delList = data.delList
delMarkerWebSocket()
}
if (data?.numList?.length) {
countNumMarkerWebSocket()
}
// 对事件列表数据进行处理
mapObj.isWebsockSign = true
console.log('-----alreadyAddId.value-----', alreadyAddId.value)
console.log('-----alreadyDelId.value-----', alreadyDelId.value)
if (alreadyDelId.value || alreadyAddId.value) {
console.log('推送过来重复的数据了!!!')
mapObj.isWebsockSign = false
alreadyDelId.value = false
alreadyAddId.value = false
return
}
queryConfirmedEventApiFn()
}
const websocketOnclose = (e) => {
console.log('websocket 断开: ' + e.code + ' ' + e.reason + ' ' + e.wasClean)
if(e.code !== 1000){
console.log("websocket 非正常断开重连...");
reconnect();
}
}
// 尝试重连
const reconnect = () => {
if(mapObj.lockReconnect) return;
mapObj.lockReconnect = true;
//没连接上会一直重连,设置延迟避免请求过多
let timer = setTimeout(function () {
console.log("尝试重连...");
initWebSocket();
// ws断开时需要重新刷新一下事件列表、打点数据,并且需要重新获取图层各等级总数
reFreshEventList();
mapObj.lockReconnect = false;
clearTimeout(timer)
}, 5000);
}
// 对总的打点数进行处理
const countNumMarkerWebSocket = () => {
mapObj.numList.forEach((numItem) => {
mapObj.eventLeveloOrStatusList.forEach((eventItem, index) => {
// 如果为新增的打点数据则直接加
if (numItem.value === eventItem.value) {
if (eventItem.count === 0 && numItem.count === -1) {
console.log('--------测试--------', mapObj.eventLeveloOrStatusList[index])
}
eventItem.count = eventItem.count + numItem.count
}
})
})
// 设置打点数
mapObj.userCoverView.forEach((coverItem) => {
mapObj.eventLeveloOrStatusList.forEach((eventItem) => {
if (coverItem.value === eventItem.value) {
coverItem.count = eventItem.count
}
})
})
mapObj.numList = []
}
// 新增打点数据
const addMarkerWebSocket = () => {
if (!mapObj.addList.length) {
alreadyAddId.value = false
return
}
mapObj.addList.forEach((addItem) => {
let addResult = []
addResult.push(addItem)
// 对总的打点mapObj.eventLeveloOrStatusList数据进行处理
let data = mapObj.eventLeveloOrStatusList.find((item) => item.value === addItem.levelOrStatus)
mapObj.eventLeveloOrStatusList.forEach((item, index) => {
if (item.value === data.value) {
// 如果一条数据重复推送了两次或多次以上
let flag = false
flag = mapObj.eventLeveloOrStatusList[index].info.some(infoItem => {
if (infoItem.levelOrStatus === '5' || infoItem.levelOrStatus === '6' || infoItem.levelOrStatus === '10') {
return infoItem.id === addItem.id
} else {
return infoItem.alarmId === addItem.alarmId
}
})
if (flag) {
// 如果推送过来的打点数据地图上不存在,则无需进行count操作
mapObj.numList.forEach(numItem => {
if (numItem.value === addItem.levelOrStatus) {
numItem.count--
}
})
alreadyAddId.value = true
} else {
// 如果一条数据只推送了一次则直接新增
accidentMarkerFn(addResult, 'addWebSocketMarker')
data.info.push(addItem)
mapObj.eventLeveloOrStatusList[index] = data
alreadyAddId.value = false
}
}
})
// 如果当前处于打开点聚合弹窗状态需要对弹窗进行新增点数据,如果是同个经纬度才需进行添加
if (clusterInfoWindow) {
if (clusterEventArr.value.length !== 0) {
if (clusterEventArr.value[0].latitude == addItem.latitude && clusterEventArr.value[0].longitude == addItem.longitude) {
clusterEventArr.value.push(addItem)
}
}
if (clusterYiGouEventArr.value.length !== 0) {
if (clusterYiGouEventArr.value[0].latitude == addItem.latitude && clusterYiGouEventArr.value[0].longitude == addItem.longitude) {
clusterYiGouEventArr.value.push(addItem)
}
}
}
})
mapObj.addList = []
}
// 删除打点数据
const delMarkerWebSocket = () => {
if (!mapObj.delList.length) {
alreadyDelId.value = false
return
}
// 删除地图上的所对应的打点数据
mapObj.delList.forEach((delItem) => {
if (delItem.value === '1'){
accidentMarkerArr1.forEach((item, index) => {
if (item.De.extData.alarmId === delItem.id) {
GDMap.remove(accidentMarkerArr1[index])
accidentMarkerArr1[index].setMap(null)
eventMarkerClusterer1.removeMarker(accidentMarkerArr1[index])
accidentMarkerArr1.splice(index, 1)
}
})
}
if (delItem.value === '2') {
accidentMarkerArr2.forEach((item, index) => {
if (item.De.extData.alarmId === delItem.id) {
GDMap.remove(accidentMarkerArr2[index])
accidentMarkerArr2[index].setMap(null)
eventMarkerClusterer2.removeMarker(accidentMarkerArr2[index])
accidentMarkerArr2.splice(index, 1)
}
})
}
if (delItem.value === '3') {
accidentMarkerArr3.forEach((item, index) => {
if (item.De.extData.alarmId === delItem.id) {
GDMap.remove(accidentMarkerArr3[index])
accidentMarkerArr3[index].setMap(null)
eventMarkerClusterer3.removeMarker(accidentMarkerArr3[index])
accidentMarkerArr3.splice(index, 1)
}
})
}
if (delItem.value === '4') {
accidentMarkerArr4.forEach((item, index) => {
if (item.De.extData.alarmId === delItem.id) {
GDMap.remove(accidentMarkerArr4[index])
accidentMarkerArr4[index].setMap(null)
eventMarkerClusterer4.removeMarker(accidentMarkerArr4[index])
accidentMarkerArr4.splice(index, 1)
}
})
}
if (delItem.value === '5') {
accidentMarkerArr5.forEach((item, index) => {
if (item.De.extData.id === delItem.id) {
GDMap.remove(accidentMarkerArr5[index])
accidentMarkerArr5[index].setMap(null)
eventMarkerClusterer5.removeMarker(accidentMarkerArr5[index])
accidentMarkerArr5.splice(index, 1)
}
})
}
if (delItem.value === '6') {
accidentMarkerArr6.forEach((item, index) => {
if (item.De.extData.id === delItem.id) {
GDMap.remove(accidentMarkerArr6[index])
accidentMarkerArr6[index].setMap(null)
eventMarkerClusterer6.removeMarker(accidentMarkerArr6[index])
accidentMarkerArr6.splice(index, 1)
}
})
}
if (delItem.value === '10') {
accidentMarkerArr10.forEach((item, index) => {
if (item.De.extData.id === delItem.id) {
GDMap.remove(accidentMarkerArr10[index])
accidentMarkerArr10[index].setMap(null)
eventMarkerClusterer10.removeMarker(accidentMarkerArr10[index])
accidentMarkerArr10.splice(index, 1)
}
})
}
// 对总的打点mapObj.eventLeveloOrStatusList数据进行处理
let data = mapObj.eventLeveloOrStatusList.find((item) => item.value === delItem.value)
if (data?.info && data.info.length !== 0) {
// 如果一条数据重复推送了两次或多次以上
let flag = false
flag = data.info.some((item, index) => {
let id = ''
if (data.value === '5' || data.value === '6' || data.value === '10') {
id = item.id
} else {
id = item.alarmId
}
if (id === delItem.id) {
data.info.splice(index, 1)
mapObj.eventLeveloOrStatusList.forEach((item, index) => {
if (item.value === data.value) {
mapObj.eventLeveloOrStatusList[index] = data
}
})
}
return id === delItem.id
})
if (!flag) {
// 查看是否一次性推了重复的数据
alreadyDelId.value = true
console.log('进来alreadyDelId.value', alreadyDelId.value)
// 如果推送过来的打点数据地图上不存在,则无需进行count操作
mapObj.numList.forEach(item => {
if (item.value === delItem.value) {
item.count++
}
})
}
} else {
// 查看是否一次性推了重复的数据
alreadyDelId.value = true
console.log('delItem', delItem)
console.log('已经没数据了,不能删了', mapObj.eventLeveloOrStatusList)
console.log('进来alreadyDelId.value', alreadyDelId.value)
// 如果推送过来的打点数据地图上不存在,则无需进行count操作
mapObj.numList.forEach(item => {
if (item.value === delItem.value) {
item.count++
}
})
}
// 如果当前打开点聚合弹窗为两条数据,恰好删除了其中一条数据,则关闭弹窗
if (clusterEventArr.value.length === 2 || clusterYiGouEventArr.value.length === 2) {
handleCloseClusterDialog(delItem.value)
}
// 如果删除的点,tab页存在该事件则需要删除该tab
// let Panes = store.state.menuTba.length === 1 ? store.state.menuTba : getStorage('tabMenuDatas').Panes
// const activeKey = 1
// if (Panes.length !== 1) {
// Panes.forEach((item, index) => {
// if(item.id && item.id === delItem.id) {
// Panes.splice(index, 1)
// }
// })
// setStorage("tabMenuDatas", {
// Panes,
// activeKey
// })
// store.dispatch("setMenuTba", Panes)
// proxy.$mybus.emit('del-tab', Panes)
// }
// 如果当前处于打开点聚合弹窗状态需要对弹窗进行删除点数据
if (clusterInfoWindow) {
if (clusterEventArr.value.length !== 0) {
clusterEventArr.value.forEach((item, index) => {
if (item.id === delItem.id) {
clusterEventArr.value.splice(index, 1)
}
})
}
if (clusterYiGouEventArr.value.length !== 0) {
clusterYiGouEventArr.value.forEach((item, index) => {
if (item.alarmId === delItem.id) {
clusterYiGouEventArr.value.splice(index, 1)
}
})
}
}
})
mapObj.delList = []
}
// 处理关闭点聚合弹窗
const handleCloseClusterDialog = (value) => {
if(value === '5' || value === '6' || value === '10') {
initClusterInfoWindow('event')
} else {
initClusterInfoWindow('alarm')
}
}
// 事件列表收缩按钮
let collapsed = ref(false)
const toggleCollapsed = () => {
collapsed.value = !collapsed.value;
};
// tab切出首页需要清除救援车、路政车、人员定时器及缓存
const clearDeviceStorageAndTimer = () => {
sessionStorage.removeItem('rescueCarData')
sessionStorage.removeItem('roadCarData')
sessionStorage.removeItem('personnelData')
if (rescueCarTimer.value !== null) {
clearTimeout(rescueCarTimer.value)
rescueCarTimer.value = null
}
if (roadCarTimer.value !== null) {
clearTimeout(roadCarTimer.value)
roadCarTimer.value = null
}
if (personnelTimer.value !== null) {
clearTimeout(personnelTimer.value)
personnelTimer.value = null
}
}
// tab切换回首页如果勾选则显示路政车、救援车、人员数据
const showDeviceStorageAndTimer = () => {
if (mapObj.isRightPurpleIcon3Boole == true) {
GDMap.remove(mapDetailObj.mapIconArr11)
mapDetailObj.mapIconArr11 = []
mapObj.rescueCarData = []
getRescueCarListApiFn() // 地图增加救援车定位信息
}
if (mapObj.isRightPurpleIcon1Boole == true) {
GDMap.remove(mapDetailObj.mapIconArr9)
mapDetailObj.mapIconArr9 = []
mapObj.roadCarData = []
getRoadCarListApiFn() // 地图增加路政车定位信息
}
if (mapObj.isRightPurpleIcon2Boole == true) {
GDMap.remove(mapDetailObj.mapIconArr10)
mapDetailObj.mapIconArr10 = []
mapObj.personnelData = []
getOperatorLocationListApiFn() // 获取app人员定位信息
}
}
onMounted(() => {
mapObj.mapLoading = true
getHighwaySectionApiFn()//通过机构编码获取路段信息
getUserCoverApiFn() // 获取用户图层信息
// 5分钟轮询路线接口
circulateSection()
})
// 路由缓存时在触发
let initHighwaySection = ref(false)
onActivated(() => {
if (initHighwaySection.value) {
reFreshEventList()
}
initHighwaySection.value = true
// 下拉滚动获取事件列表数据
handlerNodeScroll()
// 30秒轮询路况和统计接口
// circulateEvent()
// 建立连接实时获取变动的打点数据及事件列表数据
// initWebSocket()
})
// 切换卫星地图
let isSatelliteLayer = ref(false)
let satellite = new AMap.TileLayer.Satellite()
let roadNet = new AMap.TileLayer.RoadNet()
const toggleMapLayer = () => {
// 切换地图图层
if (isSatelliteLayer.value) {
GDMap.remove([satellite, roadNet])
GDMap.setMapStyle(`amap://styles/02fd07714a3aac53f6cdf9b02998f192`)
}
// 切换卫星地图
else {
GDMap.add([satellite, roadNet])
}
isSatelliteLayer.value = !isSatelliteLayer.value
}
onDeactivated(() => {
clearTimeout(facilitiesAndEventInfoTimer.value)
clearPartDrawMarkerTimer()
})
return {
clusterArr,
clusterRescueCarArr,
clusterRoadCarArr,
clusterEventArr,
clusterYiGouEventArr,
clusterWindowBoxRef,
clusterRescueCarWindowBoxRef,
clusterRoadCarWindowBoxRef,
clusterEventWindowBoxRef,
clusterYiGouEventWindowBoxRef,
eventList,
statusIcon,
typeIcon,
yiGouObj,
closeInfoDetailFn,
mapObj,
bridgeClick,
rescueCarClick,
roadCarClick,
rightBlueIcon2Click,
rightBlueIcon3Click,
rightBlueIcon4Click,
rightGreenIcon1Click,
rightGreenIcon2Click,
rightGreenIcon3Click,
rightGreenIcon4Click,
toEventDetailsFn,
toYiGouEventDetailsFn,
inputSearchFn,
inputChangeFn,
personnelClick,
accidentBool,
accidentFn1,
addEventDetail,
statusOptions,
getStatus,
handleSearchSelect,
// 新版首页
layerLogo,
initMapLayer,
toggleLayer,
toggleLayerStatus,
toggleResouceStatus,
toggleDeviceStatus,
handleDevice,
handleSwitch,
handleSepupCancel,
handleSepupConfirm,
handleDeviceSelect,
mouseleave,
collapsed,
toggleCollapsed,
toggleMapLayer,
isSatelliteLayer,
}
},
}
</script>
<style scoped lang="less">
@import '@/assets/css/style.css';
@import '@/assets/css/commonly.css';
@import '@/views/roadOverview/roadOverviewNew.css';
ol,
ul {
list-style: none;
}
li {
list-style-type: none;
}
#container {
min-height: 968px;
}
@red: #fc693b;
@org: #ff9447;
@yel: #ffbb2f;
@blue: #1b7fff;
@green:#47CE5A;
.red {
color: #fc693b;
}
.org {
color: #ff9447;
}
.yel {
color: #ffbb2f;
}
.blue {
color: #1b7fff;
}
.green{
color: #47CE5A;
}
.red-name {
color: #FF4747;
}
.org-name {
color: #FF852E;
}
.yel-name {
color: #FFB71B;
}
.blue-name {
color: #1B7FFF;
}
.bg-dispost {
color: #fff !important;
background: #409EFF !important;
}
.bg-known {
color: #fff !important;
background: #67C23A !important;
}
.bg-work {
color: #fff !important;
background: #FFA500 !important;
}
.color-dispost {
color: #409EFF !important;
}
.color-known {
color: #67C23A !important;
}
.color-work {
color: #FFA500 !important;
}
:deep(.amap-zoom-ruler) {
height: 125px;
}
/deep/ .markerBox{
display: flex;
.markerImage{
width: 40px;
height: 40px;
position: absolute;
left: -2px;
}
.markerContent{
color: #fff;
background: #8A6BFA;
height: 36px;
line-height: 36px;
max-width: 265px;
min-width: 120px;
border-radius:40px;
padding-right:10px;
p{
margin-left: 45px;
text-align:left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.markerContentCar {
background-color: rgba(255, 187, 47, 0.8) !important;
}
}
/deep/ .renderAnyClusterBox {
width: 60px;
height: 60px;
border-radius: 60px;
}
/deep/ .renderAnyClusterCount {
width: 42px;
height: 42px;
border-radius: 42px;
line-height: 42px;
text-align: center;
color: #fff;
font-size: 18px;
margin: auto;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
/deep/ .renderClusterBox{
background: rgba(138, 107, 250, 0.3);
}
/deep/ .renderClusterCount{
background: rgba(138,107,250,0.8);
border: 2px solid #6130F0;
}
/deep/ .renderEventClusterBox1{
background: rgba(252, 105, 59, 0.3);
}
/deep/ .renderEventClusterCount1{
background: rgba(252, 105, 59, 0.8);
border: 2px solid rgba(252, 105, 59);
}
/deep/ .renderEventClusterBox2{
background: rgba(255, 148, 71, 0.3);
}
/deep/ .renderEventClusterCount2{
background: rgba(255, 148, 71, 0.8);
border: 2px solid rgba(255, 148, 71);
}
/deep/ .renderEventClusterBox3{
background: rgba(255, 187, 47, 0.3);
}
/deep/ .renderEventClusterCount3{
background: rgba(255, 187, 47, 0.8);
border: 2px solid rgba(255, 187, 47);
}
/deep/ .renderEventClusterBox4{
background: rgba(27, 127, 255, 0.3);
}
/deep/ .renderEventClusterCount4{
background: rgba(27, 127, 255, 0.8);
border: 2px solid rgba(27, 127, 255);
}
/deep/ .renderEventClusterBox5{
background: rgba(71, 206, 90, 0.3);
}
/deep/ .renderEventClusterCount5{
background: rgba(71, 206, 90, 0.8);
border: 2px solid rgba(71, 206, 90);
}
/deep/ .clusterWindowBox{
display: flex;
flex-wrap: wrap;
width: 574px;
max-height: 262px;
background: #FFFFFF;
border-radius: 10px;
overflow: auto;
padding: 0 12px 0 12px;
text-align: left;
position: relative;
.oneCluster.clusterWindowItem{
width:100%;
border-right: none !important;
}
.clusterWindowItem{
width: 50%;
font-size: 18px;
color: #6B7299;
padding-left: 10px;
border-top: 1px solid #EEEEEE;
padding-top:11px;
padding-bottom:4px;
// padding-right: 12px;
p{
margin-bottom:6px;
margin-top:0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
}
}
.clusterEventWindowItem {
cursor: pointer;
font-size: 16px;
}
.clusterEventWindowItem-name {
font-size: 16px !important;
font-weight: 700;
}
.clusterWindowItem:nth-child(1),.clusterWindowItem:nth-child(2){
border-top: none;
}
.clusterWindowItem:nth-of-type(2n+1){
padding-left: 0;
border-right:1px solid #EEEEEE;
}
}
/deep/ .clusterWindowBox2 {
max-height: 317px;
}
.eventList-main {
.nothing {
display: flex;
justify-content: center;
align-items: center;
margin: 150px auto 10px auto;
img {
width: 80px;
height: 80px;
margin-right: 10px;
border-radius: 50%;
}
div {
text-align: left;
div:nth-child(1) {
color: #2B210E;
font-size: 16px;
}
div:nth-child(2) {
color: rgba(0, 0, 0, 0.25);
margin-top: 5px;
font-size: 14px;
}
}
}
}
/deep/.amap-info-close {
display: none !important;
}
/deep/ .amap-marker-label{
border: none;
position: relative;
}
// :has父元素选择器,:has(xxx)的样式才能生效
/deep/ .amap-marker-label:has(.accidentLabel){
display: none;
padding: 10px;
&::after{
content: '';
position: absolute;
border-top: 10px solid white;
border-right: 10px solid transparent;
border-left: 10px solid transparent;
bottom: -9px;
left: 98px;
}
}
/deep/ .amap-marker-label:has(.theLabel){
border-radius:5px;
padding: 3px 8px 1px 5px;
box-shadow: 0px 3px 6px 1px rgba(0,0,0,0.16);
top: -30px !important;
&::after{
content: '';
position: absolute;
border-top: 4px solid white;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
bottom: -4px;
left: calc(50% - 4px)
}
.theLabel{
min-width: 42px;
height: 20px;
line-height: 20px;
div{
text-align: center;
}
}
}
/deep/ .amap-marker-label:has(.theLabel1){
left: -19% !important;
}
/deep/ .amap-marker-label:has(.theLabel2){
left: -27% !important;
}
/deep/ .amap-marker-label:has(.theLabel3){
left: -34% !important;
}
/deep/ .amap-marker-label:has(.theLabel4){
left: -38% !important;
}
.select-box {
display: flex;
align-items: center;
span {
color: rgba(0, 0, 0, 0.85);
font-size: 15px;
}
}
.select-box /deep/.ant-select{
// width: 122px!important;
width: 177px !important;
}
.info{
.detail_box {
height: 31.25vw;
}
}
.visualization /deep/ .mySelect{
left: 0!important;
top: 34px!important;
background: rgba(12,36,83,0.76);
.ant-select-item-option-active,.ant-select-item-option-selected{
background: #033D9A;
.ant-select-item-option-content{
// color: blue;
}
}
.ant-select-item-option-content{
color: #fafafa;
}
.ant-select-item-empty{
.ant-empty-description{
color: #fafafa;
}
}
}
// 新版首页
/deep/ .ant-spin-text {
padding-top: 355px !important;
}
/deep/ .ant-spin-dot-spin {
margin-top: 330px !important;
}
.activelogo {
border: 1px solid #2BA2FC !important;
background-color: #E7F5FE !important;
}
.active-satellite{
color: #2BA2FC;
}
.activeSelect {
width: 8px;
height: 8px;
border-radius: 2px;
background-color: #3A97F9;
}
.road-layer-btn-box {
box-sizing: border-box;
width: 154px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.16);
}
.road-right-wrap__satellite {
box-sizing: border-box;
width: 77px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
background: #FFFFFF;
color: #848484;
font-size: 21px;
cursor: pointer;
border-radius: 5px 0 0 5px;
}
.road-layer-boder {
width: 2px;
height: 42px;
background-color: #DEE2E9;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.road-layer-reset-btn {
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
width: 77px;
height: 50px;
background: #FFFFFF;
color: #848484;
font-size: 18px;
cursor: pointer;
border-radius: 0 5px 5px 0;
}
.road-right-wrap {
&__layer {
display: flex;
justify-content: center;
align-items: center;
width: 154px;
height: 50px;
background: #FFFFFF;
border-radius: 5px;
box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.16);
color: #848484;
font-size: 21px;
cursor: pointer;
&--pic1 {
width: 15px;
height: 15px;
}
&--pic2 {
width: 25px;
height: 25px;
}
&--name {
margin-left: 10px;
margin-bottom: 2px;
font-size: 18px;
&-active {
color: #6699FF;
}
}
}
&__level {
margin-top: 6px;
background: #FFFFFF;
box-shadow: 0px 0px 10px 1px rgba(0,0,0,0.16);
border-radius: 5px;
padding: 12px;
}
&__item {
display: flex;
align-items: center;
width: 131px;
height: 66px;
border: 1px solid #DEE2E9;
padding: 9px 0;
border-radius: 4px;
cursor: pointer;
&--box {
display: flex;
justify-content: center;
align-items: center;
width: 81px;
height: 48px;
background: #FFFFFF;
border: 1px solid #DEE2E9;
border-radius: 4px;
margin-left: 12px;
margin-right: 3px;
color: #000000;
font-size: 14px;
.grade-name {
margin-left: 5px;
}
.grade-logo {
display: inline-block;
width: 28px;
height: 36px;
}
}
.grade-num {
display: flex;
justify-content: center;
align-items: center;
width: 26px;
height: 36px;
font-size: 24px;
}
}
&__item:not(:first-child){
margin-top: 6px;
}
}
.road-right-resouce {
margin-right: 1px;
width: 154px;
height: 666px;
background: #FFFFFF;
box-shadow: 0px 0px 6px 1px rgba(0,0,0,0.16);
border-radius: 5px;
padding: 8px 7px;
&__item {
display: flex;
align-items: center;
justify-content: space-between;
width: 140px;
height: 50px;
border-radius: 4px;
padding: 9px 8px;
border: 1px solid #DEE2E9;
cursor: pointer;
&--pic {
width: 32px;
height: 32px;
}
&--name {
margin-left: 19px;
color: #000000;
font-size: 14px;
}
&--box {
display: flex;
justify-content: center;
align-items: center;
width: 14px;
height: 14px;
border-radius: 2px;
border: 1px solid #D9D9D9;
background: #FFFFFF;
}
}
&__item:not(:first-child){
margin-top: 6px;
}
&__btn {
display: flex;
justify-content: center;
align-items: center;
margin-top: 9px;
width: 140px;
height: 32px;
background: #3B7FEB;
border-radius: 4px;
color: #FFFFFF;
font-size: 12px;
cursor: pointer;
img {
width: 15px;
height: 15px;
margin-right: 3px;
}
}
}
.road-right-setup {
margin-right: 1px;
width: 154px;
height: 578px;
background: #FFFFFF;
box-shadow: 0px 0px 6px 1px rgba(0,0,0,0.16);
border-radius: 5px;
padding: 8px 7px;
&__item {
display: flex;
align-items: center;
justify-content: space-between;
width: 140px;
height: 66px;
border-radius: 4px;
padding: 9px;
border: 1px solid #DEE2E9;
background: #FFFFFF;
cursor: pointer;
color: #000000;
&--pic {
width: 28px;
height: 36px;
}
&--name {
margin-left: 8px;
}
&--wrap {
display: flex;
justify-content: space-between;
width: 100%;
}
&--box {
display: flex;
justify-content: center;
align-items: center;
width: 14px;
height: 14px;
border-radius: 2px;
border: 1px solid #D9D9D9;
background: #FFFFFF;
}
&--left {
display: flex;
justify-content: center;
align-items: center;
width: 81px;
height: 48px;
border: 1px solid #DEE2E9;
border-radius: 4px;
color: #000000;
font-size: 14px;
}
&--right {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
}
}
&__item:not(:first-child){
margin-top: 8px;
}
.switch-type {
margin-top: 10px;
}
&__btn {
margin-top: 18px;
display: flex;
justify-content: center;
align-items: center;
&--cancel {
display: flex;
justify-content: center;
align-items: center;
width: 60px;
height: 32px;
color: #666666;
font-size: 12px;
border: 1px solid #DCDFE6;
border-radius: 4px;
cursor: pointer;
margin-right: 15px;
}
&--confirm {
display: flex;
justify-content: center;
align-items: center;
color: #FFFFFF;
font-size: 12px;
width: 60px;
height: 32px;
border-radius: 4px;
background: #3B7FEB;
cursor: pointer;
}
}
}
.collapsed-box {
position: absolute;
top: 50%;
left: 97%;
width: 29px;
height: 41px;
transform: translate(0, -50%);
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
border-radius: 3px;
box-shadow: 0px 3px 6px 1px rgba(0,0,0,0.16);
transition: left 0.5s;
-moz-transition: left 0.5s;
-webkit-transition: left 0.5s;
-o-transition: left 0.5s;
img {
width: 17px;
height: 17px;
}
}
.eventList2 {
width: 2px !important;
height: calc(100vh - 35px) !important;
padding-left: 0 !important;
transition: 0.5s;
-moz-transition: 0.5s;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
}
.collapsed-box2 {
position: absolute;
top: 50%;
left: 0;
transform: translate(0, -50%);
transition: left 0.5s;
-moz-transition: left 0.5s;
-webkit-transition: left 0.5s;
-o-transition: left 0.5s;
}
.dn {
display: none !important;
transition: 0.5s;
-moz-transition: 0.5s;
-webkit-transition: 0.5s;
-o-transition: 0.5s;
}
.satellite-icon{
width: 1.125rem;
height: 1.125rem;
margin-right: 4px;
}
.satellite-title{
font-size: 18px;
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
# 高德地图搜索
// 根据地点名搜索相关
geocoder = new window.AMap.Geocoder({
city: "010",
});
// 根据地点名获取坐标轴
const getCoordinateByName = async() => {
return new Promise((resolve, reject) => {
geocoder.getLocation(data.inputValue, function (status, result) {
if (status === 'complete' && result.geocodes.length) {
let lnglat = result.geocodes[0].location;
data.longitude = lnglat.lng;
data.latitude = lnglat.lat;
resolve({ longitude: data.longitude, latitude: data.latitude });
} else {
// 给个默认坐标
data.longitude = "113.338552";
data.latitude = "23.076839";
resolve({ longitude: data.longitude, latitude: data.latitude });
}
});
});
}
// 点击地图后地点查询
geocoder.getAddress(lnglat, function(status, result) {
if (status === 'complete' && result.info === 'OK') {
console.log(result);
// result为对应的地理位置详细信息
data.inputValue = result.regeocodes[0].formattedAddress
searchMap()
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 封装外部链接组件
注意:设置外链带token的话需要遵循的格式token=${token}
// router.js
{
path: '/scheduling-page/iframePageContent',
name: 'IframePageContent',
component: () => import('@/views/layouts/IframePageView.vue')
}
1
2
3
4
5
6
2
3
4
5
6
// IframePageView.vue
<!-- 跳转外部链接页面 -->
<template>
<div>
<iframe :src="routeUrl" frameborder="0" style="width: 100%; height: 99%; border: medium none;border-radius: 6px;" />
</div>
</template>
<script>
import { ref, getCurrentInstance, onMounted } from 'vue'
import store from "@/store/store";
export default {
name: 'IframePageContent',
setup() {
const { proxy } = getCurrentInstance()
let routeUrl = ref(store.state.iframeUrl)
onMounted(() => {
// 跳转外部链接
let tokenStr = '${token}'
if (routeUrl.value.indexOf(tokenStr) !== -1) {
routeUrl.value = routeUrl.value.replace(tokenStr, sessionStorage.getItem('accessToken'))
}
console.log('iframeUrl', routeUrl.value)
})
return {
routeUrl,
}
}
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// GlobalHeader.vue
// 如果是是跳外部链接,则设置internalOrExternal为true(点击的时候触发)
if (item.meta && item.meta.internalOrExternal !== undefined && item.meta.internalOrExternal === true && item.component === 'layouts/lframePageView') {
const query = queryURLParams(item.meta.url)
router.push({
path: '/scheduling-page/iframePageContent',
query
})
store.commit('SET_IFRAME_URL', item.meta.url)
} else {
router.push(item.path);
}
// 如果关闭当前tab前一个tab为iframe外链则需要进行处理(关闭的时候触发)
if (panes.value[i - 1].meta && panes.value[i - 1].meta.url) {
const url = panes.value[i - 1].meta.url
let path = url.split('?')[1]
if (path.slice(0, 5) === 'token') {
path = path.replace('token=${token}','')
} else {
path = path.replace('&token=${token}','')
}
path = `/scheduling-page/iframePageContent?${path}`
router.push(path);
} else {
router.push(panes.value[i - 1].path);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 轮询接口
// 5分钟刷新一次路况接口及右侧统计接口
let facilitiesAndEventInfoTimer = ref(null)
const circulateEvent = () => {
facilitiesAndEventInfoTimer.value = setTimeout(() => {
let parameter = {
sysOrgCode: sysOrgCode,
}
mapObj.sectionIdArr = []
getHighwaySectionApi(parameter).then((data) => {
clearTimeout(facilitiesAndEventInfoTimer.value)
//console.log('getHighwaySectionApiFn-data:', data)
let result = data.result
let sectionIdArr = []
if (data.code == 200) {
if (result && result.length > 0) {
result.forEach((e) => {
sectionIdArr.push(e.sectionId)
})
mapObj.sectionIdArr = sectionIdArr.join(',')
mapObj.eventList = []
eventPageNo.value = 1
queryEventInfoApiFn()
queryConfirmedEventApiFn()
}
circulateEvent()
} else {
//console.log(data.message)
}
})
}, 30000)
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 分段渲染多数据
- 通过定时器分段渲染数据,最后循环清除所有定时器
注意:做不到通过判断每次渲染条数再去渲染下一段数据,最后等全部数据拿到再渲染到页面上
//根据路段画线路
const _drawPolylineFn = (tmcs,type) => {
let tmcsLength = 0
tmcsLength = tmcs.length
let colorArr = ['#04D099','#FFCC00','#FF0033','#660033'],pathArr = []
if(tmcs.length>0){
let polylineColor = ''
let polyline = ''
for(let i=0;i<tmcsLength;i++){
polylineColor =
tmcs[i].tmc_status == '畅通'
? colorArr[0]
: tmcs[i].tmc_status == '缓行'
? colorArr[1]
: tmcs[i].tmc_status == '拥堵'
? colorArr[2]
: tmcs[i].tmc_status == '严重拥堵'
? colorArr[3]
: colorArr[0]
if(tmcs[i].tmc_polyline_arr.length>0){
polyline = new AMap.Polyline({
path: tmcs[i].tmc_polyline_arr,
borderWeight: 2, // 描边的宽度,默认为1
strokeWeight:5, // 线条宽度
strokeColor: polylineColor, // 线条颜色
lineJoin: 'round', // 折线拐点连接处样式
lineCap:'round',//圆头
isOutline:true, // 线条是否带描边
outlineColor:polylineColor, //线条描边颜色
zIndex: 10,
strokeOpacity: 0.3
});
mapDetailObj.polylineArr.push(polyline);
}
}
GDMap.add(mapDetailObj.polylineArr)
}
type++
let loopFnTimer = setTimeout(function(){
_loopFn(eventDetailsObj.mapLineData[`${type}`], type)
if (type === eventDetailsObj.mapLineData.length) {
loopFnTimerArr.forEach((item) => {
clearTimeout(item)
})
loopFnTimerArr = []
}
}, 200)
loopFnTimerArr.push(loopFnTimer)
}
function _loopFn(lineRoadData,type){
if(type<eventDetailsObj.mapLineData.length){
_drawPolylineFn(lineRoadData,type)
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# 动态路由
let addRoutes = (menuDatas) => {
menuDatas.forEach(item => {
let name = item.name.split('-')[item.name.split('-').length - 1] || ''
if (item.children && item.children.length != 0) {
item.children.forEach(v => {
let names = v.name.split('-')[v.name.split('-').length - 1] || ''
// console.log("打印看看:", names, v.component)
router.addRoute('index', {
path: v.path,
name: names,
component: () => import(`@/views/${v.component}`),
meta: {
title: v.meta.title,
keepAlive: v.meta.keepAlive
}
})
});
} else if (item.meta.title !== '首页') {
router.addRoute('index', {
path: item.path,
name: name,
component: () => import(`@/views/${item.component}`),
})
}
});
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 上传单个图片
- 不支持上传视频格式、上传音频格式
- 文件超过2M, 请重新上传
- 图片尺寸超过18px*18px,请重新上传!
<!-- 事件图标 -->
<a-col :span="12" :offset="1" class="avatarItem">
<a-form-item
label="事件图标"
name="icon"
>
<a-upload
name="file"
:file-list="iconList"
:beforeUpload="iconBeforeUpload"
@change="iconHandleChange"
:max-count="1"
:show-upload-list="false"
>
<img v-if="formState.icon" :src="formState.icon" alt="avatar" class="avatar" />
<a-button>上传文件</a-button>
</a-upload>
<div class="warning-container">
<img class="warning" src="@/assets/images/roadOverview/warning_icon.png" alt>
<div>支持上传JPG,JPEG,PNG,BMP格式文件大小不大于2MB</div>
</div>
</a-form-item>
</a-col>
// 图标上传
const iconList = ref([]);
const iconHandleChange = (info) => {
const formData = new FormData()
if (info.file.status != 'uploading') {
let file = iconList.value[0]
formData.append("file", file);
if (file.type.includes("image")){
formData.append("biz", "img");
} else if (file.type.includes("video")) {
message.warning('不支持上传视频格式')
return
// formData.append("biz", "video");
}else if (file.type.includes("audio")) {
message.warning('不支持上传音频格式')
return
// formData.append("biz", "voice");
}
uploadApi(formData).then((data) => {
if (data.code == 200) {
message.success("上传成功");
formState.icon = data.message
} else {
message.warn("上传失败");
}
})
}
};
// 图标上传前
const iconBeforeUpload = async(file) => {
const isJpgOrPng = file.type.includes("bmp")|| file.type.includes("jpg") || file.type.includes("png") || file.type.includes("jpeg")
if (!isJpgOrPng) {
message.error('该文件类型暂不支持上传,请重新上传!');
return
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('文件超过2M, 请重新上传');
return
}
const image = new Image();
image.src = window.URL.createObjectURL(file);
await new Promise((resolve, reject) => {
image.onload = resolve;
image.onerror = reject;
});
const isSize = image.width <= 18 && image.height <= 18;
if (!isSize) {
message.error("图片尺寸超过18px*18px,请重新上传!");
return;
}
iconList.value = [file]
return isJpgOrPng && isLt2M && isSize;
};
.avatarItem{
.avatar{
width: 1.875rem;
margin: 0 10px;
background-color: #cbcbcb;
}
/deep/ .ant-form-item-control-input-content{
display: flex;
align-items: center;
}
.warning-container{
color: #34A2FB;
display: flex;
width: 13.75rem;
margin-left: .625rem;
align-items: center;
.warning{
width: 1.25rem;
height: 1.25rem;
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# 聊天功能
/*******获取群聊websocket推送消息*/
function initWebSocket() {
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
//type固定值 pc userId当前登录人id eventId 当前事件id
var userId = store.state.userInfo.id;
var url = (process.env.VUE_APP_API_HOST4).replace("https://","wss://").replace("http://","ws://")+"websocket/pc/"+userId+'/' + globalData.eventDetailsObj.id
// +'/'+new Date().getTime();
console.log("url",url);
console.log("globalData.websockSign",globalData.websockSign);
if(globalData.websockSign !== null && globalData.websockSign.readyState == 1){
//避免重复链接
console.log("websocket 连接已存在...");
}else{
globalData.websockSign = new WebSocket(url);
globalData.websockSign.onopen = (e)=>websocketOnopen(e);
globalData.websockSign.onerror = (e)=>websocketOnerror(e);
globalData.websockSign.onmessage =(e)=>websocketOnmessage(e);
globalData.websockSign.onclose = (e)=>websocketOnclose(e);
}
}
const websocketOnopen = (e) => {
console.log("WebSocket连接成功",e);
message.success('长连接已连上')
}
const websocketOnerror = (e) => {
console.log('WebSocket连接发生错误: ' + e.code + ' ' + e.reason + ' ' + e.wasClean)
if(num==0)message.error('长连接已断开')
if(e.code !== 1000){
console.log("websocket 非正常断开重连...");
reconnect();
}
}
let chatHistoryTimer2 = ref(null)
const websocketOnmessage = (e) => {
videoTotal.value = scenVideoTotal.value
let msgCon = eval("(" + e.data + ")")
let msgList = msgCon.msgList; //解析对象
console.log('websocketOnmessage接收内容',eval("(" + e.data + ")"))
globalData.groupChatArr = msgList
globalData.groupChatArr.map(item=>{
item.msg.map(ele=>{
ele.showDurationSeconds = ele.videoTime * 1
ele.isPlay = false
if (!!ele.videoUrl) {
videoTotal.value = videoTotal.value + 1
ele.videoTotal = videoTotal.value
}
})
})
//刷新流程跟踪节点树(判断是否为app传过来的消息 是则刷新)
if(msgCon.channelId && msgCon.eventId && msgCon.type === "app"){
globalData.taskNodeList.forEach((item,index)=>{
if(item.status != 0 && item.status != '-1'){
getTaskNodeApiFn(item.channelId)
}
})
}
//如果app发送消息的类型是eventInfo,重新刷新事件详情内容
// pc发送消息,重新刷新事件详情内容
if(msgCon.type === "eventInfo"){
findByEventIdApi({eventId:router.currentRoute._value.query.eventId || props.eventDetailData}).then(res=>{
if (res.code === 200) {
let tmpResult = res.result && res.result.records[0]
tmpResult.startTime = tmpResult.startTime ? dayjs(tmpResult.startTime,'YYYY-MM-DD HH:mm:ss') : null
tmpResult.endTime = tmpResult.endTime?dayjs(tmpResult.endTime,'YYYY-MM-DD HH:mm:ss') : null
tmpResult.levelId = tmpResult.levelId ? tmpResult.levelId +'':null
tmpResult.relVehicleInfoJson = tmpResult.relVehicleInfoJson ?JSON.parse(tmpResult.relVehicleInfoJson):[]
globalData.eventDetailsObj = tmpResult
}
})
}
//设置滚动条到最底部
let chatHistory = document.getElementById("chatBox");
if(chatHistory){
// if (chatHistory.scrollHeight > chatHistory.clientHeight) {
chatHistoryTimer2.value = setTimeout(function () {
chatHistory.scrollTop = chatHistory.scrollHeight;
}, 1000 * 0.1);
// }
}
if(eventDynamicsRef.value && msgCon.type === "app"){
eventDynamicsRef.value.queryTimelineByIdFn(globalData.eventDetailsObj.id) //获取时间轴信息
}
eventAddApiFn()
}
const websocketOnclose = (e) => {
console.log('websocket 断开: ' + e.code + ' ' + e.reason + ' ' + e.wasClean)
if(e.code !== 1000){
console.log("websocket 非正常断开重连...");
reconnect();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# 按钮权限控制
//permission.js
//请求菜单、用户信息
getUserPermisson({ token: res.result.token }).then(res2 => {
if (res2.code === 200 && res2.success) {
store.dispatch('userInfo', res2.result.userInfo);
store.dispatch('auth', res2.result.auth);
//动态处理路由
addRoutes(res2.result.menu);
//储存菜单数据
setStorage('menuDatas', res2.result.menu)
}
//默认跳转首页
let goUrl = '/scheduling-page/index'
//如果是大屏
if(to.query.redirectParam && to.query.redirectParam === "lsdPage" ){
goUrl = '/scheduling-page/lsd/visualization'
}
next({ path: goUrl })
}).catch(() => {
//接口请求失败,提示然后跳转到一体化
message.error(res.message);
setTimeout(() => {
removeStorage();
window.location.replace(process.env.VUE_APP_API_HOST2);
window.name="'一体化平台'"
}, 2000);
});
// buttonPermissions.js
// 按钮权限
import store from '@/store/store'
const buttonPermissions = (app) => {
app.directive("buttonCode", {
// 渲染完毕
mounted(el, binding) {
// 获取权限
let auth = store.state.auth
// 对比已有权限和按钮的权限字符
let res = auth.some((item) => {
return binding.value == item.action
})
if(!res) el.remove()
}
})
}
export default buttonPermissions
// main.js
import buttonPermissions from "./utils/directive/buttonPermissions"; //按钮权限
app.use(buttonPermissions) //按钮权限 指令型 v-buttonCode
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 卫星地图
// 切换卫星地图
const isSatelliteLayer = ref(false)
let satellite = new AMap.TileLayer.Satellite()
let roadNet = new AMap.TileLayer.RoadNet()
const toggleMapLayer = () => {
// 切换地图图层
if (isSatelliteLayer.value) {
GDMap.remove([satellite, roadNet])
GDMap.setMapStyle(`amap://styles/02fd07714a3aac53f6cdf9b02998f192`)
}
// 切换卫星地图
else {
GDMap.add([satellite, roadNet])
}
isSatelliteLayer.value = !isSatelliteLayer.value
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 腾讯地图
uniapp
不支持高德地图,所以选择了腾讯地图- 需要生产key关联
appid
- 设置request合法域名,添加
https://apis.map.qq.com
- 路线规划功能仅适用于 jssdkv1.2 (opens new window),下载完后放在项目根目录下面的
static
文件夹下面
<!-- 救援定位组件 -->
<template>
<view class="secure-position-box" >
<map class="secure-position-box__map" id="mapDom" :latitude="dataSource.markers[0].latitude" :longitude="dataSource.markers[0].longitude"
:markers="dataSource.markers" :polyline="dataSource.polyline" show-location="true"></map>
<view v-if="rescueType === 1" class=secure-position-box__wrap>
<!-- 定位信息 -->
<view class="secure-position-box__content">
<view class="secure-position-box__info">
<view class="secure-position-box__info--title">定位信息</view>
<view class="secure-position-box__info--position" @click="resetPosition">重新定位</view>
</view>
<view class="secure-position-box__detail">
<image class="secure-position-box__detail--icon" src="/static/images/resuce/marker-icon.png"
mode="aspectFill"></image>
<view class="secure-position-box__detail--location">{{ dataSource.roadData.roadName }}</view>
</view>
</view>
<!-- 一键救援 -->
<view class="secure-position-box__rescue">
<view class="secure-position-box__rescue--operate">
<view class="secure-position-box__rescue-team">
<view class="secure-position-box__rescue-team--name">救援队</view>
<view class="secure-position-box__rescue-team--phone">02080808080</view>
</view>
<view class="secure-position-box__rescue--icon">
<image class="secure-position-box__rescue--icon-video" @click="toPhone()" src="@/static/images/resuce/rescue-phone-green.png"
mode="aspectFill"></image>
<image class="secure-position-box__rescue--icon-phone" src="/static/images/resuce/rescue-video.png"
mode="aspectFill"></image>
</view>
</view>
<button class="secure-position-box__rescue--btn" @click="toRescueInformation">一键救援</button>
</view>
</view>
<view class="topTip" v-if="rescueType === 2">
<view class="topTipFlex">
<view class="topTipLeft">
<image class="icon" src="@/static/images/resuce/rescue-loding.png"></image>
<text class="time">{{ minute }}:{{ second }}</text>
</view>
<view class="topTipRight">
<view class="topBox">等待救援队响应...</view>
<view class="botBox">
<image class="icon" src="@/static/images/resuce/rescue-video-grey.png"></image>
<view>视频电话</view>
<image class="icon" @click="toPhone()" src="@/static/images/resuce/rescue-phone-green.png"></image>
<view>语音电话</view>
</view>
</view>
</view>
<view class="topTipBtn" @click="cancellation">取消</view>
</view>
<view class="botTip" v-if="rescueType === 3">
<view class="botTipTitle">
<view class="titleLeft">救援队正努力赶来</view>
<view class="titleRight">预计<text> {{ dataSource.reachTime }} </text>到达</view>
</view>
<view class="botTipList">
<text class="label">救援人员</text>
<text class="name">{{ dataSource.rescueTeamData.rescueName }}</text>
<text class="phone">{{ dataSource.rescueTeamData.rescueMobile }}</text>
<image class="icon" @click="toPhone(dataSource.rescueTeamData.rescueMobile)" src="@/static/images/resuce/rescue-phone-green.png"></image>
</view>
<view class="botTipList">
<text class="label">救援类型</text>
<text class="name" v-if="dataSource.rescueTeamData.rescueType === 1"> 拖车 </text>
<text class="name" v-if="dataSource.rescueTeamData.rescueType === 2"> 救护车 </text>
<text class="name" v-if="dataSource.rescueTeamData.rescueType === 3"> 交通事故 </text>
<text class="name" v-if="dataSource.rescueTeamData.rescueType === 4"> 补胎 </text>
<text class="name" v-if="dataSource.rescueTeamData.rescueType === 5"> 车辆事故 </text>
</view>
<view class="botTipList">
<text class="label">所在高速</text>
<text class="name">{{ dataSource.rescueTeamData.highwayName }}</text>
</view>
<view class="botTipList">
<text class="label">救援车牌</text>
<text class="name">{{ dataSource.rescueTeamData.rescuePlateNumber }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref, watch, reactive, onMounted,getCurrentInstance } from "vue"
import { onLoad, onShow, onReady } from '@dcloudio/uni-app'
let { proxy } = getCurrentInstance();
import { request } from '/request/index.js'
// 引入SDK核心类,js文件根据自己业务,位置可自行放置
let QQMapWx = require('../../static/utils/qqmap-wx-jssdk.min.js');
// 实例化API核心类
const qqmapsdk = new QQMapWx({
key: "SWWBZ-YPGCC-3JU2Y-AQZXX-QD2CF-SLB2Z",
});
// 数据源
const dataSource = reactive({
// 通过经纬度获取路段信息
roadData: {},
// 救援车预计到达时间
reachTime:'',
// 救援队信息
rescueTeamData:{},
// 标记点(起点,终点)
markers: [
{
id: 0,
latitude: "",
longitude: "",
width: 22, //宽
height: 30, //高
iconPath: "../../static/images/resuce/marker-icon-red.png",
},
],
// 线路
polyline: [{
points: [],
color: "#5977ff",
width: 5,
// dottedLine: true,//是否虚线
arrowLine: true,//是否带箭头
}],
// 地图实例
mapDom:{}
})
// 根据经纬度计算两点的方向(动态控制救援车图标方向)
const bearing = (start, end) =>{
let rad = Math.PI / 180,
lat1 = start.latitude * rad,
lat2 = end.latitude * rad,
lon1 = start.longitude * rad,
lon2 = end.longitude * rad;
const a = Math.sin(lon2 - lon1) * Math.cos(lat2);
const b = Math.cos(lat1) * Math.sin(lat2) -
Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
const degrees = Math.atan2(a, b) % (2 * Math.PI);
return degrees * 180 / Math.PI;
}
// 通过经纬度获取详细地址接口
const getAdress = async (lon,lat) => {
try {
let {data: res} = await request({
url: `/highway-applet/api/rescue/getHighwayByLngLat?longitude=${lon}&latitude=${lat}`,
method: "get",
})
dataSource.roadData = res.result || {}
} catch (error) {
console.log('error', error)
}
}
// 获取当前定位信息
const getLocate = () => {
uni.getLocation({
type: "gcj02",
success: res => {
dataSource.markers[0].longitude = res.longitude;//经度
dataSource.markers[0].latitude = res.latitude;//维度
// 通过经纬度获取详细地址
getAdress(res.longitude,res.latitude)
// 坐标转详细地址(sdk自带)
// qqmapsdk.reverseGeocoder({
// location: {
// longitude: res.longitude,
// latitude: res.latitude
// },
// //成功后的回调
// success: (r) => {
// console.log('地址信息', r.result);
// dataSource.position = r.result.formatted_addresses.recommend
// },
// fail: function (res) {
// console.log(res);
// }
// })
},
fail: res => {
console.log(res);
}
});
};
// 获取线路规划线路数据
// 查询地图路线
const getQueryMapRoutine = (isClear = false) =>{
qqmapsdk.direction({
mode: 'driving', // 'driving'(驾车路线规划)
// from参数不填默认当前地址
from: {
latitude: isClear ? dataSource.markers[0].latitude : dataSource.markers[1].latitude,
longitude: isClear ? dataSource.markers[0].longitude : dataSource.markers[1].longitude,
},
to:{
latitude: dataSource.markers[0].latitude,
longitude: dataSource.markers[0].longitude,
},
success: (res) => {
if(isClear){
dataSource.polyline[0].points = []
return false
}
console.log('路线规划结果', res);
let coors = res.result.routes[0].polyline
let pl = []
//坐标解压(返回的点串坐标,通过前向差分进行压缩)
let kr = 1000000;
for (let i = 2; i < coors.length; i++) {
coors[i] = Number(coors[i - 2]) + Number(coors[i]) / kr;
}
//将解压后的坐标放入点串数组pl中
for (let i = 0; i < coors.length; i += 2) {
pl.push({ latitude: coors[i], longitude: coors[i + 1] })
}
dataSource.polyline[0].points = pl
// 总距离
let distance = res.result.routes[0].distance >1000 ? (res.result.routes[0].distance/1000).toFixed(2) + "Km" : res.result.routes[0].distance + "m"
dataSource.markers[1].callout.content = `距您${distance}`
// 总时长(res.result.routes[0].duration))
let time = new Date()
let addTime = new Date(time.setMinutes(time.getMinutes() + res.result.routes[0].duration))
let hours = addTime.getHours() < 10 ? "0" + addTime.getHours() : addTime.getHours()
let minutes = addTime.getMinutes() < 10 ? "0" + addTime.getMinutes() : addTime.getMinutes()
dataSource.reachTime = hours + ':' + minutes
// 根据经纬度计算两点的方向角度
dataSource.markers[1].rotate = bearing({
latitude: dataSource.markers[1].latitude,
longitude: dataSource.markers[1].longitude,
},pl[1]) - 180
}
})
}
// 视野回到当前定位
const resetView = () =>{
uni.createMapContext("mapDom", proxy).moveToLocation()
}
// 重新定位
const resetPosition = () => {
getLocate()
resetView()
}
const rescueType = ref(1)//救援状态
const minute = ref('00')//分
const second = ref('00')//秒
let timer = null //计时器轮询
let orderTimer = null //订单轮询
watch(rescueType, (val) => {
// 等待救援队时间(开启计时器)
if (val === 2) {
timer = setInterval(() => {
second.value++
minute.value = parseInt(minute.value)
if (second.value < 10) {
second.value = '0' + second.value
}
if (second.value > 59) {
second.value = '00'
minute.value++
}
if (minute.value < 10) {
minute.value = '0' + minute.value
}
}, 1000)
}
if(val !== 2){
// 停止计时器
clearInterval(timer)
timer = null
minute.value = '00'
second.value = '00'
}
// 轮询查看救援状态
if(val === 2 || val === 3){
// 停止计时器
clearInterval(orderTimer)
orderTimer = null
orderTimer = setInterval(()=>{
getOrderStatus()
},5000)
}
})
// 取消救援
const cancellation = async() => {
// 主动取消救援接口
try {
let res = await request({
url: `/highway-applet/api/rescue/cancelRescue`,
method: "put",
data: {id:uni.getStorageSync('informationData').id}
})
if(res.data.code === 200){
uni.showToast({
title: res.data.message,
icon: 'success',
mask: true,
});
rescueType.value = 1
//救援状态
uni.setStorageSync('isTabbar',1)
uni.removeStorageSync('informationData') // 删除缓存的救援信息、
}
} catch (error) {
console.log('error', error)
}
}
// 查看当前订单状态
const getOrderStatus = async() =>{
try {
let res = await request({
url: `/highway-applet/api/rescue/getListByUserId?cusUserId=${uni.getStorageSync('userInfo').id}`,
method: "get",
isLoading:true
})
// getRecordByUserId
if(res.data.result.length === 0) {
clearInterval(orderTimer)
orderTimer = null
rescueType.value = 1
uni.setStorageSync('isTabbar',1)
// 订单结束删除线路并删除救援图标
if(dataSource.markers.length == 2){
dataSource.markers.splice(1,1)
getQueryMapRoutine(true)
}
return false
}
let data = dataSource.rescueTeamData = res.data.result[0]
// 救援待确认
if(data.status == 0){
rescueType.value = 2
uni.setStorageSync('isTabbar',2)
uni.setStorageSync('informationData',data)
}
// 已确认等待救援
if(data.status == 1){
rescueType.value = 3
uni.setStorageSync('isTabbar',3)
// 救援车图标位置
dataSource.markers[1] = {
id: 1,
latitude: data.rescueLatitude,
longitude: data.rescueLongitude,
callout: {
content: '',
color: "#ccc",
fontSize: "16",
borderRadius: "6",
bgColor: "#ffffff",
padding: "10",
display: "ALWAYS",
anchorY:15
},
width: 15,
height: 30,
iconPath: "../../static/images/resuce/marker-icon-end.png",
rotate:0//旋转角度
}
// 画线路
getQueryMapRoutine()
}
// 救援结束|主动取消
if(data.status == 2 || data.status == 3){
// 停止计时器
clearInterval(orderTimer)
orderTimer = null
rescueType.value = 1
uni.setStorageSync('isTabbar',1)
}
// 救援结束清掉路线
if(data.status == 2 ){
uni.switchTab ({
url: '/pages/rescue/rescue'
});
}
} catch (error) {
console.log('error', error)
}
}
// 点击一键救援
const toRescueInformation = () => {
uni.navigateTo({
url: '/pages/preparation/preparation?params=' + JSON.stringify(dataSource.roadData)
});
}
// 唤起拨号页面
const toPhone = (data) =>{
let phone = data || '02080808080';
const res = uni.getSystemInfoSync();
// ios系统默认有个模态框
if (res.platform == 'ios') {
uni.makePhoneCall({
phoneNumber: phone,
success() {
console.log('拨打成功了');
},
fail() {
console.log('拨打失败了');
}
})
} else {
//安卓手机手动设置一个showActionSheet
uni.showActionSheet({
itemList: [phone, '呼叫'],
success: function(res) {
console.log(res);
if (res.tapIndex == 1) {
uni.makePhoneCall({
phoneNumber: phone,
})
}
}
})
}
}
onShow(() => {
// 从存储里获取当前状态
rescueType.value = uni.getStorageSync('isTabbar') || rescueType.value;
})
onLoad(()=>{
// 获取定位
getLocate()
// 获取订单状态
getOrderStatus()
})
</script>
<style lang="scss" scoped>
.secure-position-box {
box-sizing: border-box;
/* height: calc(100vh - 395rpx); */
height: 100vh;
&__map {
width: 100%;
height: 100%;
}
&__wrap {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 446rpx;
background: #FFFFFF;
border-radius: 38rpx 38rpx 0 0;
}
/* #ifdef H5 */
&__wrap {
position: fixed;
bottom: 100rpx;
left: 0;
right: 0;
height: 446rpx;
background: #FFFFFF;
border-radius: 38rpx 38rpx 0 0;
}
/* #endif */
&__content {
padding: 22rpx 42rpx 38rpx 38rpx;
border-bottom: 2rpx solid #D2D2D2;
}
&__info {
display: flex;
justify-content: space-between;
align-items: center;
&--title {
font-size: 28rpx;
color: #252525;
}
&--position {
font-size: 28rpx;
color: #4367FD;
cursor: pointer;
}
}
&__detail {
display: flex;
align-items: center;
margin-top: 20rpx;
&--icon {
width: 40rpx;
height: 40rpx;
margin-right: 8rpx;
}
&--location {
font-size: 32rpx;
color: #252525;
}
}
&__rescue {
padding: 28rpx 30rpx 0rpx 30rpx;
&--operate {
display: flex;
justify-content: space-between;
align-items: center;
}
&-team {
display: flex;
align-items: center;
&--name {
color: #666666;
font-size: 32rpx;
}
&--phone {
color: #4367FD;
font-weight: bold;
font-size: 36rpx;
margin-left: 20rpx;
}
}
&--icon {
display: flex;
align-items: center;
&-video {
width: 66rpx;
height: 66rpx;
margin-right: 40rpx;
cursor: pointer;
}
&-phone {
width: 66rpx;
height: 66rpx;
margin-right: 14rpx;
cursor: pointer;
}
}
&--btn {
display: flex;
justify-content: center;
align-items: center;
margin-top: 52rpx;
background: #4367FD;
border-radius: 46rpx;
height: 92rpx;
font-size: 32rpx;
color: #FFFFFF;
}
}
.topTip {
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
background: #fff;
width: 100%;
margin: 20rpx 16rpx;
.topTipFlex {
display: flex;
padding-top: 18rpx;
border-bottom: 2rpx solid #F1F1F1;
.topTipLeft {
margin: 0 26rpx 22rpx 34rpx;
width: 180rpx;
height: 180rpx;
background: url("@/static/images/resuce/rescue-loding-background.png") no-repeat;
background-size: cover;
position: relative;
.icon {
width: 160rpx;
height: 160rpx;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
animation: rotation 2s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.time {
display: inline-block;
width: 180rpx;
height: 180rpx;
text-align: center;
line-height: 180rpx;
color: rgb(93, 105, 125);
font-size: 32rpx;
}
}
.topTipRight {
.topBox {
height: 58rpx;
line-height: 58rpx;
font-size: 40rpx;
font-weight: bold;
color: #252525;
}
.botBox {
display: flex;
margin-top: 30rpx;
.icon {
width: 60rpx;
height: 60rpx;
margin-right: 12rpx;
}
view {
height: 60rpx;
line-height: 60rpx;
color: #666666;
font-size: 28rpx;
margin-right: 52rpx;
}
}
}
}
.topTipBtn {
height: 88rpx;
line-height: 88rpx;
color: #4367FD;
font-size: 32rpx;
text-align: center;
}
}
.botTip {
box-sizing: border-box;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 16rpx 2rpx rgba(67, 103, 253, 0.08);
border-radius: 32rpx 32rpx 0rpx 0rpx;
padding: 42rpx 34rpx 25rpx 38rpx;
/* #ifdef H5 */
.botTip {
box-sizing: border-box;
position: fixed;
bottom: 100rpx;
left: 0;
width: 100%;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 16rpx 2rpx rgba(67, 103, 253, 0.08);
border-radius: 32rpx 32rpx 0rpx 0rpx;
padding: 42rpx 34rpx 25rpx 38rpx;
}
/* #endif */
.botTipTitle {
display: flex;
justify-content: space-between;
align-items: center;
.titleLeft {
height: 60rpx;
line-height: 60rpx;
font-size: 40rpx;
font-weight: bold;
color: #252525;
}
.titleRight {
font-size: 36rpx;
color: #666666;
text {
color: #4367FD;
}
}
}
.botTipList {
position: relative;
.label {
height: 66rpx;
line-height: 66rpx;
font-size: 32rpx;
color: #666666;
margin-right: 32rpx;
}
.name {
height: 66rpx;
line-height: 66rpx;
font-size: 36rpx;
color: #111111;
}
.phone {
margin-left: 16rpx;
color: #4367FD;
font-size: 36rpx;
}
.icon {
width: 60rpx;
height: 60rpx;
vertical-align: middle;
position: absolute;
top: 0;
right: 0;
}
}
}
}</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
# 请求头签名
npm i -S CryptoJS
// utils.js
import CryptoJS from "crypto-js";
// 获取签名
export function generateSignature(method, uri, query, secretKey) {
// uri = uri.replace('/highway-applet/api','/highway-applet//api')//暂时
const message = method + uri + (query ? '?' + query : '') + secretKey;
const hash = CryptoJS.SHA256(message);
const signature = CryptoJS.enc.Base64.stringify(hash);
return signature;
}
// https://gaosudanao.gci-china.com
export function getBaseUrl() {
const baseUrl = process.env.NODE_ENV === 'development' ? 'https://gongludanaoyitihuapingtaiwxapp.gzydzf.com' : 'https://gongludanaoyitihuapingtaiwxapp.gzydzf.com'
return baseUrl;
}
// 提示信息
export function showToastFn(message){
setTimeout(()=>{
uni.showToast({
title: message,
icon: 'none',
mask: true
})
},0)
return showToastFn
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# uniapp封装请求
// request/index.js
import { generateSignature, getBaseUrl, showToastFn } from '../common/utils.js'
let ajaxNum = 0;
export const request = (params) => {
// if (params.method.toUpperCase() === 'PUT') {
// uni.showToast({
// title: '保存成功',
// icon: 'success',
// mask: true,
// });
// } else if(params.method.toUpperCase() !== 'PUT' && !params.isLoading) {
// uni.showLoading({
// title: '加载中',
// mask: true,
// });
// }
if(!params.isLoading){
uni.showLoading({
title: '加载中',
mask: true,
});
}
// 设置请求头签名
let header = {}
if (params.url === '/highway-applet/api/login/wxLogin' || params.url === '/highway-applet/api/login/getAuthorization' || params.url.includes('/highway-applet/api/login/getCusInfoByMinaId')) {
header = undefined
} else {
// 获取接口对应的签名
let signature = ''
if (params.url.includes('?')) {
signature = generateSignature(params.method.toUpperCase(), params.url.split('?')[0], params.url.split('?')[1], 'Gsgl@2023-!')
} else {
signature = generateSignature(params.method.toUpperCase(), params.url, '', 'Gsgl@2023-!')
}
header = {
'X-Signature': signature
}
}
ajaxNum++;
return new Promise((resolve, reject)=>{
uni.request({
...params,
header,
url: getBaseUrl() + params.url,
success: (result) => {
// if(!params.isLoading){
// uni.hideLoading()
// }
ajaxNum--;
if (result.data.code !== 200) {
showToastFn(result.data.message || '接口出错')
return false
}
resolve(result)
},
fail: (err) => {
showToastFn('网络不给力,请稍后重试!')
reject(err)
},
complete: () => {
if(ajaxNum === 0){}
uni.hideLoading({
fail(){}
});
}
});
})
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 小程序登录流程
@getphonenumber
查看用户是否授权成功,没成功拒绝访问- 用户授权则调用
uin.login
的code
去获取用户的openid
和sessionkey
- 获取用户的个人信息,调用
uni.getUserInfo
(需要传递openid、sessionkey、encryptedData、iv、avatarUrl、nickName
)
import { request } from '/request/index.js'
//解决 体验版|正式版 手机授权第一次解密失败
uni.login({
provider: 'weixin',
success: async(loginRes) => {
}
})
// 字典项
let dictionaryList = ['rescue_type', 'rescue_occupy_lane','schedule_vehicle_type' ]
const decryptPhoneNumber = (phoneData) => {
if(!phoneData.detail.code) return false //拒绝授权
uni.login({
provider: 'weixin', //使用微信登录
success: async(loginRes) => {
let res = await request({
url: `/highway-applet/api/login/getAuthorization`,
method: "post",
data:{
code: loginRes.code
}
})
if(res.data.code === 200){
const sessionKey = res.data.result.sessionKey;
const openid = res.data.result.openid;
uni.getUserInfo({
success: async headData => {
const encryptedData = phoneData.detail.encryptedData;
const iv = phoneData.detail.iv;
let res = await request({
url: `/highway-applet/api/login/wxLogin`,
method: "post",
data:{
openid: openid, //授权用户唯一标识
sessionKey: sessionKey,//会话秘钥
encryptedData: encryptedData,//手机号加密字段
iv: iv,//初始化向量
avatarUrl: headData.userInfo.avatarUrl,//头像地址
nickName: headData.userInfo.nickName,//昵称
}
})
if(res.data.code === 200 && res.data.result){
// 首次登录将个人信息存入缓存
uni.setStorageSync('userInfo', res.data.result.userInfo);
uni.switchTab ({
url: '/pages/rescue/rescue'
});
for(let item of dictionaryList){
getDictionaryData(item)
}
}
}
})
}
},
});
}
let dictionary = {}
// 通过字典编号获取字典数据
const getDictionaryData = async (type) =>{
try {
let {data: res} = await request({
url: `/highway-applet/api/plate/getDictByCode?dictCode=${type}`,
method: "get",
})
switch(type){
case 'rescue_type':
dictionary.rescueData = res.result//救援类型
break;
case 'rescue_occupy_lane':
dictionary.laneData = res.result//占用车道
break;
case 'schedule_vehicle_type':
dictionary.accidentCar = res.result//事故车辆
break;
}
uni.setStorageSync('dictionary', dictionary);
} catch (error) {
console.log('error', error)
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# xm-keyboard
支持Vue3的车牌键盘
<view class="xm-box" :class="showKeyBoard ? 'show':''" @tap="toShow">
<view class="xm-input" :class="plateNumber.length === index ? 'cur':''" v-for="(item, index) in 8" :key="index">
{{ plateNumber.charAt(index) }}
</view>
</view>
<xm-keyboard v-model="showKeyBoard" maxAutoClose :show="showKeyBoard" :mask="false" @change="data => changeValue(data)" :maxLength="8" :defaultValue="plateNumber" :mode="keyMode" @close="e => closeShow(e)"></xm-keyboard>
let showKeyBoard = ref(false)
let keyMode = computed(() => {
let length = plateNumber.value.length;
if(length == 0) return 0;
return 1
})
const toShow = () => {
showKeyBoard.value = true
isFocus.value = true
}
const changeValue = (data) => {
plateNumber.value = data.text
}
.xm-box{
display: flex;
justify-content: space-between;
margin-left: 52rpx;
&.show{
.cur {
border-color: #4367FD;
@keyframes blink{
0%{
opacity: 0;
}
50%{
opacity: 1;
}
100%{
opacity: 0;
}
}
&::after{
color: #4367FD;
content: '|';
animation: blink 1s infinite;
}
}
}
.xm-input{
margin-right: 20rpx;
border: 2rpx solid #ADADAD;
border-radius: 5rpx;
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 36rpx;
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 代码格式化
// .prettierrc
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
// .eslintrc.js
rules: {
'no-console.log': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'indent': 0,
'space-before-function-paren': 0
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# Antd vue样式
# radio
:deep(.ant-radio-group) {
flex-direction: column;
}
:deep(.ant-radio-wrapper) {
color: #CCD1DC;
font-size: 18px;
}
:deep(.ant-radio-inner) {
background: #294680;
border: 1px solid #409EFF;
}
:deep(.ant-radio-inner)::after {
background: #409EFF;
}
:deep(.ant-radio-wrapper.ant-radio-wrapper-checked .ant-radio-inner) {
/* 取消选中瞬间的白色样式 */
box-shadow: none;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 滚动条
.organ-box::-webkit-scrollbar {
/*滚动条整体样式*/
width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
height: 1px;
}
.organ-box::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 10px;
background-color: #0180FF;
}
.organ-box::-webkit-scrollbar-track {
/*滚动条里面轨道*/
background: #083D8E;
border-radius: 10px;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 处理页面空白chunk load failed
// 处理页面空白chunk load failed
router.onError((error) => {
const pattern = /Loading chunk (\d)+ failed/g;
const isChunkLoadFailed = error.message.match(pattern);
if(isChunkLoadFailed){
// 用路由的replace方法,并没有相当于F5刷新页面,失败的js文件并没有从新请求,会导致一直尝试replace页面导致死循环,而用 location.reload 方法,相当于触发F5刷新页面,虽然用户体验上来说会有刷新加载察觉,但不会导致页面卡死及死循环,从而曲线救国解决该问题
window.location.reload();
// const targetPath = router.history.pending.fullPath;
// router.replace(targetPath);
} else {
console.log('error', error)
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 页面只弹出一个接口请求报错提示
Axios.interceptors.response.use(res => {
//token是否超过有效期
let tokens = JSON.parse(sessionStorage.getItem('tokenTimes'))
if(tokens&&tokens.termOfValidity){
let nowTime = new Date();
// console.log("得很好:",parseInt(nowTime-new Date(tokens.currentTime))/1000/60)
// console.log("得很好:",new Date(tokens.currentTime))
let timeDiff = parseInt(nowTime-new Date(tokens.currentTime))/1000/60;
if(Math.ceil(timeDiff)>9){
// console.log("需要刷新token了")
}
}
// 获取文件名
if(res.headers['content-disposition'])res.data['content-disposition'] = res.headers['content-disposition']
// 响应拦截处理
return res.data;
}, error => {
const err = error.toString();
//按照实际的响应包进行解析,通过关键字匹配的方式
if (error.response?.message === 'Token失效,请重新登录'||error.response?.data.message === 'Token失效,请重新登录') {
// 页面只弹出一个接口请求报错提示
if (store.state.errIndex === 0) {
message.error('很抱歉,登录已过期,请重新登录')
store.commit('SET_ERR_INDEX', 1)
}
removeStorage();
setTimeout(() => {
window.location.replace(window._CONFIG['goBackUrl']);
window.name="'一体化平台'"
}, 1500)
return;
}
// switch (true) {
// case err.indexOf('Network') !== -1:
// console.log('后端服务器无响应或者URL错误', err);
// message.error('后端服务器无响应或者URL错误');
// break;
// case err.indexOf('timeout') !== -1:
// console.log('请求后端服务器超时!', err);
// message.error('请求后端服务器超时!');
// break;
// default:
// message.error(error.response.data.message||'接口请求出错!');
// break
// }
if(error.message.indexOf('Network') !== -1) {
console.log('后端服务器无响应或者URL错误', err);
message.error('后端服务器无响应或者URL错误');
}else if (error.message.indexOf('timeout') !== -1) {
console.log('请求后端服务器超时!', err);
message.error('请求后端服务器超时!');
}else {
message.error(error.response?.data.message||'接口请求出错!');
}
return Promise.reject(error);
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
编辑 (opens new window)
上次更新: 2023/08/14, 09:24:32