Merge pull request 'trp_dev' (#398) from trp_dev into dengjie

Reviewed-on: http://git.feashow.cn/clay/tunnel-cloud-web/pulls/398
This commit is contained in:
2024-12-29 06:53:03 +00:00
7 changed files with 379 additions and 290 deletions

View File

@@ -10,7 +10,7 @@
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"autofit.js": "^3.0.4",
"autofit.js": "^3.2.1",
"axios": "^1.4.0",
"csv-exportor": "^1.0.2",
"echarts": "^5.4.2",

View File

@@ -315,7 +315,7 @@ async function handleMounted() {
demo.isedit = params.isedit;
let tunnelasync = await demo.loadModel(
GLTFLoader,
"/tunnelModel/chanel-have-wall-now-use.gltf"
"/tunnelModel/chanel-have-wall-now-use.gltf",
);
demo.addOrbitControls(OrbitControls);
demo.addTween(TWEEN);

View File

@@ -1,28 +1,28 @@
<template>
<div id="scene">
<div id="cvs" ref="content"></div>
<dev-info ref="info" :devInfo="devInfo"/>
<dev-info ref="info" :devInfo="devInfo" />
<!-- 这里的预览模式需要做成不能修改的模式 -->
<edit-dialog
ref="edit"
@addEquipment="handleAddEqu"
@removeEquipment="handleRemoveEqu"
@cancel="handleCancel"
:hasDev="hasDevice"
:pointNum="pointNum"
:tunnelId="params.tunnelId"
:position="targetP?.name"
:hasEquipment="hasDevice"
:pointGap="pointGap"
:form="params.form"
ref="edit"
@addEquipment="handleAddEqu"
@removeEquipment="handleRemoveEqu"
@cancel="handleCancel"
:hasDev="hasDevice"
:pointNum="pointNum"
:tunnelId="params.tunnelId"
:position="targetP?.name"
:hasEquipment="hasDevice"
:pointGap="pointGap"
:form="params.form"
/>
<el-dialog
v-model="centerDialogVisible"
width="30%"
destroy-on-close
center
:show-close="false"
style="
v-model="centerDialogVisible"
width="30%"
destroy-on-close
center
:show-close="false"
style="
margin: 20% auto;
width: 569px;
height: 330px;
@@ -47,27 +47,30 @@ import DevInfo from "./displayInfoComp/DevInfo.vue";
import EditDialog from "./editEquComp/editDialog.vue";
// 导入模模型加载器
import {GLTFLoader} from "three/examples/jsm/loaders/GLTFLoader";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
// import { DRACOLoader } from "three/examples/jsm/loaders/dracoloader";
import {OrbitControls} from "three/examples/jsm/controls/OrbitControls";
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
import * as TWEEN from "three/examples/jsm/libs/tween.module";
import {
CSS3DRenderer,
CSS3DObject,
CSS3DSprite,
} from "three/addons/renderers/CSS3DRenderer.js";
// 引入CSS2渲染器CSS2DRenderer和CSS2模型对象CSS2DObject
import {
CSS2DRenderer,
CSS2DObject,
} from "three/addons/renderers/CSS2DRenderer.js";
import {OBJLoader} from "three/examples/jsm/loaders/OBJLoader";
import {RGBELoader} from "three/examples/jsm/loaders/RGBELoader";
import {onMounted, reactive, ref, toRaw, watch} from "vue";
import {ElMessage} from "element-plus";
import {useModelSceneStore} from "@/store/modelSceneStore";
import {LOD} from "three";
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader";
import {
onMounted,
reactive,
ref,
toRaw,
watch,
defineProps,
defineExpose,
} from "vue";
import { ElMessage } from "element-plus";
import { useModelSceneStore } from "@/store/modelSceneStore";
import { getScreenSimulateTunnel } from "@/api/tunnelManage";
// 获取html标签跟随组件dom
const content = ref(null);
const info = ref(null);
@@ -85,20 +88,21 @@ const params = defineProps([
"form",
"deviceData",
"devRealtimeData",
"simulateData",
]); //接收参数看是不是编辑模式,如果是编辑模式,则需要做一些处理
let isedit = ref(params.isedit);
let tunnelId = reactive(params.tunnelId);
watch(
() => params.tunnelLength,
(now) => {
params.tunnelLength = now;
// console.log(params.tunnelLength);
pointGap = now / 20;
// console.log(params.form.tunnelName);
},
{deep: true}
() => params.tunnelLength,
(now) => {
params.tunnelLength = now;
// console.log(params.tunnelLength);
pointGap = now / 20;
// console.log(params.form.tunnelName);
},
{ deep: true }
);
let pointGap = reactive(params.tunnelLength);
@@ -110,12 +114,12 @@ async function handleMounted() {
const doms = [info.value.$el, edit.value.$el];
demo = new ThreeDScene(three, content.value);
//看是不是预览模式,然后继续相关的操作(会在demo中的初始化中进行)
demo.isedit = params.isedit;
// "../../../../public/tunnelModel/chanel-have-wall-now-use.gltf"
demo.isedit =false;
const loaded = await demo.loadModel(
GLTFLoader,
"/tunnelModel/chanel-have-wall-now-use.gltf",
true
GLTFLoader,
"/tunnelModel/chanel-have-wall-now-use.gltf",
true,
);
demo.addOrbitControls(OrbitControls, true);
demo.addTween(TWEEN);
@@ -153,42 +157,114 @@ async function handleMounted() {
// console.log('parmas',newModelList)
modelList.value = [
{
"typeKey": "frequency",
"position": "point_001_tr",
"threshold": "",
"equipmentId": 3048,
"equipmentName": "温度传感器",
"equipmentType": "sensor"
}, {
"typeKey": "temperature",
"position": "point_020_tr",
"threshold": "",
"equipmentId": 10,
"equipmentName": "1度传感器",
"equipmentType": "sensor"
}
]
// modelList.value = await initData(params.tunnelId, params.form);
// console.log("test", modelList.value);
demo.editTunnelInit(toRaw(modelList.value));
typeKey: "frequency",
position: "point_001_tr",
threshold: "",
equipmentId: 3048,
equipmentName: "温度传感器",
equipmentType: "sensor",
data: 100, //实时数据
unit: "℃", //单位
},
{
typeKey: "temperature",
position: "point_020_tr",
threshold: "",
equipmentId: 10,
equipmentName: "1度传感器",
equipmentType: "sensor",
data: 10, //实时参数
unit: "%", //单位
},
];
// 初始化仿真參數
const { data } = await getScreenSimulateTunnel(params.tunnelId);
const modeData = randomPosition([
...data.frequencyChangerList,
...data.windPressureSensorList,
...data.sensorList,
]).map((item) => ({
...item,
equipmentType: item.equipmentType.startsWith("frequency")
? "frequency"
: "sensor",
}));
demo.editTunnelInit(modeData);
// 初始化标牌信息
demo.SignsInf("dsadsa", String(params.tunnelLength));
} catch (err) {}
}
// 从新渲染数据
async function rerender() {
try {
// 初始化仿真參數
const { data } = await getScreenSimulateTunnel(params.tunnelId);
console.log(data);
const modeData = randomPosition([
...data.frequencyChangerList,
...data.windPressureSensorList,
...data.sensorList,
]).map((item) => ({
...item,
equipmentType: item.equipmentType.startsWith("frequency")
? "frequency"
: "sensor",
}));
demo.editTunnelInit(modeData);
demo.SignsInf(params.form.tunnelAlias, String(params.tunnelLength));
} catch (err) {
} catch (error) {
ElMessage({
message: "获取仿真数据异常!",
type: "warning",
});
}
}
// 随机生成1-20的随机数
function randomNum(max = 20) {
const nums = new Set();
while (nums.size < max) {
nums.add(Math.floor(Math.random() * max + 1).toString());
}
return [...nums];
}
//随机定位
function randomPosition(simulateData) {
const mid = Math.floor(simulateData.length / 2);
const lrIndex = Math.floor(Math.random() * 2);
const lr_position = ["tl", "tr"];
const leftPosition = randomNum();
const rightPosition = randomNum();
const leftData = simulateData.slice(0, mid).map((item, index) => ({
...item,
position: `point_0${leftPosition[index].padStart(2, 0)}_${
lr_position[lrIndex]
}`,
}));
const rightData = simulateData
.slice(mid, simulateData.length)
.map((item, index) => ({
...item,
position: `point_0${rightPosition[index].padStart(2, 0)}_${
lr_position[1 - lrIndex]
}`,
}));
return [...leftData, ...rightData];
}
// 每个模型加载回调
function loadModel(path) {
return new Promise((resolve, reject) => {
loader.load(
path,
(obj) => {
resolve(obj);
},
(xhr) => {
},
(err) => {
reject(err);
}
path,
(obj) => {
resolve(obj);
},
(xhr) => {},
(err) => {
reject(err);
}
);
});
}
@@ -203,12 +279,12 @@ let devInfo = reactive({
// 对象建构赋值功能
function editDevInfo(
value = {
meshId: null,
name: "无",
state: "无",
position: "无",
}
value = {
meshId: null,
name: "无",
state: "无",
position: "无",
}
) {
devInfo.meshId = value.meshId;
devInfo.name = value.name;
@@ -243,10 +319,10 @@ function rClickCallback(demo) {
hasDevice.value = targetPoint.hasDevice;
targetP.value = targetPoint;
pointNum.value = Number(
targetPoint.name.substring(
targetPoint.name.indexOf("_") + 1,
targetPoint.name.lastIndexOf("_")
) - 1
targetPoint.name.substring(
targetPoint.name.indexOf("_") + 1,
targetPoint.name.lastIndexOf("_")
) - 1
);
if (!targetPoint.info) return;
editDevInfo(targetPoint.info);
@@ -292,23 +368,23 @@ function handleRemoveEqu() {
function handleConfirmAddEqu() {
console.log("target:", targetP.value.info);
modelStore
.deleteEquipment(targetP.value.info.equipmentId, pointGap)
.then((res) => {
demo.removeEquipment(targetP.value);
centerDialogVisible.value = false;
handleCancel();
ElMessage({
message: "删除成功!",
type: "success",
});
})
.catch((res) => {
console.log(res);
ElMessage({
message: "删除失败!",
type: "warning",
});
.deleteEquipment(targetP.value.info.equipmentId, pointGap)
.then((res) => {
demo.removeEquipment(targetP.value);
centerDialogVisible.value = false;
handleCancel();
ElMessage({
message: "删除成功!",
type: "success",
});
})
.catch((res) => {
console.log(res);
ElMessage({
message: "删除失败!",
type: "warning",
});
});
}
// 处理取消关闭编辑框事件
@@ -351,6 +427,9 @@ const ThreeConfig = {
watch(params.devRealtimeData, () => {
// console.log("devRealtimeData", params.devRealtimeData);
});
defineExpose({
rerender,
});
</script>
<style lang="scss" scoped>

View File

@@ -354,7 +354,6 @@ export default class Demo {
this.CSS2Renderer = new CSS2Renderer();
this.CSS2Renderer.setSize(window.innerWidth, window.innerHeight - 100);
this.CSS2Renderer.render(this.scene, this.camera);
this.mountedElement.appendChild(this.CSS2Renderer.domElement);
// 初始化html标签

View File

@@ -34,7 +34,7 @@ function addEquipment(targetPoint, formInfo, fanData) {
}
//判断墙是否已经存在,如果存在的话,就不管,添加则无效嘛(就是说只能添加一面墙,如果存在一面墙,则不管了)
let hasWall = false
let hasWall = false;
let wallHang = 0;
// function handleValveEqu(targetPoint, equipmentInfo) {
@@ -49,7 +49,8 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
equMesh.position.copy(worldP);
//设备添加标签
const tag = EquipmentTag(equipmentInfo.equipmentName);
const param = `${equipmentInfo.data || "--"} ${equipmentInfo.unit || "-"}`; //渲染设备参数(data)和单位unit
const tag = EquipmentTag(equipmentInfo.equipmentName,param);
equMesh.getObjectByName("tag").material = tag;
if (/tr$/.test(targetPoint.name)) {
equMesh.rotation.z = -Math.PI / 2;
@@ -195,11 +196,10 @@ function handleFanEqu(
if (item.isMesh) {
item.material = item.material.clone();
}
})
});
// equMesh.geometry = this.equMap.get("equ_fan").geometry.clone();
// console.log(equMesh);
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
equMesh.position.copy(worldP);
equMesh.translateY(-0.6);
@@ -213,15 +213,13 @@ function handleFanEqu(
...equipmentInfo,
};
//我们把风机的附着点挂在原型上,这样应该可以进行处理
if (targetPoint.info.equipmentName.slice(0, 1) == '1') {
this.scene.Fan1targetPoint = targetPoint
if (targetPoint.info.equipmentName.slice(0, 1) == "1") {
this.scene.Fan1targetPoint = targetPoint;
} else {
this.scene.Fan2targetPoint = targetPoint
this.scene.Fan2targetPoint = targetPoint;
}
//这里感觉情况改变风机的颜色
changeFanColor(fanData, targetPoint, this.scene)
changeFanColor(fanData, targetPoint, this.scene);
// 定义风机旋转
const fanLeaf = equMesh.getObjectByName("fan_leafs");
@@ -240,7 +238,6 @@ function removeEquipment(targetPoint) {
//删除设备这里需要再进行处理,就是根据附着点(附着点一定保存了当前添加设备的信息了)判断是不是分压阀,然后继续一样的隐藏
if (!targetPoint.hasDevice) return;
//删除我们这里使用行数来判断,即是不是删除到了我们的那一行呢?
//如果删除到了我们那行的话我们必须将行的数组从中去掉已存在的数据然后将附着点列表中也去除这个点然后将墙设置为false来让下次使用
@@ -286,8 +283,6 @@ function removeEquipment(targetPoint) {
// }
// deleteItem(Allhang, Number(lineIndex))
console.log("测试是不是删除了");
const mesh = this.scene.getObjectById(targetPoint.info.id);
this.scene.remove(mesh);
@@ -298,13 +293,12 @@ function removeEquipment(targetPoint) {
}
export { addEquipment, removeEquipment };
function deleteItem(array, item) {
let index = array.indexOf(item);
if (index !== -1) {
array.splice(index, 1);
}
return array
return array;
}
// 这里是改变风机颜色的代码
@@ -315,7 +309,7 @@ function changeFanColor(fanData, targetPoint, scene) {
//if保证存在风机即有长度再进行遍历
for (let i = 0; i < fanData.length; i++) {
//先做匹配操作
let fanType = fanData[i].equipmentType
let fanType = fanData[i].equipmentType;
//有符合条件的风机进来了
if (targetPoint.info.typeKey == fanType) {
//下面进行变色需要的逻辑判断了
@@ -327,9 +321,9 @@ function changeFanColor(fanData, targetPoint, scene) {
// console.log(obj);
// 判断子对象是否是物体,如果是,更改其颜色
if (obj.isMesh) {
obj.material.color.set(0xFF0000)
obj.material.color.set(0xff0000);
}
})
});
}
});
} else {
@@ -342,9 +336,9 @@ function changeFanColor(fanData, targetPoint, scene) {
// console.log(obj);
// 判断子对象是否是物体,如果是,更改其颜色
if (obj.isMesh) {
obj.material.color.set(0x008000)
obj.material.color.set(0x008000);
}
})
});
}
});
} else {
@@ -356,4 +350,4 @@ function changeFanColor(fanData, targetPoint, scene) {
}
}
}
}
}

