index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. <template>
  2. <div class="windTurbineMonitor">
  3. <div class="title">
  4. <div class="station">
  5. 机型:
  6. <el-select v-model="windModel" @change="changeModel">
  7. <el-option v-for="item in windModelSList" :key="item.value" :label="item.label" :value="item.value">
  8. </el-option>
  9. </el-select>
  10. </div>
  11. <div class="station">
  12. 风机:
  13. <el-select v-model="windSObj" clearable @clear="checkAllWind = false" collapse-tags multiple>
  14. <el-option label="全选" :class="{ selected: checkAllWind }" @click="funCheckwindsAll"></el-option>
  15. <el-option v-for="item in windSList" :key="item.aname" :label="item.aname" :value="item.aname">
  16. </el-option>
  17. </el-select>
  18. </div>
  19. <div class="station">
  20. 日期
  21. <div class="search-input">
  22. <el-date-picker
  23. v-model="dateTime"
  24. size="mini"
  25. type="datetime"
  26. format="YYYY/MM/DD HH:mm:ss"
  27. >
  28. </el-date-picker>
  29. </div>
  30. </div>
  31. <el-button round size="mini" class="searchColor" @click="funGetTableData"
  32. >搜 索</el-button
  33. >
  34. </div>
  35. <div class="data-bodys">
  36. <div class="line clearfix">
  37. <div class="leftContent left"><span>风机数据查询</span></div>
  38. </div>
  39. <div class="economicTable">
  40. <el-table
  41. :data="tableData"
  42. style="width: 100%"
  43. size="mini"
  44. stripe
  45. height="100%"
  46. @cell-click="cellClick"
  47. @header-click="headerClick"
  48. >
  49. <el-table-column
  50. align="center"
  51. prop="code"
  52. label="风机编号"
  53. width="200"
  54. ></el-table-column>
  55. <el-table-column
  56. v-for="(item, index) in tableColumn"
  57. :key="index"
  58. :prop="item.code"
  59. header-align="center"
  60. align="center"
  61. >
  62. <template #header>
  63. <!-- <el-tooltip
  64. class="box-item"
  65. effect="dark"
  66. :content="item.message"
  67. placement="top"
  68. > -->
  69. <div style="padding: 5px 0">
  70. <div style="font-size: 14px">{{item.label}}</div>
  71. <div style="font-size: 16px">{{item.title}}</div>
  72. </div>
  73. <!-- </el-tooltip> -->
  74. </template>
  75. <template #default="scoped">
  76. <span>{{scoped.row[item.code] || "-"}}</span>
  77. </template>
  78. </el-table-column>
  79. </el-table>
  80. </div>
  81. </div>
  82. <el-dialog
  83. v-model="componentsVisible"
  84. width="50%"
  85. custom-class="componentsDia"
  86. destroy-on-close
  87. >
  88. <template #title>
  89. <div class="dialog-title">
  90. <div class="title">测点</div>
  91. </div>
  92. </template>
  93. <div style="height: 100%">
  94. <!-- :componentsData="componentsData" -->
  95. <components-detail
  96. ref="componentsDetail"
  97. :windModel="windModel"
  98. @selectTags="selectTags"
  99. >
  100. </components-detail>
  101. </div>
  102. </el-dialog>
  103. <el-dialog
  104. v-model="dialogVisible"
  105. width="100%"
  106. custom-class="historyDetailModel"
  107. destroy-on-close
  108. fullscreen
  109. >
  110. <template #title>
  111. <div class="dialog-title">
  112. <div class="title">{{dialogTitle}}</div>
  113. </div>
  114. </template>
  115. <div style="height: 100%">
  116. <history-detail
  117. ref="windhistoryDetail"
  118. :dateTime="dateTime"
  119. :hiswindVal="hiswindVal"
  120. :hisuniVal="hisuniVal"
  121. :componentsData="componentsData"
  122. >
  123. </history-detail>
  124. </div>
  125. </el-dialog>
  126. </div>
  127. </template>
  128. <script>
  129. import dayjs from "dayjs";
  130. import historyDetail from "./historyDetail.vue";
  131. import componentsDetail from "./componentsDetail.vue";
  132. import { getApiequipmentListByWp2, getComponentsData, getComponentsTableData } from "@/api/monthlyPerformanceAnalysis";
  133. import dataJson from "./dataJson.json";
  134. export default {
  135. name: "windTurbineMonitor",
  136. components: {
  137. historyDetail,
  138. componentsDetail
  139. },
  140. data() {
  141. return {
  142. windSObj: [],
  143. windModel: "WT2000D121H85",
  144. windModelSList: [],
  145. dialogVisible: false,
  146. componentsVisible: false,
  147. windComponent: "",
  148. dialogTitle: "",
  149. checkAllWind: true,
  150. windSList: [],
  151. allwindSList: [],
  152. stationVal: "NX_FGS_HA_FDC_STA",
  153. dateTime: "",
  154. tableData: [],
  155. tableColumn: [],
  156. company: "",
  157. companyOptions: [],
  158. pickerTimer: [],
  159. componentsData: [],
  160. selectComponentsData: [],
  161. hiswindVal: "",
  162. hisuniVal: "",
  163. };
  164. },
  165. watch: {},
  166. filters: {},
  167. computed: {},
  168. created() {
  169. this.windModelSList = [
  170. {
  171. label: "中车",
  172. value: "WT2000D121H85"
  173. },
  174. {
  175. label: "联合动力",
  176. value: "UP2000-130"
  177. }
  178. ]
  179. // this.tableColumn = [
  180. // {
  181. // label: "日平均风速",
  182. // title: "m/s",
  183. // code: "RPJFS",
  184. // message: "区域集控.惠安风场.一期.风机1107.日平均风速"
  185. // },
  186. // {
  187. // label: "IGBT温度1",
  188. // title: "℃",
  189. // code: "AI002",
  190. // message: "区域集控.惠安风场.一期.风机1106.IGBT温度1"
  191. // }
  192. // ]
  193. // this.componentsData = dataJson.data.components
  194. // this.dataChange(dataJson.data.tableData)
  195. this.dateTime = dayjs().format("YYYY-MM-DD HH:mm:ss"),
  196. this.getWindData();
  197. },
  198. methods: {
  199. selectTags(tags) {
  200. this.selectComponentsData = tags
  201. this.tableColumn = []
  202. tags.forEach(it => {
  203. let obj = {
  204. label: it.description,
  205. title: it.unit || "",
  206. code: it.uniformCode,
  207. message: it.code
  208. }
  209. this.tableColumn.push(obj)
  210. })
  211. this.componentsVisible = false
  212. this.funGetTableData()
  213. },
  214. changeModel(val) {
  215. console.log("val===>>", val)
  216. this.windSList = [];
  217. this.allwindSList.forEach(it => {
  218. if (it.modelId === val) {
  219. this.windSList.push(it)
  220. }
  221. })
  222. },
  223. // 获取风机
  224. async getWindData() {
  225. let that = this
  226. that.windSList = [];
  227. let params = {
  228. wpid: that.stationVal,
  229. };
  230. const { data: datas } = await getApiequipmentListByWp2(params);
  231. if (datas.data.length) {
  232. that.allwindSList = datas.data
  233. datas.data.forEach(it => {
  234. if (it.modelId === that.windModel) {
  235. that.windSList.push(it)
  236. }
  237. })
  238. that.windSList.forEach((it, index) => {
  239. if (index < 10) {
  240. this.windSObj.push(it.aname)
  241. }
  242. })
  243. } else {
  244. that.windSList = datas.data;
  245. that.windVal = "";
  246. }
  247. that.funGetComponents();
  248. },
  249. //获取测点
  250. funGetComponents() {
  251. let that = this;
  252. let params = {
  253. modelId: that.windModel,
  254. query: ""
  255. }
  256. getComponentsData(params).then((res) => {
  257. if (res) {
  258. that.componentsData = res
  259. that.selectComponentsData = res.slice(0, 10)
  260. that.selectComponentsData.forEach(it => {
  261. let obj = {
  262. label: it.description,
  263. title: it.unit || "",
  264. code: it.uniformCode
  265. }
  266. this.tableColumn.push(obj)
  267. })
  268. that.funGetTableData()
  269. }
  270. });
  271. },
  272. //获取表格
  273. funGetTableData() {
  274. let that = this;
  275. let uni = []
  276. that.selectComponentsData.forEach((it, index) => {
  277. if (index < 10) {
  278. uni.push(it.uniformCode)
  279. }
  280. })
  281. let params = {
  282. windturbineIds: that.windSObj.join(","),
  283. uniformCodes: uni.join(","),
  284. time: new Date(that.dateTime).getTime() / 1000
  285. }
  286. getComponentsTableData(params).then((res) => {
  287. if (res) {
  288. that.dataChange(res)
  289. }
  290. });
  291. },
  292. dataChange(res) {
  293. if (res) {
  294. let data = []
  295. for(let i in res) {
  296. let obj = {
  297. code: i
  298. }
  299. res[i].forEach(it => {
  300. obj[it.uniformCode] = it.value
  301. })
  302. data.push(obj)
  303. }
  304. this.tableData = data
  305. }
  306. },
  307. cellClick(row, column, cell, event) {
  308. if (column.property !== "code") {
  309. this.dialogVisible = true;
  310. this.dialogTitle = "历史数据查询";
  311. this.hiswindVal = row.code
  312. this.hisuniVal = column.property
  313. }
  314. },
  315. headerClick() {
  316. this.componentsVisible = true
  317. },
  318. funCheckwindsAll() {
  319. this.checkAllWind = !this.checkAllWind;
  320. if (this.checkAllWind) {
  321. this.windSObj = this.windSList.map((o) => o.aname);
  322. } else {
  323. this.windSObj = [];
  324. }
  325. },
  326. },
  327. mounted() {},
  328. beforeUnmount() {},
  329. };
  330. </script>
  331. <style lang="less" scoped>
  332. .title {
  333. display: flex;
  334. flex-direction: row;
  335. align-items: center;
  336. margin-top: 10px;
  337. .station {
  338. display: flex;
  339. flex-direction: row;
  340. align-items: center;
  341. font-size: 14px;
  342. font-family: Microsoft YaHei;
  343. font-weight: 400;
  344. color: #b3b3b3;
  345. margin-left: 10px;
  346. }
  347. .el-date-editor--daterange {
  348. background: transparent;
  349. border: 1px solid #2a374f;
  350. border-radius: 30px;
  351. height: 25px;
  352. .el-range-input {
  353. background: transparent;
  354. color: #fff;
  355. }
  356. .el-range-separator {
  357. width: 10%;
  358. color: #fff;
  359. position: relative;
  360. }
  361. }
  362. .search-input {
  363. margin-left: 10px;
  364. }
  365. .but {
  366. display: flex;
  367. flex-direction: row;
  368. align-content: center;
  369. margin-left: 20px;
  370. }
  371. .buttons {
  372. background-color: rgba(5, 187, 76, 0.2);
  373. border: 1px solid #3b6c53;
  374. color: #b3b3b3;
  375. font-size: 14px;
  376. &:hover {
  377. background-color: rgba(5, 187, 76, 0.5);
  378. color: #ffffff;
  379. }
  380. }
  381. }
  382. .windTurbineMonitor {
  383. height: 100%;
  384. width: 100%;
  385. padding: 0 10px;
  386. padding-bottom: 10px;
  387. .line {
  388. padding-bottom: 5px;
  389. .leftContent {
  390. width: 242px;
  391. height: 41px;
  392. line-height: 41px;
  393. background: url("~@/assets/imgs/title_left_bg.png") no-repeat;
  394. span {
  395. font-size: 16px;
  396. font-family: Microsoft YaHei;
  397. font-weight: 400;
  398. color: #05bb4c;
  399. margin-left: 25px;
  400. }
  401. }
  402. }
  403. .data-bodys {
  404. display: flex;
  405. flex-direction: column;
  406. background-color: rgba(0, 0, 0, 0.45);
  407. border-radius: 5px;
  408. height: calc(100% - 45px);
  409. padding-top: 10px;
  410. .economicTable {
  411. width: 100%;
  412. height: calc(100% - 40px);
  413. }
  414. }
  415. }
  416. .clearfix::after {
  417. content: "";
  418. clear: both;
  419. height: 0;
  420. line-height: 0;
  421. visibility: hidden;
  422. display: block;
  423. }
  424. .clearfix {
  425. zoom: 1;
  426. }
  427. .left {
  428. float: left;
  429. }
  430. .right {
  431. float: right;
  432. }
  433. .searchColor {
  434. background-color: rgba(5, 187, 76, 0.2);
  435. border: 1px solid #3b6c53;
  436. color: #b3b3b3;
  437. font-size: 14px;
  438. margin-left: 10px;
  439. &:hover {
  440. background-color: rgba(5, 187, 76, 0.5);
  441. color: #ffffff;
  442. }
  443. }
  444. </style>
  445. <style lang="less" scoped>
  446. ::v-deep .el-table__body-wrapper {
  447. background: #142446 !important;
  448. }
  449. </style>
  450. <style lang="less">
  451. .el-overlay {
  452. .el-overlay-dialog {
  453. overflow-y: hidden !important;
  454. .componentsDia{
  455. background: #142446 !important;
  456. margin-top: 10vh !important;
  457. .el-dialog__header{
  458. .dialog-title{
  459. padding-left: 20px;
  460. }
  461. }
  462. .el-dialog__body {
  463. padding: 0px 20px !important;
  464. }
  465. }
  466. .historyDetailModel{
  467. overflow-x: hidden !important;
  468. .el-dialog__header{
  469. .dialog-title{
  470. padding-left: 20px;
  471. }
  472. }
  473. }
  474. }
  475. }
  476. </style>