邓洁: 优化界面

This commit is contained in:
邓洁
2024-01-02 22:41:31 +08:00
parent c730283e78
commit 073ec5c570
10 changed files with 151 additions and 131 deletions

View File

@@ -154,7 +154,7 @@ body,
position: static !important; position: static !important;
.el-drawer { .el-drawer {
width: 900px !important; width: 960px !important;
background-color: transparent; background-color: transparent;
box-shadow: none; box-shadow: none;
} }
@@ -671,3 +671,11 @@ input[type="number"] {
background-color: transparent !important; background-color: transparent !important;
color: #60DDDE !important; color: #60DDDE !important;
} }
.showNull{
font-size:35px;
min-height: 350px;
display: flex;
justify-content: center;
align-items: center;
color: #2fb0df;
}

View File

@@ -1,21 +1,19 @@
<template> <template>
<div id="air-info"> <div id="air-info">
<div class="fan-speed"> <div style="height: 21px" v-if="airList.length!==0"></div>
<div class="fan-speed" v-if="windSpeed!==0">
<img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/> <img src="@/assets/images/airInfo/fan-v-icon.png" alt=""/>
<div class="fan-info" @click="handleOpenChart"> <div class="fan-info" @click="handleOpenChart">
<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,index) in airList"
:key="item.equipmentId" :key="index"
:wp="item" :wp="item"
:icon="item.icon"
:name="item.name"
:unit="item.unit"
@click="handleOpenAirChart(item)" @click="handleOpenAirChart(item)"
/> />
<div style="height: 1px" v-if="airList.length!==0"></div>
<div class="digital-tunnel"> <div class="digital-tunnel">
<el-dialog :close-on-click-modal="false" v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px" <el-dialog :close-on-click-modal="false" v-model="isWindSpeedVisited" :title="'风速监控数据'" width="2175px"
:modal="false"> :modal="false">
@@ -72,7 +70,7 @@ const props = defineProps({
list: Array, list: Array,
airData: Array airData: Array
}); });
const windSpeed = ref('') const windSpeed = ref(0)
const windSpeedId = ref(0) const windSpeedId = ref(0)
const airTitle = ref('') const airTitle = ref('')
const airList = ref([]) const airList = ref([])
@@ -81,6 +79,7 @@ const selectTimeButton = ref(2);
const isWindSpeedVisited = ref(false); const isWindSpeedVisited = ref(false);
const isAirVisited = ref(false); const isAirVisited = ref(false);
watch(() => props.list, (now) => { watch(() => props.list, (now) => {
console.log('props.list', now)
airList.value?.forEach(item => { airList.value?.forEach(item => {
now.forEach(newItem => { now.forEach(newItem => {
if (item.equipmentId === newItem.equipmentId) { if (item.equipmentId === newItem.equipmentId) {
@@ -378,26 +377,27 @@ const initAirChart = (type, values) => {
<style lang="scss" scoped> <style lang="scss" scoped>
#air-info { #air-info {
position: absolute; //min-height: 350px;
margin-top: 40px;
//position: absolute;
z-index: 100; z-index: 100;
width: 824px; width: 824px;
//height: 400px; //height: 400px;
top: 1003px; //top: 1003px;
right: 72px; //right: 72px;
background-image: url(@/assets/images/airInfo/bg.png); background-image: url(@/assets/images/airInfo/bg.png);
padding: 25px 20px 0 21px; //padding: 25px 20px 1px 21px;
.fan-speed { .fan-speed {
box-sizing: border-box;
display: flex; display: flex;
//height: 40px; //height: 40px;
font-size: 30px; font-size: 30px;
font-family: MicrosoftYaHei;
color: #ffffff; color: #ffffff;
line-height: 40px;
align-items: center; align-items: center;
padding: 5px 0 5px 15px; padding: 5px 0 5px 15px;
margin-bottom: 25px; margin-bottom: 25px;
margin-left: 21px;
&:hover { &:hover {
//width: 790px; //width: 790px;
background: #2E5589; background: #2E5589;

View File

@@ -1,45 +1,38 @@
<template> <template>
<div id="item-info"> <div id="item-info" v-if="params.wp!==undefined">
<div class="label"> <div class="label">
<div :style="{ backgroundImage: 'url(' +getImageUrl(windIcon)+')' }" class="wind-icon"></div> <div :style="{ backgroundImage: 'url(' +getImageUrl(windIcon)+')' }" class="wind-icon"></div>
<span>{{ params.name }}</span> <span>{{ params.wp.name }}</span>
</div> </div>
<div class="container" ref="length"> <div class="container" ref="length">
<div class="value" ref="value"></div> <div class="value" ref="value"></div>
<div id="point" ref="point"></div> <div id="point" ref="point"></div>
</div> </div>
<div class="value-num" :class="{ warning: isWaring }"> <div class="value-num" :class="{ warning: isWaring }">
{{ valueAndUnit }} {{ params.wp.value }} {{ params.wp.unit }}
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
const params = defineProps({ const params = defineProps({
wp: Object, wp: Object
icon: String,
name: String,
unit: String,
}); });
// const info = {
// windPId: 0, //编号 const windIcon = ref();
// max: 120, //最大值
// value: 40, //测量值
// point: 60, //阈值
// };
const windIcon = reactive(params.icon);
const length = ref(null); const length = ref(null);
const value = ref(null); const value = ref(null);
const point = ref(null); const point = ref(null);
onMounted(handleOnMounted); const isWaring = ref();
// watch(() => params.wp.value, () => {
function handleOnMounted() { // setValue();
setValue(); // });
} onMounted(() => {
if (params.wp !== undefined) {
watch(() => params.wp.value, () => { setValue();
setValue(); windIcon.value = params.wp.icon
}); }
})
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
} }
@@ -55,23 +48,25 @@ 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;
} }
let isWaring = computed(() => { // let isWaring = computed(() => {
return params.wp.value >= params.wp.point; // return params.wp.value >= params.wp.point;
}); // });
const valueAndUnit = computed(() => params.wp.value + " "+ params.unit );
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
#item-info { #item-info {
display: flex; display: flex;
align-items: center; align-items: center;
width: 100%; width: 790px;
padding: 5px 14px; padding: 5px 14px;
margin-bottom: 30px; margin-bottom: 25px;
margin-left: 21px;
&:hover { &:hover {
width: 790px;
background: #2E5589; background: #2E5589;
border-radius: 6px; border-radius: 6px;

View File

@@ -3,7 +3,10 @@
id="bad-gas-info" id="bad-gas-info"
:style="{ backgroundImage: 'url(' + getImageUrl(bgImage) + ')' }"> :style="{ backgroundImage: 'url(' + getImageUrl(bgImage) + ')' }">
<div class="title">有害气体</div> <div class="title">有害气体</div>
<div class="info-list"> <div v-if="badGasList==null||badGasList.length===0" class="showNull">
暂无数据~
</div>
<div v-else class="info-list">
<gas-info-item <gas-info-item
v-for="item in badGasList" v-for="item in badGasList"
:key="item.equipmentId" :key="item.equipmentId"
@@ -11,7 +14,6 @@
@click="handleOpenChart" @click="handleOpenChart"
/> />
</div> </div>
<div class="digital-tunnel"> <div class="digital-tunnel">
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
@@ -355,32 +357,31 @@ const initChart = (type, values) => {
<style lang="scss" scoped> <style lang="scss" scoped>
#bad-gas-info { #bad-gas-info {
margin-top:40px;
cursor: pointer; cursor: pointer;
position: absolute; //position: absolute;
width: 824px; width: 824px;
min-height: 300px;
//height: 621px; //height: 621px;
top: 1441px; //top: 1441px;
right: 72px; //right: 72px;
background-image: url(../../../assets/images/badGasInfo/bg.png); background-image: url(../../../assets/images/badGasInfo/bg.png);
padding: 22px 17px 25px 50px;
.title { .title {
width: 128px; font-size: 38px;
height: 45px;
font-size: 32px;
font-family: PingFang-SC, PingFang-SC;
font-weight: 800; font-weight: 800;
color: #38cafb; color: #38cafb;
line-height: 45px; line-height: 45px;
margin: 22px 0px 0px 62px; //margin: 22px 0px 0px 62px;
} }
.info-list { .info-list {
width: 100%; width: 100%;
height: calc(621px - 45px - 22px); //height: calc(621px - 45px - 22px);
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-around; justify-content: space-around;
padding: 10px 0px 0px 10px; padding: 16px 0 0 10px;
} }
} }
</style> </style>

View File

@@ -1,7 +1,10 @@
<template> <template>
<div id="fan_info"> <div id="fan_info">
<div class="title">风机</div> <div class="title">风机</div>
<div class="fans"> <div v-if="socketData==null||socketData.length===0" class="showNull">
暂无数据~
</div>
<div v-else class="fans">
<div class="fan-item" v-for="(item,index) in socketData" :key="item.equipmentId"> <div class="fan-item" v-for="(item,index) in socketData" :key="item.equipmentId">
<div> <div>
<!-- echarts --> <!-- echarts -->
@@ -470,6 +473,7 @@ const initChart = (type, valueA,valueB,valueC) => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep( .el-radio__input.is-checked + .el-radio__label) { :deep( .el-radio__input.is-checked + .el-radio__label) {
color: #38CAFB; color: #38CAFB;
} }
@@ -516,11 +520,12 @@ input[type="number"] {
#fan_info { #fan_info {
//height: 1465px; //height: 1465px;
//height: 1000px; //height: 1000px;
min-height: 350px;
width: 830px; width: 830px;
position: absolute; //position: absolute;
z-index: 100; z-index: 100;
top: 184px; //top: 184px;
left: 68px; //left: 68px;
padding: 10px 10px 20px 10px; padding: 10px 10px 20px 10px;
background-image: url(../../../assets/images/fanInfo/bg.png); background-image: url(../../../assets/images/fanInfo/bg.png);
color: #2fb0df; color: #2fb0df;
@@ -529,8 +534,8 @@ input[type="number"] {
.title { .title {
width: 40%; width: 40%;
text-align: left; text-align: left;
padding: 0 0 0 62px; padding: 0 0 0 50px;
font-size: 32px; font-size: 38px;
font-weight: bold; font-weight: bold;
color: #38cafb; color: #38cafb;
line-height: 42px; line-height: 42px;
@@ -553,7 +558,7 @@ input[type="number"] {
.echart { .echart {
height: 270px; height: 270px;
width: 30%; width: 34%;
margin: 0px 0px 0px 10px; margin: 0px 0px 0px 10px;
position: relative; position: relative;
} }
@@ -659,7 +664,7 @@ input[type="number"] {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
padding: 0 20px; //padding: 0 20px;
font-size: 28px; font-size: 28px;
color: #38cafb; color: #38cafb;
line-height: 37px; line-height: 37px;

View File

@@ -97,14 +97,14 @@ let isWaringC = computed(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.abnormal:hover { //.abnormal:hover {
background: #9C5252 !important; // background: #9C5252 !important;
border-radius: 6px; // border-radius: 6px;
//
.point { // .point {
background: #fff !important; // background: #fff !important;
} // }
} //}
.wind-pressure-item { .wind-pressure-item {
display: flex; display: flex;

View File

@@ -59,7 +59,7 @@ const props = defineProps({
let myEcharts = reactive({}); let myEcharts = reactive({});
const isVisited = ref(false); const isVisited = ref(false);
const eleData = ref([]) const eleData = ref([])
const electricityConsumptionMonthly = ref() const electricityConsumptionMonthly = ref(0)
const monthlySavings = ref(4000) const monthlySavings = ref(4000)
const length = ref(null); const length = ref(null);
const valueA = ref(); const valueA = ref();
@@ -88,16 +88,18 @@ watch(() => props.list, (now) => {
}) })
setValueA() setValueA()
}, {deep: true}); }, {deep: true});
onMounted(()=>{ onMounted(() => {
setValueA() setValueA()
setValueB() setValueB()
}) })
const setValueA=()=> { const setValueA = () => {
if (electricityConsumptionMonthly.value === 0 || length.value === null) return
let width = (electricityConsumptionMonthly.value * length.value.offsetHeight) / 10000; let width = (electricityConsumptionMonthly.value * length.value.offsetHeight) / 10000;
valueA.value.style.height = `${width}px`; valueA.value.style.height = `${width}px`;
} }
const setValueB=()=> { const setValueB = () => {
let width = (4000 * length.value.offsetHeight) / 10000; if (monthlySavings.value === 0 || length.value === null) return
let width = (monthlySavings.value * length.value.offsetHeight) / 10000;
valueB.value.style.height = `${width}px`; valueB.value.style.height = `${width}px`;
} }
const getBasicData = (data) => { const getBasicData = (data) => {
@@ -234,15 +236,15 @@ const getImageUrl = (name) => {
} }
#used-ele { #used-ele {
//flex:1; margin-top: 40px;
cursor: pointer; cursor: pointer;
width: 830px; width: 830px;
//height: 373px; //height: 373px;
color: aliceblue; color: aliceblue;
position: absolute; //position: absolute;
top: 1220px; //top: 1220px;
//top: 1680px; //top: 1680px;
left: 68px; //left: 68px;
background-image: url(../../../assets/images/usedEle/bg.png); background-image: url(../../../assets/images/usedEle/bg.png);
padding: 21px 62px 35px 62px; padding: 21px 62px 35px 62px;
@@ -270,6 +272,7 @@ const getImageUrl = (name) => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
.container { .container {
width: 60px; width: 60px;
height: 210px; height: 210px;
@@ -288,6 +291,7 @@ const getImageUrl = (name) => {
transition: width 0.5s linear 0s; transition: width 0.5s linear 0s;
} }
} }
> div:nth-child(2) { > div:nth-child(2) {
display: flex; display: flex;

View File

@@ -1,7 +1,10 @@
<template> <template>
<div id="wind-pressure"> <div id="wind-pressure">
<div class="name">风压</div> <div class="name">风压</div>
<div class="list"> <div v-if="wpList==null||wpList.length===0" class="showNull">
暂无数据~
</div>
<div v-else class="list">
<wind-pressure-item v-for="(item,index) in wpList" :key="item.equipmentId" :wp="item" <wind-pressure-item v-for="(item,index) in wpList" :key="item.equipmentId" :wp="item"
@click="handleOpenChart(item)"/> @click="handleOpenChart(item)"/>
</div> </div>
@@ -206,21 +209,20 @@ const initChart = (type, values) => {
#wind-pressure { #wind-pressure {
width: 830px; width: 830px;
//height: 779px; //height: 779px;
position: absolute; //position: absolute;
top: 185px; min-height: 350px;
right: 68px; //top: 185px;
//right: 68px;
background-image: url(../../../assets/images/windPressure/bg.png); background-image: url(../../../assets/images/windPressure/bg.png);
padding: 22px 17px 0 23px; padding: 22px 17px 1px 23px;
.name { .name {
width: 64px; font-size: 38px;
height: 42px;
font-size: 32px;
font-family: MicrosoftYaHei, MicrosoftYaHei; font-family: MicrosoftYaHei, MicrosoftYaHei;
font-weight: bold; font-weight: bold;
color: #38cafb; color: #38cafb;
line-height: 42px; line-height: 42px;
margin-left: 62px; margin-left: 50px;
margin-bottom: 38px; margin-bottom: 38px;
} }
} }

View File

@@ -1,7 +1,7 @@
<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" v-if="showMenu" /> <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">
@@ -16,8 +16,8 @@
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item v-for="item in siteList" :key="item.value" :command="item">{{ <el-dropdown-item v-for="item in siteList" :key="item.value" :command="item">{{
item.label item.label
}} }}
</el-dropdown-item> </el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
@@ -36,21 +36,21 @@
<preview-scene id="tunnel-box" :isedit="false" :tunnelId="tunnelId" :key="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">
<fan-info v-if="showFan" :list="socketData.leftData" :fan-data="largeScreenData" <fan-info v-if="showFan" :list="socketData.leftData" :fan-data="largeScreenData"
:transducer-data="largeScreenData" /> :transducer-data="largeScreenData"/>
<!-- <transducer-list v-if="showFan" :list="socketData.leftData" :transducer-data="largeScreenData" />--> <!-- <transducer-list v-if="showFan" :list="socketData.leftData" :transducer-data="largeScreenData" />-->
<used-ele v-if="showFan" :list="socketData.leftData" :ele-data="largeScreenData" /> <used-ele v-if="showFan" :list="socketData.leftData" :ele-data="largeScreenData"/>
</el-drawer> </el-drawer>
<div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div> <div v-if="drawerLeft" class="left-arrow" @click="closeLeft"></div>
<div v-else class="shrink-left" @click="closeLeft"></div> <div v-else class="shrink-left" @click="closeLeft"></div>
</div> </div>
<div class="right"> <div class="right">
<el-drawer v-model="drawerRight" direction="rtl" modal-class="modal-box" :modal="false" :show-close="false" <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"> :close-on-click-modal="false" :close-on-press-escape="false">
<wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData" /> <wind-pressure-list v-if="showFan" :list="socketData.windPressure" :win-data="largeScreenData"/>
<air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData" /> <air-info v-if="showFan" :list="socketData.sensor" :air-data="largeScreenData"/>
<bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData" :tunnelId="tunnelId" /> <bad-gas-info v-if="showFan" :list="socketData.sensor" :bad-gas-data="largeScreenData" :tunnelId="tunnelId"/>
</el-drawer> </el-drawer>
<div v-if="drawerRight" class="right-arrow" @click="closeRight"></div> <div v-if="drawerRight" class="right-arrow" @click="closeRight"></div>
<div v-else class="shrink-right" @click="closeRight"></div> <div v-else class="shrink-right" @click="closeRight"></div>
@@ -77,16 +77,13 @@ import WindPressureList from "@/components/content/windPressure/WindPressureList
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 ManageBtn from "@/components/manageBtn/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 { getLargeScreen, getLargeScreenInfo, getTunnelBySiteId } from "@/api/largeScreen"; import {getLargeScreen, getLargeScreenInfo, getTunnelBySiteId} from "@/api/largeScreen";
import { 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 {initSceneData} from "@/api/tunnelScene";
import { getSiteDetail } from "../../api/site";
import { editTunnel, getTunnelDetail } from "@/api/tunnelManage";
const authStore = useAuthStore(); const authStore = useAuthStore();
const router = useRouter(); const router = useRouter();
const selectIndex = ref(-1); const selectIndex = ref(-1);
@@ -163,6 +160,7 @@ const getUser = () => {
getUserInfo().then(res => { getUserInfo().then(res => {
currentUser.value = res.data.user.userName currentUser.value = res.data.user.userName
currentUserId.value = res.data.user.userId currentUserId.value = res.data.user.userId
localStorage.setItem('userId', currentUserId.value)
}) })
} }
const getDefaultSite = (siteId) => { const getDefaultSite = (siteId) => {
@@ -187,6 +185,7 @@ const getOtherInfo = () => {
siteList.value = res.data.siteOption siteList.value = res.data.siteOption
currentSiteId.value = res.data.siteOption[0].value currentSiteId.value = res.data.siteOption[0].value
currentSite.value = res.data.siteOption[0].label currentSite.value = res.data.siteOption[0].label
localStorage.setItem('site', currentSite.value)
tunnelList.value = res.data.tunnelOption tunnelList.value = res.data.tunnelOption
getTunnel(res.data.siteOption[0].value) getTunnel(res.data.siteOption[0].value)
} }
@@ -237,7 +236,7 @@ const manageSelect = (index) => {
} }
} else if (index == '隧道管理') { } else if (index == '隧道管理') {
if (currentSiteId.value && currentUserId.value) { if (currentSiteId.value && currentUserId.value) {
router.push("/tunnel/" + currentSiteId.value + '/i'+'/' + currentUserId.value); router.push("/tunnel/" + currentSiteId.value + '/i' + '/' + currentUserId.value);
} }
} else if (index == '用户管理') { } else if (index == '用户管理') {
if (currentSiteId.value) { if (currentSiteId.value) {
@@ -340,13 +339,15 @@ initWebSocket();
// getTunnelPreview(); // getTunnelPreview();
</script> </script>
<style lang="scss"> <style lang="scss">
//.el-drawer__body{ .el-drawer__header {
// width: 100%; display: none;
// display: flex!important; }
// flex-direction: column!important;
// flex: 1; .el-drawer__body {
// height: 100%; padding: 180px 68px 0 68px;
//} overflow: hidden;
}
.el-dropdown__popper.el-popper { .el-dropdown__popper.el-popper {
background: transparent; background: transparent;
//border: none; //border: none;

View File

@@ -49,7 +49,7 @@
<el-table-column prop="phoneNumber" label="电话号码" align="center"/> <el-table-column prop="phoneNumber" label="电话号码" align="center"/>
<el-table-column prop="state" label="状态" align="center"> <el-table-column prop="state" label="状态" align="center">
<template #default="scope"> <template #default="scope">
{{scope.row.state=="1"?'启用':'停用'}} {{ scope.row.state == "1" ? '启用' : '停用' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@@ -70,7 +70,7 @@
</div> </div>
<el-form :model="form" :label-position="right" :rules="formRules" ref="formInstance" label-width="240px"> <el-form :model="form" :label-position="right" :rules="formRules" ref="formInstance" label-width="240px">
<el-form-item label="当前站点"> <el-form-item label="当前站点">
<div class="current-site">{{ currentSite }}<span>如果需要切换站点,请返回首屏切换</span></div> <div class="current-site">{{ currentSite }}<span v-if="showAdmin">如果需要切换站点,请返回首屏切换</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="请输入用户名"/>
@@ -143,12 +143,10 @@ import {addUser, editUser, getUser, getRoleOption} from "@/api/user";
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
import {getTunnelOption} from "@/api/tunnel"; import {getTunnelOption} from "@/api/tunnel";
import {deleteUser, getUserDetail} from "../../api/user"; import {deleteUser, getUserDetail} from "../../api/user";
import {getSiteDetail} from "@/api/site";
const router = useRouter() const router = useRouter()
const title = ref('添加用户') const title = ref('添加用户')
const siteId = reactive(router.currentRoute.value.params.siteId) const siteId = reactive(router.currentRoute.value.params.siteId)
const tunnelIndex = ref()
const username = ref() const username = ref()
const userIds = ref() const userIds = ref()
const showFirst = ref(true) const showFirst = ref(true)
@@ -161,6 +159,7 @@ const pageInfo = reactive({
}); });
const total = ref(10); const total = ref(10);
const isVisited = ref(false); const isVisited = ref(false);
const showAdmin = ref(false);
const form = ref({ const form = ref({
password: '', password: '',
userName: '', userName: '',
@@ -177,6 +176,13 @@ const formRules = ref({
const radioList = ref([]) const radioList = ref([])
const tunnelList = ref([]) const tunnelList = ref([])
const multipleTable = ref() const multipleTable = ref()
onMounted(() => {
if (localStorage.getItem('userId') == 2) {
showAdmin.value = true
} else {
showAdmin.value = false
}
})
const getTunnel = () => { const getTunnel = () => {
getTunnelOption(siteId).then(res => { getTunnelOption(siteId).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
@@ -189,9 +195,7 @@ const handleAddUser = () => {
reset() reset()
title.value = '添加用户' title.value = '添加用户'
isVisited.value = true isVisited.value = true
getSiteDetail(siteId).then((res) => { currentSite.value = localStorage.getItem('site')
currentSite.value = res.data.siteName
});
} }
const handleEditUser = (row) => { const handleEditUser = (row) => {
reset() reset()
@@ -210,7 +214,7 @@ const handleAll = () => {
multipleTable.value.toggleAllSelection() multipleTable.value.toggleAllSelection()
} }
const handleDelete = () => { const handleDelete = () => {
if (userIds.value ===undefined) { if (userIds.value === undefined) {
ElMessage.warning('请先选择用户进行删除') ElMessage.warning('请先选择用户进行删除')
} else { } else {
ElMessageBox.confirm(`是否确认删除该用户吗?`, '系统提示', { ElMessageBox.confirm(`是否确认删除该用户吗?`, '系统提示', {
@@ -282,7 +286,7 @@ const handleSubmit = async (formInstance) => {
nickName: form.value.nickName, nickName: form.value.nickName,
password: form.value.password, password: form.value.password,
phoneNumber: form.value.phoneNumber, phoneNumber: form.value.phoneNumber,
state:form.value.state, state: form.value.state,
userName: form.value.userName, userName: form.value.userName,
roleIds: [form.value.roleId], roleIds: [form.value.roleId],
tunnelList: form.value.tunnelList tunnelList: form.value.tunnelList
@@ -298,8 +302,8 @@ const handleSubmit = async (formInstance) => {
} }
}) })
} else { } else {
const editData={ const editData = {
userId:form.value.userId, userId: form.value.userId,
...data ...data
} }
await editUser(editData).then(res => { await editUser(editData).then(res => {