allMatrices.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  1. <template>
  2. <el-dialog width="70%" @open="opened" @closed="closed" :fullscreen="true" :show-close="true" class="dialogs">
  3. <template #title>
  4. <div class="showTitles currentShowTitles">
  5. <div class="titles">风机矩阵</div>
  6. </div>
  7. </template>
  8. <div class="body" @contextmenu="contextmenu">
  9. <div class="titleList">
  10. <div class="title">
  11. <div :class="current === item.id ? 'title-onItem' : 'title-item'" v-for="(item, index) in stationList"
  12. :key="index" @click="handleChange(item.id)">
  13. {{ item.name }}
  14. </div>
  15. </div>
  16. <div class="infoMsg">
  17. <div class="infoTitle">
  18. <span>欠发电量</span>
  19. </div>
  20. <div v-for="item in showpieColor" :key="item.name" class="infoMainCV">
  21. <span class="colorLine" :style="{'background': item.value}"></span>
  22. <span class="colorValue">{{item.name}}</span>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="content">
  27. <box-select node=".box" @selectList="selectList">
  28. <div class="windStation" v-for="(item, index) in stationArr" :key="index">
  29. <div class="stationTitle" v-if="item[0].stationId">
  30. <div class="stationName">
  31. {{getStationName(item)}}
  32. </div>
  33. <div class="num">
  34. <div class="jrts">接入台数</div>
  35. <!-- <div class="jrts_num">{{ item.length }}</div> -->
  36. <div class="jrts_num">{{ getStatus(item, 'jr') }}</div>
  37. </div>
  38. <div class="num">
  39. <div class="djts">待机台数</div>
  40. <div class="djts_num">
  41. <!-- {{ item.filter((val) => val.status === 2)?.length }} -->
  42. <div class="jrts_num">{{ getStatus(item, 'dj') }}</div>
  43. </div>
  44. </div>
  45. <div class="num">
  46. <div class="bwts">并网台数</div>
  47. <div class="bwts_num">
  48. <!-- {{ item.filter((val) => val.status === 4)?.length }} -->
  49. <div class="jrts_num">{{ getStatus(item, 'bw') }}</div>
  50. </div>
  51. </div>
  52. <div class="num">
  53. <div class="gzts">故障台数</div>
  54. <div class="gzts_num">
  55. <!-- {{ item.filter((val) => val.status === 5)?.length }} -->
  56. <div class="jrts_num">{{ getStatus(item, 'gz') }}</div>
  57. </div>
  58. </div>
  59. <div class="num">
  60. <div class="jxts">检修台数</div>
  61. <div class="jxts_num">
  62. <!-- {{ item.filter((val) => val.status === 6)?.length }} -->
  63. <div class="jrts_num">{{ getStatus(item, 'jx') }}</div>
  64. </div>
  65. </div>
  66. <div class="num">
  67. <div class="lxts">离线台数</div>
  68. <div class="lxts_num">
  69. <!-- {{ item.filter((val) => val.status === 7)?.length }} -->
  70. <div class="jrts_num">{{ getStatus(item, 'lx') }}</div>
  71. </div>
  72. </div>
  73. <div class="stationInfo">
  74. <div class="name">实时功率</div>
  75. <div class="nums">
  76. <!-- {{
  77. $store.state.titleInfo.stationOverviewInfos[
  78. item[0].stationId
  79. ]?.realTimePower?.value.toFixed(2)
  80. }}MW -->
  81. {{getseeting($store.state.titleInfo.stationOverviewInfos, item[0], 'power')}}MW
  82. </div>
  83. </div>
  84. <div class="stationInfo">
  85. <div class="name">平均风速</div>
  86. <div class="nums">
  87. <!-- {{
  88. $store.state.titleInfo.stationOverviewInfos[
  89. item[0].stationId
  90. ]?.averageWindSpeed?.value.toFixed(2)
  91. }}m/s -->
  92. {{getseeting($store.state.titleInfo.stationOverviewInfos, item[0], 'wind')}}m/s
  93. </div>
  94. </div>
  95. </div>
  96. <div class="stationTitle" v-else>
  97. <div class="stationName">
  98. {{getStationName(item)}}
  99. </div>
  100. <div class="num">
  101. <div class="jrts">接入台数</div>
  102. <!-- <div class="jrts_num">{{ item.length }}</div> -->
  103. <div class="jrts_num">{{ getStatus(item, 'jr') }}</div>
  104. </div>
  105. <div class="num">
  106. <div class="djts">待机台数</div>
  107. <div class="djts_num">
  108. <!-- {{ item.filter((val) => val.status === 2)?.length }} -->
  109. <div class="jrts_num">{{ getStatus(item, 'dj') }}</div>
  110. </div>
  111. </div>
  112. <div class="num">
  113. <div class="bwts">并网台数</div>
  114. <div class="bwts_num">
  115. <!-- {{ item.filter((val) => val.status === 4)?.length }} -->
  116. <div class="jrts_num">{{ getStatus(item, 'bw') }}</div>
  117. </div>
  118. </div>
  119. <div class="num">
  120. <div class="gzts">故障台数</div>
  121. <div class="gzts_num">
  122. <!-- {{ item.filter((val) => val.status === 5)?.length }} -->
  123. <div class="jrts_num">{{ getStatus(item, 'gz') }}</div>
  124. </div>
  125. </div>
  126. <div class="num">
  127. <div class="jxts">离线台数</div>
  128. <div class="jxts_num">
  129. <!-- {{ item.filter((val) => val.status === 6)?.length }} -->
  130. <div class="jrts_num">{{ getStatus(item, 'lx') }}</div>
  131. </div>
  132. </div>
  133. <div class="num">
  134. <div class="lxts">维护台数</div>
  135. <div class="lxts_num">
  136. <!-- {{ item.filter((val) => val.status === 7)?.length }} -->
  137. <div class="jrts_num">{{ getStatus(item, 'wh') }}</div>
  138. </div>
  139. </div>
  140. <div class="num">
  141. <div class="gzts">限电台数</div>
  142. <div class="gzts_num">
  143. <!-- {{ item.filter((val) => val.status === 7)?.length }} -->
  144. <div class="jrts_num">{{ getStatus(item, 'xd') }}</div>
  145. </div>
  146. </div>
  147. <div class="num">
  148. <div class="gzts">限电停机台数</div>
  149. <div class="gzts_num">
  150. <!-- {{ item.filter((val) => val.status === 5)?.length }} -->
  151. <div class="jrts_num">{{ getStatus(item, 'xdtj') }}</div>
  152. </div>
  153. </div>
  154. <div class="num">
  155. <div class="lxts">未知台数</div>
  156. <div class="lxts_num">
  157. <!-- {{ item.filter((val) => val.status === 6)?.length }} -->
  158. <div class="jrts_num">{{ getStatus(item, 'wz') }}</div>
  159. </div>
  160. </div>
  161. <div class="stationInfo">
  162. <div class="name">实时功率</div>
  163. <div class="nums">
  164. <!-- {{
  165. $store.state.titleInfo.stationOverviewInfos[
  166. item[0].stationId
  167. ]?.realTimePower?.value.toFixed(2)
  168. }}MW -->
  169. {{getseeting($store.state.titleInfo.stationOverviewInfos, item[0], 'power')}}MW
  170. </div>
  171. </div>
  172. <div class="stationInfo">
  173. <div class="name">日照强度</div>
  174. <div class="nums">
  175. <!-- {{
  176. $store.state.titleInfo.stationOverviewInfos[
  177. item[0].stationId
  178. ]?.averageWindSpeed?.value.toFixed(2)
  179. }}m/s -->
  180. {{getseeting($store.state.titleInfo.stationOverviewInfos, 'wind')}}m/s
  181. </div>
  182. </div>
  183. </div>
  184. <div class="block" v-if="showWh(item)">
  185. <UnpaidMatrixBlock @on-click="handleDetial" @choose-click="handleClick" :dataList="item">
  186. </UnpaidMatrixBlock>
  187. </div>
  188. <div class="block" v-else>
  189. <UnpaidMatrixBlockPv @on-click="handleDetialPv" @choose-click="handleClickPv" :dataList="item">
  190. </UnpaidMatrixBlockPv>
  191. </div>
  192. </div>
  193. </box-select>
  194. </div>
  195. </div>
  196. <WindturbineDetailPages v-model="dialogVisible" @close="handleClose" :windturbine="currentWindturbine">
  197. </WindturbineDetailPages>
  198. <PvDetailPages v-model="dialogPvDia" @close="handleClose" :windturbine="currentWindturbinePv">
  199. </PvDetailPages>
  200. <ParametersContrast :chooseList="chooseList" v-model="parametersDisplay"></ParametersContrast>
  201. </el-dialog>
  202. </template>
  203. <script>
  204. import BackgroundData from "utils/BackgroundData";
  205. import UnpaidMatrixBlock from "components/unpaidMatrixBlock.vue";
  206. import UnpaidMatrixBlockPv from "components/unpaidMatrixBlockPv.vue";
  207. import WindturbineDetailPages from "components/WindturbineDetailPages.vue";
  208. import PvDetailPages from "components/PvDetailPages.vue";
  209. import boxSelect from "components/boxSelect.vue";
  210. import ParametersContrast from "./control/parametersContrast.vue";
  211. import MessageBridge from "../utils/MessageBridge";
  212. import api from "api/index";
  213. export default {
  214. components: {
  215. UnpaidMatrixBlock,
  216. UnpaidMatrixBlockPv,
  217. WindturbineDetailPages,
  218. PvDetailPages,
  219. boxSelect,
  220. ParametersContrast,
  221. },
  222. data() {
  223. return {
  224. current: "all",
  225. windterbin: {},
  226. stationObj: {},
  227. cache: {},
  228. stationArr: [],
  229. dialogVisible: false,
  230. dialogPvDia: false,
  231. currentWindturbine: {},
  232. currentWindturbinePv: {},
  233. chooseList: [],
  234. lockValues: [],
  235. parametersDisplay: false,
  236. intervals: null,
  237. showpieColor: [
  238. {
  239. name: '×5: 0%~5%',
  240. value: '#05bb4c'
  241. },
  242. {
  243. name: '×4: 5%~10%',
  244. value: '#0ec7dc'
  245. },
  246. {
  247. name: '×3: 10%~20%',
  248. value: '#4b55ae'
  249. },
  250. {
  251. name: '×2: 20%~40%',
  252. value: '#e17d24'
  253. },
  254. {
  255. name: '×1: >40%',
  256. value: '#ba3237'
  257. },
  258. ]
  259. };
  260. },
  261. created() {
  262. this.getLocks();
  263. },
  264. mounted() { },
  265. methods: {
  266. showWh(item) {
  267. let show = false
  268. if (item[0].stationId) {
  269. show = true
  270. }
  271. return show
  272. },
  273. getStatus(item, type) {
  274. let num = 0
  275. if (item[0].stationId) {
  276. if (type === 'jr') {
  277. num = item.length
  278. } else if (type === 'dj') {
  279. num = item.filter((val) => val.status === 2)?.length
  280. } else if (type === 'bw') {
  281. num = item.filter((val) => val.status === 4)?.length
  282. } else if (type === 'gz') {
  283. num = item.filter((val) => val.status === 5)?.length
  284. } else if (type === 'jx') {
  285. num = item.filter((val) => val.status === 6)?.length
  286. } else if (type === 'lx') {
  287. num = item.filter((val) => val.status === 7)?.length
  288. }
  289. } else {
  290. if (type === 'jr') {
  291. num = item.length
  292. } else if (type === 'dj') {
  293. num = item.filter((val) => val.status === 0)?.length
  294. } else if (type === 'bw') {
  295. num = item.filter((val) => val.status === 1)?.length
  296. } else if (type === 'gz') {
  297. num = item.filter((val) => val.status === 2)?.length
  298. } else if (type === 'lx') {
  299. num = item.filter((val) => val.status === 3)?.length
  300. } else if (type === 'wh') {
  301. num = item.filter((val) => val.status === 4)?.length
  302. } else if (type === 'xd') {
  303. num = item.filter((val) => val.status === 5)?.length
  304. } else if (type === 'xdtj') {
  305. num = item.filter((val) => val.status === 6)?.length
  306. } else if (type === 'wz') {
  307. num = item.filter((val) => val.status === -1)?.length
  308. }
  309. }
  310. return num
  311. },
  312. getStationName(item) {
  313. let name = ''
  314. if (item[0]) {
  315. this.stationList.forEach(val =>{
  316. if (item[0].stationId) {
  317. if (item[0].stationId === val.id) {
  318. name = val.name
  319. }
  320. } else if (item[0].station) {
  321. if (item[0].station === val.id) {
  322. name = val.name
  323. }
  324. }
  325. })
  326. }
  327. return name
  328. },
  329. getseeting(arr, item, type) {
  330. let num = ''
  331. if (arr[item.stationId]) {
  332. if (arr[item.stationId].realTimePower) {
  333. if (type === 'power') {
  334. num = arr[item.stationId].realTimePower.value.toFixed(2)
  335. } else {
  336. num = arr[item.stationId].averageWindSpeed.value.toFixed(2)
  337. }
  338. }
  339. }
  340. return num
  341. },
  342. opened() {
  343. let stationList = [
  344. {
  345. id: "all",
  346. name: "全部",
  347. },
  348. ];
  349. let stations = this.$store.state.stationList;
  350. stations.forEach((item) => {
  351. if (item.id.indexOf("FDC") != -1 || item.id.indexOf("GDC") != -1) {
  352. stationList.push(item);
  353. this.stationObj[item.id] = [];
  354. }
  355. });
  356. this.stationList = stationList;
  357. this.handleWindturbineChange();
  358. // this.intervals = setInterval(this.handleWindturbineChange, 3000);
  359. },
  360. closed() {
  361. this.chooseList = [];
  362. clearInterval(this.intervals);
  363. this.intervals = null;
  364. },
  365. handleChange(val) {
  366. let stationArr = [];
  367. this.current = val;
  368. let stationObj = {};
  369. let stations = this.$store.state.stationList;
  370. stations.forEach((item) => {
  371. if (val === "all") {
  372. if (item.id.indexOf("FDC") != -1 || item.id.indexOf("GDC") != -1) {
  373. stationObj[item.id] = [];
  374. }
  375. } else if (item.id === val) {
  376. stationObj[item.id] = [];
  377. }
  378. });
  379. if (val === "all") {
  380. stationObj = this.cache;
  381. } else {
  382. stationObj[val] = this.cache[val];
  383. }
  384. let list = Object.keys(stationObj).sort();
  385. for (const id of list) {
  386. stationArr.push(stationObj[id]);
  387. }
  388. this.stationObj = stationObj;
  389. this.stationArr = stationArr;
  390. },
  391. //风场回调
  392. handleDetial(itm) {
  393. this.dialogVisible = true;
  394. this.currentWindturbine = itm;
  395. },
  396. handleClick(values) {
  397. if (values.active) {
  398. let showIndex = null;
  399. this.chooseList.forEach((item, index) => {
  400. if (item.windturbineId === values.windturbineId) {
  401. showIndex = index;
  402. }
  403. });
  404. this.chooseList.splice(showIndex, 1);
  405. } else {
  406. this.chooseList.push(values);
  407. }
  408. this.stationArr.forEach((item) => {
  409. item.forEach((val) => {
  410. if (val.windturbineId === values.windturbineId) {
  411. val.active = !val.active;
  412. }
  413. });
  414. });
  415. },
  416. handleClose() {
  417. this.dialogVisible = false;
  418. this.getLocks();
  419. },
  420. //光伏回调
  421. handleDetialPv(item) {
  422. this.dialogPvDia = true;
  423. this.currentWindturbinePv = item;
  424. console.log('item', item)
  425. },
  426. handleClickPv(values) {
  427. if (values.active) {
  428. let showIndex = null;
  429. this.chooseList.forEach((item, index) => {
  430. if (item.windturbineId === values.windturbineId) {
  431. showIndex = index;
  432. }
  433. });
  434. this.chooseList.splice(showIndex, 1);
  435. } else {
  436. this.chooseList.push(values);
  437. }
  438. this.stationArr.forEach((item) => {
  439. item.forEach((val) => {
  440. if (val.id === values.id) {
  441. val.active = !val.active;
  442. }
  443. });
  444. });
  445. },
  446. handleClosePv() {
  447. this.dialogPvDia = false;
  448. },
  449. selectList(val) {
  450. val.forEach((item) => {
  451. this.handleClick(this.windterbin[item.id]);
  452. });
  453. },
  454. getLocks() {
  455. api.getCustomerLock().then((res) => {
  456. if (res) {
  457. this.lockValues = res.data;
  458. }
  459. });
  460. },
  461. /* 右键菜单 */
  462. contextmenu() {
  463. const remote = require("electron").remote;
  464. let that = this;
  465. let menuTemplate = [];
  466. menuTemplate = [
  467. {
  468. label: "启动",
  469. click() {
  470. that.sendCommand({ controlType: "1", deviceType: "Manual" });
  471. },
  472. },
  473. {
  474. label: "停机",
  475. click() {
  476. that.sendCommand({ controlType: "2", deviceType: "Manual" });
  477. },
  478. },
  479. {
  480. label: "复位",
  481. click() {
  482. that.sendCommand({ controlType: "5", deviceType: "Manual" });
  483. },
  484. },
  485. {
  486. label: "维护",
  487. click() {
  488. that.sendCommand({ controlType: "6", deviceType: "Manual" });
  489. },
  490. },
  491. {
  492. label: "取消维护",
  493. click() {
  494. that.sendCommand({ controlType: "8", deviceType: "Manual" });
  495. },
  496. },
  497. {
  498. label: "挂牌",
  499. submenu: [
  500. {
  501. label: "检修",
  502. click() {
  503. that.sendLock({ value: "CheckLock" });
  504. },
  505. },
  506. {
  507. label: "故障维修",
  508. click() {
  509. that.sendLock({ value: "FaultLock" });
  510. },
  511. },
  512. {
  513. label: "场内受累检修",
  514. click() {
  515. that.sendLock({ value: "StationCheckLock" });
  516. },
  517. },
  518. {
  519. label: "场内受累故障",
  520. click() {
  521. that.sendLock({ value: "StationFaulLock" });
  522. },
  523. },
  524. {
  525. label: "场外受累电网",
  526. click() {
  527. that.sendLock({ value: "StationPowerLineLock" });
  528. },
  529. },
  530. {
  531. label: "场外受累天气",
  532. click() {
  533. that.sendLock({ value: "StationWeatherLock" });
  534. },
  535. },
  536. ],
  537. },
  538. {
  539. label: "取消挂牌",
  540. click() {
  541. that.sendLock({ value: "UnLock" });
  542. },
  543. },
  544. {
  545. label: "参数对比",
  546. click() {
  547. that.parametersContrast();
  548. },
  549. },
  550. ];
  551. const menu = remote.Menu.buildFromTemplate(menuTemplate);
  552. menu.popup(remote.getCurrentWindow());
  553. },
  554. sendCommand(msg, windturbine) {
  555. let bd = BackgroundData.getInstance();
  556. if (!bd.LoginUser) {
  557. this.$notify({
  558. title: "请登录",
  559. message: "控制风机需要先登录!",
  560. type: "warning",
  561. position: "bottom-right",
  562. offset: 60,
  563. duration: 3000,
  564. });
  565. return;
  566. }
  567. let sendList = [];
  568. if (windturbine) {
  569. sendList = windturbine;
  570. } else {
  571. this.chooseList.forEach((item) => {
  572. item.controlType = Number(msg.controlType);
  573. });
  574. sendList = this.chooseList;
  575. }
  576. if (sendList.length > 0) {
  577. bd.checkout(sendList);
  578. this.chooseList = [];
  579. let pairs = {};
  580. sendList.forEach((item) => {
  581. let ct = {
  582. windturbineId: item.windturbineId,
  583. stationId: item.stationId,
  584. projectId: item.projectId,
  585. modelId: item.modelId,
  586. controlType: item.controlType,
  587. lockType: item.lockType,
  588. userName: `system_${bd.LoginUser.name}`,
  589. userId: 0,
  590. auto: false,
  591. deviceType: msg.deviceType,
  592. };
  593. pairs[ct.windturbineId] = ct;
  594. });
  595. api.windturbControl(pairs).then((res) => {
  596. if (res) {
  597. this.controlSuccess(res);
  598. }
  599. });
  600. }
  601. },
  602. sendLock(msg, windturbine) {
  603. let bd = BackgroundData.getInstance();
  604. if (!bd.LoginUser) {
  605. this.$notify({
  606. title: "请登录",
  607. message: "控制风机需要先登录!",
  608. type: "warning",
  609. position: "bottom-right",
  610. offset: 60,
  611. duration: 3000,
  612. });
  613. return;
  614. }
  615. let sendList = [];
  616. if (windturbine) {
  617. windturbine.lockType = msg.value;
  618. sendList.push(windturbine);
  619. } else {
  620. this.chooseList.forEach((item) => {
  621. item.lockType = msg.value;
  622. });
  623. sendList = this.chooseList;
  624. }
  625. if (sendList.length > 0) {
  626. this.chooseList = [];
  627. let pairs = {};
  628. sendList.forEach((item) => {
  629. let ct = {
  630. windturbineId: item.windturbineId,
  631. stationId: item.stationId,
  632. projectId: item.projectId,
  633. modelId: item.modelId,
  634. controlType: item.controlType,
  635. lockType: item.lockType,
  636. userName: `system_${bd.LoginUser.name}`,
  637. userId: 0,
  638. };
  639. pairs[ct.windturbineId] = ct;
  640. });
  641. api.windturbControlLock(pairs).then((res) => {
  642. if (res) {
  643. this.controlSuccess(res);
  644. }
  645. });
  646. }
  647. },
  648. /* 控制成功 */
  649. controlSuccess(msg) {
  650. let bd = BackgroundData.getInstance();
  651. for (let id in msg.data) {
  652. let val = msg.data[id];
  653. if (val.errorCode !== "0") {
  654. bd.removeCheckouts(val);
  655. }
  656. }
  657. let mss = ""; // 信息
  658. let iserror = false; // 是否有控制错误的风机
  659. for (let v in msg.data) {
  660. let val = msg.data[v];
  661. if (val.errorCode > 0) {
  662. iserror = true;
  663. mss += `${val.windturbineId} ${this.controlErorCodes[val.errorCode]
  664. }\n`;
  665. }
  666. }
  667. let tp = iserror ? "warning" : "success";
  668. // if (!iserror) {
  669. // mss = "控制成功";
  670. // }
  671. this.$notify({
  672. title: "控制",
  673. message: mss,
  674. type: tp,
  675. position: "bottom-right",
  676. offset: 60,
  677. duration: 3000,
  678. });
  679. },
  680. /* 控制失败 */
  681. controlError(err) {
  682. this.$notify({
  683. title: "控制出现错误",
  684. message: err.message,
  685. type: "warning",
  686. position: "bottom-right",
  687. offset: 60,
  688. duration: 3000,
  689. });
  690. },
  691. parametersContrast() {
  692. if (this.chooseList.length > 0) {
  693. this.parametersDisplay = true;
  694. }
  695. },
  696. getPvMsg(msg) {
  697. window.sessionStorage.removeItem('pv')
  698. // let jsonMsg = JSON.parse(msg)
  699. window.sessionStorage.setItem('pv', msg)
  700. this.changeData()
  701. },
  702. getWindMsg(msg) {
  703. window.sessionStorage.removeItem('wind')
  704. // let jsonMsg = JSON.parse(msg)
  705. window.sessionStorage.setItem('wind', msg)
  706. this.changeData()
  707. },
  708. changeData() {
  709. let wswind = JSON.parse(window.sessionStorage.getItem('wind'))
  710. let pv = JSON.parse(window.sessionStorage.getItem('pv'))
  711. let msg = {}
  712. if (wswind && pv) {
  713. msg = {...wswind, ...pv}
  714. let stationArr = [];
  715. for (const key in this.stationObj) {
  716. this.stationObj[key] = [];
  717. }
  718. this.windterbin = msg;
  719. let arr = Object.keys(msg).sort();
  720. for (const id of arr) {
  721. let val = msg[id];
  722. //风机
  723. if (val.stationId) {
  724. if (val.lockValue === 9) {
  725. val.lockValues = this.lockValues.filter(
  726. (item) => val.windturbineId === item.windturbineID
  727. )[0]?.value;
  728. }
  729. this.chooseList.forEach((item) => {
  730. if (item.windturbineId === val.windturbineId) {
  731. val.active = true;
  732. }
  733. });
  734. if (this.current === "all") {
  735. this.stationObj[val.stationId]?.push(val);
  736. } else {
  737. if (this.current === val.stationId) {
  738. this.stationObj[val.stationId]?.push(val);
  739. }
  740. }
  741. }
  742. // 光伏
  743. if(val.station) {
  744. if (this.current === "all") {
  745. this.stationObj[val.station]?.push(val);
  746. } else {
  747. if (this.current === val.station) {
  748. this.stationObj[val.station]?.push(val);
  749. }
  750. }
  751. }
  752. }
  753. this.current === "all" &&
  754. (this.cache = JSON.parse(JSON.stringify(this.stationObj)));
  755. let list = Object.keys(this.stationObj).sort();
  756. for (const id of list) {
  757. stationArr.push(this.stationObj[id]);
  758. }
  759. // this.stationArr = stationArr;
  760. this.stationArr = this.sortStarionArr(stationArr);
  761. }
  762. },
  763. // 按照场站排序
  764. sortStarionArr(arr) {
  765. let newArr = []
  766. for (let i = 0; i<this.stationList.length; i++) {
  767. let item = this.stationList[i]
  768. for (let j = 0; j<arr.length; j++) {
  769. let itn = arr[j]
  770. if (itn[0].stationId && itn[0].stationId === item.id) {
  771. newArr.push(itn)
  772. } else if (itn[0].station && itn[0].station === item.id) {
  773. newArr.push(itn)
  774. }
  775. }
  776. }
  777. return newArr
  778. },
  779. handleWindturbineChange() {
  780. let ws = MessageBridge.getInstance();
  781. let wind = [
  782. { key: "/topic/windturbine", action: this.getWindMsg },
  783. ];
  784. let guangfu = [
  785. { key: "/topic/pv", action: this.getPvMsg },
  786. ];
  787. ws.register(wind);
  788. ws.register(guangfu);
  789. // api.getWindturbine().then((res) => {
  790. // if (res.data) {
  791. // let stationArr = [];
  792. // for (const key in this.stationObj) {
  793. // this.stationObj[key] = [];
  794. // }
  795. // this.windterbin = res.data;
  796. // let arr = Object.keys(res.data).sort();
  797. // for (const id of arr) {
  798. // let val = res.data[id];
  799. // if (val.lockValue === 9) {
  800. // val.lockValues = this.lockValues.filter(
  801. // (item) => val.windturbineId === item.windturbineID
  802. // )[0]?.value;
  803. // }
  804. // this.chooseList.forEach((item) => {
  805. // if (item.windturbineId === val.windturbineId) {
  806. // val.active = true;
  807. // }
  808. // });
  809. // if (this.current === "all") {
  810. // this.stationObj[val.stationId]?.push(val);
  811. // } else {
  812. // if (this.current === val.stationId) {
  813. // this.stationObj[val.stationId]?.push(val);
  814. // }
  815. // }
  816. // }
  817. // this.current === "all" &&
  818. // (this.cache = JSON.parse(JSON.stringify(this.stationObj)));
  819. // let list = Object.keys(this.stationObj).sort();
  820. // for (const id of list) {
  821. // stationArr.push(this.stationObj[id]);
  822. // }
  823. // this.stationArr = stationArr;
  824. // }
  825. // });
  826. },
  827. },
  828. };
  829. </script>
  830. <style lang="less" scoped>
  831. .body {
  832. display: flex;
  833. flex-direction: column;
  834. background-color: #000000;
  835. height: 90vh;
  836. width: 102%;
  837. margin-left: -1%;
  838. margin-top: -40px;
  839. overflow-y: auto;
  840. }
  841. .body::-webkit-scrollbar {
  842. /*隐藏滚轮*/
  843. display: none;
  844. }
  845. .titleList {
  846. display: flex;
  847. flex-direction: row;
  848. align-items: center;
  849. justify-content: space-between;
  850. margin-left: 3vw;
  851. padding-top: 8px;
  852. position: absolute;
  853. width: 96%;
  854. background-color: #000000;
  855. padding-bottom: 10px;
  856. .infoMsg{
  857. display: flex;
  858. border-radius: 10px;
  859. height: 34px;
  860. padding: 0 10px;
  861. margin-right: 20px;
  862. position: relative;
  863. top: 5px;
  864. .infoTitle{
  865. position: relative;
  866. top: 2px;
  867. color: #fff;
  868. font-weight: 600;
  869. padding: 0 10px;
  870. span{
  871. margin-right: 10px;
  872. }
  873. }
  874. .infoMainCV{
  875. .colorLine{
  876. width:25px;
  877. height:14px;
  878. border-radius:3px;
  879. display:inline-block;
  880. margin-top:2px;
  881. position: relative;
  882. top: 3px;
  883. }
  884. .colorValue{
  885. font-size: 12px;
  886. margin: 0 15px 0 5px;
  887. color: #fff;
  888. }
  889. }
  890. .infoMain{
  891. padding: 0 20px;
  892. color: #fff;
  893. .infoMain_top{
  894. display: flex;
  895. justify-content: end;
  896. .whiteBox{
  897. display: inline-block;
  898. width: 15px;
  899. height: 5px;
  900. background: #fff;
  901. position: relative;
  902. top: 5px;
  903. }
  904. .infoMainMsg{
  905. }
  906. }
  907. .infoMain_bot{
  908. position: relative;
  909. top: -3px;
  910. }
  911. }
  912. .item9 {
  913. background-color: rgba(05, 187, 76, 1);
  914. }
  915. .item8 {
  916. background-color: #0ec7dc;
  917. }
  918. .item7 {
  919. background-color: rgba(75, 85, 174, 1);
  920. }
  921. .item6 {
  922. background-color: rgba(225, 125, 36, 1);
  923. }
  924. .item5 {
  925. background-color: rgba(186, 50, 55, 1);
  926. }
  927. }
  928. }
  929. .title {
  930. display: flex;
  931. flex-direction: row;
  932. align-items: center;
  933. .title-item {
  934. background-color: #242424;
  935. border-radius: 4px;
  936. padding: 8px 27px 7px 25px;
  937. font-size: 14px;
  938. color: #b4bdc0;
  939. margin-right: 10px;
  940. }
  941. .title-onItem {
  942. background-color: rgba(37, 116, 219, 1);
  943. border-radius: 4px;
  944. padding: 8px 27px 7px 25px;
  945. font-size: 14px;
  946. color: #b4bdc0;
  947. margin-right: 10px;
  948. }
  949. }
  950. .content {
  951. display: flex;
  952. flex-direction: column;
  953. margin-top: 50px;
  954. }
  955. .block {
  956. padding-left: 10px;
  957. }
  958. .windStation {
  959. display: flex;
  960. flex-direction: column;
  961. background-color: #242424;
  962. border-radius: 4px;
  963. width: 95%;
  964. margin-left: 3vw;
  965. padding-bottom: 20px;
  966. padding-left: 10px;
  967. margin-bottom: 20px;
  968. .stationTitle {
  969. display: flex;
  970. flex-direction: row;
  971. // align-items: center;
  972. margin-top: 10px;
  973. .stationName {
  974. font-size: 14px;
  975. margin-left: 10px;
  976. color: #b4bdc0;
  977. }
  978. .num {
  979. display: flex;
  980. flex-direction: row;
  981. align-items: center;
  982. justify-content: space-between;
  983. margin-left: 25px;
  984. width: 90px;
  985. .jrts {
  986. font-size: 12px;
  987. color: #606769;
  988. }
  989. .jrts_num {
  990. font-size: 16px;
  991. color: #ffffff;
  992. }
  993. .djts {
  994. font-size: 12px;
  995. color: #05bb4c;
  996. }
  997. .djts_num {
  998. font-size: 16px;
  999. color: #05bb4c;
  1000. }
  1001. .bwts {
  1002. font-size: 12px;
  1003. color: #4b55ae;
  1004. }
  1005. .bwts_num {
  1006. font-size: 16px;
  1007. color: #4b55ae;
  1008. }
  1009. .gzts {
  1010. font-size: 12px;
  1011. color: #ba3237;
  1012. }
  1013. .gzts_num {
  1014. font-size: 16px;
  1015. color: #ba3237;
  1016. }
  1017. .jxts {
  1018. font-size: 12px;
  1019. color: #e17d24;
  1020. }
  1021. .jxts_num {
  1022. font-size: 16px;
  1023. color: #e17d24;
  1024. }
  1025. .lxts {
  1026. font-size: 12px;
  1027. color: #606769;
  1028. }
  1029. .lxts_num {
  1030. font-size: 16px;
  1031. color: #606769;
  1032. }
  1033. }
  1034. }
  1035. .stationInfo {
  1036. display: flex;
  1037. flex-direction: row;
  1038. align-items: center;
  1039. margin-left: 30px;
  1040. font-size: 16px;
  1041. .name {
  1042. color: #ffffff;
  1043. margin-right: 25px;
  1044. }
  1045. .nums {
  1046. color: #05bb4c;
  1047. }
  1048. }
  1049. }
  1050. .item2 {
  1051. flex: 1;
  1052. display: flex;
  1053. width: 20%;
  1054. flex-wrap: wrap;
  1055. .name {
  1056. color: #fff;
  1057. width: 50%;
  1058. text-align: center;
  1059. }
  1060. .num2 {
  1061. width: 50%;
  1062. color: #fff;
  1063. text-align: left;
  1064. }
  1065. .num1 {
  1066. width: 50%;
  1067. color: #fff;
  1068. text-align: center;
  1069. position: relative;
  1070. &::after {
  1071. content: "";
  1072. position: absolute;
  1073. width: 1.481vh;
  1074. height: 0.556vh;
  1075. background-color: #fff;
  1076. left: 1.204vh;
  1077. top: 0.741vh;
  1078. }
  1079. }
  1080. .num3 {
  1081. width: 50%;
  1082. color: #fff;
  1083. text-align: left;
  1084. }
  1085. }
  1086. </style>