index.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810
  1. <template>
  2. <div class="rateAnalysis" :class="!theme ? 'themeDark' : 'themeLight'">
  3. <div class="rateAnalysisMain">
  4. <div class="main_top">
  5. <p class="topPsty">对风偏差分析</p>
  6. <div class="search-item" style="margin-left: 16px">
  7. <span class="label">场站:</span>
  8. <div class="search-content">
  9. <el-select
  10. v-model="stationId"
  11. style="width: 120px"
  12. clearable
  13. size="mini"
  14. placeholder="全部"
  15. popper-class="select"
  16. @change="getWindturbineList"
  17. >
  18. <el-option
  19. v-for="item in stationList"
  20. :key="item.id"
  21. :value="item.id"
  22. :label="item.name"
  23. ></el-option>
  24. </el-select>
  25. </div>
  26. </div>
  27. <div class="search-item">
  28. <span class="label">机组:</span>
  29. <div class="search-content">
  30. <el-select
  31. v-model="deviceId"
  32. style="width: 120px"
  33. clearable
  34. size="mini"
  35. placeholder="全部"
  36. popper-class="select"
  37. >
  38. <el-option
  39. v-for="item in windturbineList"
  40. :key="item.id"
  41. :value="item.id"
  42. :label="item.aname"
  43. >
  44. </el-option>
  45. </el-select>
  46. </div>
  47. </div>
  48. <div class="search-item">
  49. <span class="label">日期:</span>
  50. <div class="search-content">
  51. <el-date-picker
  52. v-model="dateTime"
  53. size="mini"
  54. type="datetimerange"
  55. range-separator="-"
  56. format="YYYY-MM-DD HH:mm:ss"
  57. value-format="YYYY-MM-DD HH:mm:ss"
  58. start-placeholder="开始"
  59. end-placeholder="结束"
  60. popper-class="date-select"
  61. >
  62. </el-date-picker>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="main">
  67. <!-- <div class="treeDataMain">
  68. <tree-cop
  69. :data="treeData"
  70. @checkChange="funTreeCheckChange"
  71. :show-checkbox="false"
  72. :height="treeHeight"
  73. :currentNodeKey="currentNodeKey"
  74. @currentChange="funCurrentChange"
  75. @refresh="funGetTree"
  76. >
  77. </tree-cop>
  78. </div>
  79. <div class="excelDataMain">
  80. <excel-cop
  81. :checkIds="excelCheckIds"
  82. :showCheckbox="false"
  83. :data="excelList"
  84. :height="excelHeight"
  85. @excelChange="funExcelChange"
  86. @checkChange="funExcelCheckChange"
  87. :theme="theme"
  88. ></excel-cop>
  89. </div> -->
  90. <div class="tableDataMain">
  91. <el-tabs v-model="activeTab">
  92. <el-tab-pane label="图表展示" name="1"> </el-tab-pane>
  93. <!-- <el-tab-pane label="风时" name="3"> </el-tab-pane> -->
  94. <el-tab-pane
  95. :label="`表格数据${
  96. tableData?.length ? ' (' + tableData.length + '个)' : ''
  97. }`"
  98. name="2"
  99. v-if="false"
  100. >
  101. </el-tab-pane>
  102. <el-row v-if="activeTab === '1'" :style="{ height: tableHeight }">
  103. <el-col
  104. :span="12"
  105. v-for="(item, index) in chartData"
  106. :key="item.id"
  107. style="height: 45%"
  108. >
  109. <el-icon
  110. :style="`cursor: pointer; ${!theme ? 'color: #fff' : ''}`"
  111. size="18"
  112. @click="funActCop(item, 'chartCop' + (index + 1))"
  113. v-if="false"
  114. >
  115. <ZoomIn />
  116. </el-icon>
  117. <chart-cop
  118. height="100%"
  119. width="100%"
  120. :xAxis="item.xAxis"
  121. :isRadar="item.isRadar"
  122. :theme="theme"
  123. :echartsTheme="echartsTheme"
  124. :subtext="item.subtext"
  125. :title="item.title"
  126. :series="item.series"
  127. :count="item.count || []"
  128. >
  129. </chart-cop>
  130. </el-col>
  131. <el-col :span="12" v-if="!!lineSeries.length" style="height: 45%">
  132. <el-icon
  133. :style="`cursor: pointer; ${!theme ? 'color: #fff' : ''}`"
  134. size="18"
  135. @click="
  136. funActCop(
  137. {
  138. xAxis: linexAxis,
  139. yAxis: lineyAxis,
  140. series: lineSeries,
  141. dataset: lineDataSet,
  142. },
  143. 'lineChartCop'
  144. )
  145. "
  146. v-if="false"
  147. >
  148. <ZoomIn />
  149. </el-icon>
  150. <line-chart-cop
  151. class=""
  152. height="100%"
  153. width="100%"
  154. :xAxis="linexAxis"
  155. :yAxis="lineyAxis"
  156. :theme="theme"
  157. :echartsTheme="echartsTheme"
  158. :series="lineSeries"
  159. subtext="对风偏差分析图"
  160. :dataset="lineDataSet"
  161. ></line-chart-cop>
  162. </el-col>
  163. <el-col :span="12" v-if="!!lineSeries.length" style="height: 45%">
  164. <el-icon
  165. :style="`cursor: pointer; ${!theme ? 'color: #fff' : ''}`"
  166. size="18"
  167. @click="
  168. funActCop(
  169. {
  170. xAxis: scatterxData,
  171. yAxis: scatteryData,
  172. series: scatterSeries,
  173. },
  174. 'scatterSingleChartCop'
  175. )
  176. "
  177. >
  178. <ZoomIn />
  179. </el-icon>
  180. <scatter-single-chart-cop
  181. class=""
  182. height="95%"
  183. width="100%"
  184. :xAxis="scatterxData"
  185. :theme="theme"
  186. :echartsTheme="echartsTheme"
  187. :yAxis="scatteryData"
  188. :series="scatterSeries"
  189. subtext="静态偏航对风分析图"
  190. >
  191. </scatter-single-chart-cop>
  192. </el-col>
  193. </el-row>
  194. <div v-if="activeTab === '2'" :style="{ height: tableHeight }">
  195. <table-cop
  196. class=""
  197. :data="tableData"
  198. :column="tableColumn"
  199. :theme="theme"
  200. fromTableId="4"
  201. :height="tableHeight"
  202. :tableId="tableShowId"
  203. :tableName="tableName"
  204. :tableFilePath="tableFilePath"
  205. style="position: relative; top: -15px"
  206. ></table-cop>
  207. </div>
  208. <div
  209. v-if="activeTab === '3'"
  210. :style="{ height: tableHeight, width: '100%' }"
  211. >
  212. <fsChart
  213. height="600px"
  214. width="100%"
  215. :xAxis="fsBarxAxis"
  216. :yAxis="fsBaryAxis"
  217. :series="fsBarSeries"
  218. :colors="[
  219. '#22a6b3',
  220. '#05bc4c',
  221. '#C531C7',
  222. '#4b55ae',
  223. '#fa8c16',
  224. '#1DA0D7',
  225. '#DD5044',
  226. '#1467e3',
  227. ]"
  228. >
  229. </fsChart>
  230. </div>
  231. </el-tabs>
  232. </div>
  233. </div>
  234. </div>
  235. <el-dialog
  236. custom-class="windLifeDialog"
  237. v-model="wtDialog"
  238. draggable
  239. title="风机功率点位"
  240. >
  241. <el-tabs v-model="wtTab">
  242. <el-tab-pane label="数据" name="table">
  243. <el-table :data="wtData" row-key="id" :max-height="550">
  244. <el-table-column property="wtId" align="center" label="风机" />
  245. <el-table-column
  246. property="time"
  247. sortable
  248. :width="160"
  249. align="center"
  250. label="时间"
  251. />
  252. <el-table-column
  253. property="speed"
  254. sortable
  255. align="center"
  256. label="风速(m/s)"
  257. />
  258. <el-table-column
  259. property="power"
  260. sortable
  261. align="center"
  262. label="功率(kW)"
  263. />
  264. <el-table-column
  265. property="rr"
  266. sortable
  267. align="center"
  268. label="转速"
  269. />
  270. <el-table-column
  271. property="filter"
  272. sortable
  273. align="center"
  274. label="是否有用点"
  275. />
  276. </el-table>
  277. </el-tab-pane>
  278. <el-tab-pane label="故障" name="problem" disabled> </el-tab-pane>
  279. <el-tab-pane label="预警" name="warning" disabled> </el-tab-pane>
  280. </el-tabs>
  281. </el-dialog>
  282. <el-dialog
  283. custom-class="windLifeDialog"
  284. draggable
  285. width="80%"
  286. v-model="dialog"
  287. :title="actDiaTitle"
  288. >
  289. <el-form class="whitespace-nowrap" :inline="true" :model="queryForm">
  290. <el-form-item label="" class="!mb-0">
  291. <el-select
  292. style="width: 150px"
  293. v-model="queryForm.checkIds"
  294. clearable
  295. @clear="checkAll = false"
  296. collapse-tags
  297. multiple
  298. >
  299. <el-option
  300. label="全选"
  301. :class="{ selected: checkAll }"
  302. @click="funCheckAll"
  303. ></el-option>
  304. <el-option
  305. v-for="item in chartExcelList"
  306. :key="item.id"
  307. :value="item.id"
  308. :label="item.name"
  309. >
  310. </el-option>
  311. </el-select>
  312. </el-form-item>
  313. <el-form-item class="!mb-0">
  314. <submit-btn desc="查询" @click="funDiaSubmit"></submit-btn>
  315. <submit-btn desc="导出" @click="funDiaExport"></submit-btn>
  316. </el-form-item>
  317. </el-form>
  318. <div v-loading="exportLoading">
  319. <el-row
  320. ref="diaPanelRef"
  321. style="height: 650px; overflow-y: auto; over-x: hidden"
  322. >
  323. <el-col
  324. :span="actCopList.length > 1 ? 12 : 24"
  325. v-for="item in actCopList"
  326. :key="item.id"
  327. style="height: 650px"
  328. >
  329. <component
  330. :is="item.actCop"
  331. width="100%"
  332. height="100%"
  333. :xAxis="item.xAxis"
  334. :subtext="item.subtext"
  335. :isRadar="item.isRadar"
  336. :title="item.title"
  337. :series="item.series"
  338. :theme="theme"
  339. :echartsTheme="echartsTheme"
  340. :isDiaAlone="actCopList.length === 1"
  341. @dblclick="funDbClick(item)"
  342. :yAxis="item.yAxis"
  343. :dataset="item.dataset"
  344. :brush="item.isBrush"
  345. @getSelected="funChartSelect"
  346. ></component>
  347. </el-col>
  348. </el-row>
  349. </div>
  350. </el-dialog>
  351. </div>
  352. </template>
  353. <script setup name="rateAnalysis">
  354. import excelCop from "@/components/generatingCapacityComponent/excel.vue";
  355. import treeCop from "@/components/generatingCapacityComponent/tree.vue";
  356. import tableCop from "@/components/generatingCapacityComponent/table.vue";
  357. import chartCop from "./components/chart.vue";
  358. import lineChartCop from "./components/lineChart.vue";
  359. // import SubmitBtn from '../../../components/SubmitBtn.vue'
  360. import scatterSingleChartCop from "./components/scatterSingleChart.vue";
  361. import fsChart from "./components/barChart.vue";
  362. // import { ElMessage } from 'element-plus';
  363. import {
  364. onMounted,
  365. ref,
  366. onActivated,
  367. shallowRef,
  368. reactive,
  369. nextTick,
  370. watch,
  371. } from "vue";
  372. import dayjs from "dayjs";
  373. import {
  374. fetchWindturbineList,
  375. getWpList,
  376. } from "@/api/zhbj/index.js";
  377. import { useStore } from "vuex";
  378. import httpRequest from "@/utils/request.js";
  379. import tools from "@tools/htmlToPdf.js";
  380. import jsonData from "./components/data.json";
  381. // import flowerRes from '@/data/flower.json'
  382. // import lineChartRes from '@/data/lineNew.json'
  383. /**配置参数 */
  384. const treeHeight = ref(window.innerHeight - 116 + "px"); //tree高度
  385. const excelHeight = ref(window.innerHeight - 116 + "px"); //excel高度
  386. const tableHeight = ref(window.innerHeight - 170 + "px");
  387. /**excel 开始 */
  388. const activeTab = ref("1");
  389. const excelCheckIds = ref([]);
  390. const excelList = ref([]);
  391. const tableShowId = ref("");
  392. const tableName = ref("");
  393. const tableFilePath = ref("");
  394. const currentNodeKey = ref("");
  395. //点击excel项时
  396. const funExcelChange = async (obj) => {
  397. excelCheckIds.value = [obj.id]; //当为单选展示风机图表时
  398. tableShowId.value = obj.id;
  399. tableName.value = obj.code
  400. ? obj.code
  401. : obj.name.substring(0, obj.name.indexOf("_"));
  402. tableFilePath.value = obj.path;
  403. chartExcelList.value = excelList.value.map((o) => {
  404. return {
  405. ...o,
  406. name: o.name.split("_")[0],
  407. };
  408. }); // 选中excel当前项时, excel列表赋值给dialog 下拉框
  409. queryForm.checkIds = excelList.value.map((o) => o.id);
  410. checkAll.value = true;
  411. funSubmit();
  412. tableDataGet();
  413. };
  414. const funExcelCheckChange = ({ checkArr, data }) => {
  415. excelCheckIds.value = checkArr;
  416. };
  417. /**表格数据 */
  418. const tableData = ref([]);
  419. const tableColumn = ref([]);
  420. const tableDataGet = async () => {
  421. const res = await httpRequest.get(`${process.env.VUE_APP_API}/wind/show`, {
  422. params: {
  423. id: excelCheckIds.value.join(),
  424. },
  425. });
  426. tableColumn.value = res.data.title.map((o) => {
  427. return {
  428. prop: o.key,
  429. label: o.des,
  430. width: o.des === "时间" ? 100 : 80,
  431. };
  432. });
  433. tableData.value = res.data.data;
  434. };
  435. /**tree 开始 */
  436. const treeData = ref([]);
  437. const actTreeNode = ref(null);
  438. const funRepeatMap = (arr) => {
  439. return arr.map((o) => {
  440. if (o.children) {
  441. const findIndex = o.children.findIndex((p) => !!p.type);
  442. if (findIndex !== -1) {
  443. o.childs = o.children;
  444. o.children = [];
  445. if (!actTreeNode.value) {
  446. actTreeNode.value = o;
  447. }
  448. }
  449. }
  450. return {
  451. ...o,
  452. children: o.children.length ? funRepeatMap(o.children) : [],
  453. };
  454. });
  455. };
  456. const funGetTree = async () => {
  457. const res = await httpRequest.get(
  458. `${process.env.VUE_APP_ALARM}/power/process/tree`
  459. );
  460. actTreeNode.value = null;
  461. excelList.value = [];
  462. treeData.value = funRepeatMap(res.data);
  463. if (actTreeNode.value) {
  464. funCurrentChange({
  465. current: actTreeNode.value,
  466. currentNode: null,
  467. });
  468. funExcelChange({
  469. id: actTreeNode.value.childs[0].id,
  470. code: actTreeNode.value.childs[0].code,
  471. path: actTreeNode.value.childs[0].path,
  472. });
  473. currentNodeKey.value = actTreeNode.value?.id || "";
  474. }
  475. };
  476. const funTreeCheckChange = ({
  477. current,
  478. checkedNodes,
  479. checkedKeys,
  480. halfCheckedNodes,
  481. halfCheckedKeys,
  482. }) => {
  483. //tree change -> excel change
  484. funCurrentChange({
  485. current,
  486. currentNode: "",
  487. });
  488. const checkIds = [];
  489. if (checkedNodes.length) {
  490. for (const node of checkedNodes) {
  491. if (node.childs && node.childs.length) {
  492. for (const child of node.childs) {
  493. checkIds.push(child.id);
  494. }
  495. }
  496. }
  497. }
  498. excelCheckIds.value = checkIds;
  499. };
  500. const funCurrentChange = ({ current, currentNode }) => {
  501. if (current.childs) {
  502. excelList.value = current.childs.map((o) => {
  503. return {
  504. id: o.id,
  505. interval: o.interval,
  506. path: o.path,
  507. prepareid: o.prepareid,
  508. station: o.station,
  509. time: o.time,
  510. type: o.type,
  511. windturbine: o.windturbine,
  512. name: o.path.substring(
  513. o.path.indexOf(o.station + "_") + (o.station + "_").length
  514. ),
  515. };
  516. });
  517. if (excelList.value.length > 0) {
  518. funExcelChange(excelList.value[0]);
  519. }
  520. } else {
  521. excelList.value = [];
  522. }
  523. };
  524. /**chart */
  525. const funText = (index) => {
  526. let str = "";
  527. switch (index) {
  528. case 0:
  529. str = "0-3";
  530. break;
  531. case 1:
  532. str = "3-5";
  533. break;
  534. case 2:
  535. str = "5-7";
  536. break;
  537. case 3:
  538. str = "7-9";
  539. break;
  540. case 4:
  541. str = "9-11";
  542. break;
  543. case 5:
  544. str = "11-20";
  545. break;
  546. case 6:
  547. str = "20-25";
  548. break;
  549. case 7:
  550. str = "25-∞";
  551. break;
  552. }
  553. return str;
  554. };
  555. const chartData = ref([]); //roses的chartList
  556. let chartId = 1;
  557. const fsBarxAxis = reactive({
  558. type: "category",
  559. data: [],
  560. splitLine: {
  561. show: false,
  562. },
  563. axisTick: {
  564. show: true,
  565. },
  566. });
  567. const fsBaryAxis = ref({
  568. type: "value",
  569. name: "小时",
  570. splitLine: {
  571. show: false,
  572. },
  573. axisTick: {
  574. show: true,
  575. },
  576. });
  577. const fsBarSeries = ref([
  578. {
  579. name: "0~3m风速",
  580. type: "bar",
  581. stack: "a",
  582. data: [],
  583. },
  584. {
  585. name: "3~5m风速",
  586. type: "bar",
  587. stack: "a",
  588. data: [],
  589. },
  590. {
  591. name: "5~10m风速",
  592. type: "bar",
  593. stack: "a",
  594. data: [],
  595. },
  596. {
  597. name: "10~12m风速",
  598. type: "bar",
  599. stack: "a",
  600. data: [],
  601. },
  602. {
  603. name: "12~25m风速",
  604. type: "bar",
  605. stack: "a",
  606. data: [],
  607. },
  608. ]);
  609. /**submit */
  610. const funSubmit = async () => {
  611. const rosesRes = await httpRequest.get(
  612. `${process.env.VUE_APP_API}/winddirecton/roses?wtid=${deviceId.value}&kssj=${dateTime.value[0]}&jssj=${dateTime.value[1]}`
  613. );
  614. const lineRes = await httpRequest.get(
  615. `${process.env.VUE_APP_API}/winddirecton/deviation/ratio?wtid=${deviceId.value}&kssj=${dateTime.value[0]}&jssj=${dateTime.value[1]}`
  616. );
  617. // const rosesRes = flowerRes
  618. // const lineRes = lineChartRes
  619. if (rosesRes.code === 200) {
  620. if (rosesRes.data.length) {
  621. chartData.value = [];
  622. for (const chart of rosesRes.data) {
  623. chartData.value.push({
  624. id: chartId,
  625. title: "",
  626. subtext: "风速风向玫瑰图",
  627. xAxis: {
  628. type: "category",
  629. boundaryGap: false,
  630. data: [
  631. "北",
  632. "",
  633. "东北",
  634. "",
  635. "东",
  636. "",
  637. "东南",
  638. "",
  639. "南",
  640. "",
  641. "西南",
  642. "",
  643. "西",
  644. "",
  645. "西北",
  646. "",
  647. ],
  648. splitLine: {
  649. show: true,
  650. },
  651. },
  652. isRadar: false,
  653. series: chart.roses.length
  654. ? chart.roses.map((o, index) => {
  655. return {
  656. type: "bar",
  657. data: o,
  658. coordinateSystem: "polar",
  659. name: funText(index),
  660. stack: "a",
  661. emphasis: {
  662. focus: "series",
  663. },
  664. };
  665. })
  666. : {
  667. type: "bar",
  668. data: chart.roses,
  669. coordinateSystem: "polar",
  670. name: "方位风速",
  671. },
  672. });
  673. chartId++;
  674. chartData.value.push({
  675. id: chartId,
  676. title: "",
  677. subtext: "风速风向频次玫瑰图",
  678. isRadar: true,
  679. xAxis: {
  680. type: "category",
  681. boundaryGap: false,
  682. data: [
  683. "北",
  684. "",
  685. "东北",
  686. "",
  687. "东",
  688. "",
  689. "东南",
  690. "",
  691. "南",
  692. "",
  693. "西南",
  694. "",
  695. "西",
  696. "",
  697. "西北",
  698. "",
  699. ],
  700. splitLine: {
  701. show: true,
  702. },
  703. },
  704. series: chart.roses.length
  705. ? [
  706. ...chart.roses.map((o, index) => {
  707. return {
  708. type: "bar",
  709. data: o,
  710. coordinateSystem: "polar",
  711. name: funText(index),
  712. stack: "a",
  713. emphasis: {
  714. focus: "series",
  715. },
  716. };
  717. }),
  718. {
  719. type: "radar",
  720. tooltip: {
  721. trigger: "item",
  722. },
  723. name: "对风",
  724. data: [
  725. {
  726. value: chart.radar,
  727. },
  728. ],
  729. },
  730. ]
  731. : [],
  732. count: chart.count || [],
  733. });
  734. chartId++;
  735. scatterSeries.value[0].data = chart.frequency.data.length
  736. ? chart.frequency.data.map((item) => {
  737. return [item[1] + "", item[0] + "", (item[2] * 15).toFixed(1)];
  738. })
  739. : [];
  740. scatterSeries.value[0].markLine.data = [
  741. {
  742. xAxis: `${chart.frequency.avg}`,
  743. name: `平均偏航:${chart.frequency.avg}度`,
  744. },
  745. ];
  746. }
  747. fsBarxAxis.data = [];
  748. let fbs = [
  749. {
  750. name: "0~3m风速",
  751. type: "bar",
  752. stack: "a",
  753. data: [],
  754. },
  755. {
  756. name: "3~5m风速",
  757. type: "bar",
  758. stack: "a",
  759. data: [],
  760. },
  761. {
  762. name: "5~7m风速",
  763. type: "bar",
  764. stack: "a",
  765. data: [],
  766. },
  767. {
  768. name: "7~9m风速",
  769. type: "bar",
  770. stack: "a",
  771. data: [],
  772. },
  773. {
  774. name: "9~11m风速",
  775. type: "bar",
  776. stack: "a",
  777. data: [],
  778. },
  779. {
  780. name: "11~20m风速",
  781. type: "bar",
  782. stack: "a",
  783. data: [],
  784. },
  785. {
  786. name: "20~25m风速",
  787. type: "bar",
  788. stack: "a",
  789. data: [],
  790. },
  791. ];
  792. fsBarxAxis.data.push(rosesRes.data[0].wt);
  793. rosesRes.data[0].speeedtime.forEach((ele, index) => {
  794. fbs[index].data.push(ele);
  795. });
  796. fsBarSeries.value = fbs;
  797. }
  798. }
  799. if (lineRes.code === 200) {
  800. if (lineRes.data.length) {
  801. lineDataSet.value[0].source = lineRes.data[0].scatter.map((o) => {
  802. return [o.x + "", o.y];
  803. });
  804. const lineSeriseMax = Math.max(...lineRes.data[0].count);
  805. const lineSeriseMaxIndex = lineRes.data[0].count.indexOf(lineSeriseMax);
  806. lineSeries.value = [
  807. {
  808. name: "对风频次",
  809. type: "line",
  810. symbol: "line", //设定为实心点
  811. symbolSize: 0, //设定实心点的大小
  812. smooth: true, //这个是把线变成曲线
  813. data: lineRes.data[0].count,
  814. yAxisIndex: 1,
  815. markLine: {
  816. symbol: "none",
  817. label: {
  818. show: false,
  819. },
  820. lineStyle: {
  821. color: "#F72C5B",
  822. width: "3",
  823. },
  824. large: true,
  825. data: [
  826. {
  827. // name: `平均偏航:${chart.frequency.avg}度`,
  828. xAxis: lineSeriseMaxIndex,
  829. },
  830. ],
  831. },
  832. },
  833. {
  834. type: "effectScatter",
  835. showEffectOn: "emphasis",
  836. rippleEffect: {
  837. scale: 1,
  838. },
  839. legendHoverLink: false,
  840. name: "数据散点",
  841. symbolSize: 5,
  842. datasetIndex: 0,
  843. encode: {
  844. x: "x",
  845. y: "y",
  846. },
  847. yAxisIndex: 0,
  848. },
  849. ];
  850. }
  851. }
  852. };
  853. /**lineChart */
  854. const linexAxis = ref({
  855. type: "category",
  856. data: new Array(101)
  857. .fill(-50)
  858. .map((o, index) => Number((o + index).toFixed(1))),
  859. splitLine: {
  860. show: false,
  861. },
  862. axisTick: {
  863. show: true,
  864. },
  865. });
  866. const lineyAxis = ref([
  867. {
  868. type: "value",
  869. name: "m/s",
  870. splitLine: {
  871. show: false,
  872. },
  873. axisTick: {
  874. show: true,
  875. },
  876. },
  877. {
  878. type: "value",
  879. name: "频次",
  880. splitLine: {
  881. show: false,
  882. },
  883. axisTick: {
  884. show: true,
  885. },
  886. },
  887. ]);
  888. const lineSeries = ref([]);
  889. const lineDataSet = ref([
  890. {
  891. source: [],
  892. },
  893. ]);
  894. // 圈选散点触发函数
  895. const funChartSelect = async (batch) => {
  896. const wDataArr = [];
  897. const yDataArr = [];
  898. let scatterls = [];
  899. let dataSetObj = [];
  900. wtData.value = [];
  901. if (batch.length && actCopList.value[0].dataset) {
  902. scatterls = batch[0].selected[1].dataIndex;
  903. if (scatterls.length) {
  904. dataSetObj = JSON.parse(actCopList.value[0].dataset);
  905. if (scatterls.length) {
  906. for (const scatterIndex of scatterls) {
  907. wDataArr.push(dataSetObj[0].source[scatterIndex].k);
  908. }
  909. }
  910. const wtRes = await httpRequest.get(
  911. `${process.env.VUE_APP_ALARM}/power/fitting/filter`,
  912. {
  913. params: {
  914. yk: yDataArr.join(","),
  915. wk: wDataArr.join(","),
  916. },
  917. }
  918. );
  919. if (wtRes.code === 200) {
  920. let id = 1;
  921. const tempArr = []; //用于以风机id 聚合dataArr
  922. if (wtRes.data.length) {
  923. for (const data of wtRes.data) {
  924. if (tempArr.length) {
  925. const findIndex = tempArr.findIndex((o) => o.wtId === data.wtId);
  926. if (findIndex !== -1) {
  927. if (!tempArr[findIndex].children) {
  928. tempArr[findIndex].children = [];
  929. }
  930. tempArr[findIndex].children.push({
  931. ...data,
  932. id: id,
  933. filter: data.filter === 0 ? "是" : "否",
  934. });
  935. id++;
  936. } else {
  937. tempArr.push({
  938. ...data,
  939. id: id,
  940. filter: data.filter === 0 ? "是" : "否",
  941. });
  942. id++;
  943. }
  944. } else {
  945. tempArr.push({
  946. ...data,
  947. id: id,
  948. filter: data.filter === 0 ? "是" : "否",
  949. });
  950. id++;
  951. }
  952. }
  953. wtDialog.value = true;
  954. nextTick(() => {
  955. wtTab.value = "table";
  956. wtData.value = tempArr;
  957. });
  958. }
  959. }
  960. }
  961. }
  962. };
  963. /**scatter chart */
  964. const scatterxData = ref([
  965. {
  966. type: "category",
  967. name: "度",
  968. data: new Array(61).fill(-30).map((o, index) => Number(o + index)),
  969. boundaryGap: false,
  970. splitLine: {
  971. show: true,
  972. },
  973. axisLine: {
  974. show: true,
  975. },
  976. },
  977. ]);
  978. const scatteryData = ref([
  979. {
  980. type: "category",
  981. data: [5, 6, 7, 8, 9, 10],
  982. axisLine: {
  983. show: false,
  984. },
  985. name: "m/s",
  986. splitLine: {
  987. show: false,
  988. },
  989. },
  990. ]);
  991. const scatterSeries = ref([
  992. {
  993. name: "对风偏航",
  994. type: "scatter",
  995. symbolSize: function (val) {
  996. return val[2];
  997. },
  998. data: [],
  999. markLine: {
  1000. symbol: "none",
  1001. label: {
  1002. show: false,
  1003. },
  1004. lineStyle: {
  1005. color: "#F72C5B",
  1006. width: "3",
  1007. },
  1008. data: [
  1009. {
  1010. // yAxis: powerproductionNum.value,
  1011. },
  1012. ],
  1013. },
  1014. animationDelay: function (idx) {
  1015. return idx * 5;
  1016. },
  1017. },
  1018. ]);
  1019. /**dialog 数据 */
  1020. const wtDialog = ref(false);
  1021. const wtData = ref([]);
  1022. const wtTab = ref("table");
  1023. /**dialog */
  1024. const dialog = ref(false);
  1025. const actChartName = ref("");
  1026. const actDiaTitle = ref("");
  1027. const diaPanelRef = ref();
  1028. const exportLoading = ref(false);
  1029. const actCopList = ref([
  1030. // {
  1031. // xAxis: [],
  1032. // subtext: '',
  1033. // title: '',
  1034. // isRadar: false,
  1035. // series: [],
  1036. // yAxis: [],
  1037. // dataset: []
  1038. // }
  1039. ]);
  1040. // 作为actCopList的备份 在actCopList赋值多个时 同时赋值, 在dialog弹出时清空. 作用: 在actCopList变化时, 重新赋值原始数据
  1041. const actCopListBak = ref([]);
  1042. const checkAll = ref(true);
  1043. const queryForm = reactive({
  1044. checkIds: [],
  1045. });
  1046. const funCheckAll = () => {
  1047. checkAll.value = !checkAll.value;
  1048. if (checkAll.value) {
  1049. queryForm.checkIds = chartExcelList.value.map((o) => o.id);
  1050. } else {
  1051. queryForm.checkIds = [];
  1052. }
  1053. };
  1054. const chartExcelList = ref([]); //dialog 下拉项
  1055. const funActCop = (obj, type) => {
  1056. switch (type) {
  1057. case "chartCop1":
  1058. actChartName.value = "chartCop1";
  1059. obj.actCop = shallowRef(chartCop);
  1060. actDiaTitle.value = "风速风向玫瑰图";
  1061. break;
  1062. case "chartCop2":
  1063. actChartName.value = "chartCop2";
  1064. obj.actCop = shallowRef(chartCop);
  1065. actDiaTitle.value = "风速风向频次玫瑰图";
  1066. break;
  1067. case "lineChartCop":
  1068. actChartName.value = "lineChartCop";
  1069. obj.actCop = shallowRef(lineChartCop);
  1070. actDiaTitle.value = "对风偏差分析图";
  1071. break;
  1072. case "scatterSingleChartCop":
  1073. actChartName.value = "scatterSingleChartCop";
  1074. obj.actCop = shallowRef(scatterSingleChartCop);
  1075. actDiaTitle.value = "静态偏航对风分析图";
  1076. break;
  1077. }
  1078. obj.isBrush = type === "lineChartCop" ? false : false;
  1079. obj.id = chartId;
  1080. chartId++;
  1081. dialog.value = true;
  1082. actCopListBak.value = [];
  1083. nextTick(() => {
  1084. actCopList.value = [obj];
  1085. });
  1086. };
  1087. const funDiaSubmit = async () => {
  1088. let url = "";
  1089. switch (actChartName.value) {
  1090. case "chartCop1":
  1091. url = "/wind/roses";
  1092. break;
  1093. case "chartCop2":
  1094. url = "/wind/roses";
  1095. break;
  1096. case "lineChartCop":
  1097. url = "/wind/deviation/ratio";
  1098. break;
  1099. case "scatterSingleChartCop":
  1100. url = "/wind/roses";
  1101. break;
  1102. }
  1103. if (url) {
  1104. const res = await httpRequest.get(`${process.env.VUE_APP_ALARM}${url}`, {
  1105. params: {
  1106. ids: queryForm.checkIds.join(","),
  1107. mode: 0,
  1108. },
  1109. });
  1110. if (res.code === 200) {
  1111. actCopList.value = [];
  1112. actCopListBak.value = []; //清空备份
  1113. if (res.data.length) {
  1114. for (const chart of res.data) {
  1115. if (actChartName.value === "chartCop1") {
  1116. actCopList.value.push({
  1117. id: chartId,
  1118. isBrush: false,
  1119. actCop: shallowRef(chartCop),
  1120. title: chart.wt,
  1121. subtext: "风速风向玫瑰图",
  1122. xAxis: {
  1123. type: "category",
  1124. boundaryGap: false,
  1125. data: [
  1126. "北",
  1127. "",
  1128. "东北",
  1129. "",
  1130. "东",
  1131. "",
  1132. "东南",
  1133. "",
  1134. "南",
  1135. "",
  1136. "西南",
  1137. "",
  1138. "西",
  1139. "",
  1140. "西北",
  1141. "",
  1142. ],
  1143. splitLine: {
  1144. show: true,
  1145. },
  1146. },
  1147. isRadar: false,
  1148. series:
  1149. // chart.roses.length ? chart.roses.map((o, index) => {
  1150. // return {
  1151. // type: 'bar',
  1152. // data: o,
  1153. // coordinateSystem: 'polar',
  1154. // name: funText(index),
  1155. // stack: 'a',
  1156. // emphasis: {
  1157. // focus: 'series'
  1158. // }
  1159. // }
  1160. // }) : []
  1161. {
  1162. type: "bar",
  1163. data: chart.roses,
  1164. coordinateSystem: "polar",
  1165. name: "方位风速",
  1166. },
  1167. });
  1168. chartId++;
  1169. }
  1170. if (actChartName.value === "chartCop2") {
  1171. actCopList.value.push({
  1172. id: chartId,
  1173. isBrush: false,
  1174. actCop: shallowRef(chartCop),
  1175. title: chart.wt,
  1176. subtext: "风速风向频次玫瑰图",
  1177. xAxis: {
  1178. type: "category",
  1179. boundaryGap: false,
  1180. data: [
  1181. "北",
  1182. "",
  1183. "东北",
  1184. "",
  1185. "东",
  1186. "",
  1187. "东南",
  1188. "",
  1189. "南",
  1190. "",
  1191. "西南",
  1192. "",
  1193. "西",
  1194. "",
  1195. "西北",
  1196. "",
  1197. ],
  1198. splitLine: {
  1199. show: true,
  1200. },
  1201. },
  1202. isRadar: true,
  1203. series: chart.roses.length
  1204. ? [
  1205. ...chart.roses.map((o, index) => {
  1206. return {
  1207. type: "bar",
  1208. data: o,
  1209. coordinateSystem: "polar",
  1210. name: funText(index),
  1211. stack: "a",
  1212. emphasis: {
  1213. focus: "series",
  1214. },
  1215. };
  1216. }),
  1217. {
  1218. type: "radar",
  1219. // coordinateSystem: 'polar',
  1220. tooltip: {
  1221. trigger: "item",
  1222. },
  1223. // smooth: true,
  1224. // areaStyle: {},
  1225. name: "对风",
  1226. data: [
  1227. {
  1228. value: chart.radar,
  1229. },
  1230. ],
  1231. },
  1232. ]
  1233. : [],
  1234. count: chart.count || [],
  1235. });
  1236. chartId++;
  1237. }
  1238. if (actChartName.value === "lineChartCop") {
  1239. actCopList.value.push({
  1240. id: chartId,
  1241. isBrush: false,
  1242. actCop: shallowRef(lineChartCop),
  1243. title: chart.wtId,
  1244. subtext: "对风偏差分析图",
  1245. xAxis: linexAxis.value,
  1246. yAxis: lineyAxis.value,
  1247. dataset: [
  1248. {
  1249. source: chart.scatter.map((o) => {
  1250. return [o.x + "", o.y];
  1251. }),
  1252. },
  1253. ],
  1254. isRadar: false,
  1255. series: [
  1256. {
  1257. name: "对风频次",
  1258. type: "line",
  1259. symbol: "line", //设定为实心点
  1260. symbolSize: 0, //设定实心点的大小
  1261. smooth: true, //这个是把线变成曲线
  1262. data: chart.count,
  1263. yAxisIndex: 1,
  1264. large: true,
  1265. },
  1266. {
  1267. type: "effectScatter",
  1268. showEffectOn: "emphasis",
  1269. large: true,
  1270. rippleEffect: {
  1271. scale: 1,
  1272. },
  1273. legendHoverLink: false,
  1274. name: "数据散点",
  1275. symbolSize: 5,
  1276. datasetIndex: 0,
  1277. encode: {
  1278. x: "x",
  1279. y: "y",
  1280. },
  1281. yAxisIndex: 0,
  1282. },
  1283. ],
  1284. });
  1285. chartId++;
  1286. }
  1287. if (actChartName.value === "scatterSingleChartCop") {
  1288. actCopList.value.push({
  1289. id: chartId,
  1290. isBrush: false,
  1291. actCop: shallowRef(scatterSingleChartCop),
  1292. title: chart.wt,
  1293. subtext: "静态偏航对风分析图",
  1294. xAxis: scatterxData.value,
  1295. yAxis: scatteryData.value,
  1296. isRadar: false,
  1297. series: [
  1298. {
  1299. name: "对风偏航",
  1300. type: "scatter",
  1301. symbolSize: function (val) {
  1302. return val[2];
  1303. },
  1304. markLine: {
  1305. symbol: "none",
  1306. label: {
  1307. show: false,
  1308. },
  1309. lineStyle: {
  1310. color: "#F72C5B",
  1311. width: "3",
  1312. },
  1313. large: true,
  1314. data: [
  1315. {
  1316. name: `平均偏航:${chart.frequency.avg}度`,
  1317. xAxis: `${chart.frequency.avg}`,
  1318. },
  1319. ],
  1320. },
  1321. data: chart.frequency.data.length
  1322. ? chart.frequency.data.map((item) => {
  1323. return [
  1324. item[1] + "",
  1325. item[0] + "",
  1326. (item[2] * 15).toFixed(1),
  1327. ];
  1328. })
  1329. : [],
  1330. animationDelay: function (idx) {
  1331. return idx * 5;
  1332. },
  1333. },
  1334. ],
  1335. });
  1336. chartId++;
  1337. }
  1338. }
  1339. actCopListBak.value = actCopList.value;
  1340. }
  1341. }
  1342. }
  1343. };
  1344. const funDiaExport = () => {
  1345. exportLoading.value = true;
  1346. tools.scrollToPDF(diaPanelRef.value, actDiaTitle.value, () => {
  1347. exportLoading.value = false;
  1348. });
  1349. };
  1350. const funDbClick = (obj) => {
  1351. if (actCopListBak.value.length > 1) {
  1352. //判断大于1时, 才有双击放大功能
  1353. if (actCopList.value.length === 1) {
  1354. actCopList.value = actCopListBak.value;
  1355. } else {
  1356. actCopList.value = [obj];
  1357. }
  1358. }
  1359. };
  1360. /**created */
  1361. // funGetTree()
  1362. const theme = ref(null);
  1363. const echartsTheme = ref("");
  1364. const store = useStore();
  1365. watch(
  1366. () => store.state.theme,
  1367. (newVal, oldVal) => {
  1368. theme.value = newVal;
  1369. echartsTheme.value = !newVal ? "dark" : "";
  1370. funGetTree();
  1371. },
  1372. {
  1373. deep: true,
  1374. }
  1375. );
  1376. const initPageData = () => {
  1377. actTreeNode.value = null;
  1378. excelList.value = [];
  1379. treeData.value = funRepeatMap(JSON.parse(JSON.stringify(jsonData.treeData)));
  1380. if (actTreeNode.value) {
  1381. if (actTreeNode.value.childs) {
  1382. excelList.value = actTreeNode.value.childs.map((o) => {
  1383. return {
  1384. id: o.id,
  1385. interval: o.interval,
  1386. path: o.path,
  1387. prepareid: o.prepareid,
  1388. station: o.station,
  1389. time: o.time,
  1390. type: o.type,
  1391. windturbine: o.windturbine,
  1392. isCheck: false,
  1393. name: o.path.substring(
  1394. o.path.indexOf(o.station + "_") + (o.station + "_").length
  1395. ),
  1396. };
  1397. });
  1398. } else {
  1399. excelList.value = [];
  1400. }
  1401. const obj = {
  1402. id: actTreeNode.value.childs[0].id,
  1403. code: actTreeNode.value.childs[0].code,
  1404. path: actTreeNode.value.childs[0].path,
  1405. };
  1406. excelCheckIds.value = [obj.id]; //当为单选展示风机图表时
  1407. tableShowId.value = obj.id;
  1408. tableName.value = obj.code;
  1409. tableFilePath.value = obj.path;
  1410. chartExcelList.value = excelList.value.map((o) => {
  1411. return {
  1412. ...o,
  1413. name: o.name.split("_")[0],
  1414. };
  1415. }); // 选中excel当前项时, excel列表赋值给dialog 下拉框
  1416. queryForm.checkIds = excelList.value.map((o) => o.id);
  1417. checkAll.value = true;
  1418. chartData.value = [];
  1419. for (const chart of jsonData.rosesData) {
  1420. let windMap = {};
  1421. chartData.value.push({
  1422. id: chartId,
  1423. title: "",
  1424. subtext: "风速风向玫瑰图",
  1425. xAxis: {
  1426. type: "category",
  1427. boundaryGap: false,
  1428. data: [
  1429. "北",
  1430. "",
  1431. "东北",
  1432. "",
  1433. "东",
  1434. "",
  1435. "东南",
  1436. "",
  1437. "南",
  1438. "",
  1439. "西南",
  1440. "",
  1441. "西",
  1442. "",
  1443. "西北",
  1444. ],
  1445. splitLine: {
  1446. show: true,
  1447. },
  1448. },
  1449. isRadar: false,
  1450. series: chart.roses.length
  1451. ? chart.roses.map((o, index) => {
  1452. return {
  1453. type: "bar",
  1454. data: o,
  1455. coordinateSystem: "polar",
  1456. name: funText(index),
  1457. stack: "a",
  1458. emphasis: {
  1459. focus: "series",
  1460. },
  1461. };
  1462. })
  1463. : {
  1464. type: "bar",
  1465. data: chart.roses,
  1466. coordinateSystem: "polar",
  1467. name: "方位风速",
  1468. },
  1469. });
  1470. chartId++;
  1471. chartData.value.push({
  1472. id: chartId,
  1473. title: "",
  1474. subtext: "风速风向频次玫瑰图",
  1475. isRadar: true,
  1476. xAxis: {
  1477. type: "category",
  1478. boundaryGap: false,
  1479. data: [
  1480. "北",
  1481. "",
  1482. "东北",
  1483. "",
  1484. "东",
  1485. "",
  1486. "东南",
  1487. "",
  1488. "南",
  1489. "",
  1490. "西南",
  1491. "",
  1492. "西",
  1493. "",
  1494. "西北",
  1495. "",
  1496. ],
  1497. splitLine: {
  1498. show: true,
  1499. },
  1500. },
  1501. series: chart.roses.length
  1502. ? [
  1503. ...chart.roses.map((o, index) => {
  1504. return {
  1505. type: "bar",
  1506. data: o,
  1507. coordinateSystem: "polar",
  1508. name: funText(index),
  1509. stack: "a",
  1510. emphasis: {
  1511. focus: "series",
  1512. },
  1513. coordinateSystem: "polar",
  1514. };
  1515. }),
  1516. {
  1517. type: "radar",
  1518. tooltip: {
  1519. trigger: "item",
  1520. },
  1521. name: "对风",
  1522. data: [
  1523. {
  1524. value: chart.radar,
  1525. },
  1526. ],
  1527. },
  1528. ]
  1529. : [],
  1530. count: chart.count || [],
  1531. });
  1532. chartId++;
  1533. scatterSeries.value[0].data = chart.frequency.data.length
  1534. ? chart.frequency.data.map((item) => {
  1535. return [item[1] + "", item[0] + "", (item[2] * 15).toFixed(1)];
  1536. })
  1537. : [];
  1538. scatterSeries.value[0].markLine.data = [
  1539. {
  1540. xAxis: `${chart.frequency.avg}`,
  1541. name: `平均偏航:${chart.frequency.avg}度`,
  1542. },
  1543. ];
  1544. }
  1545. lineDataSet.value[0].source = jsonData.ratioData[0].scatter.map((o) => {
  1546. return [o.x + "", o.y];
  1547. });
  1548. const lineSeriseMax = Math.max(...jsonData.ratioData[0].count);
  1549. const lineSeriseMaxIndex =
  1550. jsonData.ratioData[0].count.indexOf(lineSeriseMax);
  1551. lineSeries.value = [
  1552. {
  1553. name: "对风频次",
  1554. type: "line",
  1555. symbol: "line", //设定为实心点
  1556. symbolSize: 0, //设定实心点的大小
  1557. smooth: true, //这个是把线变成曲线
  1558. data: jsonData.ratioData[0].count,
  1559. yAxisIndex: 1,
  1560. markLine: {
  1561. symbol: "none",
  1562. label: {
  1563. show: false,
  1564. },
  1565. lineStyle: {
  1566. color: "#F72C5B",
  1567. width: "3",
  1568. },
  1569. large: true,
  1570. data: [
  1571. {
  1572. // name: `平均偏航:${chart.frequency.avg}度`,
  1573. xAxis: lineSeriseMaxIndex,
  1574. },
  1575. ],
  1576. },
  1577. },
  1578. {
  1579. type: "effectScatter",
  1580. showEffectOn: "emphasis",
  1581. rippleEffect: {
  1582. scale: 1,
  1583. },
  1584. legendHoverLink: false,
  1585. name: "数据散点",
  1586. symbolSize: 5,
  1587. datasetIndex: 0,
  1588. encode: {
  1589. x: "x",
  1590. y: "y",
  1591. },
  1592. yAxisIndex: 0,
  1593. },
  1594. ];
  1595. tableColumn.value = jsonData.tableData.title.map((o) => {
  1596. return {
  1597. prop: o.key,
  1598. label: o.des,
  1599. width: o.des === "时间" ? 100 : 80,
  1600. };
  1601. });
  1602. tableData.value = jsonData.tableData.data;
  1603. currentNodeKey.value = actTreeNode.value?.id || "";
  1604. }
  1605. };
  1606. // 场站列表/升压站列表
  1607. const stationId = ref("");
  1608. const stationList = ref([]);
  1609. const getStationList = async () => {
  1610. const { data } = await getWpList("windturbine");
  1611. stationList.value = data;
  1612. stationId.value = data?.[0]?.id || "";
  1613. if (stationList.value.length) {
  1614. await getWindturbineList();
  1615. }
  1616. };
  1617. //get 风机
  1618. const deviceId = ref("");
  1619. const windturbineList = ref([]);
  1620. const getWindturbineList = async () => {
  1621. const { data } = await fetchWindturbineList(stationId.value);
  1622. windturbineList.value = data;
  1623. deviceId.value = data?.[0]?.id || "";
  1624. funSubmit();
  1625. // tableDataGet();
  1626. };
  1627. const dateTime = ref([]);
  1628. /**activated */
  1629. onMounted(() => {
  1630. dateTime.value = [
  1631. dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
  1632. dayjs().format("YYYY-MM-DD HH:mm:ss"),
  1633. ];
  1634. // initPageData();
  1635. getStationList();
  1636. // funGetTree();
  1637. //test
  1638. // funSubmit()
  1639. //
  1640. theme.value = store.state.theme;
  1641. echartsTheme.value = !theme.value ? "dark" : "";
  1642. tableHeight.value = window.innerHeight - 170 + "px";
  1643. excelHeight.value = window.innerHeight - 116 + "px";
  1644. treeHeight.value = window.innerHeight - 116 + "px";
  1645. window.addEventListener("resize", () => {
  1646. tableHeight.value = window.innerHeight - 170 + "px";
  1647. excelHeight.value = window.innerHeight - 116 + "px";
  1648. treeHeight.value = window.innerHeight - 116 + "px";
  1649. });
  1650. });
  1651. </script>
  1652. <style lang="less">
  1653. .rateAnalysis {
  1654. height: 100%;
  1655. .rateAnalysisMain {
  1656. height: 100%;
  1657. .main_top {
  1658. height: 40px;
  1659. display: flex;
  1660. align-items: center;
  1661. .topPsty {
  1662. position: relative;
  1663. top: 5px;
  1664. padding: 7px 20px;
  1665. font-size: 12px;
  1666. font-weight: 600;
  1667. margin-left: 10px;
  1668. border-radius: 3px;
  1669. }
  1670. }
  1671. .main {
  1672. display: flex;
  1673. width: 100%;
  1674. .treeDataMain,
  1675. .excelDataMain,
  1676. .tableDataMain {
  1677. border-radius: 10px;
  1678. }
  1679. .treeDataMain {
  1680. margin-right: 10px;
  1681. padding: 10px 0 10px 10px;
  1682. width: calc(19% - 20px);
  1683. }
  1684. .excelDataMain {
  1685. margin-right: 10px;
  1686. padding: 10px 0 10px 10px;
  1687. width: calc(15% - 20px);
  1688. .excelDataMain_top {
  1689. padding: 5px 0;
  1690. }
  1691. .excelDataMain_bot {
  1692. padding: 5px 0;
  1693. }
  1694. }
  1695. .tableDataMain {
  1696. padding: 10px;
  1697. width: calc(100% - 20px);
  1698. .chartRowTop {
  1699. display: flex;
  1700. justify-content: space-between;
  1701. }
  1702. }
  1703. }
  1704. }
  1705. }
  1706. .themeDark {
  1707. .rateAnalysisMain {
  1708. .main_top {
  1709. .topPsty {
  1710. color: #1c99ff;
  1711. background: #1e2126;
  1712. }
  1713. }
  1714. .main {
  1715. background: #13171e;
  1716. .treeDataMain {
  1717. background: transparent;
  1718. }
  1719. .excelDataMain {
  1720. background: #313233;
  1721. }
  1722. .tableDataMain {
  1723. margin-top: 5px;
  1724. background: #212223;
  1725. }
  1726. }
  1727. }
  1728. }
  1729. .themeLight {
  1730. padding: 0;
  1731. .rateAnalysisMain {
  1732. .main_top {
  1733. .topPsty {
  1734. color: #2778ff;
  1735. background: #ffffff;
  1736. }
  1737. }
  1738. .main {
  1739. background: #e6e8f2;
  1740. .treeDataMain {
  1741. background: transparent;
  1742. }
  1743. .excelDataMain {
  1744. background: #f4f6fb;
  1745. }
  1746. .tableDataMain {
  1747. background: #fff;
  1748. margin-top: 5px;
  1749. }
  1750. }
  1751. }
  1752. }
  1753. .search-item {
  1754. display: flex;
  1755. margin-right: 10px;
  1756. max-width: 450px;
  1757. align-items: center;
  1758. .label {
  1759. margin-right: 10px;
  1760. text-align: right;
  1761. white-space: nowrap;
  1762. // width: 60px;
  1763. }
  1764. .search-content {
  1765. flex: 1;
  1766. }
  1767. }
  1768. </style>