dataScreen.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <div class="screen">
  3. <div style="height: 10px"></div>
  4. <div class="titleImage">
  5. <el-image :src="titleUrl" />
  6. <span class="Heading">龙弛智慧隧道系统</span>
  7. <div class="titleOption" style="left: 19%" @click="jumpScreen('map')">
  8. <span>地图</span>
  9. </div>
  10. <div class="titleOption" style="left: 76%" @click="jumpScreen('model')">
  11. <span>模型</span>
  12. </div>
  13. </div>
  14. <div style="height: 10px"></div>
  15. <el-row>
  16. <el-col :span="5" style="height: 900px;">
  17. <div class="deviceBox">
  18. <img src="@/assets/main_top_left.png" alt=""/>
  19. <div class="titleIcon"></div>
  20. <div class="deviceBox_title">设备汇总</div>
  21. <div class="deviceOptionBox">
  22. <div class="deviceOption" v-for="item in deviceList">
  23. <img :src="item.url" style="width: 35px;height: 35px" alt=""/>
  24. <el-text style="padding-top: 8px;color: #ffffff" size="small">{{item.label + item.value}}</el-text>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="chartBox">
  29. <Chart/>
  30. </div>
  31. <div class="chartBox">
  32. <lightChart/>
  33. </div>
  34. </el-col>
  35. <el-col :span="14" style="display: flex;justify-content: center">
  36. <div class="centerBox">
  37. <Map @call-parent="parentMethod"/>
  38. </div>
  39. </el-col>
  40. <el-col :span="5" class="rightBox">
  41. <div style="height: 20px"></div>
  42. <div class="panel">
  43. <span class="panel-title">亮度调整</span>
  44. <el-slider
  45. v-model="transparency"
  46. :step="50"
  47. show-stops
  48. :show-tooltip="false"
  49. class="panel-slider"
  50. @change="changeTransparency"
  51. />
  52. <div class="brightness" style="margin: 90px 0 0 50px;">
  53. <span>低</span>
  54. <span>中</span>
  55. <span>高</span>
  56. </div>
  57. <el-slider
  58. v-model="transparencyTwo"
  59. :step="50"
  60. show-stops
  61. :show-tooltip="false"
  62. class="panel-slider2"
  63. @change="changeTransparencyTwo"
  64. />
  65. <div class="brightness" style="margin: 50px 0 0 50px;">
  66. <span>低</span>
  67. <span>中</span>
  68. <span>高</span>
  69. </div>
  70. <div class="panel-bottom"></div>
  71. </div>
  72. <!-- <div class="vehicleBox">-->
  73. <!-- <div class="panel" style="height: 190px">-->
  74. <!-- <span class="panel-title">车辆检测器</span>-->
  75. <!-- <el-form style="position: absolute;left: 40px;top: 50px">-->
  76. <!-- <el-form-item label="交通量" label-width="110" label-position="left">-->
  77. <!-- <el-row style="width: 200px">-->
  78. <!-- <el-col :span="15" class="vehicleData">-->
  79. <!-- <span>123</span>-->
  80. <!-- </el-col>-->
  81. <!-- <el-col :span="9" class="vehicleUnit">-->
  82. <!-- <span>辆</span>-->
  83. <!-- </el-col>-->
  84. <!-- </el-row>-->
  85. <!-- </el-form-item>-->
  86. <!-- <el-form-item label="平均车速" label-width="110" label-position="left">-->
  87. <!-- <el-row style="width: 200px">-->
  88. <!-- <el-col :span="15" class="vehicleData">-->
  89. <!-- <span>66</span>-->
  90. <!-- </el-col>-->
  91. <!-- <el-col :span="9" class="vehicleUnit">-->
  92. <!-- <span>km/h</span>-->
  93. <!-- </el-col>-->
  94. <!-- </el-row>-->
  95. <!-- </el-form-item>-->
  96. <!-- <el-form-item label="车道占有量" label-width="110" label-position="left">-->
  97. <!-- <el-row style="width: 200px">-->
  98. <!-- <el-col :span="15" class="vehicleData">-->
  99. <!-- <span>12</span>-->
  100. <!-- </el-col>-->
  101. <!-- <el-col :span="9" class="vehicleUnit">-->
  102. <!-- <span>%</span>-->
  103. <!-- </el-col>-->
  104. <!-- </el-row>-->
  105. <!-- </el-form-item>-->
  106. <!-- </el-form>-->
  107. <!-- <div class="panel-bottom"></div>-->
  108. <!-- </div>-->
  109. <!-- </div>-->
  110. <div class="warnBox">
  111. <img :src="warn" alt="" class="warnBoxExternal" />
  112. <img :src="warnTitle" alt="" class="warnBoxTitle"/>
  113. <span>警告列表</span>
  114. </div>
  115. </el-col>
  116. </el-row>
  117. </div>
  118. </template>
  119. <script setup>
  120. // 标题图片
  121. import titleUrl from '@/assets/title_bg.png'
  122. import environments from "@/assets/icons/environment.png";
  123. import fourWays from "@/assets/icons/fourWays.png"
  124. import inductance from "@/assets/icons/inductance.png"
  125. import singleLamp from "@/assets/icons/singleLamp.png"
  126. import Chart from "./components/chart.vue";
  127. import warn from '@/assets/main_bottopm_top2.png'
  128. import Map from './components/map.vue'
  129. import warnTitle from '@/assets/warnTitle.png'
  130. import lightChart from './components/lightChart.vue'
  131. import { queryTunnelList } from '@/api/tunnel'
  132. import {reactive, onMounted, ref, watch} from 'vue'
  133. // 单灯控制
  134. import { updateTunnelLamp } from "@/api/tunnel";
  135. // 四路控制
  136. import { deviceSwitch } from "@/api/device";
  137. import {useScreenStore} from "@/pinia/modules/screen";
  138. import {ElMessage} from "element-plus";
  139. // 灯光数据
  140. const lampData = reactive({})
  141. const useScreen = useScreenStore()
  142. const deviceList = reactive([
  143. {url: environments, label: '环境:', value: '1/0'},
  144. {url: fourWays, label: '四路:', value: '1/0'},
  145. {url: inductance, label: '电感:', value: '1/0'},
  146. {url: singleLamp, label: '单灯:', value: '1/0'},
  147. ])
  148. const condition = {
  149. pageInfo: {
  150. page: 1,
  151. pageSize: 1000
  152. },
  153. name: '',
  154. regionId: 0,
  155. userId: 1
  156. }
  157. // 存储模型数据
  158. let materialOne = reactive({})
  159. let materialTwo = reactive({})
  160. // 亮度调整
  161. const transparency = ref(0)
  162. const relayList = reactive([])
  163. const changeTransparency = (e) => {
  164. let option = {
  165. 0: [0.8, 33, 1],
  166. 50: [0.5, 66, 2],
  167. 100: [0.2, 100, 3]
  168. }
  169. materialOne.opacity = option[e][0]
  170. if (lampData.switchType === '单灯控制器') {
  171. updateTunnelLamp({
  172. id: lampData.ID,
  173. tunnelSn: lampData.tunnelSn,
  174. lampValue1: option[e][1]
  175. }).then(res => {
  176. if (res.code === 0) {
  177. ElMessage.success('已发送')
  178. }
  179. })
  180. } else {
  181. let relay = relayList[0].deviceRelays
  182. for (let i = 0; i < relay.length; i++) {
  183. relay[i].state = i < option[e][2];
  184. }
  185. for (let j = 0; j < relay.length; j++) {
  186. deviceSwitch({
  187. tunnelSn: lampData.tunnelSn,
  188. radarId: relayList[0].radarId,
  189. relayId: relay[j].relayId,
  190. state: relay[j].state
  191. }).then(res => {
  192. if (res.code === 0) {
  193. console.log('发送成功')
  194. }
  195. })
  196. }
  197. }
  198. }
  199. const transparencyTwo = ref(0)
  200. const changeTransparencyTwo = (e) => {
  201. let option = {
  202. 0: [0.8, 33, 1],
  203. 50: [0.5, 66, 2],
  204. 100: [0.2, 100, 3]
  205. }
  206. materialTwo.opacity = option[e][0]
  207. if (lampData.switchType === '单灯控制器') {
  208. updateTunnelLamp({
  209. id: lampData.ID,
  210. tunnelSn: lampData.tunnelSn,
  211. lampValue2: option[e][1]
  212. }).then(res => {
  213. if (res.code === 0) {
  214. ElMessage.success('已发送')
  215. }
  216. })
  217. } else {
  218. let relay = relayList[1].deviceRelays
  219. for (let i = 0; i < relay.length; i++) {
  220. relay[i].state = i < option[e][2];
  221. }
  222. for (let j = 0; j < relay.length; j++) {
  223. deviceSwitch({
  224. tunnelSn: lampData.tunnelSn,
  225. radarId: relayList[1].radarId,
  226. relayId: relay[j].relayId,
  227. state: relay[j].state
  228. }).then(res => {
  229. if (res.code === 0) {
  230. console.log('发送成功');
  231. }
  232. })
  233. }
  234. }
  235. }
  236. const parentMethod = (e) => {
  237. console.log('子组件调用了')
  238. console.log(e)
  239. }
  240. const brightness = () => {
  241. if (lampData.switchType === '单灯控制器') {
  242. let val1 = lampData.lampValue1
  243. let val2 = lampData.lampValue2
  244. let judge = {
  245. 0:[0.8,0],
  246. 33: [0.8,0],
  247. 66: [0.5,50],
  248. 100: [0.2,100],
  249. }
  250. transparency.value = judge[val1][1]
  251. transparencyTwo.value = judge[val1][1]
  252. materialOne.opacity = judge[val1][0]
  253. materialTwo.opacity = judge[val2][0]
  254. } else if(lampData.switchType === '四路控制器') {
  255. relayList.length = 0
  256. lampData.devices.forEach(item => {
  257. if (item.genre === 6) {
  258. relayList.push(item)
  259. }
  260. })
  261. let deviceLamp1 = relayList[0].deviceRelays
  262. let deviceLamp2 = relayList[1].deviceRelays
  263. let count1 = 0
  264. let count2 = 0
  265. deviceLamp1.forEach(item => {
  266. item.state ? count1++ : count1
  267. })
  268. deviceLamp2.forEach(item => {
  269. item.state ? count2++ : count2
  270. })
  271. let judgeWay = {
  272. 0: [0.8,0],
  273. 1: [0.8,0],
  274. 2: [0.5,50],
  275. 3: [0.2,100],
  276. 4: [0.2,100]
  277. }
  278. transparency.value = judgeWay[count1][1]
  279. transparencyTwo.value = judgeWay[count2][1]
  280. materialOne.opacity = judgeWay[count1][0]
  281. materialTwo.opacity = judgeWay[count2][0]
  282. }
  283. }
  284. onMounted(() => {
  285. queryTunnelList(condition).then(res => {
  286. if (res.code === 0) {
  287. useScreen.setTunnelList(res.data)
  288. Object.assign(lampData, res.data.list[0])
  289. brightness()
  290. }
  291. })
  292. })
  293. watch(() => useScreen.currentTunnel, (newValue, oldValue) => {
  294. yourMethod(newValue) // 调用你的方法
  295. })
  296. const yourMethod = (value) => {
  297. Object.assign(lampData, value)
  298. brightness()
  299. }
  300. </script>
  301. <style scoped lang="less">
  302. .horn {
  303. position: absolute;
  304. content: "";
  305. width: 10px;
  306. height: 10px;
  307. }
  308. .screen{
  309. width: 100%;
  310. height: 1000px;
  311. //background-image: url("@/assets/back.jpeg");
  312. background-size:100% 100%;
  313. background: #2d407d url("@/assets/line.png");
  314. .titleImage {
  315. width: 100%;
  316. height: 70px;
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. position: relative;
  321. .Heading{
  322. position: absolute;
  323. left: 42%;
  324. top: 25%;
  325. text-align: center;
  326. font-size: 1.7vw;
  327. font-weight: bold;
  328. color: #0EFCFF;
  329. }
  330. .titleOption{
  331. position: absolute;
  332. top: 7px;
  333. width: 100px;
  334. height: 32px;
  335. border: 1px solid #0EFCFF;
  336. color: #0EFCFF;
  337. display: flex;
  338. align-items: center;
  339. justify-content: center;
  340. font-size: 16px;
  341. }
  342. }
  343. .deviceBox {
  344. width: 400px;
  345. height: 180px;
  346. margin: 20px;
  347. position: relative;
  348. pointer-events: auto;
  349. img {
  350. width: 400px;
  351. height: 180px;
  352. }
  353. .deviceBox_title {
  354. position: absolute;
  355. left: 30px;
  356. top: 15px;
  357. font-size: 20px;
  358. color: #0EFCFF;
  359. }
  360. .deviceOptionBox {
  361. position: absolute;
  362. top: 70px;
  363. width: 400px;
  364. height: 60px;
  365. display: flex;
  366. justify-content: space-around;
  367. align-items: center;
  368. .deviceOption {
  369. width: 90px;
  370. height: 60px;
  371. display: flex;
  372. flex-direction: column;
  373. align-items: center;
  374. color: #ffffff;
  375. }
  376. }
  377. }
  378. .titleIcon{
  379. width: 5px;
  380. height: 20px;
  381. background-color: #0EFCFF;
  382. position: absolute;
  383. left: 20px;
  384. top: 16px;
  385. }
  386. .chartBox{
  387. width: 450px;
  388. height: 250px;
  389. margin: 20px;
  390. position: relative;
  391. pointer-events: auto;
  392. }
  393. .rightBox{
  394. height: 900px;
  395. .warnBox{
  396. position: relative;
  397. width: 400px;
  398. height: 300px;
  399. margin: 20px 0 0 20px;
  400. .warnBoxExternal{
  401. width: 400px;
  402. height: 270px;
  403. }
  404. .warnBoxTitle{
  405. width: 200px;
  406. height: 35px;
  407. position: absolute;
  408. left: 20px;
  409. top: 30px;
  410. }
  411. span{
  412. color:#ffffff;
  413. font-size: 18px;
  414. position: absolute;
  415. left: 70px;
  416. top: 37px;
  417. }
  418. }
  419. .panel{
  420. position: relative;
  421. width: 400px;
  422. height: 200px;
  423. margin-left: 20px;
  424. border: 1px solid rgba(25,186,139,0.17);
  425. padding: 0 0.1875rem 0.5rem;
  426. margin-bottom: 0.1875rem;
  427. background: url(@/assets/line.png) rgba(255,255,255,0.04);
  428. &::before{
  429. .horn;
  430. top: 0;
  431. left: 0;
  432. border-left: 2px solid #02a6b5;
  433. border-top: 2px solid #02a6b5;
  434. }
  435. &::after{
  436. .horn;
  437. top: 0;
  438. right: 0;
  439. border-right: 2px solid #02a6b5;
  440. border-top: 2px solid #02a6b5;
  441. }
  442. .panel-bottom{
  443. &::before{
  444. .horn;
  445. bottom: 0;
  446. left: 0;
  447. border-left: 2px solid #02a6b5;
  448. border-bottom: 2px solid #02a6b5;
  449. }
  450. &::after{
  451. .horn;
  452. bottom: 0;
  453. right: 0;
  454. border-right: 2px solid #02a6b5;
  455. border-bottom: 2px solid #02a6b5;
  456. }
  457. }
  458. .panel-title{
  459. position: absolute;
  460. left: 160px;
  461. top: 10px;
  462. font-size: 20px;
  463. font-weight: bold;
  464. color: #0EFCFF;
  465. }
  466. .panelSwitchTitle{
  467. color: #ffffff;
  468. font-size: 16px;
  469. position: absolute;
  470. bottom: 30px;
  471. font-weight: bold;
  472. left:25px;
  473. }
  474. .panelSwitch{
  475. position: absolute;
  476. right: 25px;
  477. bottom: 20px;
  478. }
  479. .panel-slider{
  480. width: 300px;
  481. position: absolute;
  482. top: 60px;
  483. left: 50px;
  484. }
  485. .panel-slider2{
  486. width: 300px;
  487. position: absolute;
  488. top: 120px;
  489. left: 50px;
  490. }
  491. .brightness{
  492. width: 300px;
  493. display: flex;
  494. justify-content: space-between;
  495. color: #909399;
  496. font-size: 14px;
  497. }
  498. }
  499. //.vehicleBox{
  500. // margin-top: 30px;
  501. // margin-bottom: 30px;
  502. // .vehicleData{
  503. // display: flex;
  504. // justify-content: end;
  505. // align-items: center;
  506. // span {
  507. // font-size: 18px;
  508. // font-weight: bold;
  509. // color: #0EFCFF;
  510. // }
  511. // }
  512. // .vehicleUnit{
  513. // display: flex;
  514. // justify-content: end;
  515. // align-items: center;
  516. // span {
  517. // color: #909399;
  518. // }
  519. // }
  520. //}
  521. }
  522. }
  523. .dataBox{
  524. width: 200px;
  525. height: 150px;
  526. background-color: #283a72;
  527. }
  528. .centerBox{
  529. width: 1150px;
  530. height: 700px;
  531. border-radius: 10px;
  532. margin-top: 20px;
  533. }
  534. </style>