fix:websocket接入,大屏修改部分

This commit is contained in:
SunTao 2024-11-14 17:43:24 +08:00
parent 912137cf0c
commit 26e6fd8584
14 changed files with 1071 additions and 241 deletions

View File

@ -68,6 +68,7 @@
"vue-seamless-scroll": "^1.1.23", "vue-seamless-scroll": "^1.1.23",
"vuedraggable": "2.24.3", "vuedraggable": "2.24.3",
"vuex": "3.6.0", "vuex": "3.6.0",
"websocket": "^1.0.35",
"xcrud": "^0.4.19" "xcrud": "^0.4.19"
}, },
"devDependencies": { "devDependencies": {

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-24 15:03:28 * @Date: 2024-10-24 15:03:28
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-06 13:25:37 * @LastEditTime: 2024-11-14 09:16:02
* @FilePath: \znxjxt-ui\src\api\xj\screen\index.js * @FilePath: \znxjxt-ui\src\api\xj\screen\index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
@ -17,10 +17,18 @@ export function selectTypeList(query) {
}); });
} }
// v1
// 获取地图打点数据接口 // 获取地图打点数据接口
// export function mapPointList(query) {
// return request({
// url: "/bigscreen/getMapPoint",
// method: "get",
// params: query,
// });
// }
export function mapPointList(query) { export function mapPointList(query) {
return request({ return request({
url: "/bigscreen/getMapPoint", url: "/bigscreen/v2/getMapPoint",
method: "get", method: "get",
params: query, params: query,
}); });
@ -79,12 +87,21 @@ export function getSegment(data) {
}); });
} }
// 根据选择的按钮类型查下级选项框 // 病害筛选根据点击的详情查图片详情
export function getItemTypes(params) { export function getMediaIndex(data){
return request({ return request({
url: "/metadata/getItemTypes", url: "/bigscreen/v2/getTableIndex",
method: "post",
data,
});
}
// 根据选择的按钮类型查下级选项框
export function getItemTypes(query) {
return request({
url: "/bigscreen/v2/getAllDefectType",
method: "get", method: "get",
params, params: query,
}); });
} }

View File

