Merge branch 'dengjie' of http://git.feashow.cn/clay/tunnel-cloud-web into trp_dev

This commit is contained in:
trp
2025-01-03 11:15:45 +08:00
5 changed files with 42 additions and 230 deletions

View File

@@ -163,6 +163,13 @@ export const startSimulation = (projectId) => {
method: 'get' method: 'get'
}) })
} }
//模拟状态
export const simulationState = (projectId) => {
return request({
url: `/tunnel/simulation/state/${projectId}`,
method: 'get'
})
}
// 结束模拟 // 结束模拟
export const endSimulation = (projectId) => { export const endSimulation = (projectId) => {
return request({ return request({

View File

@@ -82,6 +82,7 @@ let dataZoomTop = reactive('87%')
let chartData = reactive([]) let chartData = reactive([])
const chooseDayRef = ref(); const chooseDayRef = ref();
const chooseMonthRef = ref(); const chooseMonthRef = ref();
const itemInfo = ref();
const windSpeed = ref(0) const windSpeed = ref(0)
const windSpeedUnit = ref('m/s') const windSpeedUnit = ref('m/s')
const windDirection = ref(null) const windDirection = ref(null)
@@ -109,7 +110,7 @@ watch(() => props.windSpeed, (now) => {
watch(() => props.list, (now) => { watch(() => props.list, (now) => {
airList.value?.forEach(item => { airList.value?.forEach(item => {
now.forEach(newItem => { now.forEach(newItem => {
if (newItem.equipmentId === 11) {//风向传感器 if (newItem.equipmentType === "windDirection") {//风向传感器
windDirection.value = newItem.value windDirection.value = newItem.value
} }
if (item.equipmentId === newItem.equipmentId) { if (item.equipmentId === newItem.equipmentId) {

View File

@@ -24,9 +24,9 @@ const length = ref(null);
const value = ref(null); const value = ref(null);
const point = ref(null); const point = ref(null);
const isWaring = ref(); const isWaring = ref();
// watch(() => params.wp.value, () => { watch(() => params.wp.value, () => {
// setValue(); setValue(params.wp.value);
// }); });
onMounted(() => { onMounted(() => {
if (params.wp !== undefined) { if (params.wp !== undefined) {
setValue(); setValue();
@@ -36,8 +36,14 @@ onMounted(() => {
const getImageUrl = (name) => { const getImageUrl = (name) => {
return new URL(`../../../../assets/images/airInfo/${name}`, import.meta.url).href return new URL(`../../../../assets/images/airInfo/${name}`, import.meta.url).href
} }
const setValue = () => { const setValue = (realValue) => {
let width = (params.wp.value * length.value.offsetWidth) / params.wp.max; let newValue=''
if(realValue){
newValue=realValue
}else{
newValue=params.wp.value
}
let width = (newValue * length.value.offsetWidth) / params.wp.max;
value.value.style.width = `${width}px`; value.value.style.width = `${width}px`;
let flag = (params.wp.point * length.value.offsetWidth) / params.wp.max; let flag = (params.wp.point * length.value.offsetWidth) / params.wp.max;
point.value.style.left = `${flag}px`; point.value.style.left = `${flag}px`;
@@ -51,7 +57,7 @@ const setValue = () => {
value.value.style.background = value.value.style.background =
"linear-gradient(270deg, #38CAFB 0%, #E9D726 100%)"; "linear-gradient(270deg, #38CAFB 0%, #E9D726 100%)";
} }
isWaring.value = params.wp.value < params.wp.point; isWaring.value = newValue < params.wp.point;
}else { }else {
if (width >= flag) { if (width >= flag) {
value.value.style.background = value.value.style.background =
@@ -60,14 +66,13 @@ const setValue = () => {
value.value.style.background = value.value.style.background =
"linear-gradient(270deg, #38CAFB 0%, #E9D726 100%)"; "linear-gradient(270deg, #38CAFB 0%, #E9D726 100%)";
} }
isWaring.value = params.wp.value >= params.wp.point; isWaring.value = newValue >= params.wp.point;
} }
} }
// let isWaring = computed(() => { // let isWaring = computed(() => {
// return params.wp.value >= params.wp.point; // return params.wp.value >= params.wp.point;
// }); // });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -73,6 +73,7 @@ const params = defineProps([
"deviceData", "deviceData",
"devRealtimeData", "devRealtimeData",
"simulateData", "simulateData",
"tunnelAlias",
]); ]);
// hover到设备回显参数 // hover到设备回显参数
@@ -153,7 +154,7 @@ async function handleMounted() {
demo.pointsVisible(false); //隐藏附着点 demo.pointsVisible(false); //隐藏附着点
TunnelSceneSimulateRender(data); TunnelSceneSimulateRender(data);
// 初始化标牌信息 // 初始化标牌信息
renderRoadPlane({ nickname: "隧道名称", length: 10000 }); renderRoadPlane({ nickname: params.tunnelAlias, length: params.tunnelLength });
} catch (err) {} } catch (err) {}
} }

View File

@@ -52,16 +52,6 @@
:tunnelAlias="tunnelAlias" :tunnelAlias="tunnelAlias"
:devRealtimeData="socketData" :devRealtimeData="socketData"
></preview-scene-simulate> ></preview-scene-simulate>
<!-- 一进去的话应该是预览模式所以引入这个组件1 -->
<!-- <preview-scene-->
<!-- id="tunnel-box"-->
<!-- :isedit="false"-->
<!-- :tunnelId="tunnelId"-->
<!-- :key="tunnelId"-->
<!-- :tunnelLen="tunnelLen"-->
<!-- :largeScreen="largeScreen"-->
<!-- :fanList="socketData.leftData"-->
<!-- ></preview-scene>-->
<div class="left" v-if="isPreview"> <div class="left" v-if="isPreview">
<el-drawer <el-drawer
v-model="drawerLeft" v-model="drawerLeft"
@@ -131,123 +121,63 @@
</template> </template>
<script setup> <script setup>
// import PreviewScene from "@/components/content/tunnelScene/PreviewScene.vue";
import PreviewSceneSimulate from "@/components/content/tunnelScene/TunnelSceneSimulate.vue"; import PreviewSceneSimulate from "@/components/content/tunnelScene/TunnelSceneSimulate.vue";
import FanInfo from "@/components/content/fanInfo/FanInfo.vue"; import FanInfo from "@/components/content/fanInfo/FanInfo.vue";
import UsedEle from "@/components/content/usedEle/UsedEle.vue";
import WindPressureList from "@/components/content/windPressure/WindPressureList.vue"; import WindPressureList from "@/components/content/windPressure/WindPressureList.vue";
import AirInfo from "@/components/content/airInfo/AirInfo.vue"; import AirInfo from "@/components/content/airInfo/AirInfo.vue";
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue"; import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
import ManageBtn from "@/components/manageBtn/index.vue";
import TunnelTitle from "@/components/tunnelTitle/index.vue"; import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {dateFormat} from "@/utils/date.js"; import {dateFormat} from "@/utils/date.js";
import {getToken} from "@/utils/auth"; import {getToken} from "@/utils/auth";
import {useAuthStore} from "@/store/userstore.js"; import {useAuthStore} from "@/store/userstore.js";
import { import {
getLargeScreen,
getLargeScreenInfo,
getTunnelBySiteId,
getAlarmInfo, getAlarmInfo,
deleteAlarmSate, deleteAlarmSate,
getAlarmDetail, getAlarmDetail,
updateAlarmState, updateAlarmState,
endSimulation, endSimulation,
blastingSimulation, blastingSimulation, simulationState,
} from "@/api/largeScreen"; } from "@/api/largeScreen";
import {ElLoading, ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import {getUserInfo} from "@/api/login"; import {getUserInfo} from "@/api/login";
import {initSceneData} from "@/api/tunnelScene";
import { import {
getScreenSimulateTunnel, getScreenSimulateTunnel,
getSimulateTunnelDetail, getSimulateTunnelDetail,
getTunnelList,
} from "@/api/tunnelManage"; } from "@/api/tunnelManage";
import {debounce} from "lodash";
let largeScreen = computed(() => largeScreenData);
const authStore = useAuthStore(); const authStore = useAuthStore();
const router = useRouter(); const router = useRouter();
const previewId = reactive(router.currentRoute.value.params.tunnelId); const previewId = reactive(router.currentRoute.value.params.tunnelId);
const siteId = reactive(router.currentRoute.value.params.siteId); const siteId = reactive(router.currentRoute.value.params.siteId);
const tunnelIdFlag = reactive(router.currentRoute.value.params.tunnelId);
const selectIndex = ref(-1);
const previewRef = ref(); const previewRef = ref();
const isVisited = ref(false);
const isDetailVisited = ref(false);
const showFan = ref(false); const showFan = ref(false);
const showDevice = ref(false); const showDevice = ref(false);
const drawerLeft = ref(true); const drawerLeft = ref(true);
const showTunnelTitle = ref(true); const showTunnelTitle = ref(true);
const isPreview = ref(true); const isPreview = ref(true);
const loading = ref(false); const loading = ref(false);
const tableEmptyText = ref("加载中~");
const initialIndex = ref(0);
const showFanLoading = ref(0); const showFanLoading = ref(0);
const showUsedLoading = ref(0);
const showWindLoading = ref(0); const showWindLoading = ref(0);
const showBadLoading = ref(0); const showBadLoading = ref(0);
const isStartSimulate = ref(true); const isStartSimulate = ref(true);
const drawerRight = ref(true); const drawerRight = ref(true);
const showMenu = ref(false);
const currentSiteId = ref(0); const currentSiteId = ref(0);
const currentSite = ref("");
const siteList = ref([]);
const alarmList = ref([]);
const alarmDetail = ref([]);
const totalTunnelList = ref([]);
const currentUser = ref(""); const currentUser = ref("");
const currentUserId = ref(0); const currentUserId = ref(0);
const currentDate = ref(dateFormat()); const currentDate = ref(dateFormat());
const tunnelBtn = ref();
const tunnelList = ref([]);
const tunnelId = ref(0); const tunnelId = ref(0);
const tunnelLength = ref(0); const tunnelLength = ref(0);
const tunnelAlias = ref(''); const tunnelAlias = ref('');
const constructionLength = ref(0); const constructionLength = ref(0);
const routeList = ref([]);
let socket = reactive(""); let socket = reactive("");
let pattern = reactive(new RegExp("[A-Za-z]+"));
let isTunnel = reactive(false);
// const equipmentOption = ref([])
const btnList = ref([
{
route: "/site",
icon: "sp_icon_zdgl.png",
name: "站点管理",
},
{
route: "/tunnel",
icon: "sp_icon_sdgl.png",
name: "隧道管理",
},
{
route: "/user",
icon: "sp_icon_yhgl.png",
name: "用户管理",
},
// {
// route: '/system',
// icon: 'sp_icon_xtgl.png',
// name: '系统管理'
// },
// {
// route: '/simulate',
// icon: 'sp_icon_mngl.png',
// name: '模拟仿真'
// },
]);
const serialNumber = ref(""); const serialNumber = ref("");
const roleKey = ref(""); const roleKey = ref("");
let token = getToken(); let token = getToken();
let send = { let send = {
type: "ping", type: "ping",
}; };
const pageInfo = reactive({
pageNum: 1,
pageSize: 10,
});
const queryForm = ref();
const form = ref(); const form = ref();
const total = ref(10);
const largeScreenData = ref(null); const largeScreenData = ref(null);
const socketData = reactive({ const socketData = reactive({
leftData: [], leftData: [],
@@ -256,13 +186,8 @@ const socketData = reactive({
windSpeed: [], windSpeed: [],
}); });
let tunnelLen = computed(() => tunnelLength); let tunnelLen = computed(() => tunnelLength);
const queryParams = reactive({
equipmentId: "",
lookupStatus: "",
});
onMounted(() => { onMounted(() => {
getUser(); getUser();
// getOtherInfo();
getScreenInfo(previewId); getScreenInfo(previewId);
getBasicData(previewId); getBasicData(previewId);
@@ -281,8 +206,7 @@ const cancelDeviceManage = () => {
const submitDevice = () => { const submitDevice = () => {
isStartSimulate.value = false; isStartSimulate.value = false;
showDevice.value = false; showDevice.value = false;
getScreenInfo(previewId,true); getScreenInfo(previewId, true);
// initWebSocket()
}; };
const simulatedBlasting = async () => { const simulatedBlasting = async () => {
@@ -293,85 +217,6 @@ const endSimulate = async () => {
await endSimulation(previewId); await endSimulation(previewId);
ElMessage.success("结束模拟成功"); ElMessage.success("结束模拟成功");
}; };
const changeName = (id) => {
for (let item of equipmentOption.value) {
if (item.value === id) {
return item.label;
}
}
return "";
};
const handleReset = () => {
queryForm.value.resetFields();
getAlarmList();
};
//点击页码进行分页功能
const handleCurrentChange = (val) => {
pageInfo.pageNum = val;
getAlarmList();
};
const handleDelete = (row) => {
ElMessageBox.confirm(`确认删除该报警信息吗?`, "系统提示", {
type: "warning",
closeOnClickModal: false,
}).then(() => {
deleteAlarmSate(row.alarmId).then((res) => {
if (res.code === 1000) {
ElMessage.success("删除成功");
getAlarmList();
}
});
});
};
//查看报警信息详情
const handleView = (row) => {
getAlarmDetail(row.alarmId).then((res) => {
if (res.code === 1000) {
isDetailVisited.value = true;
alarmDetail.value = res.data;
if (roleKey.value !== "administrator") {
if (!row.lookupStatus) {
handleChangeState(row);
}
}
}
});
};
const handleChangeState = (row) => {
updateAlarmState([
{
alarmId: row.alarmId,
lookupStatus: true,
userId: currentUserId.value,
},
]).then((res) => {
if (res.code === 1000) {
// ElMessage.success(res.msg);
getAlarmList();
} else {
// ElMessage.error(res.msg);
}
});
};
const getAlarmList = () => {
loading.value = true;
getAlarmInfo({
tunnelId: tunnelId.value,
lookupStatus: queryParams.lookupStatus,
...pageInfo,
}).then((res) => {
if (res.code === 1000) {
loading.value = false;
if (res.data.rows.length === 0) {
tableEmptyText.value = "暂无数据~";
} else {
tableEmptyText.value = "";
}
alarmList.value = res.data.rows;
total.value = res.data.total;
}
});
};
const getUser = () => { const getUser = () => {
getUserInfo().then((res) => { getUserInfo().then((res) => {
currentUser.value = res.data.user.userName; currentUser.value = res.data.user.userName;
@@ -381,42 +226,20 @@ const getUser = () => {
localStorage.setItem("userId", currentUserId.value); localStorage.setItem("userId", currentUserId.value);
}); });
}; };
const getSimulationState = () => {
const getOtherInfo = () => { simulationState(previewId).then((res) => {
getLargeScreenInfo().then((res) => { if (res.code === 1000) {
if (res?.code === 1000) { if (res.data) {
let routeArr = []; if (res.data.state) {
res.data.routeList.forEach((item) => { isStartSimulate.value = false
for (let btn of btnList.value) {
if (item === btn.route) {
routeArr.push(btn);
}
} }
});
routeList.value = routeArr;
showMenu.value = true;
siteList.value = res.data.siteOption;
tunnelList.value = res.data.tunnelOption;
if (siteId) {
currentSiteId.value = siteId;
currentSite.value = localStorage.getItem("site");
showTunnelTitle.value = false;
nextTick(() => {
showTunnelTitle.value = true;
});
getTunnel(siteId);
} else { } else {
getTunnel(res.data.siteOption[0].value); isStartSimulate.value = true
currentSiteId.value = res.data.siteOption[0].value;
currentSite.value = res.data.siteOption[0].label;
localStorage.setItem("site", currentSite.value);
localStorage.setItem("currentSiteId", currentSiteId.value);
} }
} }
}); });
}; };
getSimulationState()
const getBasicData = (id) => { const getBasicData = (id) => {
getSimulateTunnelDetail(id).then((res) => { getSimulateTunnelDetail(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
@@ -424,14 +247,14 @@ const getBasicData = (id) => {
tunnelAlias.value = res.data.tunnelAlias; tunnelAlias.value = res.data.tunnelAlias;
serialNumber.value = res.data.serialNumber; serialNumber.value = res.data.serialNumber;
constructionLength.value = res.data.constructionLength; constructionLength.value = res.data.constructionLength;
initWebSocket(); initWebSocket()
} else { } else {
ElMessage.warning(res.msg); ElMessage.warning(res.msg);
} }
}); });
}; };
const getScreenInfo = (id,flag) => { const getScreenInfo = (id, flag) => {
if (id) { if (id) {
tunnelId.value = id; tunnelId.value = id;
// equipmentOption.value = [] // equipmentOption.value = []
@@ -467,7 +290,9 @@ const getScreenInfo = (id,flag) => {
showBadLoading.value = 1; showBadLoading.value = 1;
} }
largeScreenData.value = res.data; largeScreenData.value = res.data;
if(flag) {
getSimulationState()
if (flag) {
nextTick(() => { nextTick(() => {
previewRef.value.TunnelSceneSimulateRender(res.data) previewRef.value.TunnelSceneSimulateRender(res.data)
}) })
@@ -481,33 +306,6 @@ const getScreenInfo = (id,flag) => {
} }
}; };
let largeScreen = computed(() => largeScreenData);
const getTunnel = (id) => {
getTunnelBySiteId(id).then((res) => {
if (res?.code === 1000) {
if (res.data.length === 0) {
if (isTunnel) {
ElMessage.warning("该站点下没有隧道可展示, 请添加设备后再试!");
} else {
ElMessage.warning("该站点下没有隧道, 请新增隧道后再试!");
}
} else {
if (!pattern.test(previewId)) {
getScreenInfo(previewId);
tunnelList.value.forEach((item, index) => {
if (item.value == previewId) {
initialIndex.value = index;
tunnelBtn.value.setActiveItem(index);
}
});
} else {
tunnelList.value = res.data;
getScreenInfo(res.data[0]?.value);
}
}
}
});
};
const closeLeft = () => { const closeLeft = () => {
drawerLeft.value = !drawerLeft.value; drawerLeft.value = !drawerLeft.value;
}; };
@@ -527,7 +325,7 @@ const handleLogout = () => {
const initWebSocket = () => { const initWebSocket = () => {
// let wsUrl = `ws://frp.toomewhy.top:38000/wstunnel/websocket/simulate/${token}/123`; // let wsUrl = `ws://frp.toomewhy.top:38000/wstunnel/websocket/simulate/${token}/123`;
// let wsUrl = `ws://192.168.31.175:8000/wstunnel/websocket/simulate/${token}/123`; // let wsUrl = `ws://192.168.31.175:9000/websocket/simulate/${token}/${serialNumber.value}`;
let wsUrl = `ws://tunnel.feashow.com/api/wstunnel/websocket/simulate/${token}/${serialNumber.value}`; let wsUrl = `ws://tunnel.feashow.com/api/wstunnel/websocket/simulate/${token}/${serialNumber.value}`;
// let wsUrl = import.meta.env.VITE_BASE_WSURL+`/${token}/${serialNumber.value}`; // let wsUrl = import.meta.env.VITE_BASE_WSURL+`/${token}/${serialNumber.value}`;
// let wsUrl = `ws://clay.frp.feashow.cn/wstunnel/websocket/equipment/${token}/${serialNumber.value}`; // let wsUrl = `ws://clay.frp.feashow.cn/wstunnel/websocket/equipment/${token}/${serialNumber.value}`;