WindturbineDetailPages.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <el-dialog
  3. width="80%"
  4. @opened="opened()"
  5. @closed="closed()"
  6. :show-close="false"
  7. class="my-info-dialog"
  8. >
  9. <template #title>
  10. <div style="margin-top: -10px; color: #ffffff">风机详情</div>
  11. </template>
  12. <div class="body">
  13. <div class="titleList">
  14. <div class="chunkdiv" @click="handleClick(true)">
  15. <div class="title">风机号:&emsp;</div>
  16. <div>{{ windturbine.windturbineId }}</div>
  17. <!-- <div>
  18. {{ windturbine.stationId.slice(0, 2) }}-{{ windturbine.code }}
  19. </div> -->
  20. </div>
  21. <div
  22. class="chunkdiv"
  23. @click="handleClick(true)"
  24. @dblclick="dbClicks(baseDate.windSpeed)"
  25. >
  26. <div class="title">{{ baseDate.windSpeed.name }}:&emsp;</div>
  27. <div>{{ baseDate.windSpeed.value }}{{ baseDate.windSpeed.unit }}</div>
  28. </div>
  29. <div
  30. class="chunkdiv"
  31. @click="handleClick(true)"
  32. @dblclick="dbClicks({ code: 'YDPJFS5M', name: '五分钟平均风速' })"
  33. >
  34. <div class="title">五分钟平均风速:&emsp;</div>
  35. <div>{{ healthInfo?.averageWindSpeed5?.toFixed(2) }}m/s</div>
  36. </div>
  37. <div
  38. class="chunkdiv"
  39. @click="handleClick(true)"
  40. @dblclick="dbClicks(theoreticalPower)"
  41. >
  42. <div class="title">理论功率:&emsp;</div>
  43. <div>{{ healthInfo?.theoreticalPower?.toFixed(2) }}Kw</div>
  44. </div>
  45. <div
  46. class="chunkdiv"
  47. @click="handleClick(true)"
  48. @dblclick="dbClicks(baseDate.power)"
  49. >
  50. <div class="title">{{ baseDate.power.name }}:&emsp;</div>
  51. <div>{{ baseDate.power.value }}{{ baseDate.power.unit }}</div>
  52. </div>
  53. <div
  54. class="chunkdiv"
  55. @click="handleClick(true)"
  56. @dblclick="dbClicks(baseDate.generatorSpeed)"
  57. >
  58. <div class="title">{{ baseDate.generatorSpeed.name }}:&emsp;</div>
  59. <div>
  60. {{ baseDate.generatorSpeed.value
  61. }}{{ baseDate.generatorSpeed.unit }}
  62. </div>
  63. </div>
  64. <div class="chunkdiv" @click="handleClick(false)">
  65. <div class="title">故障信息: &emsp;{{ faultNum }}</div>
  66. </div>
  67. </div>
  68. <BasicInformationDetail
  69. v-show="current"
  70. ref="BasicInfo"
  71. :types="types"
  72. @health-click="handleHealth"
  73. :windturbine="windturbine"
  74. ></BasicInformationDetail>
  75. <div class="faultInfo" v-show="!current">
  76. <div class="left-item">
  77. <div
  78. :class="item.openedCount > 0 ? 'faultNameErr' : 'faultName'"
  79. v-for="(item, index) in fault"
  80. :key="index"
  81. @click="handleFaultClick(index)"
  82. >
  83. {{ item.component }}
  84. <div class="faultNum" v-if="item.openedCount > 0">
  85. ({{ item.openedCount }})
  86. </div>
  87. </div>
  88. </div>
  89. <div class="right-item">
  90. <div class="tables">
  91. <el-table
  92. :data="faultList"
  93. class="table"
  94. style="width: 100%"
  95. height="67vh"
  96. stripe
  97. highlight-current-row
  98. :header-cell-style="{
  99. background: 'rgb(30,30,30)',
  100. color: 'rgb(220,220,220)',
  101. padding: '4px',
  102. fontSize: '14px',
  103. 'border-bottom': 'solid 1px rgba(77, 77, 77, 1)',
  104. }"
  105. :cell-style="tableCellStyle"
  106. >
  107. <el-table-column
  108. prop="id"
  109. label="报警编号"
  110. width="200"
  111. align="center"
  112. >
  113. </el-table-column>
  114. <el-table-column
  115. prop="modelId"
  116. label="风机型号"
  117. width="150"
  118. align="center"
  119. >
  120. </el-table-column>
  121. <el-table-column prop="alertText" label="报警信息" align="center">
  122. </el-table-column>
  123. <el-table-column label="故障状态" width="120" align="center">
  124. <template #default="scope">
  125. <span>
  126. {{ scope.row.isOpened > 0 ? "故障" : "正常" }}
  127. </span>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </el-dialog>
  136. </template>
  137. <script>
  138. import api from "api/index";
  139. import BasicInformationDetail from "./BasicInformationDetail.vue";
  140. import BackgroundData from "utils/BackgroundData";
  141. import Fault from "utils/fault";
  142. export default {
  143. components: {
  144. BasicInformationDetail,
  145. },
  146. props: {
  147. windturbine: Object,
  148. },
  149. data() {
  150. return {
  151. current: true,
  152. BasicInfo: {},
  153. healthInfo: {},
  154. line: "",
  155. alarmTime: "",
  156. alarmContent: "",
  157. alarms: [],
  158. count: false,
  159. theoreticalPower: {
  160. code: "LLGL",
  161. name: "理论功率",
  162. },
  163. typeList: [
  164. {
  165. type: 0,
  166. name: "已经停机",
  167. },
  168. {
  169. type: 1,
  170. name: "上电",
  171. },
  172. {
  173. type: 2,
  174. name: "待机",
  175. },
  176. {
  177. type: 3,
  178. name: "启动",
  179. },
  180. {
  181. type: 4,
  182. name: "并网",
  183. },
  184. {
  185. type: 5,
  186. name: "故障",
  187. },
  188. {
  189. type: 6,
  190. name: "维护",
  191. },
  192. {
  193. type: 7,
  194. name: "离线",
  195. },
  196. ],
  197. baseDate: {
  198. windSpeed: {
  199. name: "",
  200. num: "",
  201. unit: "",
  202. },
  203. power: {
  204. name: "",
  205. num: "",
  206. unit: "",
  207. },
  208. generatorSpeed: {
  209. name: "",
  210. num: "",
  211. unit: "",
  212. },
  213. },
  214. types: null,
  215. fault: {},
  216. refreshTimer: "",
  217. refreshTimers: "",
  218. faultNum: 0,
  219. faultList: [],
  220. // station: [],
  221. };
  222. },
  223. created() {
  224. this.getUniformCodes();
  225. // this.getWindturbineFdc();
  226. },
  227. methods: {
  228. // getWindturbineFdc() {
  229. // api.getWindturbineFdc().then((res) => {
  230. // this.station = res.data;
  231. // });
  232. // },
  233. handleFaultClick(index) {
  234. this.faultList = this.fault[index].alertSnaps;
  235. },
  236. handleClick(val) {
  237. this.current = val;
  238. },
  239. getUniformCodes() {
  240. api.getUniformCodes().then((res) => {
  241. this.UniformCodes = res.data;
  242. });
  243. },
  244. opened() {
  245. this.line = "";
  246. this.alarmTime = "";
  247. this.alarmContent = "";
  248. this.BasicInfo = this.uniformCodesDeal(this.windturbine);
  249. this.BasicInfo.windturbineId = this.windturbine.windturbineId;
  250. // this.dateDeal(this.BasicInfo)
  251. this.$refs.BasicInfo.start(this.BasicInfo);
  252. this.initData();
  253. this.refreshData();
  254. this.refreshTimer = setInterval(this.refreshData, 5000);
  255. },
  256. tableCellStyle({ row, column, rowIndex, columnIndex }) {
  257. let warningColor = false;
  258. let obj = {};
  259. if (row.isOpened > 0) {
  260. warningColor = true;
  261. }
  262. if (warningColor) {
  263. obj = {
  264. height: "40px",
  265. background: "rgb(30,30,30)",
  266. color: "#FF0000",
  267. padding: "3px",
  268. fontSize: "12px",
  269. "border-top": "0px solid #000000",
  270. "border-bottom": "1px solid #000000",
  271. "border-right": "1px solid #000000",
  272. };
  273. } else {
  274. obj = {
  275. height: "40px",
  276. background: "rgb(30,30,30)",
  277. color: "rgb(220,220,220)",
  278. padding: "3px",
  279. fontSize: "12px",
  280. "border-top": "0px solid #000000",
  281. "border-bottom": "1px solid #000000",
  282. "border-right": "1px solid #000000",
  283. };
  284. }
  285. return obj;
  286. },
  287. uniformCodesDeal(windturbine) {
  288. let val = this.UniformCodes[windturbine.stationId][windturbine.modelId];
  289. let codes = "";
  290. val.forEach((element) => {
  291. element.param.forEach((itm) => {
  292. codes += itm.code + ",";
  293. });
  294. });
  295. val.codes = codes;
  296. return val;
  297. },
  298. closed() {
  299. this.$refs.BasicInfo.end();
  300. this.$emit("close");
  301. clearInterval(this.refreshTimer);
  302. clearInterval(this.refreshTimers);
  303. this.refreshTimers = null;
  304. this.refreshTimer = null;
  305. },
  306. dateDeal(BasicInfo) {
  307. let showInf = {};
  308. showInf = BasicInfo.filter((item) => item.tag === "基本信息")[0];
  309. this.baseDate.windSpeed = showInf.param.filter(
  310. (item) => item.name === "风速"
  311. )[0];
  312. this.baseDate.power = showInf.param.filter(
  313. (item) => item.name === "有功功率"
  314. )[0];
  315. this.baseDate.generatorSpeed = showInf.param.filter(
  316. (item) => item.name === "发电机转速"
  317. )[0];
  318. this.baseDate.type = showInf.param.filter(
  319. (item) => item.name === "状态"
  320. )[0].value
  321. ? this.typeList.filter(
  322. (status) =>
  323. status.type ===
  324. Number(
  325. showInf.param.filter((item) => item.name === "状态")[0].value
  326. )
  327. )[0].name
  328. : "";
  329. this.types = Number(
  330. showInf.param.filter((item) => item.name === "状态")[0].value
  331. );
  332. },
  333. refreshData() {
  334. let bg = BackgroundData.getInstance();
  335. bg.initWinturbineBaseData(this.BasicInfo, this.onMessage);
  336. this.dateDeal(this.BasicInfo);
  337. // clearInterval(this.refreshTimer);
  338. // this.refreshTimers = setInterval(this.refreshData, 5000);
  339. },
  340. initData() {
  341. api
  342. .getWindWarning(this.windturbine.windturbineId, "1", "50")
  343. .then((msg) => {
  344. let vs = msg.data;
  345. if (vs.length <= 0) return;
  346. this.alarmTime = BackgroundData.getInstance().formatDate(
  347. vs[0].lastUpdateTime
  348. );
  349. this.alarmContent = vs[0].alertText;
  350. this.alarms = msg.data;
  351. this.$refs.BasicInfo.alarmd(this.alarms);
  352. })
  353. .catch((err) => {
  354. console.log(err);
  355. });
  356. api
  357. .alarmSnap({
  358. windturbineId: this.windturbine.windturbineId,
  359. })
  360. .then((res) => {
  361. this.fault = res.data;
  362. this.faultList = res.data[0].alertSnaps;
  363. let faultNum = 0;
  364. this.fault.forEach((item) => {
  365. faultNum = faultNum + item.openedCount;
  366. });
  367. this.faultNum = faultNum;
  368. });
  369. },
  370. dbClicks(value) {
  371. this.$refs.BasicInfo.dbClicks(value, this.windturbine.windturbineId);
  372. },
  373. handleHealth(value) {
  374. this.healthInfo = value;
  375. },
  376. },
  377. watch: {
  378. windturbine: {
  379. handler: function (json) {
  380. if (json) {
  381. this.initData();
  382. }
  383. },
  384. },
  385. },
  386. };
  387. </script>
  388. <style scoped>
  389. .my-info-dialog {
  390. box-shadow: 0px 0px 10px #05bb4c;
  391. }
  392. .body {
  393. background-color: black;
  394. margin-top: -30px;
  395. margin-left: -10px;
  396. margin-right: -10px;
  397. margin-bottom: -30px;
  398. border-bottom: 20px solid rgb(36, 36, 36);
  399. }
  400. .chunkdiv {
  401. display: flex;
  402. flex-direction: row;
  403. justify-content: center;
  404. align-items: center;
  405. width: 17%;
  406. background-color: #363636;
  407. margin: 1px;
  408. padding: 4px 0px;
  409. font-size: 12px;
  410. color: #ffffff;
  411. overflow: hidden;
  412. white-space: nowrap;
  413. }
  414. .title {
  415. font-size: 12px;
  416. color: #b3b3b3;
  417. }
  418. table {
  419. margin-left: 2px;
  420. margin-right: 2px;
  421. }
  422. /* td {
  423. width: 20%;
  424. } */
  425. el-tabs {
  426. background-color: black;
  427. }
  428. .svg {
  429. height: 67vh;
  430. }
  431. .titleList {
  432. display: flex;
  433. flex-direction: row;
  434. align-items: center;
  435. }
  436. .faultInfo {
  437. height: 70vh;
  438. display: flex;
  439. flex-direction: row;
  440. width: 100%;
  441. }
  442. .left-item {
  443. width: 16%;
  444. background-color: #4d4d4d;
  445. display: flex;
  446. flex-direction: column;
  447. padding-top: 20px;
  448. align-items: center;
  449. height: 96%;
  450. overflow-y: auto;
  451. }
  452. .faultName {
  453. font-size: 16px;
  454. color: #ffffff;
  455. margin-bottom: 10px;
  456. }
  457. .faultNameErr {
  458. display: flex;
  459. flex-direction: row;
  460. align-items: baseline;
  461. font-size: 16px;
  462. color: red;
  463. margin-bottom: 15px;
  464. }
  465. .faultNum {
  466. font-size: 12px;
  467. }
  468. .right-item {
  469. width: 83%;
  470. background-color: #4d4d4d;
  471. margin-left: 15px;
  472. height: 96%;
  473. padding-bottom: 20px;
  474. }
  475. .el-table {
  476. background-color: #000000 !important;
  477. }
  478. .el-table__body-wrapper::-webkit-scrollbar {
  479. width: 8px !important;
  480. height: 0px !important;
  481. background-color: black !important;
  482. }
  483. .el-table__body-wrapper::-webkit-scrollbar-thumb {
  484. background-color: #292929 !important;
  485. border-radius: 6px !important;
  486. }
  487. .tables {
  488. width: 98%;
  489. margin: 1%;
  490. }
  491. </style>