@ -20,7 +20,7 @@ export function getSegment() {
// 病害类型下拉数据 // 病害类型下拉数据
export function getDefectList(params) { export function getDefectList(params) {
return request({ return request({
url: "/metadata/defectType", url: "/bigscreen/v2/getAllDefectType",
method: "get", method: "get",
params, params,
}); });

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 10:46:23 * @Date: 2024-10-14 10:46:23
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-06 16:42:42 * @LastEditTime: 2024-11-14 16:58:34
* @FilePath: \znxjxt-ui\src\views\xj\inspection\task-management\components\fssm-map.vue * @FilePath: \znxjxt-ui\src\views\xj\inspection\task-management\components\fssm-map.vue
* @Description: 公共地图 * @Description: 公共地图
--> -->
@ -150,6 +150,7 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
}, },
/* 监听传过来的底图类型 */ /* 监听传过来的底图类型 */
baseMap: { baseMap: {
handler(val) { handler(val) {
@ -211,7 +212,7 @@ export default {
minZoom: 7, minZoom: 7,
maxZoom: 18, maxZoom: 18,
}), }),
layers: [ tianditu_img_c, tianditu_cva_c], layers: [tianditu_img_c, tianditu_cva_c],
}); });
// //
map.on("singleclick", (e) => { map.on("singleclick", (e) => {

229
src/plugins/websocket.js Normal file
View File

@ -0,0 +1,229 @@
/*
* @Author: SunTao 328867980@qq.com
* @Date: 2024-11-13 17:13:54
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 17:14:13
* @FilePath: \znxjxt-ui\src\plugins\websocket.js
* @Description: websocket传输
*/
// websocket实例
let wsObj = null;
// ws连接地址
let wsUrl = null;
// let userId = null;
// 是否执行重连 true/不执行 false/执行
let lockReconnect = false;
// 重连定时器
let wsCreateHandler = null;
// 连接成功,执行回调函数
let messageCallback = null;
// 连接失败,执行回调函数
let errorCallback = null;
// 发送给后台的数据
let sendDatas = {};
/**
* 发起websocket请求函数
* @param {string} url ws连接地址
* @param {Object} agentData 传给后台的参数
* @param {function} successCallback 接收到ws数据对数据进行处理的回调函数
* @param {function} errCallback ws连接错误的回调函数
*/
export const connectWebsocket = (url, agentData, successCallback, errCallback) => {
wsUrl = url;
createWebSoket();
messageCallback = successCallback;
errorCallback = errCallback;
sendDatas = agentData;
};
// 手动关闭websocket 这里手动关闭会执行onclose事件
export const closeWebsocket = () => {
if (wsObj) {
writeToScreen("手动关闭websocket");
wsObj.close(); // 关闭websocket
// wsObj.onclose() // 关闭websocket(如果上面的关闭不生效就加上这一条)
// 关闭重连
lockReconnect = true;
wsCreateHandler && clearTimeout(wsCreateHandler);
// 关闭心跳检查
heartCheck.stop();
}
};
//向服务器端发送消息
export const sendMsg = value => {
wsObj.send(JSON.stringify(value));
};
// 创建ws函数
const createWebSoket = () => {
//判断浏览器是否支持websocket
if (typeof WebSocket === "undefined") {
writeToScreen("您的浏览器不支持WebSocket无法获取数据");
return false;
}
// const host = window.location.host; //获取端口
// userId = GetQueryString("userId");
// wsUrl = "ws://" + host + "/websoket" + userId;
try {
wsObj = new WebSocket(wsUrl);
initWsEventHandle();
} catch (e) {
writeToScreen("连接异常,开始重连");
reconnect();
}
};
const initWsEventHandle = () => {
try {
// 连接成功
wsObj.onopen = event => {
// heartCheck.start(); //开启心跳
onWsOpen(event); //客户端与服务器端通信
};
// 监听服务器端返回的信息
wsObj.onmessage = event => {
onWsMessage(event); //接收数据,抛出
// heartCheck.reset(); //重置心跳
};
wsObj.onclose = event => {
writeToScreen("onclose执行关闭事件");
onWsClose(event); //关闭事件
};
wsObj.onerror = event => {
writeToScreen("onerror执行error事件开始重连");
onWsError(event); //error事件
reconnect(); //重连
};
} catch (err) {
writeToScreen("绑定事件没有成功,开始重连");
reconnect();
}
};
//open事件 WebSocket连接成功时触发
const onWsOpen = event => {
// 客户端与服务器端通信
// wsObj.send('我发送消息给服务端');
// 添加状态判断当为OPEN时发送消息
if (wsObj.readyState === wsObj.OPEN) {
// wsObj.OPEN = 1
// 发给后端的数据需要字符串化
wsObj.send(JSON.stringify(sendDatas));
}
if (wsObj.readyState === wsObj.CLOSED) {
// wsObj.CLOSED = 3
writeToScreen("wsObj.readyState=3, ws连接异常开始重连");
reconnect();
errorCallback(event);
}
};
//message事件 接收到WebSocket服务器发送的消息时触发
const onWsMessage = event => {
const jsonStr = event.data;
// writeToScreen("onWsMessage接收到服务器的数据: ", jsonStr);
messageCallback(jsonStr);
};
//close事件 WebSocket连接关闭时触发
const onWsClose = event => {
writeToScreen("DISCONNECT");
// e.code === 1000 表示正常关闭。 无论为何目的而创建, 该链接都已成功完成任务。
// e.code !== 1000 表示非正常关闭。
console.log("onclose event: ", event);
if (event && event.code !== 1000) {
writeToScreen("非正常关闭");
errorCallback(event);
// 如果不是手动关闭,这里的重连会执行;如果调用了手动关闭函数,这里重连不会执行
reconnect();
}
};
//error事件 WebSocket连接出错时触发
const onWsError = event => {
writeToScreen("onWsError: ", event.data);
errorCallback(event);//抛出错误
};
//封装console.log()
const writeToScreen = massage => {
console.log(massage);
};
// 重连函数
const reconnect = () => {
if (lockReconnect) {
return;
}
writeToScreen("3秒后重连");
lockReconnect = true;
// 没连接上会一直重连,设置延迟避免请求过多
wsCreateHandler && clearTimeout(wsCreateHandler);
wsCreateHandler = setTimeout(() => {
writeToScreen("重连..." + wsUrl);
createWebSoket();
lockReconnect = false;
writeToScreen("重连完成");
}, 5000);
};
// 从浏览器地址中获取对应参数
const GetQueryString = name => {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
// 获取url中 ? 符后的字符串并正则匹配
let r = window.location.search.substr(1).match(reg);
let context = "";
r && (context = r[2]);
reg = null;
r = null;
return context;
};
// 心跳检查看看websocket是否还在正常连接中
let heartCheck = {
timeout: 15 * 1000,
timeoutObj: null,
serverTimeoutObj: null,
// 重启
reset() {
clearTimeout(this.timeoutObj);
clearTimeout(this.serverTimeoutObj);
this.start();
},
// 停止
stop() {
clearTimeout(this.timeoutObj);
clearTimeout(this.serverTimeoutObj);
},
// 开启定时器
start() {
this.timeoutObj && clearTimeout(this.timeoutObj);
this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
// 15s之内如果没有收到后台的消息则认为是连接断开了需要重连
this.timeoutObj = setTimeout(() => {
writeToScreen("心跳检查发送ping到后台");
try {
const datas = { content: "心跳检测" };
wsObj.send(JSON.stringify(datas));
} catch (err) {
writeToScreen("发送ping异常,重连");
reconnect();
}
// console.log("内嵌定时器this.serverTimeoutObj: ", this.serverTimeoutObj);
// 内嵌定时器
this.serverTimeoutObj = setTimeout(() => {
writeToScreen("没有收到后台的数据,重新连接");
reconnect();
}, this.timeout);
}, this.timeout);
},
};

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-22 15:30:25 * @Date: 2024-10-22 15:30:25
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 13:31:49 * @LastEditTime: 2024-11-14 16:44:42
* @FilePath: \znxjxt-ui\src\views\big-screen\components\img-dialog.vue * @FilePath: \znxjxt-ui\src\views\big-screen\components\img-dialog.vue
* @Description: 大屏查看图片弹窗 * @Description: 大屏查看图片弹窗
--> -->
@ -53,6 +53,7 @@
v-model="imgForm.segmentId" v-model="imgForm.segmentId"
placeholder="请选择路段名称" placeholder="请选择路段名称"
:popper-append-to-body="false" :popper-append-to-body="false"
filterable
clearable clearable
> >
<el-option <el-option
@ -84,18 +85,32 @@
<el-input <el-input
v-model="imgForm.stakeStart" v-model="imgForm.stakeStart"
placeholder="起始公里桩" placeholder="起始公里桩"
style="width: 8rem" style="width: 6rem"
clearable clearable
/> />
<span style="margin: 0 5px">-</span> <span style="margin: 0 5px">-</span>
<el-input <el-input
v-model="imgForm.stakeEnd" v-model="imgForm.stakeEnd"
placeholder="终止公里桩" placeholder="终止公里桩"
style="width: 8rem" style="width: 6rem"
clearable clearable
/> />
</el-form-item> </el-form-item>
<el-form-item class="form-item" label="病害状态" prop="state">
<el-select
v-model="imgForm.state"
:popper-append-to-body="false"
placeholder="请选择病害状态"
clearable
>
<el-option
v-for="item in defectStatus"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-button <el-button
type="primary" type="primary"
class="btn-submit" class="btn-submit"
@ -162,10 +177,24 @@
</template> </template>
<script> <script>
import { getDefectStatus } from "@/api/xj/disease"; import {
import { defeaseList, getSegment, getItemTypes } from "@/api/xj/screen/index"; defeaseList,
getSegment,
getItemTypes,
getMediaIndex,
} from "@/api/xj/screen/index";
export default { export default {
name: "ImgDialog", name: "ImgDialog",
props: {
bottomTipClick: {
type: String,
default: "",
},
imageItem: {
type: Object,
default: () => {},
},
},
data() { data() {
return { return {
// //
@ -179,11 +208,13 @@ export default {
// index // index
currentIndex: 0, currentIndex: 0,
// index // index
selectedThumbnail: null, selectedThumbnail: 0,
// //
loading: false, loading: false,
// //
imgForm: { imgForm: {
// id
id: null,
// //
segmentId: "", segmentId: "",
// //
@ -192,31 +223,37 @@ export default {
stakeStart: "", stakeStart: "",
// //
stakeEnd: "", stakeEnd: "",
//
state: "",
}, },
// //
roadTypeList: [], roadTypeList: [],
// //
defectTypeList: [], defectTypeList: [],
//
defectStatus: [
{ label: "已修复", value: "2" },
{ label: "未修复", value: "1" },
],
// //
params: { params: {
page: 1, page: 1,
size: 10, size: 10,
}, },
pageTip: 1,
// //
rectItem: [], rectItem: [],
colorList: ["#FF0000", "#07E8E2", "#DD9F18", "#994EFF", "#08B4A6"], colorList: ["#FFFFFF", "#07E8E2", "#DD9F18", "#994EFF", "#08B4A6"],
//
defectStatus: [],
}; };
}, },
computed: { computed: {
// url // url
currentImage() { currentImage() {
if (this.defectData.length > 0) { if (
// this.rectItem = this.defectData.length > 0 &&
// this.defectData[this.currentIndex]?.items[ this.defectData.length > this.currentIndex
// this.selectedThumbnail ) {
// ]?.children; // this.showImage(this.currentIndex);
return this.defectData[this.currentIndex].items[this.selectedThumbnail] return this.defectData[this.currentIndex].items[this.selectedThumbnail]
.img; .img;
} }
@ -226,34 +263,25 @@ export default {
return this.defectData[this.currentIndex]?.items || []; return this.defectData[this.currentIndex]?.items || [];
}, },
}, },
watch: {
imageItem: {
handler() {
this.getMediaBySnapshotid();
},
deep: true,
immediate: true,
},
bottomTipClick: {
handler() {
this.getDefectType();
},
},
},
created() { created() {
this.getList();
this.showImage(0);
this.getSegmentList(); this.getSegmentList();
this.getDefectStatusList();
this.getDefectType(); this.getDefectType();
}, },
methods: { methods: {
/* 查询病害状态下拉数据 */
getDefectStatusList() {
getDefectStatus().then(({ data, code }) => {
if (code === 200) {
this.defectStatus = data;
}
});
},
/* 过滤列表病害状态 */
filterState(value) {
let a = null;
[a] = this.defectStatus.filter((item) => {
return item.value === value;
});
if (a) {
return a.label;
}
},
/* 获取路段下拉数据 */ /* 获取路段下拉数据 */
getSegmentList() { getSegmentList() {
getSegment().then(({ code, data }) => { getSegment().then(({ code, data }) => {
@ -265,10 +293,29 @@ export default {
/* 获取病害类型下拉数据 */ /* 获取病害类型下拉数据 */
getDefectType() { getDefectType() {
getItemTypes({ type: "defect" }).then(({ code, data }) => { getItemTypes({ classType: this.bottomTipClick }).then(
({ code, data }) => {
if (code === 200) { if (code === 200) {
this.defectTypeList = data; this.defectTypeList = data;
} }
}
);
},
/* 根据传回来的快照id查图片详细数据 */
getMediaBySnapshotid() {
getMediaIndex({
classType: this.bottomTipClick,
id: this.imageItem.snapshotId,
}).then(({ code, data }) => {
if (code === 200) {
this.currentIndex = data.index;
this.pageTip = data.page;
this.params.page = data.page;
this.params.size = data.size;
this.imgForm.segmentId = data.segmentId.toString();
this.getList();
}
}); });
}, },
@ -290,23 +337,55 @@ export default {
} }
}, },
/* 获取图片列表/点击搜索事件 */ /* 向下获取图片列表 */
getList() { getList() {
this.loading = true; this.loading = true;
const data = { const data = {
classType: this.bottomTipClick,
...this.imgForm, ...this.imgForm,
...this.params, ...this.params,
}; };
defeaseList(data) defeaseList(data)
.then((response) => { .then(({ code, data }) => {
this.aimList.push(...response.data.aim); if (code === 200) {
this.ariaList.push(...response.data.aria); this.aimList.push(...data.aim);
this.ariaList.push(...data.aria);
if (this.labelCheck === "aria") { if (this.labelCheck === "aria") {
this.defectData = this.ariaList; this.defectData = this.ariaList;
} else { } else {
this.defectData = this.aimList; this.defectData = this.aimList;
} }
this.loading = false; this.loading = false;
}
})
.finally(() => {
// this.showImage(this.currentIndex);
})
.catch(() => {
this.loading = false;
});
},
/* 向上获取列表数据 */
getListTop() {
this.loading = true;
const data = {
classType: this.bottomTipClick,
...this.imgForm,
...this.params,
};
defeaseList(data)
.then(({ code, data }) => {
if (code === 200) {
this.aimList.unshift(...data.aim);
this.ariaList.unshift(...data.aria);
if (this.labelCheck === "aria") {
this.defectData = this.ariaList;
} else {
this.defectData = this.aimList;
}
this.loading = false;
}
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
@ -319,6 +398,8 @@ export default {
if (this.imgForm.stakeStart) { if (this.imgForm.stakeStart) {
if (stakeReg.test(this.imgForm.stakeStart)) { if (stakeReg.test(this.imgForm.stakeStart)) {
this.defectData = []; this.defectData = [];
this.ariaList = [];
this.aimList = [];
this.params = { this.params = {
page: 1, page: 1,
size: 10, size: 10,
@ -331,6 +412,8 @@ export default {
} else if (this.imgForm.stakeEnd) { } else if (this.imgForm.stakeEnd) {
if (stakeReg.test(this.imgForm.stakeEnd)) { if (stakeReg.test(this.imgForm.stakeEnd)) {
this.defectData = []; this.defectData = [];
this.ariaList = [];
this.aimList = [];
this.params = { this.params = {
page: 1, page: 1,
size: 10, size: 10,
@ -342,6 +425,8 @@ export default {
} }
} else { } else {
this.defectData = []; this.defectData = [];
this.ariaList = [];
this.aimList = [];
this.params = { this.params = {
page: 1, page: 1,
size: 10, size: 10,
@ -354,11 +439,14 @@ export default {
/* 重置事件 */ /* 重置事件 */
resetQuery() { resetQuery() {
this.defectData = []; this.defectData = [];
this.ariaList = [];
this.aimList = [];
this.imgForm = { this.imgForm = {
segmentId: "", segmentId: "",
defectType: "", defectType: "",
stakeStart: "", stakeStart: "",
stakeEnd: "", stakeEnd: "",
state: "",
}; };
this.params = { this.params = {
page: 1, page: 1,
@ -370,9 +458,9 @@ export default {
/* 左侧点击图片事件 */ /* 左侧点击图片事件 */
showImage(index) { showImage(index) {
if (this.currentIndex === this.defectData.length - 1) { // if (this.currentIndex === this.defectData.length - 1) {
this.loadMoreImages(); // this.loadMoreBottomImages();
} // }
this.currentIndex = index; this.currentIndex = index;
this.selectedThumbnail = 0; // Reset to the first thumbnail when changing the main item this.selectedThumbnail = 0; // Reset to the first thumbnail when changing the main item
this.scrollToCurrentImage(); this.scrollToCurrentImage();
@ -402,27 +490,41 @@ export default {
}, },
/* 滚动触发事件 */ /* 滚动触发事件 */
handleScroll() { handleScroll(e) {
// +
const sidebar = this.$refs.sidebar; const sidebar = this.$refs.sidebar;
//
if (e.target.scrollTop < 1 && this.pageTip > 1 && !this.loading) {
this.loadMoreTopImages();
}
//
// +
if ( if (
sidebar.scrollTop + sidebar.clientHeight >= sidebar.scrollHeight - 1 && sidebar.scrollTop + sidebar.clientHeight >= sidebar.scrollHeight - 1 &&
!this.loading !this.loading
) { ) {
this.loadMoreImages(); this.loadMoreBottomImages();
} }
// if (this.currentIndex === this.defectData.length - 1) { // if (this.currentIndex === this.defectData.length - 1) {
// this.loadMoreImages(); // this.loadMoreBottomImages();
// } // }
}, },
/* 加载更多图片方法 */ /* 向下加载更多图片方法 */
loadMoreImages() { loadMoreBottomImages() {
this.params.page += 1; this.params.page += 1;
this.getList(); this.getList();
}, },
/* 点击目标详情事件 */ /* 向上加载更多图片 */
loadMoreTopImages() {
this.pageTip -= 1;
this.params.page -= 1;
this.currentIndex += this.params.size;
this.getListTop();
},
/* 点击目标详情/空间维度事件 */
clickImage(item) { clickImage(item) {
if (this.labelCheck === "aim") { if (this.labelCheck === "aim") {
this.labelCheck = "aria"; this.labelCheck = "aria";
@ -457,7 +559,7 @@ export default {
this.scrollToCurrentImage(); this.scrollToCurrentImage();
this.updateRects(); this.updateRects();
} else { } else {
this.loadMoreImages(); this.loadMoreBottomImages();
} }
} }
}, },
@ -618,7 +720,7 @@ export default {
} }
.el-select { .el-select {
width: 10rem; width: 8rem;
.el-input--small .el-input__inner { .el-input--small .el-input__inner {
color: #ffffff; color: #ffffff;
@ -674,6 +776,7 @@ export default {
.image-info { .image-info {
width: 100%; width: 100%;
background-color: rgba(0, 0, 0, 0.5);
} }
} }
@ -694,6 +797,7 @@ export default {
> div { > div {
cursor: pointer; cursor: pointer;
white-space: nowrap;
position: absolute; position: absolute;
top: -1.2rem; top: -1.2rem;
} }
@ -703,7 +807,7 @@ export default {
.rect-image { .rect-image {
width: 80%; width: 80%;
position: absolute; position: absolute;
bottom: 0; top: 0;
} }
.image-viewer { .image-viewer {

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-08 11:56:02 * @Date: 2024-11-08 11:56:02
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 15:09:42 * @LastEditTime: 2024-11-14 13:12:32
* @FilePath: \znxjxt-ui\src\views\big-screen\traffic-components\traffic-log.vue * @FilePath: \znxjxt-ui\src\views\big-screen\traffic-components\traffic-log.vue
* @Description: 病害巡检-病害日志 * @Description: 病害巡检-病害日志
--> -->
@ -151,10 +151,8 @@
<script> <script>
import { emergencyData, DefectType } from "@/api/xj/screen/traffic-screen"; import { emergencyData, DefectType } from "@/api/xj/screen/traffic-screen";
import { getSegment } from "@/api/xj/screen/index"; import { getSegment } from "@/api/xj/screen/index";
import vueSeamlessScroll from "vue-seamless-scroll";
export default { export default {
name: "TrafficLog", name: "TrafficLog",
components: { vueSeamlessScroll },
props: { props: {
// 4 // 4
bottomTipClick: { bottomTipClick: {
@ -187,17 +185,6 @@ export default {
{ label: "已修复", value: "2" }, { label: "已修复", value: "2" },
{ label: "未修复", value: "1" }, { label: "未修复", value: "1" },
], ],
//
defaultOption: {
step: 0.2, //
limitMoveNum: 1,
hoverStop: true, // stop
direction: 1, // 0 1 2 3
openWatch: true, // dom
singleHeight: 0, // (0)direction => 0/1
singleWidth: 0, // (0) direction => 2/3
waitTime: 2000, // (1000ms)
},
// //
emergencyList: [], emergencyList: [],
// //
@ -274,11 +261,26 @@ export default {
}; };
emergencyData(data).then(({ code, data }) => { emergencyData(data).then(({ code, data }) => {
if (code === 200) { if (code === 200) {
this.tableTotal = data.length; this.emergencyList = data.rows;
this.emergencyList = data; this.tableTotal = data.total;
} }
}); });
}, },
/* 点击表格详情事件 */
detailDefect(item) {
this.$emit("imagePoint", {
snapshotId: item.snapshotId,
segmentId: item.segmentId,
tablePoint: [item.coordinates[0], item.coordinates[1]],
});
},
/* 页码修改事件 */
handleCurrentChange(age) {
this.pagination.page = age;
this.getData();
},
}, },
}; };
</script> </script>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-17 11:34:00 * @Date: 2024-10-17 11:34:00
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 14:11:57 * @LastEditTime: 2024-11-14 17:26:53
* @FilePath: \znxjxt-ui\src\views\big-screen\index.vue * @FilePath: \znxjxt-ui\src\views\big-screen\index.vue
* @Description: 大屏首页 * @Description: 大屏首页
--> -->
@ -73,6 +73,7 @@
:select="item.select" :select="item.select"
:is="item.component" :is="item.component"
:bottomTipClick="bottomTipClick" :bottomTipClick="bottomTipClick"
@imagePoint="getimagePoint"
></component ></component
></template> ></template>
<template slot="operation" v-if="item.selectIsShow"> <template slot="operation" v-if="item.selectIsShow">
@ -89,7 +90,7 @@
</div> </div>
<div class="road-content"> <div class="road-content">
<!-- 地图右上角多选框切换坐标类型 --> <!-- 地图右上角多选框切换坐标类型 -->
<!-- <div class="road-checkBox"> <div class="road-checkBox" v-if="showIconList">
<fssm-scroll class="road-scroll"> <fssm-scroll class="road-scroll">
<el-checkbox-group v-model="iconType" @change="handleChecked"> <el-checkbox-group v-model="iconType" @change="handleChecked">
<el-checkbox <el-checkbox
@ -100,7 +101,7 @@
> >
</el-checkbox-group> </el-checkbox-group>
</fssm-scroll> </fssm-scroll>
</div> --> </div>
<!-- 地图图例 --> <!-- 地图图例 -->
<div class="map-legend"></div> <div class="map-legend"></div>
<!-- 图片背景 --> <!-- 图片背景 -->
@ -141,10 +142,10 @@
ref="roadMap" ref="roadMap"
:showChange="true" :showChange="true"
:controlStyle="{ top: '10%', left: '26%' }" :controlStyle="{ top: '10%', left: '26%' }"
@map-moveend="mapMoveend"
@map-zoom="getZoom"
@feature-select="featureSelect" @feature-select="featureSelect"
@map-zoom="getZoom"
></fssm-map> ></fssm-map>
<!-- @map-moveend="mapMoveend" -->
</div> </div>
</div> </div>
<div class="screen-footer"> <div class="screen-footer">
@ -176,7 +177,7 @@
></div> ></div>
</div> </div>
</div> </div>
<!-- 图片弹窗 --> <!-- 详情图片弹窗 -->
<el-dialog <el-dialog
:title="imgTitle" :title="imgTitle"
:visible.sync="imgVisible" :visible.sync="imgVisible"
@ -186,7 +187,11 @@
destroy-on-close destroy-on-close
@close="imgCancel" @close="imgCancel"
> >
<img-dialog></img-dialog> <img-dialog
v-if="imgTitle === '查看'"
:imageItem="imageItem"
:bottomTipClick="bottomTipClick"
></img-dialog>
</el-dialog> </el-dialog>
<!-- 查看点位图片弹窗 --> <!-- 查看点位图片弹窗 -->
@ -218,6 +223,14 @@
</template> </template>
<script> <script>
// websocket
import {
connectWebsocket,
closeWebsocket,
sendMsg,
} from "@/plugins/websocket.js";
//
import { getToken } from "@/utils/auth.js";
// //
import FssmMap from "@/components/map/fssm-map.vue"; import FssmMap from "@/components/map/fssm-map.vue";
import { Feature } from "ol"; import { Feature } from "ol";
@ -253,7 +266,6 @@ import {
getItemTypes, getItemTypes,
getRoadListTypes, getRoadListTypes,
} from "@/api/xj/screen/index"; } from "@/api/xj/screen/index";
import { DefectType } from "@/api/xj/screen/traffic-screen";
export default { export default {
name: "BigScreen", name: "BigScreen",
components: { components: {
@ -336,27 +348,33 @@ export default {
], ],
// //
mapCareList: [], mapCareList: [],
//
changeMapBtn: [
{ name: "路面", click: "1" },
{ name: "交安", click: "2" },
{ name: "道桥", click: "3" },
{ name: "绿化", click: "4" },
],
// icon // icon
iconTypeList: [], iconTypeList: [],
// icon // icon
iconType: [], iconType: [],
//
showIconList: false,
// //
mapCareSelect: "", mapCareSelect: "",
// //
dieaseTypeList: [], dieaseTypeList: [],
// //
roadList: [], roadList: [],
// // -
roadSelect: "", roadSelect: "",
// //
bottomTipClick: "1", bottomTipClick: "1",
//
changeMapBtn: [
{ name: "路面", click: "1" },
{ name: "交安", click: "2" },
{ name: "桥隧", click: "3" },
{ name: "绿化", click: "4" },
],
// //
elementDiv: "OverviewScreen", elementDiv: "OverviewScreen",
// //
@ -365,6 +383,7 @@ export default {
{ name: "病害巡检", component: "DiseaseScreen" }, { name: "病害巡检", component: "DiseaseScreen" },
{ name: "道路资产", component: "RoadScreen" }, { name: "道路资产", component: "RoadScreen" },
], ],
// () // ()
centerPiont: [], centerPiont: [],
// //
@ -379,15 +398,19 @@ export default {
clusters: null, clusters: null,
// 线 // 线
markLayerLines: null, markLayerLines: null,
// //
imgTitle: "查看", imgTitle: "查看",
// //
imgVisible: false, imgVisible: false,
// //
imageItem: {},
//
screenImage: {}, screenImage: {},
// //
showImageDialog: false, showImageDialog: false,
// //
screenRects: [], screenRects: [],
}; };
}, },
@ -397,6 +420,7 @@ export default {
this.getMapCare(); this.getMapCare();
this.getRoadList(); this.getRoadList();
this.getDieaseTypeList(); this.getDieaseTypeList();
// this.initWebSocket();
}, },
methods: { methods: {
/* 获取当前时间 */ /* 获取当前时间 */
@ -452,7 +476,7 @@ export default {
/* 获取图片背景左上角病害类型下拉 */ /* 获取图片背景左上角病害类型下拉 */
getDieaseTypeList() { getDieaseTypeList() {
DefectType().then(({ code, data }) => { getItemTypes().then(({ code, data }) => {
if (code === 200) { if (code === 200) {
this.dieaseTypeList = data; this.dieaseTypeList = data;
} }
@ -468,13 +492,25 @@ export default {
}); });
}, },
/* 点击病害筛查 */ /* 点击病害日志详情打开弹窗进行地图打点 */
clickImg() { getimagePoint(item) {
this.imgTitle = "查看";
this.imageItem = item;
this.imgVisible = true; this.imgVisible = true;
// \
this.$nextTick(() => {
const map = this.$refs.roadMap.instance.get("map");
map.getView().setCenter(item.tablePoint);
map.getView().setZoom(16);
});
this.roadSelect = item.segmentId;
this.getCenterPiont();
}, },
/* 关闭图片查看弹窗 */ /* 关闭图片查看弹窗 */
imgCancel() { imgCancel() {
this.imgTitle = "";
this.imageItem = {};
this.imgVisible = false; this.imgVisible = false;
}, },
@ -507,7 +543,8 @@ export default {
}); });
} }
mapPointList({ mapPointList({
type: this.bottomTipClick, type: this.elementDiv,
classType: this.bottomTipClick,
segmentId: this.roadSelect, segmentId: this.roadSelect,
}).then(({ code, data }) => { }).then(({ code, data }) => {
if (code === 200) { if (code === 200) {
@ -564,8 +601,8 @@ export default {
features.push(feature); features.push(feature);
}); });
const clusterSource = new Cluster({ const clusterSource = new Cluster({
distance: this.mapZoom > 15 ? 0 : 130, distance: this.mapZoom > 15 ? 0 : 100,
minDistance: this.mapZoom > 15 ? 0 : 130, minDistance: this.mapZoom > 15 ? 0 : 100,
source: new VectorSource({ source: new VectorSource({
features, features,
}), }),
@ -636,12 +673,14 @@ export default {
/* 获取地图线段点位信息 */ /* 获取地图线段点位信息 */
getLinePoint() { getLinePoint() {
mapPciList({ zoom: this.mapZoom }).then(({ code, data }) => { if (!this.markLayerLines) {
mapPciList().then(({ code, data }) => {
if (code === 200) { if (code === 200) {
this.lineString = data; this.lineString = data;
this.drawLine(); this.drawLine();
} }
}); });
}
}, },
/* 绘制地图线段 */ /* 绘制地图线段 */
@ -696,13 +735,16 @@ export default {
changeIconType(value) { changeIconType(value) {
if (this.bottomTipClick !== value) { if (this.bottomTipClick !== value) {
this.bottomTipClick = value; this.bottomTipClick = value;
this.getIconType();
this.getCenterPiont();
} }
}, },
/* 获取icon多选数据 */ /* 获取icon多选数据 */
getIconType(value) { getIconType() {
const type = this.elementDiv === "RoadScreen" ? "" : this.bottomTipClick;
this.mapLogeList = {}; this.mapLogeList = {};
getItemTypes({ type: value }).then(({ code, data }) => { getItemTypes({ classType: type }).then(({ code, data }) => {
if (code === 200) { if (code === 200) {
this.iconTypeList = data; this.iconTypeList = data;
this.iconType = data.map((item) => { this.iconType = data.map((item) => {
@ -717,33 +759,39 @@ export default {
/* 传回来的地图图层 */ /* 传回来的地图图层 */
getZoom(zoom) { getZoom(zoom) {
if (zoom === "11" && this.mapZoom !== zoom) {
this.mapZoom = zoom; this.mapZoom = zoom;
this.$nextTick(() => { // if (zoom === "11" && this.mapZoom !== zoom) {
const map = this.$refs.roadMap.instance.get("map"); // this.mapZoom = zoom;
map.removeLayer(this.markLayerLines); // this.$nextTick(() => {
this.markLayerLines = null; // const map = this.$refs.roadMap.instance.get("map");
}); // map.removeLayer(this.markLayerLines);
this.getLinePoint(); // this.markLayerLines = null;
} else if (zoom === "10" && this.mapZoom !== zoom) { // });
this.mapZoom = zoom; // this.getLinePoint();
this.$nextTick(() => { // } else if (zoom === "10" && this.mapZoom !== zoom) {
const map = this.$refs.roadMap.instance.get("map"); // this.mapZoom = zoom;
map.removeLayer(this.markLayerLines); // this.$nextTick(() => {
this.markLayerLines = null; // const map = this.$refs.roadMap.instance.get("map");
}); // map.removeLayer(this.markLayerLines);
this.getLinePoint(); // this.markLayerLines = null;
// });
// this.getLinePoint();
// }
if (this.clusters && zoom * 1 > 15) {
this.clusters.getSource().setDistance(0);
} else if (this.clusters && zoom * 1 <= 15) {
this.clusters.getSource().setDistance(100);
} }
}, },
/* 地图缩放完成事件 */ /* 地图缩放完成事件 */
mapMoveend(zoom) { // mapMoveend(zoom) {
if (this.clusters && zoom * 1 > 15) { // if (this.clusters && zoom * 1 > 15) {
this.clusters.getSource().setDistance(0); // this.clusters.getSource().setDistance(0);
} else if (this.clusters && zoom * 1 <= 15) { // } else if (this.clusters && zoom * 1 <= 15) {
this.clusters.getSource().setDistance(130); // this.clusters.getSource().setDistance(100);
} // }
}, // },
/* 地图选中feature事件 */ /* 地图选中feature事件 */
featureSelect(e) { featureSelect(e) {
@ -782,7 +830,10 @@ export default {
changeElement(item) { changeElement(item) {
if (this.elementDiv !== item) { if (this.elementDiv !== item) {
this.elementDiv = item.component; this.elementDiv = item.component;
this.roadSelect = "";
if (item.component === "OverviewScreen") { if (item.component === "OverviewScreen") {
/* 清空线段图层 */
this.markLayerLines = null;
this.leftModuleList = [ this.leftModuleList = [
{ {
width: "100%", width: "100%",
@ -828,6 +879,10 @@ export default {
class: "twe", class: "twe",
}, },
]; ];
//
this.showIconList = false;
//
this.mapZoom="";
} else if (item.component === "RoadScreen") { } else if (item.component === "RoadScreen") {
this.leftModuleList = [ this.leftModuleList = [
{ {
@ -867,6 +922,17 @@ export default {
class: "twe", class: "twe",
}, },
]; ];
this.$nextTick(() => {
const map = this.$refs.roadMap.instance.get("map");
map.getView().setZoom(10);
map.getView().setCenter([123.30297096718999, 41.87942945541742]);
});
//
this.getIconType();
this.showIconList = true;
//
this.getCenterPiont();
this.getLinePoint();
} else if (item.component === "DiseaseScreen") { } else if (item.component === "DiseaseScreen") {
this.leftModuleList = [ this.leftModuleList = [
{ {
@ -906,6 +972,17 @@ export default {
class: "one", class: "one",
}, },
]; ];
this.$nextTick(() => {
const map = this.$refs.roadMap.instance.get("map");
map.getView().setZoom(10);
map.getView().setCenter([123.30297096718999, 41.87942945541742]);
});
//
this.getIconType();
this.showIconList = true;
//
this.getCenterPiont();
this.getLinePoint();
} }
} }
}, },
@ -957,9 +1034,33 @@ export default {
boxSizing: "border-box", boxSizing: "border-box",
}; };
}, },
/* 初始化websocket */
initWebSocket() {
const url = `ws://192.168.1.188:8080/websocket?token=${getToken()}`;
const data = { type: "carLocation", status: true };
connectWebsocket(
url,
data,
(res) => {
// console.log("onWsMessage: ", res);
console.log(JSON.parse(res));
},
(err) => {
console.log("断开重连");
}
);
},
/* 发送消息 */
sendMsg() {
sendMsg(5555); //value
// this.value = "";
},
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timeFlag); clearInterval(this.timeFlag);
closeWebsocket();
}, },
}; };
</script> </script>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-18 10:16:30 * @Date: 2024-10-18 10:16:30
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-10-24 17:09:27 * @LastEditTime: 2024-11-14 15:49:52
* @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\disease-trends.vue * @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\disease-trends.vue
* @Description: 总览大屏-病害趋势 * @Description: 总览大屏-病害趋势
--> -->
@ -44,12 +44,12 @@ export default {
const yData1 = this.echartList.map((item) => { const yData1 = this.echartList.map((item) => {
return item.A1000; return item.A1000;
}); });
const yData2 = this.echartList.map((item) => { // const yData2 = this.echartList.map((item) => {
return item.A2001; // return item.A2001;
}); // });
const yData3 = this.echartList.map((item) => { // const yData3 = this.echartList.map((item) => {
return item.A2000; // return item.A2000;
}); // });
const yData4 = this.echartList.map((item) => { const yData4 = this.echartList.map((item) => {
return item.A0; return item.A0;
}); });
@ -167,8 +167,66 @@ export default {
}, },
data: yData1, data: yData1,
}, },
// {
// name: "()",
// type: "line",
// smooth: true,
// areaStyle: {
// color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {
// offset: 0,
// color: "#08B4A6",
// },
// {
// offset: 1,
// color: "rgba(8,180,166,0)",
// },
// ]),
// },
// lineStyle: {
// width: 1,
// color: "#08B4A6",
// },
// //
// showSymbol: false,
// symbol: "circle", // circle, diamond, pin
// symbolSize: 10, //
// itemStyle: {
// color: "#08B4A6",
// },
// data: yData2,
// },
// {
// name: "()",
// type: "line",
// smooth: true,
// areaStyle: {
// color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {
// offset: 0,
// color: "#146fd7",
// },
// {
// offset: 1,
// color: "rgba(20, 111, 215,0)",
// },
// ]),
// },
// lineStyle: {
// width: 1,
// color: "#146fd7",
// },
// //
// showSymbol: false,
// symbol: "circle", // circle, diamond, pin
// symbolSize: 10, //
// itemStyle: {
// color: "#146fd7",
// },
// data: yData3,
// },
{ {
name: "块状修补(沥青)", name: "横向裂缝",
type: "line", type: "line",
smooth: true, smooth: true,
areaStyle: { areaStyle: {
@ -194,64 +252,6 @@ export default {
itemStyle: { itemStyle: {
color: "#08B4A6", color: "#08B4A6",
}, },
data: yData2,
},
{
name: "条状修补(沥青)",
type: "line",
smooth: true,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#146fd7",
},
{
offset: 1,
color: "rgba(20, 111, 215,0)",
},
]),
},
lineStyle: {
width: 1,
color: "#146fd7",
},
//
showSymbol: false,
symbol: "circle", // circle, diamond, pin
symbolSize: 10, //
itemStyle: {
color: "#146fd7",
},
data: yData3,
},
{
name: "横向裂缝",
type: "line",
smooth: true,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#994EFF",
},
{
offset: 1,
color: "rgba(153,78,255,0)",
},
]),
},
lineStyle: {
width: 1,
color: "#994EFF",
},
//
showSymbol: false,
symbol: "circle", // circle, diamond, pin
symbolSize: 10, //
itemStyle: {
color: "#994EFF",
},
data: yData4, data: yData4,
}, },
{ {

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-08 09:40:18 * @Date: 2024-11-08 09:40:18
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 13:23:21 * @LastEditTime: 2024-11-14 15:54:12
* @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\inspection-vehicles.vue * @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\inspection-vehicles.vue
* @Description: 总览大屏-巡检车辆 * @Description: 总览大屏-巡检车辆
--> -->
@ -29,6 +29,7 @@
><el-button ><el-button
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
clearable
@click="getTableData" @click="getTableData"
></el-button ></el-button
></template> ></template>
@ -42,7 +43,7 @@
height="285" height="285"
> >
<el-table-column prop="plateNo" label="车牌号码"> </el-table-column> <el-table-column prop="plateNo" label="车牌号码"> </el-table-column>
<el-table-column prop="serverStatus" label="状态"> </el-table-column> <el-table-column prop="status" label="状态"> </el-table-column>
<el-table-column prop="pci" label="操作"> <el-table-column prop="pci" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover <el-popover
@ -57,19 +58,19 @@
<span class="value">{{ scope.row.plateNo }}</span> <span class="value">{{ scope.row.plateNo }}</span>
</div> </div>
<div> <div>
<span class="name">设备编号</span> <span class="name">设备编号:</span>
<span class="value">{{ scope.row.appid }}</span> <span class="value">{{ scope.row.appid }}</span>
</div> </div>
<div> <div>
<span class="name">车辆状态</span> <span class="name">车辆状态:</span>
<span class="value">{{ scope.row.status }}</span>
</div>
<div>
<span class="name">网络连接:</span>
<span class="value"></span> <span class="value"></span>
</div> </div>
<div> <div>
<span class="name">网络连接</span> <span class="name">设备状态:</span>
<span class="value"></span>
</div>
<div>
<span class="name">设备状态</span>
<span class="value"></span> <span class="value"></span>
</div> </div>
</div> </div>
@ -149,7 +150,7 @@ export default {
methods: { methods: {
/* 获取表格数据 */ /* 获取表格数据 */
getTableData() { getTableData() {
getCarList().then(({ code, data }) => { getCarList({ no: this.tableInput }).then(({ code, data }) => {
if (code === 200) { if (code === 200) {
this.carNum = data.total; this.carNum = data.total;
this.tableTotal = data.total; this.tableTotal = data.total;

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-18 10:25:29 * @Date: 2024-10-18 10:25:29
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 14:01:48 * @LastEditTime: 2024-11-14 16:16:56
* @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\work-order.vue * @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\work-order.vue
* @Description: 总览大屏-巡查里程 * @Description: 总览大屏-巡查里程
--> -->
@ -11,20 +11,47 @@
<div class="content"> <div class="content">
<div class="patrol-div"> <div class="patrol-div">
<div class="value"> <div class="value">
<span>{{ formatNumber(patrolObject.len) }}</span <span @click="showDetail">{{ formatNumber(patrolObject.len) }}</span
>km >km
</div> </div>
</div> </div>
<div class="patrol-div"> <div class="patrol-div">
<div class="value"> <div class="value">
<span>{{ formatTime(patrolObject.time) }}</span <span @click="showDetail">{{ formatTime(patrolObject.time) }}</span
>h >h
</div> </div>
</div> </div>
<!-- 巡查里程弹窗 -->
<el-dialog
title="巡查里程总览"
:visible.sync="showDialogVisible"
width="50rem"
append-to-body
:close-on-click-modal="false"
destroy-on-close
@close="screenCancel"
>
<div class="patrol-content">
<el-select
:popper-append-to-body="false"
v-model="companySelect"
placeholder="请选择分公司"
>
<el-option
v-for="item in companyList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<div ref="patrolChart" class="dialog-div"></div>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from "echarts";
import { getMileage } from "@/api/xj/screen/disease-screen"; import { getMileage } from "@/api/xj/screen/disease-screen";
export default { export default {
name: "PatrolOrder", name: "PatrolOrder",
@ -32,6 +59,12 @@ export default {
return { return {
// //
patrolObject: {}, patrolObject: {},
//
showDialogVisible: false,
//
companySelect: "",
//
companyList: [],
}; };
}, },
created() { created() {
@ -62,7 +95,7 @@ export default {
}, },
/* 累计时长修改 */ /* 累计时长修改 */
formatTime(num){ formatTime(num) {
if (num >= 100000000) { if (num >= 100000000) {
// 1亿 x.xx亿 // 1亿 x.xx亿
return (num / 100000000).toFixed(2) + "亿"; return (num / 100000000).toFixed(2) + "亿";
@ -73,7 +106,161 @@ export default {
// 1 // 1
return num; return num;
} }
},
/* 打开弹窗方法 */
showDetail() {
this.showDialogVisible = true;
this.getChartData();
},
/* 请求弹窗数据 */
getChartData() {
this.$nextTick(() => {
this.drawChart();
});
},
/* 绘制echart图 */
drawChart() {
if (this.$refs.patrolChart) {
const chart = echarts.init(this.$refs.patrolChart);
chart.setOption({
color: [
{
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: "#8DF2FF" }, // 0%
{ offset: 1, color: "#82B3FD" }, // 100%
],
},
{
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: "#8087FF" }, // 0%
{ offset: 1, color: "#532EFF" }, // 100%
],
},
{
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: "#FFB3B3" }, // 0%
{ offset: 1, color: "#FF2E2E" }, // 100%
],
},
{
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: "#F7DA15" }, // 0%
{ offset: 1, color: "#FCC105" }, // 100%
],
},
],
title: {
text: "",
},
tooltip: {
trigger: "axis",
show: true,
confine: false,
backgroundColor: "rgba(9, 24, 48, 0.5)",
borderColor: "rgba(75, 253, 238, 0.4)",
textStyle: {
fontSize: 12,
color: "#ffffff",
},
},
grid: {
left: "3%",
right: "0%",
bottom: "10%",
containLabel: true,
},
legend: {
orient: "horizontal",
left: "right",
textStyle: {
color: "#fff",
},
itemWidth: 8,
itemHeight: 8,
},
xAxis: {
type: "category",
axisLabel: {
interval: 0,
color: "#fff",
formatter: (params) => {
if (params.length > 4) {
return `${params.slice(0, 4)}...`;
} }
return params;
},
},
axisTick: {
show: false,
},
axisLine: {
show: false,
},
data: ["dsds", "4ds", "5454", "sff"],
},
yAxis: {
type: "value",
axisLabel: {
color: "rgba(255,255,255,0.65)",
},
splitLine: {
lineStyle: {
color: "rgba(255,255,255,0.2)",
},
},
name: "单位:个",
nameTextStyle: {
color: "rgba(255,255,255,0.65)",
},
},
series: [
{
barWidth: 10,
name: "巡查里程",
type: "bar",
data: [10, 25, 23, 58],
},
{
barWidth: 10,
name: "巡查时长",
type: "bar",
data: [10, 25, 23, 58],
},
],
});
window.addEventListener("resize", () => {
chart.resize();
});
}
},
/* 弹窗关闭 */
screenCancel() {
this.showDialogVisible = false;
},
}, },
}; };
</script> </script>
@ -101,11 +288,84 @@ export default {
.value { .value {
span { span {
cursor: pointer;
font-family: "DouYu"; font-family: "DouYu";
font-size: 1.4rem; font-size: 1.4rem;
} }
} }
} }
} }
//
.patrol-content {
height: 30rem;
padding: 0 2rem;
::v-deep .el-select {
width: 12rem;
.el-input .el-select__caret {
line-height: 1.5rem;
}
.el-input--medium .el-input__inner {
height: 1.5rem;
background-color: transparent;
color: #89c5e8;
border-color: #6991cd;
}
.el-select-dropdown {
background-color: #102649;
border-color: #08204f;
.el-scrollbar {
.el-select-dropdown__wrap {
.el-scrollbar__view {
.el-select-dropdown__item {
color: #aaabb8;
}
.el-select-dropdown__item:hover {
background-color: #2b4c7e;
}
.el-select-dropdown__item.selected {
background-color: #2b4c7e;
}
.el-select-dropdown__item.hover {
background-color: #2b4c7e;
}
}
.el-select-dropdown__list {
background-color: #102649;
}
}
}
}
}
.dialog-div {
width: 100%;
height: 100%;
}
}
/* 修改弹窗样式 */
::v-deep .el-dialog__header {
padding: 10px;
background-color: #113463;
span,
i {
color: #ffffff;
}
}
::v-deep .el-dialog__body {
padding: 0;
background-color: #113463;
}
</style> </style>

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-18 09:42:49 * @Date: 2024-10-18 09:42:49
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-13 13:38:46 * @LastEditTime: 2024-11-14 15:48:21
* @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\today-inspection.vue * @FilePath: \znxjxt-ui\src\views\big-screen\disease-components\today-inspection.vue
* @Description: 总览大屏-今日巡查 * @Description: 总览大屏-今日巡查
--> -->
@ -10,10 +10,10 @@
<template> <template>
<div class="content"> <div class="content">
<div class="today-left"> <div class="today-left">
<span>{{ today }}</span> <span @click="showDialog('1')">{{ today }}</span>
</div> </div>
<div class="today-right"> <div class="today-right">
<div class="right-sum" @click="showDialog"> <div class="right-sum" @click="showDialog('2')">
<span>{{ all }}</span <span>{{ all }}</span
> >
</div> </div>
@ -33,9 +33,41 @@
@close="screenCancel" @close="screenCancel"
> >
<div class="today-content"> <div class="today-content">
<div class="today-select">
<div>
<el-select
:popper-append-to-body="false"
v-model="roadSelect"
placeholder="请选择路段"
>
<el-option
v-for="item in roadList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div>
<el-select
:popper-append-to-body="false"
v-model="companySelect"
placeholder="请选择分公司"
>
<el-option
v-for="item in companyList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</div>
<div class="today-bottom">
<div ref="leftChart" class="dialog-div"></div> <div ref="leftChart" class="dialog-div"></div>
<div ref="rightChart" class="dialog-div"></div> <div ref="rightChart" class="dialog-div"></div>
</div> </div>
</div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -53,10 +85,20 @@ export default {
all: "0", all: "0",
// //
scale: "0", scale: "0",
// /
clickTip: "",
// //
showDialogVisible: false, showDialogVisible: false,
//
roadSelect: "",
//
roadList: [],
// //
leftChartData: [], leftChartData: [],
//
companySelect: "",
//
companyList: [],
// //
rightChartData: [], rightChartData: [],
}; };
@ -77,7 +119,8 @@ export default {
}, },
/* 点击打开弹窗 */ /* 点击打开弹窗 */
showDialog() { showDialog(item) {
this.clickTip = item;
this.getChartData(); this.getChartData();
this.showDialogVisible = true; this.showDialogVisible = true;
}, },
@ -241,7 +284,7 @@ export default {
}, },
{ {
barWidth: 10, barWidth: 10,
name: "桥", name: "",
type: "bar", type: "bar",
data: y2Data, data: y2Data,
}, },
@ -389,7 +432,7 @@ export default {
}, },
{ {
barWidth: 10, barWidth: 10,
name: "桥", name: "",
type: "bar", type: "bar",
data: y2Data, data: y2Data,
}, },
@ -409,6 +452,7 @@ export default {
/* 关闭 弹窗事件 */ /* 关闭 弹窗事件 */
screenCancel() { screenCancel() {
this.clickTip = "";
this.showDialogVisible = false; this.showDialogVisible = false;
}, },
}, },
@ -435,6 +479,7 @@ export default {
background-position: 100% 60%; background-position: 100% 60%;
span { span {
cursor: pointer;
font-size: 2rem; font-size: 2rem;
font-weight: 800; font-weight: 800;
font-family: "DouYu"; font-family: "DouYu";
@ -520,12 +565,75 @@ export default {
.today-content { .today-content {
height: 30rem; height: 30rem;
display: flex; display: flex;
flex-direction: column;
.today-select {
width: 100%;
// height: 10%;
display: flex;
> div {
width: 50%;
padding: 0 2rem;
::v-deep .el-select {
width: 12rem;
.el-input .el-select__caret {
line-height: 1.5rem;
}
.el-input--medium .el-input__inner {
height: 1.5rem;
background-color: transparent;
color: #89c5e8;
border-color: #6991cd;
}
.el-select-dropdown {
background-color: #102649;
border-color: #08204f;
.el-scrollbar {
.el-select-dropdown__wrap {
.el-scrollbar__view {
.el-select-dropdown__item {
color: #aaabb8;
}
.el-select-dropdown__item:hover {
background-color: #2b4c7e;
}
.el-select-dropdown__item.selected {
background-color: #2b4c7e;
}
.el-select-dropdown__item.hover {
background-color: #2b4c7e;
}
}
.el-select-dropdown__list {
background-color: #102649;
}
}
}
}
}
}
}
.today-bottom {
width: 100%;
height: 100%;
display: flex;
.dialog-div { .dialog-div {
width: 50%; width: 50%;
height: 100%; height: 90%;
margin: 0 1rem; margin: 0 1rem;
} }
}
} }
/* 修改弹窗样式 */ /* 修改弹窗样式 */

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-11-01 17:25:06 * @Date: 2024-11-01 17:25:06
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-04 16:29:02 * @LastEditTime: 2024-11-14 15:00:35
* @FilePath: \znxjxt-ui\src\views\xj\inspection\confirmation-management\image-dialog.vue * @FilePath: \znxjxt-ui\src\views\xj\inspection\confirmation-management\image-dialog.vue
* @Description: 病害确认-影像模式弹窗 * @Description: 病害确认-影像模式弹窗
--> -->
@ -157,8 +157,9 @@ import {
getSegment, getSegment,
getDefectStatus, getDefectStatus,
mergeDefect, mergeDefect,
listDefect,
} from "@/api/xj/confirmation"; } from "@/api/xj/confirmation";
import { defeaseList, getItemTypes } from "@/api/xj/screen/index"; import { getItemTypes } from "@/api/xj/screen/index";
export default { export default {
name: "ImageDialog", name: "ImageDialog",
props: {}, props: {},
@ -260,15 +261,19 @@ export default {
/* 获取左侧图片列表 */ /* 获取左侧图片列表 */
getList() { getList() {
console.log(11);
this.loading = true; this.loading = true;
const data = { const data = {
...this.imgForm, ...this.imgForm,
...this.params, ...this.params,
}; };
defeaseList(data) listDefect(data)
.then((response) => { .then(({ code,rows }) => {
this.defectData = response.data; if (code === 200) {
this.defectData = rows;
this.loading = false; this.loading = false;
}
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;

View File

@ -2,7 +2,7 @@
* @Author: SunTao 328867980@qq.com * @Author: SunTao 328867980@qq.com
* @Date: 2024-10-14 13:59:51 * @Date: 2024-10-14 13:59:51
* @LastEditors: SunTao 328867980@qq.com * @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-11-07 16:46:43 * @LastEditTime: 2024-11-14 15:26:15
* @FilePath: \znxjxt-ui\src\views\xj\inspection\surface-management\index.vue * @FilePath: \znxjxt-ui\src\views\xj\inspection\surface-management\index.vue
* @Description: 巡检管理-路面病害对比 * @Description: 巡检管理-路面病害对比
--> -->
@ -267,6 +267,7 @@ export default {
return it.snapshotId === item.data.snapshotId; return it.snapshotId === item.data.snapshotId;
}); });
this.dialogImgLeft = leftImg[0]; this.dialogImgLeft = leftImg[0];
} }
this.viewVisible = true; this.viewVisible = true;
}, },