View File

@@ -6,7 +6,8 @@
<div class="top-length">
<span>隧道总长度: {{ tunnelLength }}</span>
<span class="all-btn" @click="startSimulate" v-if="isStartSimulate"
>开始模拟</span>
>开始模拟</span
>
<div v-else>
<span class="all-btn" @click="simulatedBlasting">模拟爆破</span>
<span class="all-btn" @click="endSimulate">结束模拟</span>
@@ -14,19 +15,19 @@
<!-- <span class="all-btn" :style="{color:!isPreview?'#f7b500':'#0BE9FA'}" @click="changeTunnelSimulateMode(false)">编辑模式</span>-->
</div>
<div class="top-right" v-if="isPreview">
<!-- <div class="current-site">-->
<!-- <el-icon-->
<!-- size="50"-->
<!-- color="#0BE9FA"-->
<!-- style="margin-left: 50px; cursor: pointer"-->
<!-- @click="-->
<!-- isVisited = true;-->
<!-- getAlarmList();-->
<!-- "-->
<!-- >-->
<!-- <Bell/>-->
<!-- </el-icon>-->
<!-- </div>-->
<!-- <div class="current-site">-->
<!-- <el-icon-->
<!-- size="50"-->
<!-- color="#0BE9FA"-->
<!-- style="margin-left: 50px; cursor: pointer"-->
<!-- @click="-->
<!-- isVisited = true;-->
<!-- getAlarmList();-->
<!-- "-->
<!-- >-->
<!-- <Bell/>-->
<!-- </el-icon>-->
<!-- </div>-->
<div class="current-user">
你好<span>{{ currentUser }}</span>
<span>今天是{{ currentDate }}</span>
@@ -34,79 +35,89 @@
</div>
</div>
</div>
<device-manage v-if="showDevice" @cancel="cancelDeviceManage" @submit="submitDevice"/>
<device-manage
v-if="showDevice"
@cancel="cancelDeviceManage"
@submit="submitDevice"
/>
<!-- 模拟隧道模式-->
<preview-scene-simulate id="tunnel-box" :isedit="false" :device-data="largeScreenData" :tunnelLength="100"></preview-scene-simulate>
<preview-scene-simulate
id="tunnel-box"
:isedit="false"
:device-data="largeScreenData"
:tunnelLength="100"
:tunnelId="tunnelId"
></preview-scene-simulate>
<!-- 一进去的话应该是预览模式所以引入这个组件1 -->
<!-- <preview-scene-->
<!-- id="tunnel-box"-->
<!-- :isedit="false"-->
<!-- :tunnelId="tunnelId"-->
<!-- :key="tunnelId"-->
<!-- :tunnelLen="tunnelLen"-->
<!-- :largeScreen="largeScreen"-->
<!-- :fanList="socketData.leftData"-->
<!-- ></preview-scene>-->
<!-- <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">
<el-drawer
v-model="drawerLeft"
direction="ltr"
modal-class="modal-box"
:modal="false"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
v-model="drawerLeft"
direction="ltr"
modal-class="modal-box"
:modal="false"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<fan-info
v-if="showFan"
:list="socketData.leftData"
:isSimulate="true"
:fan-data="largeScreenData"
:transducer-data="largeScreenData"
:loading="showFanLoading"
:tunnel-id="tunnelId"
v-if="showFan"
:list="socketData.leftData"
:isSimulate="true"
:fan-data="largeScreenData"
:transducer-data="largeScreenData"
:loading="showFanLoading"
:tunnel-id="tunnelId"
/>
<!-- <used-ele-->
<!-- v-if="showFan"-->
<!-- :list="socketData.leftData"-->
<!-- :loading="showUsedLoading"-->
<!-- :ele-data="largeScreenData"-->
<!-- />-->
<!-- <used-ele-->
<!-- v-if="showFan"-->
<!-- :list="socketData.leftData"-->
<!-- :loading="showUsedLoading"-->
<!-- :ele-data="largeScreenData"-->
<!-- />-->
</el-drawer>
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
<div v-else class="shrink-left" @click="closeLeft"></div>
</div>
<div class="right" v-if="isPreview">
<el-drawer
v-model="drawerRight"
direction="rtl"
modal-class="modal-box"
:modal="false"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
v-model="drawerRight"
direction="rtl"
modal-class="modal-box"
:modal="false"
:show-close="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<wind-pressure-list
v-if="showFan"
:list="socketData.windPressure"
:isSimulate="true"
:win-data="largeScreenData"
:loading="showWindLoading"
v-if="showFan"
:list="socketData.windPressure"
:isSimulate="true"
:win-data="largeScreenData"
:loading="showWindLoading"
/>
<air-info
v-if="showFan"
:list="socketData.sensor"
:windSpeed="socketData.windSpeed"
:isSimulate="true"
:air-data="largeScreenData"
v-if="showFan"
:list="socketData.sensor"
:windSpeed="socketData.windSpeed"
:isSimulate="true"
:air-data="largeScreenData"
/>
<bad-gas-info
v-if="showFan"
:list="socketData.sensor"
:bad-gas-data="largeScreenData"
:isSimulate="true"
:tunnelId="tunnelId"
:loading="showBadLoading"
v-if="showFan"
:list="socketData.sensor"
:bad-gas-data="largeScreenData"
:isSimulate="true"
:tunnelId="tunnelId"
:loading="showBadLoading"
/>
</el-drawer>
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
@@ -115,10 +126,10 @@
</div>
<div class="alarm-dialog alarm-tunnel">
<el-dialog
:close-on-click-modal="false"
v-model="isDetailVisited"
title="报警信息详情"
width="1500px"
:close-on-click-modal="false"
v-model="isDetailVisited"
title="报警信息详情"
width="1500px"
>
<div class="detail">
<div>报警时间</div>
@@ -132,33 +143,33 @@
</div>
<div class="alarm-tunnel">
<el-dialog
:close-on-click-modal="false"
v-model="isVisited"
title="报警信息"
width="2175px"
:modal="false"
:close-on-click-modal="false"
v-model="isVisited"
title="报警信息"
width="2175px"
:modal="false"
>
<div class="left-top-icon"></div>
<div class="right-top-icon"></div>
<el-form
:model="queryParams"
inline
class="query-form"
ref="queryForm"
@submit.prevent="getAlarmList"
v-if="roleKey !== 'administrator'"
:model="queryParams"
inline
class="query-form"
ref="queryForm"
@submit.prevent="getAlarmList"
v-if="roleKey !== 'administrator'"
>
<el-form-item label="查阅状态" prop="lookupStatus">
<el-select
v-model="queryParams.lookupStatus"
placeholder="请选择查阅状态"
:fit-input-width="true"
:teleported="false"
clearable
filterable
v-model="queryParams.lookupStatus"
placeholder="请选择查阅状态"
:fit-input-width="true"
:teleported="false"
clearable
filterable
>
<el-option label="已读" :value="true"/>
<el-option label="未读" :value="false"/>
<el-option label="已读" :value="true" />
<el-option label="未读" :value="false" />
</el-select>
</el-form-item>
<el-form-item>
@@ -167,87 +178,87 @@
</el-form-item>
</el-form>
<div
class="device-table"
:style="{ marginTop: roleKey === 'administrator' ? '40px' : '0' }"
class="device-table"
:style="{ marginTop: roleKey === 'administrator' ? '40px' : '0' }"
>
<el-table
stripe
v-loading="loading"
:empty-text="tableEmptyText"
style="background-color: #011c29; --el-table-border-color: none"
:header-cell-style="{
stripe
v-loading="loading"
:empty-text="tableEmptyText"
style="background-color: #011c29; --el-table-border-color: none"
:header-cell-style="{
backgroundColor: '#064B66',
color: '#fff',
fontSize: '40px',
borderBottom: 'none',
}"
:data="alarmList"
:data="alarmList"
>
<el-table-column
prop="tunnelName"
label="隧道名称"
align="center"
width="400px"
prop="tunnelName"
label="隧道名称"
align="center"
width="400px"
/>
<el-table-column
prop="alarmContent"
label="告警信息"
align="center"
prop="alarmContent"
label="告警信息"
align="center"
/>
<el-table-column
prop="alarmTime"
label="告警时间"
align="center"
width="480px"
prop="alarmTime"
label="告警时间"
align="center"
width="480px"
/>
<el-table-column
prop="lookupStatus"
label="查阅状态"
align="center"
width="200px"
v-if="roleKey !== 'administrator'"
prop="lookupStatus"
label="查阅状态"
align="center"
width="200px"
v-if="roleKey !== 'administrator'"
>
<template #default="scope">
<el-tag :type="scope.row.lookupStatus ? 'success' : 'warning'"
>{{ scope.row.lookupStatus ? "已读" : "未读" }}
>{{ scope.row.lookupStatus ? "已读" : "未读" }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300px">
<template #default="scope">
<el-button
type="primary"
size="mini"
style="font-weight: bold"
@click="handleView(scope.row)"
link
>详情
type="primary"
size="mini"
style="font-weight: bold"
@click="handleView(scope.row)"
link
>详情
</el-button>
<el-button
type="danger"
size="mini"
v-if="roleKey !== 'administrator'"
@click="handleDelete(scope.row)"
link
>删除
type="danger"
size="mini"
v-if="roleKey !== 'administrator'"
@click="handleDelete(scope.row)"
link
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<div
class="pagination"
:style="{ bottom: roleKey === 'administrator' ? '40px' : '0' }"
class="pagination"
:style="{ bottom: roleKey === 'administrator' ? '40px' : '0' }"
>
<el-pagination
background
v-model:current-page="pageInfo.pageNum"
v-model:page-size="pageInfo.pageSize"
:total="total"
prev-text="上一页"
next-text="下一页"
layout="prev, pager, next"
@current-change="handleCurrentChange"
:hide-on-single-page="true"
background
v-model:current-page="pageInfo.pageNum"
v-model:page-size="pageInfo.pageSize"
:total="total"
prev-text="上一页"
next-text="下一页"
layout="prev, pager, next"
@current-change="handleCurrentChange"
:hide-on-single-page="true"
/>
</div>
</div>
@@ -267,9 +278,9 @@ import AirInfo from "@/components/content/airInfo/AirInfo.vue";
import BadGasInfo from "@/components/content/badGasInfo/BadGasInfo.vue";
import ManageBtn from "@/components/manageBtn/index.vue";
import TunnelTitle from "@/components/tunnelTitle/index.vue";
import {dateFormat} from "@/utils/date.js";
import {getToken} from "@/utils/auth";
import {useAuthStore} from "@/store/userstore.js";
import { dateFormat } from "@/utils/date.js";
import { getToken } from "@/utils/auth";
import { useAuthStore } from "@/store/userstore.js";
import {
getLargeScreen,
getLargeScreenInfo,
@@ -277,13 +288,19 @@ import {
getAlarmInfo,
deleteAlarmSate,
getAlarmDetail,
updateAlarmState, endSimulation, blastingSimulation,
updateAlarmState,
endSimulation,
blastingSimulation,
} from "@/api/largeScreen";
import {ElLoading, ElMessage, ElMessageBox} from "element-plus";
import {getUserInfo} from "@/api/login";
import {initSceneData} from "@/api/tunnelScene";
import {getScreenSimulateTunnel, getSimulateTunnelDetail, getTunnelList} from "@/api/tunnelManage";
import {debounce} from "lodash";
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
import { getUserInfo } from "@/api/login";
import { initSceneData } from "@/api/tunnelScene";
import {
getScreenSimulateTunnel,
getSimulateTunnelDetail,
getTunnelList,
} from "@/api/tunnelManage";
import { debounce } from "lodash";
const authStore = useAuthStore();
const router = useRouter();
@@ -382,9 +399,9 @@ const queryParams = reactive({
onMounted(() => {
getUser();
// getOtherInfo();
getScreenInfo(previewId)
getScreenInfo(previewId);
getBasicData(previewId)
getBasicData(previewId);
nextTick(() => {
showFan.value = true;
});
@@ -400,15 +417,15 @@ const cancelDeviceManage = () => {
const submitDevice = () => {
isStartSimulate.value = false;
showDevice.value = false;
getScreenInfo(previewId)
getScreenInfo(previewId);
// initWebSocket()
};
const simulatedBlasting =async () => {
await blastingSimulation(previewId,10)
const simulatedBlasting = async () => {
await blastingSimulation(previewId, 10);
};
const endSimulate =async () => {
const endSimulate = async () => {
isStartSimulate.value = true;
await endSimulation(previewId)
await endSimulation(previewId);
};
const changeName = (id) => {
for (let item of equipmentOption.value) {
@@ -540,12 +557,12 @@ const getBasicData = (id) => {
tunnelLength.value = res.data.totalLength;
serialNumber.value = res.data.serialNumber;
constructionLength.value = res.data.constructionLength;
initWebSocket()
initWebSocket();
} else {
ElMessage.warning(res.msg);
}
})
}
});
};
const getScreenInfo = (id) => {
if (id) {
@@ -573,13 +590,13 @@ const getScreenInfo = (id) => {
// })
res.data.sensorList.forEach((item) => {
if (
item.equipmentType === "dust" ||
item.equipmentType === "carbonDioxide" ||
item.equipmentType === "carbonMonoxide" ||
item.equipmentType === "hydrogenSulfide" ||
item.equipmentType === "sulfurDioxide" ||
item.equipmentType === "sulfurMonoxide" ||
item.equipmentType === "nitrogenDioxide"
item.equipmentType === "dust" ||
item.equipmentType === "carbonDioxide" ||
item.equipmentType === "carbonMonoxide" ||
item.equipmentType === "hydrogenSulfide" ||
item.equipmentType === "sulfurDioxide" ||
item.equipmentType === "sulfurMonoxide" ||
item.equipmentType === "nitrogenDioxide"
) {
showBadLoading.value = 0;
} else {
@@ -590,7 +607,7 @@ const getScreenInfo = (id) => {
showBadLoading.value = 1;
}
largeScreenData.value = res.data;
console.log('largeScreenData.value', largeScreenData.value)
console.log("largeScreenData.value", largeScreenData.value);
} else {
ElMessage.warning(res.msg);
}
@@ -631,7 +648,7 @@ const getTunnel = (id) => {
}
}
});
}
};
const closeLeft = () => {
drawerLeft.value = !drawerLeft.value;
};
@@ -650,7 +667,7 @@ const handleLogout = () => {
};
const initWebSocket = () => {
let wsUrl = `ws://192.168.31.175:8000/wstunnel/websocket/simulate/${token}/123`
let wsUrl = `ws://192.168.31.175:8000/wstunnel/websocket/simulate/${token}/123`;
// let wsUrl = `ws://tunnel.feashow.com/api/websocket/simulate/${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}`;

View File

@@ -74,7 +74,7 @@ export default defineConfig({
// rewrite: (path) => path.replace(/^\/api/, ''),
// },
'/api': {
target: 'http://web-tunnel.feashow.com/api',
target: 'http://frp.toomewhy.top:38000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},