| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466 |
- <template>
- <div style="background-color: #0e122d">
- <div class="screenTitle">
- <img
- :src="topBg"
- alt=""
- >
- <span>龙弛智慧隧道系统</span>
- </div>
- <div class="screen">
- <div class="leftBox">
- <div class="deviceSummary">
- <div class="deviceSummary_title">
- <img
- alt=""
- :src="Device"
- style="padding-left: 15px"
- >
- <span style="padding-left: 10px;">设备汇总</span>
- </div>
- <div class="deviceOptionBox">
- <div
- v-for="item in deviceTypeList"
- :key="item.id"
- class="deviceOptionRow"
- >
- <div
- v-for="item2 in item"
- :key="item2.ID"
- class="deviceOption"
- >
- <div style="width: 35px;height: 35px">
- <img
- :src="item.url"
- style="width: 35px;height: 35px"
- alt=""
- >
- </div>
- <el-text
- style="padding-top: 8px;color: #ffffff"
- size="small"
- >
- 1/0
- </el-text>
- </div>
- </div>
- </div>
- </div>
- <div class="inductance">
- <div class="inductanceTitle">
- <img
- alt=""
- :src="Power"
- style="padding-left: 15px"
- >
- <span style="padding-left: 10px;">电感检测</span>
- </div>
- </div>
- <div class="warn">
- <div class="warnTitle">
- <img
- alt=""
- :src="Warn"
- style="padding-left: 15px"
- >
- <span style="padding-left: 10px;">警告列表</span>
- </div>
- </div>
- </div>
- <div class="centerBox">
- <div style="width: 1200px;height: 600px;border: 3px solid #1b92fd; padding: 2px">
- <Map />
- </div>
- <div class="centerBox_chart">
- <div class="centerBox_environment">
- <div class="centerBox_environment_title">
- <img
- :src="Setting"
- alt=""
- style="padding-left: 10px"
- >
- <span style="padding-left: 15px;">环境</span>
- </div>
- <div
- id="environment"
- class="centerBox_environment_chart"
- style="width: 500px"
- />
- </div>
- <div class="centerBox_environment">
- <div class="centerBox_environment_title">
- <img
- :src="Sunlight"
- alt=""
- style="padding-left: 10px"
- >
- <span style="padding-left: 15px;">光照度</span>
- </div>
- <div
- id="lamp"
- class="centerBox_environment_chart"
- style="width: 500px"
- />
- </div>
- </div>
- </div>
- <div class="rightBox" />
- </div>
- </div>
- </template>
- <script setup>
- import Device from '@/assets/icons/device.png'
- import { reactive, onMounted, watch } from 'vue'
- // 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 Setting from '@/assets/icons/setting.png'
- import Sunlight from '@/assets/icons/sunlight.png'
- import topBg from '@/assets/icons/topbg.png'
- import Power from '@/assets/icons/power.png'
- import Warn from '@/assets/icons/warn.png'
- import Map from '@/view/screen/components/map.vue'
- import * as echarts from 'echarts'
- import { useScreenStore } from '@/pinia/modules/screen'
- import { queryTunnelList } from '@/api/tunnel'
- import { queryAllDeviceGenres } from '@/api/device'
- 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 deviceTypeList = reactive([])
- const condition = {
- pageInfo: {
- page: 1,
- pageSize: 1000
- },
- name: '',
- regionId: 0,
- userId: 1
- }
- const lampData = reactive({})
- onMounted(() => {
- queryTunnelList(condition).then(res => {
- if (res.code === 0) {
- useScreen.setTunnelList(res.data)
- Object.assign(lampData, res.data.list[0])
- loading(lampData.envData)
- loadingLamp(lampData.envData)
- }
- })
- queryAllDeviceGenres().then(res => {
- if (res.code === 0) {
- const result = []
- for (let i = 0; i < res.data.length; i += 4) {
- result.push(res.data.slice(i, i + 4))
- }
- deviceTypeList.push(...result)
- console.log('设备类型', deviceTypeList)
- }
- })
- })
- const loading = (list) => {
- const chartDom = document.getElementById('environment')
- const myChart = echarts.init(chartDom)
- const option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- crossStyle: {
- color: '#ffffff'
- }
- },
- },
- legend: {
- data: [
- // '待下发','处置中','已完成'
- {
- name: '温度',
- textStyle: {
- color: '#0EFCFF' // 图例文字颜色
- }
- },
- {
- name: '湿度',
- textStyle: {
- color: '#1b92fd' // 图例文字颜色
- }
- }
- ],
- },
- xAxis: {
- type: 'time', // 使用时间类型的x轴
- boundaryGap: false,
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ffffff',
- width: 1,
- type: 'solid'
- }
- }
- },
- yAxis: {
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ffffff',
- width: 1,
- type: 'solid'
- }
- },
- splitLine: {
- lineStyle: {
- color: ['#ffffff']
- }
- }
- },
- series: [
- {
- name: '温度',
- type: 'line',
- data: list.map(item => [new Date(item.CreatedAt).getTime(), item.temperature])
- },
- {
- name: '湿度',
- type: 'line',
- data: list.map(item => [new Date(item.CreatedAt).getTime(), item.humidity])
- }
- ],
- }
- option && myChart.setOption(option)
- }
- const loadingLamp = (list) => {
- const chartDom = document.getElementById('lamp')
- const myChart = echarts.init(chartDom)
- const option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- crossStyle: {
- color: '#ffffff'
- }
- },
- },
- legend: {
- data: [
- {
- name: '光照度',
- textStyle: {
- color: '#ffffff' // 图例文字颜色
- }
- },
- ]
- },
- xAxis: {
- type: 'time', // 使用时间类型的x轴
- boundaryGap: false,
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ffffff',
- width: 1,
- type: 'solid'
- }
- }
- },
- yAxis: {
- axisLine: {
- show: true,
- lineStyle: {
- color: '#ffffff',
- width: 1,
- type: 'solid'
- }
- },
- splitLine: {
- lineStyle: {
- color: ['#ffffff']
- }
- }
- },
- series: [
- {
- name: '光照度',
- type: 'bar',
- data: list.map(item => [new Date(item.CreatedAt).getTime(), item.illuminance])
- },
- ]
- }
- option && myChart.setOption(option)
- }
- watch(() => useScreen.currentTunnel, (newValue) => {
- loading(newValue.envData)
- loadingLamp(newValue.envData)
- })
- </script>
- <style scoped lang="less">
- // 公共样式
- .title {
- display: flex;
- align-items: center;
- font-size: 20px;
- font-family: PingFang-SC-Medium,serif;
- color: rgba(27, 146, 253, 1);
- }
- .boxShape {
- width: 370px;
- border: 1px solid rgba(27,146,253,0.5);
- background: rgba(50, 72, 106, 0.2);
- margin-left: 20px;
- }
- //.....................
- .screenTitle{
- width: 100%;
- height: 100px;
- display: flex;
- justify-content: center;
- align-items: center;
- //background: linear-gradient(to bottom, #2583e0, #80aad8); /*设置渐变的方向从左到右 颜色从ff0000到ffff00*/
- //-webkit-background-clip: text;/*将设置的背景颜色限制在文字中*/
- //-webkit-text-fill-color: transparent;/*给文字设置成透明*/
- position: relative;
- span{
- position: absolute;
- top: 30px;
- left: 890px;
- font-size: 30px;
- color: #ffffff;
- padding-left: 20px;
- letter-spacing: 10px;
- }
- img{
- height: 80px;
- }
- }
- .screen{
- width: 100%;
- height: 1200px;
- background-color: #0e122d;
- display: flex;
- margin-top: 20px;
- .leftBox {
- width: 20%;
- height: 1200px;
- .deviceSummary {
- height: 240px;
- .boxShape;
- .deviceSummary_title {
- width: 370px;
- height: 50px;
- .title;
- img{
- width: 30px;
- height: 30px;
- }
- }
- .deviceOptionBox {
- width: 370px;
- height: 190px;
- margin-top: 20px;
- .deviceOptionRow {
- width: 100%;
- height: 60px;
- display: flex;
- margin-top: 20px;
- .deviceOption {
- width: 90px;
- height: 60px;
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #ffffff;
- }
- }
- }
- }
- .inductance {
- height: 200px;
- margin-top: 20px;
- .boxShape;
- .inductanceTitle {
- width: 370px;
- height: 50px;
- .title;
- img{
- width: 30px;
- height: 30px;
- }
- }
- }
- .warn {
- height: 400px;
- margin-top: 20px;
- .boxShape;
- .warnTitle {
- width: 370px;
- height: 50px;
- .title;
- img{
- width: 30px;
- height: 30px;
- }
- }
- }
- }
- .centerBox {
- width: 60%;
- height: 1200px;
- display: flex;
- flex-direction: column;
- align-items: center;
- .centerBox_chart {
- width: 1200px;
- height: 220px;
- margin-top: 40px;
- display: flex;
- justify-content: space-between;
- border: 1px solid rgba(27,146,253,0.5);
- background: rgba(50, 72, 106, 0.2);
- }
- .centerBox_environment{
- width: 500px;
- height: 220px;
- position: relative;
- .centerBox_environment_title {
- width: 500px;
- height: 50px;
- .title;
- img {
- width: 30px;
- height: 30px;
- }
- }
- .centerBox_environment_chart {
- height: 250px;
- position: absolute;
- top: 5px;
- }
- }
- }
- .rightBox {
- width: 20%;
- height: 1200px;
- }
- }
- </style>
|