RightSlide.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <template>
  2. <div class="rightcon" :style="{ transform: `scale(${scale})`, transformOrigin: '100% 0' }">
  3. <div style="display: flex;position: absolute;width: 430px;top: 0;right: 0;z-index: 10;"
  4. :class="[!isFold ? 'ani1back' : 'ani1']" :style="{ animationDelay: !isFold ? '0s' : '0.2s' }">
  5. <RightSlideList :companyCode="companyCode" :realtimeData="realtimeData" @changeLine="changeLine" />
  6. <div style="position: relative;">
  7. <img src="@assets/img/photovoltaic/card3bg.png" style="width:430px" :class="[!isFold ? 'fadeIn' : 'fadeOut']"
  8. :style="{ animationDelay: !isFold ? '0s' : '0.2s' }" />
  9. <div class="cardcon">
  10. <CardVue class="animate__animated" :class="[`animate__slide${isFold ? 'Out' : 'In'}Right`]" :img="imgCard3"
  11. :style="{ animationDelay: foldDelay[0] }" title="值班情况" width="389">
  12. <template #desc>
  13. <div style="font-size: 14px;">
  14. <span style="color: #fff;margin-right: 21px;">
  15. 今日在岗人数
  16. </span>
  17. <span style="color: #1B99FF;margin-left: 50px;">
  18. {{ dutyInfo?.workNum ?? '--' }}
  19. </span>
  20. </div>
  21. </template>
  22. <div style="flex: 1; display: flex;height: 100%;">
  23. <div style="flex:1">
  24. <div style="padding-top: 15px; padding-left: 33px;">
  25. <img src="@assets/img/photovoltaic/avatar.png" style="width:52px; float: left;margin-right: 3px;" />
  26. <div style="font-size: 14px;color: #fff; margin-top: 11px;">今日值班员</div>
  27. <div style="font-size: 18px;color: #1B99FF; margin-top: 0px;">
  28. {{ dutyInfo?.name ?? '--' }}
  29. </div>
  30. </div>
  31. <div
  32. style="font-size: 12px;color: #b6b6b6;line-height: 28px;clear: both;padding-left: 5px;margin-top: -2px;">
  33. <img src="@assets/img/photovoltaic/arrow.png" style="width:26px;float: left;" />
  34. <div>
  35. 联系方式
  36. </div>
  37. </div>
  38. </div>
  39. <div style="flex:1;display: flex;height: 100%;padding-right: 22px;">
  40. <div
  41. style=" padding-top: 25px;font-size: 14px;color: #fff;text-align: right;line-height: 22px;padding-left: 30px;">
  42. <div>值班长</div>
  43. <div style="margin-top: 15px;">现场负责人</div>
  44. </div>
  45. <div
  46. style="flex:1;padding-top: 25px;font-size: 18px;color: #1B99FF;margin-left: 25px;line-height: 22px; text-align: right;">
  47. <div>
  48. {{ dutyInfo?.officer ?? '--' }}
  49. </div>
  50. <div style="margin-top: 15px;">
  51. {{ dutyInfo?.responsible ?? '--' }}
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </CardVue>
  57. <CardVue :style="{ animationDelay: foldDelay[1] }" class="animate__animated"
  58. :class="[`animate__slide${isFold ? 'Out' : 'In'}Right`]" :img="imgCard4" width="389" title="发电情况"
  59. desc="单位(MWh)" style="margin-top: 10px;">
  60. <div class="flexcol" style="padding-left:20px;padding-right: 40px;padding-top: 25px;">
  61. <div v-for="i in 3">
  62. <div style="flex-direction: row;justify-content: space-between;">
  63. <div>
  64. <div style="font-size: 14px;color:#fff">
  65. {{ ['', '日', '月', '年'][i] }}发电量
  66. </div>
  67. <div style="color: #1B99FF;font-size: 20px;font-family: Bicubik;">
  68. {{ FDL[i - 1] }}
  69. </div>
  70. </div>
  71. <div style="flex-direction: row;justify-content: space-between;width: 220px;margin-right: 10px;">
  72. <div style="align-items: center;">
  73. <div style="font-size: 13px; color: #c1c1c1;">
  74. 计划电量
  75. </div>
  76. <div style="font-size: 14px; color: #fff;margin-top: 6px;">
  77. {{ JHFDL[i - 1] }}
  78. </div>
  79. </div>
  80. <div class="linediv"></div>
  81. <div style="align-items: center;">
  82. <div style="font-size: 13px; color: #c1c1c1;">
  83. 完成率
  84. </div>
  85. <div style="font-size: 14px; color: #fff;margin-top: 6px;">
  86. {{ formatPercent(JHFDL[i - 1], FDL[i - 1]) }}
  87. </div>
  88. </div>
  89. <div class="linediv"></div>
  90. <div style="align-items: center;">
  91. <div style="font-size: 13px; color: #c1c1c1;">
  92. 等效小时
  93. </div>
  94. <div style="font-size: 14px; color: #fff;margin-top: 6px;">
  95. {{ LYXS[i - 1] }}
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <div style="height: 30px;margin-top: 10px;">
  101. <Slider :value="getPercent(JHFDL[i - 1], FDL[i - 1])" />
  102. </div>
  103. </div>
  104. </div>
  105. </CardVue>
  106. <CardVue :style="{ animationDelay: foldDelay[2] }" class="animate__animated"
  107. :class="[`animate__slide${isFold ? 'Out' : 'In'}Right`]" :img="imgCard5" width="389" title="今日告警"
  108. style="margin-top: 10px;">
  109. <div
  110. style="flex:1; display: flex; align-items: center; justify-content: space-around;padding: 0 15px;height: 100%;">
  111. <div class="item1" @click="clickAlarm()">
  112. <div class="numm">
  113. <img src="@assets/img/photovoltaic/gjg.png" class="anii" />
  114. {{ alarmData?.totalNum ?? '--' }}
  115. </div>
  116. <img src="@assets/img/photovoltaic/gjb.png" />
  117. <div style="margin-top: -6px;">
  118. 报警
  119. </div>
  120. </div>
  121. <div class="item1" @click="clickAlarm(0)">
  122. <div class="numm">
  123. <img src="@assets/img/photovoltaic/wqrg.png" class="anii" />
  124. {{ alarmData?.unCdNum ?? '--' }}
  125. </div>
  126. <img src="@assets/img/photovoltaic/wqrb.png" />
  127. <div style="margin-top: -6px;">
  128. 未确认</div>
  129. </div>
  130. <div class="item1" @click="clickAlarm(1)">
  131. <div class="numm">
  132. <img src="@assets/img/photovoltaic/yqrg.png" class="anii" />
  133. {{ alarmData?.cdNum ?? '--' }}
  134. </div>
  135. <img src="@assets/img/photovoltaic/yqrb.png" />
  136. <div style="margin-top: -6px;">
  137. 已确认</div>
  138. </div>
  139. </div>
  140. </CardVue>
  141. <CardVue :style="{ animationDelay: foldDelay[3] }" class="animate__animated"
  142. :class="[`animate__slide${isFold ? 'Out' : 'In'}Right`]" :img="imgCard6" width="389" title="设备状态"
  143. style="margin-top: 10px;">
  144. <div
  145. style="height: 100%; padding: 34px 26px 27px 22px;display: flex;align-items: center;justify-content: space-between;">
  146. <div class="chart-online" @click="tolightMatrixMonitor()">
  147. <div class="device-online" style="cursor: pointer">
  148. <div class="device-online-progess"></div>
  149. <div class="device-online-data">
  150. <img src="@assets/img/images/gfL-orange.png" width="31" height="26" style="margin-left: 30px" />
  151. <div class="online-data" style="margin-top: 5px">
  152. {{ ztp }}
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. <div style="margin-left: 24px;margin-bottom: -5px;cursor: pointer;">
  158. <ColorDiv @click="tolightMatrixMonitor(3)" color="white" label="通信中断" :value="sbzt?.[3] ?? '--'"
  159. :percent="sbztp[3]" />
  160. <ColorDiv @click="tolightMatrixMonitor(2)" color="red" label="设备停机" :value="sbzt?.[2] ?? '--'"
  161. :percent="sbztp[2]" />
  162. <ColorDiv @click="tolightMatrixMonitor(1)" color="yellow" label="带障运行" :value="sbzt?.[1] ?? '--'"
  163. :percent="sbztp[1]" />
  164. <ColorDiv @click="tolightMatrixMonitor(0)" color="blue" label="正常运行" :value="sbzt?.[0] ?? '--'"
  165. :percent="sbztp[0]" />
  166. </div>
  167. </div>
  168. </CardVue>
  169. </div>
  170. </div>
  171. </div>
  172. <!-- 展开按钮 -->
  173. <div style="position: absolute;right: 0;z-index: 10;top:170px;width: 15px; cursor: pointer;"
  174. @click="isFold = !isFold">
  175. <img src="@assets/img/photovoltaic/right-btn.png" style="width: 15px" />
  176. <img style="position: absolute;width: 7px;top: 310px;right: 6px;" :src="!isFold ? rightr : leftr" />
  177. </div>
  178. </div>
  179. </template>
  180. <script setup>
  181. import Slider from '../components/Slider.vue'
  182. import ColorDiv from '../components/ColorDiv.vue'
  183. import RightSlideList from './RightSlideList.vue';
  184. import { GetPlanValues } from '@api/home'
  185. import { GetDutyInfoData } from '@api/station'
  186. import { GetCompanEquipmentsDatas, GetRtValuesByTagName } from '@api/photovoltaicStation'
  187. import { computed, nextTick, onMounted, onUnmounted, ref, watchEffect } from 'vue';
  188. import { useResizeScale, useClickAlarm } from '../hooks';
  189. import CardVue from '../components/CardVue.vue';
  190. import { alarmRefreshTime, rtDataRefreshTime } from '@/config'
  191. import { useRouter } from 'vue-router';
  192. const props = defineProps({
  193. realtimeData: Object,
  194. companyCode: String,
  195. alarmData: Object,
  196. calcData: Object
  197. })
  198. const router = useRouter()
  199. const clickAlarm = useClickAlarm()
  200. const emit = defineEmits(['changeLine'])
  201. const changeLine = v => emit('changeLine', v)
  202. function tolightMatrixMonitor(status = '') {
  203. router.push({
  204. name: 'lightMatrixMonitor',
  205. query: {
  206. companyCode: props.companyCode,
  207. nemCode: props.companyCode,
  208. czType: status
  209. }
  210. })
  211. }
  212. const showCardVue = ref()
  213. function cardanimationend() {
  214. if (isFold.value) {
  215. showCardVue.value = false
  216. }
  217. }
  218. function cardanimationstart() {
  219. if (!isFold.value) {
  220. showCardVue.value = true
  221. }
  222. }
  223. const scale = useResizeScale()
  224. const leftr = require('@assets/img/photovoltaic/arrow-left.png')
  225. const rightr = require('@assets/img/photovoltaic/arrow-right.png')
  226. const imgCard3 = require('@assets/img/photovoltaic/card3.png')
  227. const imgCard4 = require('@assets/img/photovoltaic/card4.png')
  228. const imgCard5 = require('@assets/img/photovoltaic/card5.png')
  229. const imgCard6 = require('@assets/img/photovoltaic/card6.png')
  230. const isFold = ref(false)
  231. const foldDelay = computed(() => {
  232. const a = ['0s', '0.1s', '0.2s', '0.3s']
  233. if (isFold.value) {
  234. a.reverse()
  235. }
  236. return a
  237. })
  238. // 实际发电量
  239. const FDL = computed(() => {
  240. const realtimeData = props.realtimeData
  241. return realtimeData ? [realtimeData.RFDL, realtimeData.YFDL, realtimeData.NFDL].map(i => (i).toFixed(2)) : ['--', '--', '--']
  242. })
  243. // 计划发电量
  244. const JHFDL = ref(['--', '--', '--'])
  245. // 值班信息
  246. const dutyInfo = ref()
  247. // 等效时长
  248. const LYXS = computed(() => {
  249. const d = props.realtimeData
  250. return d ? [d.RLYXS, d.YLYXS, d.NLYXS].map(i => (i).toFixed(2)) : ['--', '--', '--']
  251. })
  252. // 设备状态
  253. const sbzt = ref()
  254. // 状态百分比
  255. const sbztp = computed(() => {
  256. if (!sbzt.value) {
  257. return ['--', '--', '--', '--']
  258. }
  259. const all = sbzt.value.reduce((x, y) => x + y)
  260. return sbzt.value.map(i => `${(i / all * 100).toFixed(2)}%`)
  261. })
  262. // 总百分比
  263. const ztp = computed(() => {
  264. if (!sbzt.value) {
  265. return '--'
  266. }
  267. const all = sbzt.value.reduce((x, y) => x + y)
  268. const sub = sbzt.value.slice(3).reduce((x, y) => x + y)
  269. return `${(100 - sub / all * 100).toFixed(2)}%`
  270. })
  271. function init() {
  272. GetPlanValues({
  273. companyCode: props.companyCode,
  274. planDate: formatDateStr(new Date())
  275. }).then(res => {
  276. JHFDL.value = [res.RJHFDL, res.YJHFDL, res.NJHFDL].map(i => {
  277. if (isNaN(i) || i === '') {
  278. return '--'
  279. } else {
  280. return i | 0
  281. }
  282. })
  283. })
  284. GetDutyInfoData({
  285. stationCode: props.companyCode,
  286. dutyDate: formatDateStr(new Date())
  287. }).then(res => {
  288. dutyInfo.value = res
  289. })
  290. }
  291. watchEffect(init)
  292. onMounted(() => {
  293. updateDeviceState()
  294. })
  295. let timer
  296. // 刷新设备状态
  297. function updateDeviceState() {
  298. GetCompanEquipmentsDatas(props.companyCode).then(({ AMDATAS, CBDATAS, EMIDATAS, INDATAS, SCBDATAS }) => {
  299. const map = {
  300. AM: AMDATAS,
  301. CB: CBDATAS,
  302. EMI: EMIDATAS,
  303. IN: INDATAS,
  304. SCB: SCBDATAS
  305. }
  306. const kvmap = {}
  307. const list = [];
  308. for (const en of Object.entries(map)) {
  309. const [type, typeList] = en
  310. typeList.forEach(({ SBZT }) => {
  311. list.push(SBZT)
  312. kvmap[SBZT] = type
  313. })
  314. }
  315. const count = [0, 0, 0, 0]
  316. GetRtValuesByTagName(list.join('|')).then(res => {
  317. res.forEach(({ value, tagName }) => {
  318. const type = kvmap[tagName]
  319. const s = getRealState(value, type)
  320. count[s]++
  321. })
  322. sbzt.value = count
  323. timer = setTimeout(updateDeviceState, rtDataRefreshTime)
  324. })
  325. })
  326. }
  327. onUnmounted(() => {
  328. clearTimeout(timer)
  329. })
  330. function getRealState(value, type) {
  331. value = Math.round(value)
  332. if (type === 'EMI' || type === 'AM') {
  333. return value >= 2 ? 3 : value
  334. }
  335. return value >= 3 ? 3 : value
  336. }
  337. function getPercent(total, finish) {
  338. if (isNaN(total) || isNaN(finish)) {
  339. return 0
  340. }
  341. const r = parseInt(finish / total * 100)
  342. return (r > 100 ? 100 : r)
  343. }
  344. function formatPercent(total, finish) {
  345. if (isNaN(total) || isNaN(finish)) {
  346. return '--'
  347. }
  348. return getPercent(total, finish) + '%'
  349. }
  350. function formatDateStr(date) {
  351. const fix = f => ('0' + f).slice(-2)
  352. return `${date.getFullYear()}-${fix(date.getMonth() + 1)}-${fix(date.getDate())}`
  353. }
  354. </script>
  355. <style lang="less" scoped>
  356. @keyframes toleft1 {
  357. from {
  358. transform: translateX(0);
  359. }
  360. to {
  361. transform: translateX(417px);
  362. }
  363. }
  364. @keyframes toright1 {
  365. from {
  366. transform: translateX(417px);
  367. }
  368. to {
  369. transform: translateX(0);
  370. }
  371. }
  372. .ani1 {
  373. animation-name: toleft1;
  374. animation-duration: 0.5s;
  375. animation-timing-function: ease-in-out;
  376. animation-fill-mode: forwards;
  377. }
  378. .ani1back {
  379. animation-name: toright1;
  380. animation-duration: 0.5s;
  381. animation-timing-function: ease-in;
  382. animation-fill-mode: forwards;
  383. }
  384. @keyframes float1 {
  385. 0% {
  386. transform: translateY(0);
  387. }
  388. 50% {
  389. transform: translateY(5px);
  390. }
  391. 100% {
  392. transform: translateY(0);
  393. }
  394. }
  395. .rightcon {
  396. position: absolute;
  397. right: 70px;
  398. top: 45px;
  399. margin-top: 59px;
  400. bottom: 0;
  401. display: flex;
  402. height: 947px;
  403. z-index: 2;
  404. }
  405. .cardcon {
  406. position: absolute;
  407. z-index: 5;
  408. left: 0;
  409. top: 0;
  410. right: 0;
  411. bottom: 0;
  412. padding-top: 25px;
  413. padding-left: 9px;
  414. padding-right: 32px;
  415. }
  416. .tt {
  417. display: flex;
  418. justify-content: space-between;
  419. font-size: 16px;
  420. line-height: 28px;
  421. color: #fff;
  422. margin-top: 3px;
  423. margin-left: 15px;
  424. margin-right: 15px;
  425. }
  426. .tt span {
  427. color: #B1B1B1;
  428. font-size: 14px;
  429. margin-right: 15px;
  430. }
  431. .rel {
  432. position: relative;
  433. }
  434. .item1 {
  435. width: 92px;
  436. text-align: center;
  437. font-size: 13px;
  438. color: #ddd;
  439. cursor: pointer;
  440. }
  441. .numm {
  442. font-size: 18px;
  443. color: #fff;
  444. font-family: Bicubik;
  445. line-height: 43px;
  446. position: relative;
  447. }
  448. .anii {
  449. width: 46px;
  450. position: absolute;
  451. left: 23px;
  452. top: 20px;
  453. z-index: 1;
  454. animation-name: float1;
  455. animation-timing-function: ease-in-out;
  456. animation-duration: 3s;
  457. animation-iteration-count: infinite;
  458. }
  459. .flexcol,
  460. .flexcol div {
  461. display: flex;
  462. flex-direction: column;
  463. }
  464. .linediv {
  465. content: '';
  466. border-left: 1px dashed #979795;
  467. height: 42px;
  468. margin: 0 15px;
  469. }
  470. .device-online {
  471. position: relative;
  472. display: flex;
  473. align-items: center;
  474. justify-content: center;
  475. width: 120px;
  476. height: 122px;
  477. background: url("../../../../../assets/img/images/equipment-online-rate-orange.png") no-repeat;
  478. background-size: cover;
  479. .device-online-progess {
  480. position: relative;
  481. top: 0px;
  482. left: 1px;
  483. width: 77%;
  484. height: 77%;
  485. background: url("../../../../../assets/img/images/equipment-online-progress-orange.png") no-repeat;
  486. background-size: cover;
  487. transform: rotateZ(360deg);
  488. animation: circleProgess 3s linear infinite;
  489. }
  490. @keyframes circleProgess {
  491. 0% {
  492. transform: rotateZ(0deg);
  493. }
  494. 25% {
  495. transform: rotateZ(90deg);
  496. }
  497. 50% {
  498. transform: rotateZ(180deg);
  499. }
  500. 75% {
  501. transform: rotateZ(270deg);
  502. }
  503. 100% {
  504. transform: rotateZ(360deg);
  505. }
  506. }
  507. .device-online-data {
  508. position: absolute;
  509. text-align: center;
  510. margin-top: 5px;
  511. .icon-Photovoltaic-pv {
  512. font-size: 46px;
  513. color: #1b99ff;
  514. }
  515. .online-data {
  516. font-family: Bicubik;
  517. font-size: 15px;
  518. color: #fff;
  519. width: 90px;
  520. }
  521. }
  522. }</style>
  523. <style>
  524. @keyframes fadein {
  525. from{
  526. opacity: 0;
  527. }
  528. to{
  529. opacity: 1;
  530. }
  531. }
  532. @keyframes fadeout {
  533. from{
  534. opacity: 1;
  535. }
  536. to{
  537. opacity: 0;
  538. }
  539. }
  540. .fadeIn {
  541. animation-name: fadein;
  542. animation-duration: 0.5s;
  543. animation-timing-function: ease-in-out;
  544. animation-fill-mode: forwards;
  545. }
  546. .fadeOut {
  547. animation-name: fadeout;
  548. animation-duration: 0.5s;
  549. animation-timing-function: ease-in-out;
  550. animation-fill-mode: forwards;
  551. }</style>