| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- <template>
- <div class="screen">
- <div style="height: 10px"></div>
- <div class="titleImage">
- <el-image :src="titleUrl" />
- <span class="Heading">龙弛智慧隧道系统</span>
- <div class="titleOption" style="left: 19%" @click="jumpScreen('map')">
- <span>地图</span>
- </div>
- <div class="titleOption" style="left: 76%" @click="jumpScreen('model')">
- <span>模型</span>
- </div>
- </div>
- <div style="height: 10px"></div>
- <el-row>
- <el-col :span="5" style="height: 900px;">
- <div class="deviceBox">
- <img src="@/assets/main_top_left.png" alt=""/>
- <div class="titleIcon"></div>
- <div class="deviceBox_title">设备汇总</div>
- <div class="deviceOptionBox">
- <div class="deviceOption" v-for="item in deviceList">
- <img :src="item.url" style="width: 35px;height: 35px" alt=""/>
- <el-text style="padding-top: 8px;color: #ffffff" size="small">{{item.label + item.value}}</el-text>
- </div>
- </div>
- </div>
- <div class="chartBox">
- <Chart/>
- </div>
- <div class="chartBox">
- <lightChart/>
- </div>
- </el-col>
- <el-col :span="14" style="display: flex;justify-content: center">
- <div class="centerBox">
- <Map @call-parent="parentMethod"/>
- </div>
- </el-col>
- <el-col :span="5" class="rightBox">
- <div style="height: 20px"></div>
- <div class="panel">
- <span class="panel-title">亮度调整</span>
- <el-slider
- v-model="transparency"
- :step="50"
- show-stops
- :show-tooltip="false"
- class="panel-slider"
- @change="changeTransparency"
- />
- <div class="brightness" style="margin: 90px 0 0 50px;">
- <span>低</span>
- <span>中</span>
- <span>高</span>
- </div>
- <el-slider
- v-model="transparencyTwo"
- :step="50"
- show-stops
- :show-tooltip="false"
- class="panel-slider2"
- @change="changeTransparencyTwo"
- />
- <div class="brightness" style="margin: 50px 0 0 50px;">
- <span>低</span>
- <span>中</span>
- <span>高</span>
- </div>
- <div class="panel-bottom"></div>
- </div>
- <div class="warnBox">
- <img :src="warn" alt="" class="warnBoxExternal" />
- <img :src="warnTitle" alt="" class="warnBoxTitle"/>
- <span>警告列表</span>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script setup>
- // 标题图片
- import titleUrl from '@/assets/title_bg.png'
- import environments from "@/assets/icons/environment.png";
- import fourWays from "@/assets/icons/fourWays.png"
- import inductance from "@/assets/icons/inductance.png"
- import singleLamp from "@/assets/icons/singleLamp.png"
- import Chart from "./components/chart.vue";
- import warn from '@/assets/main_bottopm_top2.png'
- import Map from './components/map.vue'
- import warnTitle from '@/assets/warnTitle.png'
- import lightChart from './components/lightChart.vue'
- import { queryTunnelList } from '@/api/tunnel'
- import {reactive, onMounted, ref, watch} from 'vue'
- // 单灯控制
- import { updateTunnelLamp } from "@/api/tunnel";
- // 四路控制
- import { deviceSwitch } from "@/api/device";
- import {useScreenStore} from "@/pinia/modules/screen";
- import {ElMessage} from "element-plus";
- // 灯光数据
- const lampData = reactive({})
- const useScreen = useScreenStore()
- const deviceList = reactive([
- {url: environments, label: '环境:', value: '1/0'},
- {url: fourWays, label: '四路:', value: '1/0'},
- {url: inductance, label: '电感:', value: '1/0'},
- {url: singleLamp, label: '单灯:', value: '1/0'},
- ])
- const condition = {
- pageInfo: {
- page: 1,
- pageSize: 1000
- },
- name: '',
- regionId: 0,
- userId: 1
- }
- // 存储模型数据
- let materialOne = reactive({})
- let materialTwo = reactive({})
- // 亮度调整
- const transparency = ref(0)
- const relayList = reactive([])
- const changeTransparency = (e) => {
- let option = {
- 0: [0.8, 33, 1],
- 50: [0.5, 66, 2],
- 100: [0.2, 100, 3]
- }
- materialOne.opacity = option[e][0]
- if (lampData.switchType === '单灯控制器') {
- updateTunnelLamp({
- id: lampData.ID,
- tunnelSn: lampData.tunnelSn,
- lampValue1: option[e][1]
- }).then(res => {
- if (res.code === 0) {
- ElMessage.success('已发送')
- }
- })
- } else {
- let relay = relayList[0].deviceRelays
- console.log(relayList[0])
- for (let i = 0; i < relay.length; i++) {
- relay[i].state = i < option[e][2];
- }
- for (let j = 0; j < relay.length; j++) {
- deviceSwitch({
- tunnelSn: lampData.tunnelSn,
- radarId: relayList[0].radarId,
- relayId: relay[j].relayId,
- state: relay[j].state
- }).then(res => {
- if (res.code === 0) {
- console.log('发送成功')
- }
- })
- }
- }
- }
- const transparencyTwo = ref(0)
- const changeTransparencyTwo = (e) => {
- let option = {
- 0: [0.8, 33, 1],
- 50: [0.5, 66, 2],
- 100: [0.2, 100, 3]
- }
- materialTwo.opacity = option[e][0]
- if (lampData.switchType === '单灯控制器') {
- updateTunnelLamp({
- id: lampData.ID,
- tunnelSn: lampData.tunnelSn,
- lampValue2: option[e][1]
- }).then(res => {
- if (res.code === 0) {
- ElMessage.success('已发送')
- }
- })
- } else {
- let relay = relayList[1].deviceRelays
- for (let i = 0; i < relay.length; i++) {
- if (i < option[e][2]) {
- relay[i].state = true
- } else {
- relay[i].state = false
- }
- }
- for (let j = 0; j < relay.length; j++) {
- deviceSwitch({
- tunnelSn: lampData.tunnelSn,
- radarId: relayList[1].radarId,
- relayId: relay[j].relayId,
- state: relay[j].state
- }).then(res => {
- if (res.code === 0) {
- console.log('发送成功');
- }
- })
- }
- }
- }
- const parentMethod = (e) => {
- console.log('子组件调用了')
- console.log(e)
- }
- const brightness = () => {
- if (lampData.switchType === '单灯控制器') {
- let val1 = lampData.lampValue1
- let val2 = lampData.lampValue2
- let judge = {
- 0:[0.8,0],
- 33: [0.8,0],
- 66: [0.5,50],
- 100: [0.2,100],
- }
- transparency.value = judge[val1][1]
- transparencyTwo.value = judge[val1][1]
- materialOne.opacity = judge[val1][0]
- materialTwo.opacity = judge[val2][0]
- } else if(lampData.switchType === '四路控制器') {
- relayList.length = 0
- lampData.devices.forEach(item => {
- if (item.genre === 6) {
- relayList.push(item)
- }
- })
- let deviceLamp1 = relayList[0].deviceRelays
- let deviceLamp2 = relayList[1].deviceRelays
- let count1 = 0
- let count2 = 0
- deviceLamp1.forEach(item => {
- item.state ? count1++ : count1
- })
- deviceLamp2.forEach(item => {
- item.state ? count2++ : count2
- })
- let judgeWay = {
- 0: [0.8,0],
- 1: [0.8,0],
- 2: [0.5,50],
- 3: [0.2,100],
- 4: [0.2,100]
- }
- transparency.value = judgeWay[count1][1]
- transparencyTwo.value = judgeWay[count2][1]
- materialOne.opacity = judgeWay[count1][0]
- materialTwo.opacity = judgeWay[count2][0]
- }
- }
- onMounted(() => {
- queryTunnelList(condition).then(res => {
- if (res.code === 0) {
- useScreen.setTunnelList(res.data)
- Object.assign(lampData, res.data.list[0])
- brightness()
- }
- })
- })
- watch(() => useScreen.currentTunnel, (newValue, oldValue) => {
- yourMethod(newValue) // 调用你的方法
- })
- const yourMethod = (value) => {
- Object.assign(lampData, value)
- brightness()
- }
- </script>
- <style scoped lang="less">
- .horn {
- position: absolute;
- content: "";
- width: 10px;
- height: 10px;
- }
- .screen{
- width: 100%;
- height: 1000px;
- //background-image: url("@/assets/back.jpeg");
- background-size:100% 100%;
- background: #2d407d url("@/assets/line.png");
- .titleImage {
- width: 100%;
- height: 70px;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- .Heading{
- position: absolute;
- left: 42%;
- top: 25%;
- text-align: center;
- font-size: 1.7vw;
- font-weight: bold;
- color: #0EFCFF;
- }
- .titleOption{
- position: absolute;
- top: 7px;
- width: 100px;
- height: 32px;
- border: 1px solid #0EFCFF;
- color: #0EFCFF;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 16px;
- }
- }
- .deviceBox {
- width: 400px;
- height: 180px;
- margin: 20px;
- position: relative;
- pointer-events: auto;
- img {
- width: 400px;
- height: 180px;
- }
- .deviceBox_title {
- position: absolute;
- left: 30px;
- top: 15px;
- font-size: 20px;
- color: #0EFCFF;
- }
- .deviceOptionBox {
- position: absolute;
- top: 70px;
- width: 400px;
- height: 60px;
- display: flex;
- justify-content: space-around;
- align-items: center;
- .deviceOption {
- width: 90px;
- height: 60px;
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #ffffff;
- }
- }
- }
- .titleIcon{
- width: 5px;
- height: 20px;
- background-color: #0EFCFF;
- position: absolute;
- left: 20px;
- top: 16px;
- }
- .chartBox{
- width: 450px;
- height: 250px;
- margin: 20px;
- position: relative;
- pointer-events: auto;
- }
- .rightBox{
- height: 900px;
- .warnBox{
- position: relative;
- width: 400px;
- height: 300px;
- margin: 20px 0 0 20px;
- .warnBoxExternal{
- width: 400px;
- height: 270px;
- }
- .warnBoxTitle{
- width: 200px;
- height: 35px;
- position: absolute;
- left: 20px;
- top: 30px;
- }
- span{
- color:#ffffff;
- font-size: 18px;
- position: absolute;
- left: 70px;
- top: 37px;
- }
- }
- .panel{
- position: relative;
- width: 400px;
- height: 200px;
- margin-left: 20px;
- border: 1px solid rgba(25,186,139,0.17);
- padding: 0 0.1875rem 0.5rem;
- margin-bottom: 0.1875rem;
- background: url(@/assets/line.png) rgba(255,255,255,0.04);
- &::before{
- .horn;
- top: 0;
- left: 0;
- border-left: 2px solid #02a6b5;
- border-top: 2px solid #02a6b5;
- }
- &::after{
- .horn;
- top: 0;
- right: 0;
- border-right: 2px solid #02a6b5;
- border-top: 2px solid #02a6b5;
- }
- .panel-bottom{
- &::before{
- .horn;
- bottom: 0;
- left: 0;
- border-left: 2px solid #02a6b5;
- border-bottom: 2px solid #02a6b5;
- }
- &::after{
- .horn;
- bottom: 0;
- right: 0;
- border-right: 2px solid #02a6b5;
- border-bottom: 2px solid #02a6b5;
- }
- }
- .panel-title{
- position: absolute;
- left: 160px;
- top: 10px;
- font-size: 20px;
- font-weight: bold;
- color: #0EFCFF;
- }
- .panelSwitchTitle{
- color: #ffffff;
- font-size: 16px;
- position: absolute;
- bottom: 30px;
- font-weight: bold;
- left:25px;
- }
- .panelSwitch{
- position: absolute;
- right: 25px;
- bottom: 20px;
- }
- .panel-slider{
- width: 300px;
- position: absolute;
- top: 60px;
- left: 50px;
- }
- .panel-slider2{
- width: 300px;
- position: absolute;
- top: 120px;
- left: 50px;
- }
- .brightness{
- width: 300px;
- display: flex;
- justify-content: space-between;
- color: #909399;
- font-size: 14px;
- }
- }
- }
- }
- .dataBox{
- width: 200px;
- height: 150px;
- background-color: #283a72;
- }
- .centerBox{
- width: 1150px;
- height: 700px;
- border-radius: 10px;
- margin-top: 20px;
- }
- </style>
|