Merge branch 'dev' into trp_dev

This commit is contained in:
trp
2023-12-30 13:25:03 +08:00
16 changed files with 356 additions and 264 deletions

View File

@@ -6,15 +6,16 @@
<div class="input-fan"><span>风速</span>{{ windSpeed }}m/s</div> <div class="input-fan"><span>风速</span>{{ windSpeed }}m/s</div>
</div> </div>
</div> </div>
<item-info <item-info
v-for="item in airList" v-for="item in airList"
:key="item.equipmentId" :key="item.equipmentId"
:wp="item" :wp="item"
:icon="item.icon" :icon="item.icon"
:name="item.name" :name="item.name"
:unit="item.unit" :unit="item.unit"
@click="handleOpenAirChart(item)" @click="handleOpenAirChart(item)"
/> />
<div class="digital-tunnel"> <div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px" :modal="false"> <el-dialog :close-on-click-modal="false" v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px" :modal="false">
<div class="left-top-icon"></div> <div class="left-top-icon"></div>
@@ -87,7 +88,7 @@ watch(() => props.list, (now) => {
}) })
}, {deep: true}); }, {deep: true});
watch(() => props.airData, (now) => { watch(() => props.airData, (now) => {
if(now.sensorList===null){ if(now.sensorList.length===0){
airList.value=[] airList.value=[]
}else { }else {
getAirInfo(now.sensorList) getAirInfo(now.sensorList)

View File

@@ -64,13 +64,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="current" @click="handleOpenChart(item)"> <div class="current" @click="handleOpenChart(item,index)">
<fan-info-item :wp="transducerData[index]" /> <fan-info-item :wp="transducerData[index]" />
</div> </div>
</div> </div>
</div> </div>
<div class="digital-tunnel"> <div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isVisited" :title="'电流监控数据'" width="2175px" <el-dialog :close-on-click-modal="false" v-model="isVisited" :title="changeNum(fanIndex)+'号风机电流监控数据'" width="2175px"
:modal="false"> :modal="false">
<div class="left-top-icon"></div> <div class="left-top-icon"></div>
<div class="right-top-icon"></div> <div class="right-top-icon"></div>
@@ -111,7 +111,9 @@ const stateA = ref(false)
const stateB = ref(false) const stateB = ref(false)
const stateC = ref(false) const stateC = ref(false)
const isVisited = ref(false) const isVisited = ref(false)
const fanIndex = ref(0)
let myEcharts = reactive({}); let myEcharts = reactive({});
watch(() => props.transducerData, (now) => { watch(() => props.transducerData, (now) => {
getTransData(now.frequencyChangerList) getTransData(now.frequencyChangerList)
}, {deep: true}); }, {deep: true});
@@ -155,8 +157,9 @@ const getFanInfo = (equipmentId) => {
} }
}) })
} }
const handleOpenChart = (item) => { const handleOpenChart = (item,index) => {
getFanInfo(item.equipmentId) getFanInfo(item.equipmentId)
fanIndex.value=index+1
} }
const getTransData = (data) => { const getTransData = (data) => {
let tranObj = {} let tranObj = {}
@@ -505,7 +508,6 @@ input[type="number"] {
:deep( .el-radio__label) { :deep( .el-radio__label) {
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;
} }
@@ -520,17 +522,14 @@ input[type="number"] {
left: 68px; left: 68px;
padding: 10px; padding: 10px;
background-image: url(../../../assets/images/fanInfo/bg.png); background-image: url(../../../assets/images/fanInfo/bg.png);
//clip-path: polygon(0% 0%, 40% 0%, 48% 15%, 100% 15%, 100% 100%, 0% 100%);
color: #2fb0df; color: #2fb0df;
box-sizing: border-box; box-sizing: border-box;
.title { .title {
width: 40%; width: 40%;
text-align: left; text-align: left;
font-size: 20px; padding: 0 0 0 62px;
padding: 0px 0px 0px 62px;
font-size: 32px; font-size: 32px;
font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold; font-weight: bold;
color: #38cafb; color: #38cafb;
line-height: 42px; line-height: 42px;
@@ -560,7 +559,6 @@ input[type="number"] {
.echart::after { .echart::after {
content: "Hz"; content: "Hz";
font-size: 24px; font-size: 24px;
font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold; font-weight: bold;
color: #ffffff; color: #ffffff;
line-height: 31px; line-height: 31px;
@@ -574,7 +572,6 @@ input[type="number"] {
width: 39px; width: 39px;
height: 140px; height: 140px;
font-size: 26px; font-size: 26px;
font-family: MicrosoftYaHei;
color: #38cafb; color: #38cafb;
line-height: 35px; line-height: 35px;
text-align: center; text-align: center;
@@ -598,7 +595,6 @@ input[type="number"] {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
font-size: 26px; font-size: 26px;
font-family: MicrosoftYaHei;
color: #38cafb; color: #38cafb;
line-height: 35px; line-height: 35px;
gap: 40px; gap: 40px;
@@ -644,7 +640,6 @@ input[type="number"] {
border-radius: 22px; border-radius: 22px;
border: 2px solid #0f82af; border: 2px solid #0f82af;
overflow: hidden; overflow: hidden;
font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold; font-weight: bold;
color: #127399; color: #127399;
line-height: 35px; line-height: 35px;
@@ -662,9 +657,8 @@ input[type="number"] {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
padding: 0px 20px; padding: 0 20px;
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;
gap: 33px; gap: 33px;
@@ -683,7 +677,6 @@ input[type="number"] {
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;
} }
@@ -696,7 +689,6 @@ input[type="number"] {
margin-left: 14px; margin-left: 14px;
outline: none; outline: none;
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold; font-weight: bold;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;
@@ -714,7 +706,6 @@ input[type="number"] {
padding-top: 30px; padding-top: 30px;
padding-right: 25px; padding-right: 25px;
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei;
color: #FFFFFF; color: #FFFFFF;
.fenliu-icon { .fenliu-icon {
@@ -737,7 +728,6 @@ input[type="number"] {
margin-left: 14px; margin-left: 14px;
outline: none; outline: none;
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold; font-weight: bold;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;
@@ -751,7 +741,6 @@ input[type="number"] {
bottom: 0; bottom: 0;
transform: translateY(-50%); transform: translateY(-50%);
font-size: 28px; font-size: 28px;
font-family: MicrosoftYaHei;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;
} }
@@ -761,13 +750,17 @@ input[type="number"] {
.current { .current {
margin-top: 30px; margin-top: 30px;
margin-right: 20px;
margin-left: 26px; margin-left: 26px;
height: 37px; //height: 37px;
font-size: 28px; font-size: 28px;
color: #FFFFFF; color: #FFFFFF;
cursor: pointer; cursor: pointer;
&:hover{
background-color: #2E5589;
border-radius: 6px;
}
} }
} }
} }
} }

View File

@@ -110,15 +110,16 @@ let isWaringC = computed(() => {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: 100%;
padding: 6px 38px 7px 10px; padding: 6px 0 7px 10px;
margin-bottom: 17px; margin-bottom: 17px;
&:hover { &:hover {
background: #2E5589; //background: #2E5589;
border-radius: 6px; //border-radius: 6px;
} }
&:last-child { &:last-child {
margin-bottom: 0;
.label { .label {
span { span {
margin: 0 5px 0 14px; margin: 0 5px 0 14px;

View File

@@ -47,15 +47,14 @@ import {
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader"; import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader";
import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader"; import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader";
import { onMounted, reactive, ref } from "vue"; import { onMounted, reactive, ref, toRaw, getCurrentInstance } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useModelSceneStore } from "@/store/modelSceneStore"; import { deleteEquipment, initData } from "./request";
import { toRaw } from "vue"
// 获取html标签跟随组件dom // 获取html标签跟随组件dom
const content = ref(null); const content = ref(null);
const info = ref(null); const info = ref(null);
const edit = ref(null); const edit = ref(null);
const store = useModelSceneStore(); let modelList = ref(null);
let demo; //定义demo全局变量 let demo; //定义demo全局变量
// const loader = new OBJLoader(); // const loader = new OBJLoader();
const loader = new OBJLoader(); const loader = new OBJLoader();
@@ -69,6 +68,16 @@ const params = defineProps(["isedit", "tunnelId"]); //接收参数看是不是
let isedit = ref(params.isedit) let isedit = ref(params.isedit)
// watch(
// () => params.tunnelId,
// (now) => {
// params.tunnelId = now
// console.log(params.tunnelId);
// },
// { deep: true }
// )
onMounted(handleMounted); onMounted(handleMounted);
// 挂载后回调 // 挂载后回调
async function handleMounted() { async function handleMounted() {
@@ -89,7 +98,7 @@ async function handleMounted() {
watch( watch(
() => params.tunnelId, () => params.tunnelId,
async () => { async () => {
const text = await store.initData(params.tunnelId); const text = await initData(params.tunnelId);
} }
); );
// 初始化设备模型 // 初始化设备模型
@@ -100,14 +109,38 @@ async function handleMounted() {
map.set("equ_sensors", await loadModel("/devicesModel/sensors.obj")); map.set("equ_sensors", await loadModel("/devicesModel/sensors.obj"));
// 给对象初加载设备模型 // 给对象初加载设备模型
demo.initDevicesModel(map); demo.initDevicesModel(map);
const equipmentList = await store.getEquipmentList(); // const equipmentList = await store.getEquipmentList();
demo.previewtunnelModeInit(equipmentList); modelList.value = await initData(params.tunnelId);
// previewEquInfProcess(equipmentList) // console.log("init", params.tunnelId);
demo.previewtunnelModeInit(modelList.value);
watch(
() => params.tunnelId,
(now) => {
params.tunnelId = now
// console.log(params.tunnelId);
checkTunnelInit(modelList.value)
demo.previewtunnelModeInit(modelList.value);
},
{ deep: true }
)
// demo.previewtunnelModeInit(equipmentList);
// previewEquInfProcess(modelList.value, targetP.value)
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
} }
function checkTunnelInit(equipmentList) {
equipmentList.forEach((item) => {
let equipment = toRaw(item)
console.log("我要清理掉之前的设备!!!");
console.log(equipment);
console.log(demo.scene.getObjectByName(equipment.position));
demo.removeEquipment(demo.scene.getObjectByName(equipment.position));
});
}
// 每个模型加载回调 // 每个模型加载回调
function loadModel(path) { function loadModel(path) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -163,46 +196,31 @@ function lClickCallback(demo) {
} }
let pointNum = ref(0); let pointNum = ref(0);
let targetP; let targetP = ref({});
// 右键点击附着点后调函数 // 右键点击附着点后调函数
function rClickCallback(demo) { function rClickCallback(demo) {
function editDev(targetPoint = null) { function editDev(targetPoint = null) {
hasDevice = targetPoint.hasDevice; hasDevice.value = targetPoint.hasDevice;
targetP = targetPoint; targetP.value = targetPoint;
//点击之后马上调用这个函数变成回调然后进行处理处理在传给preview表单 const equipmentList = initData(params.tunnelId)
const equipmentList = store.getEquipmentList().then((result) => { equipmentList.then((result) => {
previewEquInfProcess(result, targetP) previewEquInfProcess(result, targetP.value)
}); })
pointNum.value = Number( pointNum.value = Number(
targetPoint.name.substring( targetPoint.name.substring(
targetPoint.name.indexOf("_") + 1, targetPoint.name.indexOf("_") + 1,
targetPoint.name.lastIndexOf("_") targetPoint.name.lastIndexOf("_")
) - 1 ) - 1
); );
if (!targetPoint.info) return; if (!targetPoint.info) return;
editDevInfo(targetPoint.info); editDevInfo(targetPoint.info);
} }
demo.addFunction("editDev", editDev); demo.addFunction("editDev", editDev);
} }
// 添加设备 // 添加设备
function handleAddEqu(formInfo) { function handleAddEqu(formInfo) {
if (!formInfo.equipmentType) { demo.addEquipment(targetP.value, formInfo);
ElMessage({
message: "请选择传感器!",
type: "warning",
});
return;
}
//表单信息
//这里利用处理请求
demo.addEquipment(targetP, formInfo);
ElMessage({
message: "添加成功!",
type: "success",
});
} }
const centerDialogVisible = ref(false); const centerDialogVisible = ref(false);
@@ -219,12 +237,22 @@ function handleRemoveEqu() {
} }
// 对话框确认删除 // 对话框确认删除
function handleConfirmAddEqu() { function handleConfirmAddEqu() {
demo.removeEquipment(targetP); console.log("target:", targetP.value.info);
centerDialogVisible.value = false; deleteEquipment(targetP.value.info.equipmentId, pointGap)
ElMessage({ .then((res) => {
message: "删除成功!", demo.removeEquipment(targetP.value);
type: "success", centerDialogVisible.value = false;
}); ElMessage({
message: "删除成功!",
type: "success",
});
})
.catch((res) => {
ElMessage({
message: "删除失败!",
type: "warning",
});
});
} }
// 处理取消关闭编辑框事件 // 处理取消关闭编辑框事件
function handleCancel() { function handleCancel() {
@@ -242,11 +270,10 @@ let equipmentValue = ref(0)
function previewEquInfProcess(equipmentList, targetP) { function previewEquInfProcess(equipmentList, targetP) {
for (const equipment of equipmentList) { for (const equipment of equipmentList) {
// console.log(equipment);
if (equipment.position == targetP.name) { if (equipment.position == targetP.name) {
equipmentType.value = equipment.equipmentType equipmentType.value = equipment.equipmentType
//需要将获取到的设备列表进行序列化 //需要将获取到的设备列表进行序列化
equipmentName.value = toRaw(equipment.chooseEquipment).label equipmentName.value = equipment.equipmentName
equipmentValue.value = equipment.threshold equipmentValue.value = equipment.threshold
if (equipmentType.value == 'frequency') { if (equipmentType.value == 'frequency') {
equipmentType.value = '风机' equipmentType.value = '风机'

View File

@@ -101,6 +101,7 @@ export const deleteEquipment = (equipmentId, pointGap) => {
}) })
.then((res) => { .then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
console.log("删除成功");
modelEquipmentList = modelEquipmentList.filter( modelEquipmentList = modelEquipmentList.filter(
(item) => item.equipmentId != equipmentId (item) => item.equipmentId != equipmentId
); );

View File

@@ -36,7 +36,7 @@ function addEquipment(targetPoint, formInfo) {
// function handleValveEqu(targetPoint, equipmentInfo) { // function handleValveEqu(targetPoint, equipmentInfo) {
// } // }
let allline = new Array
// 其他传感器 // 其他传感器
function handleOtherEqu(targetPoint, equipmentInfo) { function handleOtherEqu(targetPoint, equipmentInfo) {
const equMesh = this.equMap.get("equ_sensors").clone(); const equMesh = this.equMap.get("equ_sensors").clone();
@@ -67,41 +67,24 @@ function handleOtherEqu(targetPoint, equipmentInfo) {
targetPoint.scale.set(0.03, 0.06, 0.05); targetPoint.scale.set(0.03, 0.06, 0.05);
this.scene.add(equMesh); this.scene.add(equMesh);
targetPoint.visible = false; targetPoint.visible = false;
// targetPoint.hasWall = true; targetPoint.hasWall = true;
// //处理风压阀的代码片段 //处理风压阀的代码片段
// let lineIndex = targetPoint.name.slice(7, 9); let lineIndex = targetPoint.name.slice(7, 9)
// for (let line = Number(lineIndex); line <= 20; line++) { if (allline.includes(Number(lineIndex))) {
// if (line < 10) { allline.slice(array.indexOf(lineIndex), 1)
// let wall = "wall_" + "0" + line; console.log('dadad');
// this.scene.getObjectByName(wall).visible = true; } else {
// let point = "point_" + "00" + line + "_tc"; allline.push(Number(lineIndex))
// this.scene.getObjectByName(point).visible = false; }
// this.scene.getObjectByName(point).layers.set(-2); console.log(allline);
// if (this.scene.getObjectByName(point).hasDevice == true) { // console.log(allline);
// let EquID = this.scene.getObjectByName(point).info.id; // allline.forEach((item, index, array) => {
// this.scene.getObjectById(EquID).visible = false; // if (array.includes(item)) {
// } // array.slice(array.indexOf(item), 1)
// } else if (line >= 10) { // array.slice(array.indexOf(item), 1)
// let wall = "wall_" + line; // console.log(array);
// this.scene.getObjectByName(wall).visible = true;
// let point = "point_" + "0" + line + "_tc";
// this.scene.getObjectByName(point).visible = false;
// this.scene.getObjectByName(point).layers.set(-2);
// if (this.scene.getObjectByName(point).hasDevice == true) {
// let EquID = this.scene.getObjectByName(point).info.id;
// this.scene.getObjectById(EquID).visible = false;
// }
// } // }
// //处理21行的设备和附着点 // })
// let point = "point_" + "0" + 21 + "_tc";
// this.scene.getObjectByName(point).visible = false;
// this.scene.getObjectByName(point).layers.set(-2);
// if (this.scene.getObjectByName(point).hasDevice == true) {
// let EquID = this.scene.getObjectByName(point).info.id;
// this.scene.getObjectById(EquID).visible = false;
// }
// }
// this.scene.getObjectByName('wall_01').visible = true
// console.log(this.scene); // console.log(this.scene);
// 保存该设备模型id后期直接从附附着点进行删除 // 保存该设备模型id后期直接从附附着点进行删除
targetPoint.info = { targetPoint.info = {
@@ -154,43 +137,44 @@ function handleFanEqu(
function removeEquipment(targetPoint) { function removeEquipment(targetPoint) {
//删除设备这里需要再进行处理,就是根据附着点(附着点一定保存了当前添加设备的信息了)判断是不是分压阀,然后继续一样的隐藏 //删除设备这里需要再进行处理,就是根据附着点(附着点一定保存了当前添加设备的信息了)判断是不是分压阀,然后继续一样的隐藏
if (!targetPoint.hasDevice) return; if (!targetPoint.hasDevice) return;
if (targetPoint.hasWall == true) { // if (targetPoint.hasWall == true) {
let lineIndex = targetPoint.name.slice(7, 9); // let lineIndex = targetPoint.name.slice(7, 9);
for (let line = Number(lineIndex); line <= 20; line++) { // for (let line = Number(lineIndex); line <= 20; line++) {
if (line < 10) { // if (line < 10) {
let wall = "wall_" + "0" + line; // let wall = "wall_" + "0" + line;
this.scene.getObjectByName(wall).visible = false; // this.scene.getObjectByName(wall).visible = false;
let point = "point_" + "00" + line + "_tc"; // let point = "point_" + "00" + line + "_tc";
console.log(this.scene.getObjectByName(point)); // console.log(this.scene.getObjectByName(point));
this.scene.getObjectByName(point).visible = true; // this.scene.getObjectByName(point).visible = true;
this.scene.getObjectByName(point).layers.set(0); // this.scene.getObjectByName(point).layers.set(0);
if (this.scene.getObjectByName(point).hasDevice == true) { // if (this.scene.getObjectByName(point).hasDevice == true) {
this.scene.getObjectByName(point).visible = false; // this.scene.getObjectByName(point).visible = false;
let EquID = this.scene.getObjectByName(point).info.id; // let EquID = this.scene.getObjectByName(point).info.id;
this.scene.getObjectById(EquID).visible = true; // this.scene.getObjectById(EquID).visible = true;
} // }
} else if (line >= 10) { // } else if (line >= 10) {
let wall = "wall_" + line; // let wall = "wall_" + line;
this.scene.getObjectByName(wall).visible = false; // this.scene.getObjectByName(wall).visible = false;
let point = "point_" + "0" + line + "_tc"; // let point = "point_" + "0" + line + "_tc";
this.scene.getObjectByName(point).visible = true; // this.scene.getObjectByName(point).visible = true;
this.scene.getObjectByName(point).layers.set(0); // this.scene.getObjectByName(point).layers.set(0);
if (this.scene.getObjectByName(point).hasDevice == true) { // if (this.scene.getObjectByName(point).hasDevice == true) {
this.scene.getObjectByName(point).visible = false; // this.scene.getObjectByName(point).visible = false;
let EquID = this.scene.getObjectByName(point).info.id; // let EquID = this.scene.getObjectByName(point).info.id;
this.scene.getObjectById(EquID).visible = true; // this.scene.getObjectById(EquID).visible = true;
} // }
} // }
//处理21行的设备和附着点 // //处理21行的设备和附着点
let point = "point_" + "0" + 21 + "_tc"; // let point = "point_" + "0" + 21 + "_tc";
this.scene.getObjectByName(point).visible = true; // this.scene.getObjectByName(point).visible = true;
this.scene.getObjectByName(point).layers.set(0); // this.scene.getObjectByName(point).layers.set(0);
if (this.scene.getObjectByName(point).hasDevice == true) { // if (this.scene.getObjectByName(point).hasDevice == true) {
let EquID = this.scene.getObjectByName(point).info.id; // let EquID = this.scene.getObjectByName(point).info.id;
this.scene.getObjectById(EquID).visible = true; // this.scene.getObjectById(EquID).visible = true;
} // }
} // }
} // }
console.log("测试是不是删除了");
const mesh = this.scene.getObjectById(targetPoint.info.id); const mesh = this.scene.getObjectById(targetPoint.info.id);
this.scene.remove(mesh); this.scene.remove(mesh);
targetPoint.visible = true; targetPoint.visible = true;

View File

@@ -1,3 +1,4 @@
export default function previewtunnelModeInit(equipmentList) { export default function previewtunnelModeInit(equipmentList) {
//初始化将墙壁隐藏起来 //初始化将墙壁隐藏起来
// for (let line = 1; line <= 20; line++) { // for (let line = 1; line <= 20; line++) {
@@ -9,14 +10,8 @@ export default function previewtunnelModeInit(equipmentList) {
// this.scene.getObjectByName(wall).visible = false // this.scene.getObjectByName(wall).visible = false
// } // }
// } // }
equipmentList.forEach((item) => { equipmentList.forEach((item) => {
const formInfo = { this.addEquipment(this.scene.getObjectByName(item.position), item);
equipmentType: item.equipmentType, //设备类型
chooseEquipment: item.chooseEquipment, //设备选择(设备名称)
threshold: item.threshold,
};
this.addEquipment(this.scene.getObjectByName(item.position), formInfo);
}); });
//进行预览和编辑模式的一些操作 //进行预览和编辑模式的一些操作
if (this.isedit == false) { if (this.isedit == false) {

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="manage-btn"> <div class="manage-btn">
<div v-for="(item,index) in btnList" :key="item.name" class="btn-box" @click="select(index)"> <div v-for="(item,index) in list" :key="item.name" class="btn-box" @click="select(item,index)">
<div :style="{ backgroundImage:'url(' +getImageUrl(item.icon)+')' }"></div> <div :style="{ backgroundImage:'url(' +getImageUrl(item.icon)+')' }"></div>
<div :class="{'select-active':selectButton===index}">{{ item.name }}</div> <div :class="{'select-active':selectButton===index}">{{ item.name }}</div>
</div> </div>
@@ -18,17 +18,17 @@ const props = defineProps({
default: [] default: []
}, },
}) })
watch(() => props.list, (now) => { // watch(() => props.list, (now) => {
let newArr=[] // let newArr=[]
btnList.value.forEach((btnList) => { // btnList.value.forEach((btnList) => {
now.forEach((item) => { // now.forEach((item) => {
if (btnList.route==item) { // if (btnList.route==item) {
newArr.push(btnList) // newArr.push(btnList)
} // }
}) // })
}) // })
btnList.value=newArr // btnList.value=newArr
}, {deep: true}); // }, {deep: true});
const emit = defineEmits(["update:modelValue", "select"]); const emit = defineEmits(["update:modelValue", "select"]);
const btnList = ref([ const btnList = ref([
{ {
@@ -56,14 +56,15 @@ const btnList = ref([
// name: '模拟仿真' // name: '模拟仿真'
// }, // },
]) ])
const newList=ref([])
const selectButton = ref(props.modelValue); const selectButton = ref(props.modelValue);
const getImageUrl = (name) => { const getImageUrl = (name) => {
return new URL(`../../assets/images/topAndDown/${name}`, import.meta.url).href return new URL(`../../assets/images/topAndDown/${name}`, import.meta.url).href
} }
const select = (index) => { const select = (item,index) => {
if (selectButton.value === index) return; if (selectButton.value === index) return;
selectButton.value = index; selectButton.value = index;
emit("update:modelValue", index); emit("update:modelValue", index);
emit("select", index); emit("select", item.name);
}; };
</script> </script>

View File

@@ -85,6 +85,7 @@ const router = createRouter({
}); });
router.beforeEach((to, form, next) => { router.beforeEach((to, form, next) => {
NProgress.start() NProgress.start()
console.log('token-----',getToken())
if (!getToken()) { if (!getToken()) {
if (to.path === '/login') { if (to.path === '/login') {
next() next()
@@ -94,12 +95,12 @@ router.beforeEach((to, form, next) => {
} }
} else { } else {
console.log('有token') console.log('有token')
if (to.path === '/login') { // if (to.path === '/login') {
next('/') // next('/')
NProgress.done() // NProgress.done()
} else { // } else {
next() next()
} // }
} }
}) })
router.afterEach(() => { router.afterEach(() => {

View File

@@ -68,13 +68,13 @@ serveice.interceptors.response.use(response=>{
window.location = '/login' window.location = '/login'
}) })
return Promise.reject('会话已过期,请重新登录') return Promise.reject('会话已过期,请重新登录')
case 402: // case 402:
break; // break;
case 403: // case 403:
ElMessage.warning('禁止访问') // ElMessage.warning('禁止访问')
removeToken() // removeToken()
window.location = '/forbidden' // window.location = '/forbidden'
break; // break;
case 404: case 404:
ElMessage.warning('不存在的地址') ElMessage.warning('不存在的地址')
break; break;

View File

@@ -93,8 +93,8 @@ const handleSave = async () => {
tunnelName: form.value.tunnelName, tunnelName: form.value.tunnelName,
serialNumber: form.value.serialNumber, serialNumber: form.value.serialNumber,
remarks: form.value.remarks, remarks: form.value.remarks,
// constructionLength:form.value.constructionLength, constructionLength:form.value.constructionLength,
constructionLength: 500, // constructionLength: 500,
tunnelLength: form.value.totalLength, tunnelLength: form.value.totalLength,
isDefault: form.value.isDefault, isDefault: form.value.isDefault,
modelEquipmentList: await store.getEquipmentList(), modelEquipmentList: await store.getEquipmentList(),

View File

@@ -45,9 +45,9 @@ import {User, Lock, Key} from "@element-plus/icons-vue";
const router = useRouter(); const router = useRouter();
const authStore = useAuthStore(); const authStore = useAuthStore();
const loginForm = reactive({ const loginForm = reactive({
username: "admin", // username: "admin",
password: "123456", password: "123456",
// username: "", username: "admin",
// password: "", // password: "",
code: "", code: "",
uuid: "", uuid: "",

View File

@@ -169,7 +169,11 @@ const getList = () => {
...pageInfo ...pageInfo
}).then((res) => { }).then((res) => {
total.value = res.data.total; total.value = res.data.total;
showAddIcon.value = total.value % 6!==0; if(total.value==0){
}else {
showAddIcon.value = total.value % 6!==0;
}
showFirst.value = total.value / pageInfo.pageSize > 1; showFirst.value = total.value / pageInfo.pageSize > 1;
res.data.rows.map(item => { res.data.rows.map(item => {
if (item.tunnelList === null || item.tunnelList.length === 0) { if (item.tunnelList === null || item.tunnelList.length === 0) {

View File

@@ -5,9 +5,9 @@
<div class="back-icon"></div> <div class="back-icon"></div>
<span>返回</span> <span>返回</span>
</div> </div>
<div class="site-name"> <!-- <div class="site-name">-->
{{ siteName }} <!-- {{ siteName }}-->
</div> <!-- </div>-->
<div class="tunnel-title"></div> <div class="tunnel-title"></div>
<div class="all-del-btn"> <div class="all-del-btn">
<div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon" @click="handleAdd"> <div class="all-btn" style=" margin-right: 40px;" v-if="!showAddIcon" @click="handleAdd">
@@ -259,13 +259,13 @@ const pageInfo = reactive({
}); });
const total = ref(10); const total = ref(10);
onMounted(() => { onMounted(() => {
getSiteDetail(siteId).then((res) => { // getSiteDetail(siteId).then((res) => {
siteName.value = res.data.siteName // siteName.value = res.data.siteName
}); // });
}) })
const handleGoSiteOrIndex = () => { const handleGoSiteOrIndex = () => {
if (type === 's') { if (type === 's') {
router.push('/site/'+userId) router.push('/site/' + userId)
} else if (type === 'i') { } else if (type === 'i') {
router.push('/') router.push('/')
} }
@@ -279,16 +279,18 @@ const getList = () => {
total.value = res.data.total total.value = res.data.total
tunnelList.value = res.data.rows tunnelList.value = res.data.rows
showFirst.value = total.value / pageInfo.pageSize >= 1; showFirst.value = total.value / pageInfo.pageSize >= 1;
} else {
ElMessage.warning(res.msg)
} }
}) })
} }
getList() getList()
const firstPage=()=>{ const firstPage = () => {
pageInfo.pageNum = 1 pageInfo.pageNum = 1
getList() getList()
} }
const lastPage=()=>{ const lastPage = () => {
pageInfo.pageNum = total.value/pageInfo.pageSize pageInfo.pageNum = total.value / pageInfo.pageSize
getList() getList()
} }
//点击页码进行分页功能 //点击页码进行分页功能
@@ -312,7 +314,7 @@ const handleSubmit = (instance) => {
ElMessage.success('新增成功') ElMessage.success('新增成功')
getList() getList()
isVisited.value = false isVisited.value = false
}else { } else {
ElMessage.warning(res.msg) ElMessage.warning(res.msg)
} }
}) })
@@ -324,17 +326,17 @@ const handleSubmit = (instance) => {
const handleGoToEditTunnel = (tunnelId) => { const handleGoToEditTunnel = (tunnelId) => {
isEdit.value = true isEdit.value = true
if (type === 's') { if (type === 's') {
router.push('/edit/' + tunnelId + '/s/'+userId) router.push('/edit/' + tunnelId + '/s/' + userId)
} else if (type === 'i') { } else if (type === 'i') {
router.push('/edit/' + tunnelId + '/i/'+userId) router.push('/edit/' + tunnelId + '/i/' + userId)
} }
} }
const handleChooseAll = () => { const handleChooseAll = () => {
tunnelList.value.map(item => { tunnelList.value.map(item => {
item.checked = !item.checked item.checked = !item.checked
if(item.checked&&!item.isDefault){ if (item.checked && !item.isDefault) {
tunnelIds.value.push(item.tunnelId) tunnelIds.value.push(item.tunnelId)
}else if(!item.checked&&!item.isDefault){ } else if (!item.checked && !item.isDefault) {
tunnelIds.value.map((newItem, index) => { tunnelIds.value.map((newItem, index) => {
if (newItem === item.tunnelId) { if (newItem === item.tunnelId) {
tunnelIds.value.splice(index, 1) tunnelIds.value.splice(index, 1)
@@ -345,9 +347,9 @@ const handleChooseAll = () => {
} }
const handleEditDevice = (tunnelId) => { const handleEditDevice = (tunnelId) => {
if (type === 's') { if (type === 's') {
router.push('/device/' + tunnelId + '/s/'+userId) router.push('/device/' + tunnelId + '/s/' + userId)
} else if (type === 'i') { } else if (type === 'i') {
router.push('/device/' + tunnelId + '/i/'+userId) router.push('/device/' + tunnelId + '/i/' + userId)
} }
} }
const restFrom = () => { const restFrom = () => {
@@ -388,23 +390,23 @@ const handleMoreDelete = () => {
if (tunnelIds.value.length === 0) { if (tunnelIds.value.length === 0) {
ElMessage.warning('请先选择隧道进行删除') ElMessage.warning('请先选择隧道进行删除')
} else { } else {
ElMessageBox.confirm(`是否确定删除该隧道`, '系统提示', { ElMessageBox.confirm(`是否确定删除该隧道`, '系统提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
customClass: 'delBox' customClass: 'delBox'
}).then(() => { }).then(() => {
deleteTunnel(tunnelIds.value).then(res => { deleteTunnel(tunnelIds.value).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
ElMessage.success(res.msg) ElMessage.success(res.msg)
getList() getList()
tunnelIds.value = [] tunnelIds.value = []
tunnelNameList.value = [] tunnelNameList.value = []
} else { } else {
ElMessage.error(res.msg) ElMessage.error(res.msg)
} }
})
}) })
})
} }
} }
@@ -628,10 +630,10 @@ const handleMoreDelete = () => {
> span:last-child { > span:last-child {
padding:1px 8px; padding: 1px 8px;
font-size: 32px; font-size: 32px;
border: 2px solid #05FEFF; border: 2px solid #05FEFF;
border-radius:10px; border-radius: 10px;
position: relative; position: relative;
} }
} }

View File

@@ -1,12 +1,12 @@
<template> <template>
<div id="main"> <div id="main">
<div class="box-top"> <div class="box-top">
<manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList"/> <manage-btn v-model="selectIndex" @select="manageSelect" :list="routeList" v-if="showMenu"/>
<div class="tunnel-title"></div> <div class="tunnel-title"></div>
<!-- <manage-length class="tunnel-length"></manage-length>--> <!-- <manage-length class="tunnel-length"></manage-length>-->
<div class="top-length"> <div class="top-length">
<span>隧道总长度: {{tunnelLength}}</span> <span>隧道总长度: {{ tunnelLength }}</span>
<span>当前施工长度: {{constructionLength}}</span> <span>当前施工长度: {{ constructionLength }}</span>
</div> </div>
<div class="top-right"> <div class="top-right">
<div class="current-site"> <div class="current-site">
@@ -31,8 +31,9 @@
</div> </div>
</div> </div>
<!-- <tunnel-scene id="tunnel-box" :isedit="false" /> --> <!-- <tunnel-scene id="tunnel-box" :isedit="false" /> -->
<!-- 一进去的话应该是预览模式所以引入这个组件 --> <!-- 一进去的话应该是预览模式所以引入这个组件1 -->
<preview-scene id="tunnel-box" :isedit="false" :tunnelId="tunnelId"></preview-scene>
<preview-scene id="tunnel-box" :isedit="false" :tunnelId="tunnelId" :key="tunnelId"></preview-scene>
<div class="left"> <div class="left">
<el-drawer v-model="drawerLeft" direction="ltr" modal-class="modal-box" :modal="false" :show-close="false" <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"> :close-on-click-modal="false" :close-on-press-escape="false">
@@ -80,7 +81,7 @@ 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 {getLargeScreen, getLargeScreenInfo, getTunnelBySiteId} from "@/api/largeScreen"; import {getLargeScreen, getLargeScreenInfo, getTunnelBySiteId} from "@/api/largeScreen";
import {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 {initSceneData} from "@/api/tunnelScene";
import {getSiteDetail} from "../../api/site"; import {getSiteDetail} from "../../api/site";
@@ -91,6 +92,7 @@ const selectIndex = ref(-1);
const showFan = ref(false); const showFan = ref(false);
const drawerLeft = ref(true); const drawerLeft = 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 currentSite = ref("");
const siteList = ref([]) const siteList = ref([])
@@ -104,6 +106,32 @@ const tunnelLength = ref(0);
const constructionLength = ref(0); const constructionLength = ref(0);
const routeList = ref([]); const routeList = ref([]);
let socket = reactive(""); let socket = reactive("");
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: '系统管理'
// },
// {
// icon: 'sp_icon_mngl.png',
// name: '模拟仿真'
// },
])
const serialNumber = ref("SC00DY00GH00ELBT"); const serialNumber = ref("SC00DY00GH00ELBT");
let token = getToken(); let token = getToken();
let send = { let send = {
@@ -128,7 +156,7 @@ const getUser = () => {
currentUserId.value = res.data.user.userId currentUserId.value = res.data.user.userId
}) })
} }
const getDefaultSite=(siteId)=>{ const getDefaultSite = (siteId) => {
// console.log('siteList.value',siteList.value) // console.log('siteList.value',siteList.value)
// getSiteDetail(siteId).then((res) => { // getSiteDetail(siteId).then((res) => {
// console.log('res',res) // console.log('res',res)
@@ -137,32 +165,46 @@ const getDefaultSite=(siteId)=>{
const getOtherInfo = () => { const getOtherInfo = () => {
getLargeScreenInfo().then((res) => { getLargeScreenInfo().then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
routeList.value = res.data.routeList let routeArr = [];
console.log(res.data.routeList,"res.data.routeList")
res.data.routeList.forEach((item, index) => {
for (let btn of btnList.value) {
if (item === btn.route){
routeArr.push(btn)
}
}
})
routeList.value = routeArr
showMenu.value = true
siteList.value = res.data.siteOption siteList.value = res.data.siteOption
currentSiteId.value = res.data.siteOption[res.data.siteOption.length-1].value currentSiteId.value = res.data.siteOption[res.data.siteOption.length - 1].value
currentSite.value = res.data.siteOption[res.data.siteOption.length-1].label currentSite.value = res.data.siteOption[res.data.siteOption.length - 1].label
getTunnel(res.data.siteOption[res.data.siteOption.length-1].value) getTunnel(res.data.siteOption[res.data.siteOption.length - 1].value)
} }
}); });
}; };
const getScreenInfo = (id) => { const getScreenInfo = (id) => {
tunnelId.value=id if (id) {
getLargeScreen(id).then((res) => { tunnelId.value = id
if (res?.code === 1000) { getLargeScreen(id).then((res) => {
largeScreenData.value = res.data; if (res?.code === 1000) {
} largeScreenData.value = res.data;
}); } else {
initSceneData(id).then((res) => { ElMessage.warning(res.msg)
tunnelLength.value=res.data.tunnelLength }
constructionLength.value=res.data.constructionLength });
}) initSceneData(id).then((res) => {
tunnelLength.value = res.data.tunnelLength
constructionLength.value = res.data.constructionLength
})
}
}; };
//根据站点id获取隧道信息 //根据站点id获取隧道信息
const getTunnel = (id) => { const getTunnel = (id) => {
getTunnelBySiteId(id).then((res) => { getTunnelBySiteId(id).then((res) => {
if (res?.code === 1000) { if (res?.code === 1000) {
tunnelList.value = res.data tunnelList.value = res.data
getScreenInfo(res.data[0].value) getScreenInfo(res.data[0]?.value)
} }
}); });
} }
@@ -174,24 +216,34 @@ const changeTunnel = (e) => {
} }
}) })
getScreenInfo(newObj.value) getScreenInfo(newObj.value)
// nextTick(() => { nextTick(() => {
// showFan.value = true; showFan.value = true;
// }); });
} }
const manageSelect = (index) => { const manageSelect = (index) => {
console.log("首页点击-", index); console.log("首页点击-", index);
if (index === 0) { if (index == '站点管理') {
router.push("/site"+'/'+currentUserId.value); if (currentUserId.value) {
} else if (index === 1) { router.push("/site/" + currentUserId.value);
router.push("/tunnel/" + currentSiteId.value+'/i'+'/'+currentUserId.value); }
} else if (index === 2) { } else if (index == '隧道管理') {
router.push("/user/" + currentSiteId.value); if (currentSiteId.value && currentUserId.value) {
router.push("/tunnel/" + currentSiteId.value + '/i/' + currentUserId.value);
}
} else if (index == '用户管理') {
if (currentSiteId.value) {
router.push("/user/" + currentSiteId.value);
}
} }
}; };
const handleChangeSite = (item) => { const handleChangeSite = (item) => {
currentSite.value = item.label currentSite.value = item.label
currentSiteId.value = item.value currentSiteId.value = item.value
getTunnel(item.value) getTunnel(item.value)
showFan.value = false
nextTick(() => {
showFan.value = true;
});
} }
const closeLeft = () => { const closeLeft = () => {
drawerLeft.value = !drawerLeft.value; drawerLeft.value = !drawerLeft.value;
@@ -259,6 +311,15 @@ const closeSocket = () => {
socket.close(); socket.close();
}; };
initWebSocket(); initWebSocket();
watch(
() => tunnelId.value,
(now) => {
tunnelId.value = now
},
{deep: true}
)
</script> </script>
<style lang="scss"> <style lang="scss">
.el-dropdown__popper.el-popper { .el-dropdown__popper.el-popper {

View File

@@ -47,6 +47,11 @@
<el-table-column prop="nickName" label="昵称" align="center"/> <el-table-column prop="nickName" label="昵称" align="center"/>
<el-table-column prop="roleName" label="身份" align="center"/> <el-table-column prop="roleName" label="身份" align="center"/>
<el-table-column prop="phoneNumber" label="电话号码" align="center"/> <el-table-column prop="phoneNumber" label="电话号码" align="center"/>
<el-table-column prop="state" label="状态" align="center">
<template #default="scope">
{{scope.row.state=="1"?'启用':'停用'}}
</template>
</el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" size="large" style="font-size: 40px;color: #17E1E2;" <el-button link type="primary" size="large" style="font-size: 40px;color: #17E1E2;"
@@ -67,8 +72,8 @@
<el-form-item label="当前站点"> <el-form-item label="当前站点">
<div class="current-site">{{ currentSite }}<span>如果需要切换站点,请返回首屏切换</span></div> <div class="current-site">{{ currentSite }}<span>如果需要切换站点,请返回首屏切换</span></div>
</el-form-item> </el-form-item>
<el-form-item label="输入账户"> <el-form-item label="输入用户名">
<el-input v-model="form.userName" placeholder="请输入账户"/> <el-input v-model="form.userName" placeholder="请输入用户名"/>
</el-form-item> </el-form-item>
<el-form-item label="输入密码" v-if="title==='添加用户'"> <el-form-item label="输入密码" v-if="title==='添加用户'">
<el-input type="password" show-password v-model="form.password" placeholder="请输入密码"/> <el-input type="password" show-password v-model="form.password" placeholder="请输入密码"/>
@@ -79,19 +84,23 @@
<el-form-item label="输入电话号码"> <el-form-item label="输入电话号码">
<el-input v-model="form.phoneNumber" placeholder="输入电话号码"/> <el-input v-model="form.phoneNumber" placeholder="输入电话号码"/>
</el-form-item> </el-form-item>
<el-form-item label="是否启用">
<el-radio-group v-model="form.state">
<el-radio label="1">启用</el-radio>
<el-radio label="0">停用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择身份"> <el-form-item label="选择身份">
<el-radio-group v-model="form.roleId" @change="(val) => { <el-radio-group v-model="form.roleId" @change="(val) => {
console.log('vaaa',val)
if (val >3){ if (val >3){
getTunnel() getTunnel()
}}"> }}">
<el-radio v-for="item in radioList" :label="item.value" :key="item.value">{{ item.label }}</el-radio> <el-radio v-for="item in radioList" :label="item.value" :key="item.value">{{ item.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="选择隧道" v-if="checkList.length!==0&&form.roleId>3"> <el-form-item label="选择隧道" v-if="form.roleId>3">
<el-select <el-select
v-model="tunnelIndex" v-model="form.tunnelList"
multiple multiple
filterable filterable
clearable clearable
@@ -99,7 +108,7 @@
:fit-input-width="true" :fit-input-width="true"
> >
<el-option <el-option
v-for="item in checkList" v-for="item in tunnelList"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
@@ -157,20 +166,21 @@ const form = ref({
userName: '', userName: '',
nickName: '', nickName: '',
phoneNumber: '', phoneNumber: '',
state: '1',
roleId: [], roleId: [],
tunnelIds: [] tunnelList: [1]
}); });
const formRules = ref({ const formRules = ref({
userName: [{required: true, message: '请输入用户名', trigger: 'blur'}], userName: [{required: true, message: '请输入用户名', trigger: 'blur'}],
password: [{required: true, message: '请输入密码', trigger: 'blur'}] password: [{required: true, message: '请输入密码', trigger: 'blur'}]
}) })
const radioList = ref([]) const radioList = ref([])
const checkList = ref([]) const tunnelList = ref([])
const multipleTable = ref() const multipleTable = ref()
const getTunnel = () => { const getTunnel = () => {
getTunnelOption(siteId).then(res => { getTunnelOption(siteId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
checkList.value = res.data tunnelList.value = res.data
} }
}) })
} }
@@ -187,8 +197,10 @@ const handleEditUser = (row) => {
reset() reset()
getUserDetail(row.userId).then(res => { getUserDetail(row.userId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
getTunnel()
form.value = res.data.user form.value = res.data.user
form.value.roleId = res.data.roleIds[0] form.value.roleId = res.data.roleIds[0]
form.value.tunnelList = res.data.user.tunnelList
} }
}) })
title.value = '修改用户' title.value = '修改用户'
@@ -198,7 +210,6 @@ const handleAll = () => {
multipleTable.value.toggleAllSelection() multipleTable.value.toggleAllSelection()
} }
const handleDelete = () => { const handleDelete = () => {
console.log('userIds.value',userIds.value)
if (userIds.value ===undefined) { if (userIds.value ===undefined) {
ElMessage.warning('请先选择用户进行删除') ElMessage.warning('请先选择用户进行删除')
} else { } else {
@@ -222,8 +233,9 @@ const reset = () => {
userName: '', userName: '',
nickName: '', nickName: '',
phoneNumber: '', phoneNumber: '',
state: '1',
roleId: [], roleId: [],
tunnelIds: [] tunnelList: []
} }
} }
const getRoleOptionInfo = () => { const getRoleOptionInfo = () => {
@@ -267,8 +279,13 @@ const handleSubmit = async (formInstance) => {
if (!valid) return; if (!valid) return;
const data = { const data = {
siteId: siteId, siteId: siteId,
nickName: form.value.nickName,
password: form.value.password,
phoneNumber: form.value.phoneNumber,
state:form.value.state,
userName: form.value.userName,
roleIds: [form.value.roleId], roleIds: [form.value.roleId],
...form.value tunnelList: form.value.tunnelList
} }
if (title.value === '添加用户') { if (title.value === '添加用户') {
await addUser(data).then(res => { await addUser(data).then(res => {
@@ -281,7 +298,11 @@ const handleSubmit = async (formInstance) => {
} }
}) })
} else { } else {
await editUser(data).then(res => { const editData={
userId:form.value.userId,
...data
}
await editUser(editData).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
getInfo() getInfo()
isVisited.value = false isVisited.value = false