index.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446
  1. <template>
  2. <div class="dataAnalysisHotAns" :class="!theme ? 'themeDark' : 'themeLight'">
  3. <div class="dataAnalysisHotAnsMain">
  4. <div class="main_top">
  5. <p class="topPsty">温度与功率分析</p>
  6. </div>
  7. <div class="main">
  8. <div class="main">
  9. <div class="treeDataMain">
  10. <tree-cop
  11. :data="processTreeData"
  12. :height="treeHeight"
  13. :currentNodeKey="currentNodeKey"
  14. @currentChange="funProcessCurrentChange"
  15. @refresh="funGetProcessTree"
  16. ></tree-cop>
  17. </div>
  18. <div class="excelDataMain">
  19. <excel-cop
  20. :data="excelList"
  21. :height="excelHeight"
  22. @excelChange="funExcelChange"
  23. :theme="theme"
  24. >
  25. </excel-cop>
  26. </div>
  27. <div class="tableDataMain">
  28. <div class="">
  29. <el-tabs v-model="activeTab">
  30. <el-tab-pane label="温度曲线" name="1"> </el-tab-pane>
  31. <el-tab-pane label="温度与功率" name="2"> </el-tab-pane>
  32. <el-tab-pane label="表格数据" name="3"> </el-tab-pane>
  33. <div v-if="activeTab === '2'" :style="{ height: tableHeight }">
  34. <div style="height: 49%">
  35. <el-icon
  36. :style="!theme ? 'color: #fff' : ''"
  37. class="chartIcon"
  38. size="18"
  39. @click="
  40. funActCop(
  41. {
  42. xAxis: barxAxis,
  43. yAxis: baryAxis,
  44. series: barSeries,
  45. },
  46. 'barChartCop'
  47. )
  48. "
  49. >
  50. <ZoomIn />
  51. </el-icon>
  52. <bar-chart-cop
  53. width="100%"
  54. height="100%"
  55. :subtext="`平均功率-额定功率 ${powerproduction}`"
  56. :xAxis="barxAxis"
  57. :theme="theme"
  58. :echartsTheme="echartsTheme"
  59. :yAxis="baryAxis"
  60. :series="barSeries"
  61. >
  62. </bar-chart-cop>
  63. </div>
  64. <div style="height: 49%">
  65. <el-icon
  66. :style="!theme ? 'color: #fff' : ''"
  67. class="chartIcon"
  68. size="18"
  69. @click="
  70. funActCop(
  71. {
  72. xAxis: linexAxis,
  73. yAxis: lineyAxis,
  74. series: lineSeries,
  75. },
  76. 'lineChartCop'
  77. )
  78. "
  79. >
  80. <ZoomIn />
  81. </el-icon>
  82. <line-chart-cop
  83. class=""
  84. height="100%"
  85. width="100%"
  86. :xAxis="linexAxis"
  87. :yAxis="lineyAxis"
  88. :series="lineSeries"
  89. :theme="theme"
  90. :echartsTheme="echartsTheme"
  91. :subtext="`额定功率温度分析 ${powerproduction}`"
  92. :dataset="lineDataSet"
  93. >
  94. </line-chart-cop>
  95. </div>
  96. </div>
  97. <div
  98. v-if="activeTab === '1'"
  99. :style="{
  100. height:
  101. typeof tableHeight === 'string'
  102. ? tableHeight
  103. : tableHeight + 'px',
  104. }"
  105. class="p-[10px]"
  106. >
  107. <CurrentScatterChart
  108. ref="chartRef"
  109. width="100%"
  110. :height="`calc( ${tableHeight} - 20px )`"
  111. :chartTitle="
  112. avgObj.title +
  113. '&nbsp;&nbsp;' +
  114. '平均Cp值:' +
  115. avgObj.cpavg +
  116. '; 静风频率:' +
  117. avgObj.frequency +
  118. '%; 曲线偏差率:' +
  119. avgObj.pcratio +
  120. '%'
  121. "
  122. :xAxisData="xAxisData"
  123. :yAxisData="{ splitLine: { show: false } }"
  124. :seriesData="seriesData"
  125. :showLegend="true"
  126. :brushSelected="false"
  127. :maxMinData="maxMinData"
  128. :theme="theme"
  129. :echartsTheme="echartsTheme"
  130. :dataSet="dataSet"
  131. @getSelected="funhotChartSelect"
  132. />
  133. </div>
  134. <div v-if="activeTab === '3'" :style="{ height: tableHeight }">
  135. <table-cop
  136. class=""
  137. :data="tableData"
  138. :column="tableColumn"
  139. :theme="theme"
  140. :height="tableHeight"
  141. tableId="1"
  142. tableName="温度与功率分析"
  143. ></table-cop>
  144. </div>
  145. </el-tabs>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <el-dialog
  152. custom-class="windLifeDialog"
  153. draggable
  154. width="80%"
  155. v-model="dialog"
  156. :title="actDiaTitle"
  157. >
  158. <el-form class="whitespace-nowrap" :inline="true" :model="queryForm">
  159. <el-form-item label="" class="!mb-0">
  160. <el-select
  161. v-model="queryForm.checkIds"
  162. clearable
  163. @clear="checkAll = false"
  164. collapse-tags
  165. multiple
  166. >
  167. <el-option
  168. label="全选"
  169. :class="{ selected: checkAll }"
  170. @click="funCheckAll"
  171. ></el-option>
  172. <el-option
  173. v-for="item in chartExcelList"
  174. :key="item.id"
  175. :value="item.id"
  176. :label="item.name"
  177. >
  178. </el-option>
  179. </el-select>
  180. </el-form-item>
  181. <el-form-item class="!mb-0">
  182. <submit-btn desc="查询" @click="funDiaSubmit"></submit-btn>
  183. <submit-btn desc="导出" @click="funDiaExport"></submit-btn>
  184. </el-form-item>
  185. </el-form>
  186. <div v-loading="exportLoading">
  187. <el-row
  188. ref="diaPanelRef"
  189. style="height: 650px; overflow-y: auto; over-x: hidden"
  190. >
  191. <el-col
  192. :span="actCopList.length > 1 ? 12 : 24"
  193. v-for="item in actCopList"
  194. :key="item.id"
  195. style="height: 650px"
  196. >
  197. <component
  198. :is="item.actCop"
  199. width="100%"
  200. height="100%"
  201. :xAxis="item.xAxis"
  202. :subtext="item.subtext"
  203. :title="item.title"
  204. :series="item.series"
  205. :isDiaAlone="actCopList.length === 1"
  206. @dblclick="funDbClick(item)"
  207. :yAxis="item.yAxis"
  208. :dataset="item.dataset"
  209. :brush="item.isBrush"
  210. :theme="theme"
  211. :echartsTheme="echartsTheme"
  212. @getSelected="funChartSelect"
  213. ></component>
  214. </el-col>
  215. </el-row>
  216. </div>
  217. </el-dialog>
  218. <el-dialog
  219. custom-class="windLifeDialog warn-table"
  220. v-model="wtDialog"
  221. draggable
  222. title="风机功率点位"
  223. >
  224. <el-tabs v-model="wtTab">
  225. <el-tab-pane label="数据" name="table">
  226. <el-table :data="wtData" row-key="id" :max-height="550">
  227. <el-table-column property="wtId" align="center" label="风机" />
  228. <el-table-column
  229. property="time"
  230. sortable
  231. :width="160"
  232. align="center"
  233. label="时间"
  234. />
  235. <el-table-column
  236. property="speed"
  237. sortable
  238. align="center"
  239. label="风速(m/s)"
  240. />
  241. <el-table-column
  242. property="power"
  243. sortable
  244. align="center"
  245. label="功率(kW)"
  246. />
  247. <el-table-column
  248. property="rr"
  249. sortable
  250. align="center"
  251. label="转速"
  252. />
  253. <el-table-column
  254. property="filter"
  255. sortable
  256. align="center"
  257. label="是否有用点"
  258. />
  259. </el-table>
  260. </el-tab-pane>
  261. <el-tab-pane label="故障" name="problem" disabled> </el-tab-pane>
  262. <el-tab-pane label="预警" name="warning" disabled> </el-tab-pane>
  263. </el-tabs>
  264. </el-dialog>
  265. </div>
  266. </template>
  267. <script setup name="prepare">
  268. import excelCop from "@/components/generatingCapacityComponent/excel.vue";
  269. import treeCop from "@/components/generatingCapacityComponent/tree.vue";
  270. import tableCop from "@/components/generatingCapacityComponent/table.vue";
  271. import barChartCop from "./components/barChart.vue";
  272. import lineChartCop from "./components/lineChart.vue";
  273. import {
  274. shallowRef,
  275. ref,
  276. nextTick,
  277. onActivated,
  278. onMounted,
  279. reactive,
  280. watch,
  281. } from "vue";
  282. import { useStore } from "vuex";
  283. import httpRequest from "@/utils/request.js";
  284. import tools from "@tools/htmlToPdf.js";
  285. import { ElMessage } from "element-plus";
  286. import util from "@tools/util";
  287. import CurrentScatterChart from "./components/current-scatter-chart.vue";
  288. import jsonData from "./components/data.json";
  289. /**配置参数 */
  290. const treeHeight = ref(window.innerHeight - 111 + "px"); //tree高度
  291. const excelHeight = ref(window.innerHeight - 111 + "px"); //excel高度
  292. const tableHeight = ref(window.innerHeight - 171 + "px");
  293. /** 额定功率 */
  294. const powerproduction = ref("");
  295. const tableData = ref([]);
  296. const tableColumn = ref([]);
  297. const currentNodeKey = ref("");
  298. const tableDataGet = async () => {
  299. const res = await httpRequest.get("/temperature/show", {
  300. params: {
  301. id: excelCheckIds.value.join(),
  302. },
  303. });
  304. tableColumn.value = res.data.title.map((o) => {
  305. return {
  306. prop: o.key,
  307. label: o.des,
  308. width: o.des === "时间" ? 100 : 80,
  309. };
  310. });
  311. tableData.value = res.data.data;
  312. };
  313. /**excel 开始 */
  314. const excelCheckboxShow = ref(false);
  315. const excelCheckIds = ref([]);
  316. const excelList = ref([]);
  317. const funExcelChange = async (obj) => {
  318. //点击excel项时
  319. /**次代码供温度功率曲线分析使用 */
  320. excelCheckIds.value = [obj.id]; //当为单选展示风机图表时
  321. chartExcelList.value = excelList.value.map((o) => {
  322. return {
  323. ...o,
  324. name: o.name.split("_")[0],
  325. };
  326. }); // 选中excel当前项时, excel列表赋值给dialog 下拉框
  327. queryForm.checkIds = excelList.value.map((o) => o.id);
  328. checkAll.value = true;
  329. funSubmit();
  330. tableDataGet();
  331. /**---------------------------- */
  332. // activeTab.value = '1'
  333. isChartArea.value = false;
  334. let chartRes = {
  335. scatterhs: [[]],
  336. scatterls: [[]],
  337. sjgl: [[]],
  338. llgl: [[]],
  339. cpz: [[]],
  340. };
  341. let chartResponse = null;
  342. if (obj.type === "fitting") {
  343. chartResponse = await httpRequest.get("/temperature/curve/analysis", {
  344. params: {
  345. id: obj.id,
  346. p: 1,
  347. },
  348. });
  349. }
  350. if (chartResponse && chartResponse.code === 200) {
  351. chartRes = chartResponse.data;
  352. maxMinData.value = [chartRes.maxhjwd, chartRes.minhjwd];
  353. markDot.pcl5 = chartRes.obj.pc5ratio;
  354. markDot.pcl10 = chartRes.obj.pc10ratio;
  355. markDot.pcl12 = chartRes.obj.pc12ratio;
  356. markDot.pcl25 = chartRes.obj.pc25ratio;
  357. avgObj.title = chartRes.obj.path
  358. .substring(
  359. chartRes.obj.path.indexOf(chartRes.obj.station + "_") +
  360. (chartRes.obj.station + "_").length
  361. )
  362. .split("_")[0];
  363. avgObj.cpavg = Number(chartRes.obj.cpavg).toFixed(2);
  364. avgObj.frequency = Number(chartRes.obj.frequency).toFixed(2);
  365. avgObj.pcratio = Number(chartRes.obj.pcratio).toFixed(2);
  366. const color = [
  367. "#1C99FF",
  368. "#FF8700",
  369. "#3D54BE",
  370. "#fa8c16",
  371. "#1DA0D7",
  372. "#DD5044",
  373. ];
  374. seriesData.value = [
  375. {
  376. name: "拟合功率",
  377. type: "line",
  378. symbol: "line", //设定为实心点
  379. symbolSize: 0, //设定实心点的大小
  380. smooth: true, //这个是把线变成曲线
  381. data: chartRes.sjgl,
  382. xAxisIndex: 0,
  383. },
  384. {
  385. name: "保证功率",
  386. type: "line",
  387. symbol: "line", //设定为实心点
  388. symbolSize: 0, //设定实心点的大小
  389. smooth: true, //这个是把线变成曲线
  390. data: chartRes.llgl,
  391. xAxisIndex: 0,
  392. },
  393. {
  394. type: "effectScatter",
  395. showEffectOn: "emphasis",
  396. rippleEffect: {
  397. scale: 1,
  398. },
  399. name: "数据散点",
  400. symbolSize: 5,
  401. // symbolSize: (data) => {
  402. // return data.s ? data.s > 10 ? 10 : data.s : 4
  403. // },
  404. // datasetIndex: 1,
  405. // encode: {
  406. // x: 'x',
  407. // y: 'y'
  408. // },
  409. data: chartRes.scatter,
  410. xAxisIndex: 0,
  411. yAxisIndex: 0,
  412. },
  413. ];
  414. }
  415. };
  416. const funExcelCheckChange = ({ checkArr, data }) => {
  417. excelCheckIds.value = checkArr;
  418. };
  419. /**prepare tree 开始 */
  420. const treeData = ref([]);
  421. const actTreeNode = ref(null); //当前激活的treeNode
  422. const funRepeatMap = (arr) => {
  423. return arr.map((o) => {
  424. if (o.children) {
  425. const findIndex = o.children.findIndex((p) => !!p.type);
  426. if (findIndex !== -1) {
  427. o.childs = o.children;
  428. o.children = [];
  429. if (!actTreeNode.value) {
  430. //判断当且仅有process获取tree时 赋值
  431. actTreeNode.value = o;
  432. }
  433. }
  434. }
  435. return {
  436. ...o,
  437. children: o.children ? funRepeatMap(o.children) : [],
  438. };
  439. });
  440. };
  441. const funCurrentChange = ({ current, currentNode }) => {
  442. excelCheckboxShow.value = true;
  443. if (current.childs) {
  444. excelList.value = current.childs.map((o) => {
  445. return {
  446. id: o.id,
  447. interval: o.interval,
  448. path: o.path,
  449. prepareid: o.prepareid,
  450. station: o.station,
  451. time: o.time,
  452. type: o.type,
  453. windturbine: o.windturbine,
  454. name: o.path.substring(
  455. o.path.indexOf(o.station + "_") + (o.station + "_").length
  456. ),
  457. };
  458. });
  459. } else {
  460. excelList.value = [];
  461. }
  462. };
  463. /**process tree 开始 */
  464. const processTreeData = ref([]);
  465. const funGetProcessTree = async () => {
  466. //flag控制是否获取tree的第一项 true为可获取
  467. actTreeNode.value = null;
  468. const res = await httpRequest.get("/power/fitting/tree");
  469. excelList.value = [];
  470. processTreeData.value = funRepeatMap(res.data); //flag控制对actTreeNode赋值
  471. if (actTreeNode.value) {
  472. funProcessCurrentChange({
  473. current: actTreeNode.value,
  474. currentNode: null,
  475. });
  476. const child = actTreeNode.value.childs[0];
  477. const obj = {
  478. id: child.id,
  479. interval: child.interval,
  480. path: child.path,
  481. prepareid: child.prepareid,
  482. station: child.station,
  483. time: child.time,
  484. type: child.type,
  485. windturbine: child.windturbine,
  486. name: child.path.substring(
  487. child.path.indexOf(child.station + "_") + (child.station + "_").length
  488. ),
  489. };
  490. currentNodeKey.value = actTreeNode.value?.id || "";
  491. funExcelChange(obj);
  492. }
  493. };
  494. const funProcessCurrentChange = ({ current, currentNode }) => {
  495. if (current.childs) {
  496. excelList.value = current.childs.map((o) => {
  497. return {
  498. id: o.id,
  499. interval: o.interval,
  500. path: o.path,
  501. prepareid: o.prepareid,
  502. station: o.station,
  503. time: o.time,
  504. type: o.type,
  505. windturbine: o.windturbine,
  506. name: o.path.substring(
  507. o.path.indexOf(o.station + "_") + (o.station + "_").length
  508. ),
  509. };
  510. });
  511. if (excelList.value.length > 0) {
  512. funExcelChange(excelList.value[0]);
  513. }
  514. } else {
  515. excelList.value = [];
  516. }
  517. };
  518. /**chart */
  519. let chartId = 1;
  520. const powerproductionNum = ref(0);
  521. /**search 开始 */
  522. const funSubmit = async () => {
  523. const tempRes = await httpRequest.get("/temperature/rated/power", {
  524. params: {
  525. ids: excelCheckIds.value.join(","),
  526. },
  527. });
  528. if (tempRes.code === 200) {
  529. if (tempRes.data.length) {
  530. for (const chart of tempRes.data) {
  531. powerproduction.value = `(额定功率=${chart.power.powerProduction}kW)`;
  532. powerproductionNum.value = chart.power.powerProduction;
  533. barxAxis.data = Object.keys(chart.res1);
  534. barSeries[0].data = Object.values(chart.res1);
  535. barSeries[0].markLine.data = [
  536. {
  537. yAxis: 0,
  538. },
  539. ];
  540. chartId++;
  541. lineSeries.value = [
  542. {
  543. type: "effectScatter",
  544. showEffectOn: "emphasis",
  545. rippleEffect: {
  546. scale: 1,
  547. },
  548. legendHoverLink: false,
  549. name: "",
  550. symbolSize: 5,
  551. data: chart.res2,
  552. yAxisIndex: 0,
  553. markLine: {
  554. symbol: "none",
  555. label: {
  556. show: false,
  557. },
  558. lineStyle: {
  559. color: "#F72C5B",
  560. },
  561. data: [
  562. {
  563. yAxis: powerproductionNum.value,
  564. },
  565. ],
  566. },
  567. },
  568. ];
  569. chartId++;
  570. }
  571. }
  572. }
  573. };
  574. /**lineChart */
  575. const linexAxis = reactive({
  576. type: "value",
  577. name: "°C",
  578. splitLine: {
  579. show: false,
  580. },
  581. axisTick: {
  582. show: true,
  583. },
  584. axisLine: {
  585. onZero: false,
  586. },
  587. });
  588. const lineyAxis = reactive([
  589. {
  590. type: "value",
  591. name: "kW",
  592. splitLine: {
  593. show: false,
  594. },
  595. axisTick: {
  596. show: true,
  597. },
  598. axisLine: {
  599. onZero: false,
  600. },
  601. },
  602. ]);
  603. const lineSeries = ref([]);
  604. const lineDataSet = reactive([
  605. {
  606. source: [],
  607. },
  608. ]);
  609. // 圈选散点触发函数
  610. const funChartSelect = async (batch) => {
  611. const wDataArr = [];
  612. const yDataArr = [];
  613. let scatterls = [];
  614. let dataSetObj = [];
  615. wtData.value = [];
  616. if (batch.length && actCopList.value[0].dataset) {
  617. scatterls = batch[0].selected[1].dataIndex;
  618. if (scatterls.length) {
  619. dataSetObj = JSON.parse(actCopList.value[0].dataset);
  620. if (scatterls.length) {
  621. for (const scatterIndex of scatterls) {
  622. wDataArr.push(dataSetObj[0].source[scatterIndex].k);
  623. }
  624. }
  625. const wtRes = await httpRequest.get("/power/fitting/filter", {
  626. params: {
  627. yk: yDataArr.join(","),
  628. wk: wDataArr.join(","),
  629. },
  630. });
  631. if (wtRes.code === 200) {
  632. let id = 1;
  633. const tempArr = []; //用于以风机id 聚合dataArr
  634. if (wtRes.data.length) {
  635. for (const data of wtRes.data) {
  636. if (tempArr.length) {
  637. const findIndex = tempArr.findIndex((o) => o.wtId === data.wtId);
  638. if (findIndex !== -1) {
  639. if (!tempArr[findIndex].children) {
  640. tempArr[findIndex].children = [];
  641. }
  642. tempArr[findIndex].children.push({
  643. ...data,
  644. id: id,
  645. filter: data.filter === 0 ? "是" : "否",
  646. });
  647. id++;
  648. } else {
  649. tempArr.push({
  650. ...data,
  651. id: id,
  652. filter: data.filter === 0 ? "是" : "否",
  653. });
  654. id++;
  655. }
  656. } else {
  657. tempArr.push({
  658. ...data,
  659. id: id,
  660. filter: data.filter === 0 ? "是" : "否",
  661. });
  662. id++;
  663. }
  664. }
  665. wtDialog.value = true;
  666. nextTick(() => {
  667. wtTab.value = "table";
  668. wtData.value = tempArr;
  669. });
  670. }
  671. }
  672. }
  673. }
  674. };
  675. /**barChart */
  676. const barxAxis = reactive({
  677. type: "category",
  678. name: "℃",
  679. data: [],
  680. splitLine: {
  681. show: false,
  682. },
  683. axisTick: {
  684. show: true,
  685. },
  686. axisLine: {
  687. onZero: false,
  688. },
  689. });
  690. const baryAxis = reactive({
  691. type: "value",
  692. name: "kW",
  693. splitLine: {
  694. show: false,
  695. },
  696. axisTick: {
  697. show: true,
  698. },
  699. axisLine: {
  700. onZero: false,
  701. },
  702. });
  703. const barSeries = reactive([
  704. {
  705. name: "",
  706. type: "bar",
  707. data: [],
  708. markLine: {
  709. symbol: "none",
  710. label: {
  711. show: false,
  712. },
  713. lineStyle: {
  714. color: "#F72C5B",
  715. },
  716. data: [],
  717. },
  718. },
  719. ]);
  720. /**chart Data */
  721. const avgObj = reactive({
  722. //平均cpz等
  723. title: "",
  724. cpavg: "",
  725. frequency: "",
  726. pcratio: "",
  727. });
  728. const markDot = reactive({
  729. //3-5 point点等
  730. pcl5: null,
  731. pcl10: null,
  732. pcl12: null,
  733. pcl25: null,
  734. });
  735. const xAxisData = ref([]);
  736. const chartRef = ref(); //chart 的ref
  737. const seriesData = ref([]);
  738. const maxMinData = ref([]);
  739. const isChartArea = ref(false); // 用来控制图表是否区域划分
  740. const dataSet = ref("");
  741. const funhotChartSelect = async (batch) => {
  742. const wDataArr = [];
  743. const yDataArr = [];
  744. let scatterls = [];
  745. let scatterhs = [];
  746. let dataSetObj = [];
  747. wtData.value = [];
  748. if (batch.length && dataSet.value) {
  749. scatterls = batch[0].selected[2].dataIndex;
  750. scatterhs = batch[0].selected[3].dataIndex;
  751. if (scatterls.length || scatterhs.length) {
  752. dataSetObj = JSON.parse(dataSet.value);
  753. if (scatterls.length) {
  754. for (const scatterIndex of scatterls) {
  755. wDataArr.push(dataSetObj[0].source[scatterIndex].k);
  756. }
  757. }
  758. if (scatterhs.length) {
  759. for (const scatterIndex of scatterhs) {
  760. yDataArr.push(dataSetObj[1].source[scatterIndex].k);
  761. }
  762. }
  763. const wtRes = await httpRequest.get("/power/fitting/filter", {
  764. params: {
  765. yk: yDataArr.join(","),
  766. wk: wDataArr.join(","),
  767. },
  768. });
  769. if (wtRes.code === 200) {
  770. let id = 1;
  771. const tempArr = []; //用于以风机id 聚合dataArr
  772. if (wtRes.data.length) {
  773. for (const data of wtRes.data) {
  774. if (tempArr.length) {
  775. const findIndex = tempArr.findIndex((o) => o.wtId === data.wtId);
  776. if (findIndex !== -1) {
  777. if (!tempArr[findIndex].children) {
  778. tempArr[findIndex].children = [];
  779. }
  780. tempArr[findIndex].children.push({
  781. ...data,
  782. id: id,
  783. filter: data.filter === 0 ? "是" : "否",
  784. });
  785. id++;
  786. } else {
  787. tempArr.push({
  788. ...data,
  789. id: id,
  790. filter: data.filter === 0 ? "是" : "否",
  791. });
  792. id++;
  793. }
  794. } else {
  795. tempArr.push({
  796. ...data,
  797. id: id,
  798. filter: data.filter === 0 ? "是" : "否",
  799. });
  800. id++;
  801. }
  802. }
  803. wtDialog.value = true;
  804. nextTick(() => {
  805. wtTab.value = "table";
  806. wtData.value = tempArr;
  807. });
  808. }
  809. }
  810. }
  811. }
  812. };
  813. const funChartArea = () => {
  814. if (seriesData.value.length) {
  815. if (!isChartArea.value) {
  816. // 请求一下
  817. seriesData.value[0] = {
  818. ...seriesData.value[0],
  819. markLine: {
  820. symbol: "none",
  821. label: {
  822. show: false,
  823. },
  824. lineStyle: {
  825. color: "rgba(96,174,255, 1)",
  826. },
  827. data: [
  828. {
  829. xAxis: 3,
  830. valueIndex: 0,
  831. },
  832. {
  833. xAxis: 5,
  834. valueIndex: 0,
  835. },
  836. {
  837. xAxis: 10,
  838. valueIndex: 0,
  839. },
  840. {
  841. xAxis: 12,
  842. valueIndex: 0,
  843. },
  844. {
  845. xAxis: 25,
  846. valueIndex: 0,
  847. },
  848. ],
  849. },
  850. markArea: {
  851. label: {
  852. fontSize: util.vh(12),
  853. },
  854. itemStyle: {
  855. color: "rgba(236,245,255, 0)",
  856. },
  857. emphasis: {
  858. itemStyle: {
  859. color: "rgba(96,174,255, 0.5)",
  860. },
  861. },
  862. data: [
  863. [
  864. {
  865. name: `3~5m 偏差率: ${markDot.pcl5}%`,
  866. xAxis: 3,
  867. },
  868. {
  869. xAxis: 5,
  870. },
  871. ],
  872. [
  873. {
  874. name: `5~10m 偏差率: ${markDot.pcl10}%`,
  875. xAxis: 5,
  876. },
  877. {
  878. xAxis: 10,
  879. },
  880. ],
  881. [
  882. {
  883. name: `10~12m 偏差率: ${markDot.pcl12}%`,
  884. xAxis: 10,
  885. },
  886. {
  887. xAxis: 12,
  888. },
  889. ],
  890. [
  891. {
  892. name: `12~25m 偏差率: ${markDot.pcl25}%`,
  893. xAxis: 12,
  894. },
  895. {
  896. xAxis: 25,
  897. },
  898. ],
  899. ],
  900. },
  901. };
  902. isChartArea.value = true;
  903. } else {
  904. seriesData.value[0] = {
  905. ...seriesData.value[0],
  906. markLine: null,
  907. markArea: null,
  908. };
  909. isChartArea.value = false;
  910. }
  911. }
  912. };
  913. /**dialog 数据 */
  914. const wtDialog = ref(false);
  915. const wtData = ref([]);
  916. const wtTab = ref("table");
  917. /**dialog */
  918. const dialog = ref(false);
  919. const actChartName = ref("");
  920. const actDiaTitle = ref("");
  921. const diaPanelRef = ref();
  922. const exportLoading = ref(false);
  923. const actCopList = ref([
  924. // {
  925. // xAxis: [],
  926. // subtext: '',
  927. // title: '',
  928. // isRadar: false,
  929. // series: [],
  930. // yAxis: [],
  931. // dataset: []
  932. // }
  933. ]);
  934. // 作为actCopList的备份 在actCopList赋值多个时 同时赋值, 在dialog弹出时清空. 作用: 在actCopList变化时, 重新赋值原始数据
  935. const actCopListBak = ref([]);
  936. const checkAll = ref(true);
  937. const queryForm = reactive({
  938. checkIds: [],
  939. });
  940. const funCheckAll = () => {
  941. checkAll.value = !checkAll.value;
  942. if (checkAll.value) {
  943. queryForm.checkIds = chartExcelList.value.map((o) => o.id);
  944. } else {
  945. queryForm.checkIds = [];
  946. }
  947. };
  948. const chartExcelList = ref([]); //dialog 下拉项
  949. const funActCop = (obj, type) => {
  950. switch (type) {
  951. case "barChartCop":
  952. actChartName.value = "barChartCop";
  953. obj.actCop = shallowRef(barChartCop);
  954. actDiaTitle.value = "平均功率-额定功率";
  955. break;
  956. case "lineChartCop":
  957. actChartName.value = "lineChartCop";
  958. obj.actCop = shallowRef(lineChartCop);
  959. actDiaTitle.value = "额定功率温度分析";
  960. break;
  961. // case 'CurrentScatterChartCop':
  962. // actChartName.value = 'CurrentScatterChartCop'
  963. // obj.actCop = shallowRef(CurrentScatte // console.log(res)rChartCop)
  964. // actDiaTitle.value = '静态偏航对风分析图'
  965. // break
  966. }
  967. obj.isBrush = false;
  968. obj.id = chartId;
  969. chartId++;
  970. dialog.value = true;
  971. actCopListBak.value = [];
  972. nextTick(() => {
  973. actCopList.value = [obj];
  974. });
  975. };
  976. const funDiaSubmit = async () => {
  977. let url = "";
  978. switch (actChartName.value) {
  979. case "barChartCop":
  980. url = "/temperature/rated/power";
  981. break;
  982. case "lineChartCop":
  983. url = "/temperature/rated/power";
  984. break;
  985. // case 'CurrentScatterChartCop':
  986. // url = '' //暂无接口
  987. // break
  988. }
  989. if (url) {
  990. const res = await httpRequest.get(url, {
  991. params: {
  992. ids: queryForm.checkIds.join(","),
  993. mode: 0,
  994. },
  995. });
  996. if (res.code === 200) {
  997. actCopList.value = [];
  998. actCopListBak.value = []; //清空备份
  999. if (res.data.length) {
  1000. for (const chart of res.data) {
  1001. if (actChartName.value === "barChartCop") {
  1002. actCopList.value.push({
  1003. id: chartId,
  1004. isBrush: false,
  1005. actCop: shallowRef(barChartCop),
  1006. title: chart.wt,
  1007. subtext: `平均功率-额定功率(额定功率=${chart.power.powerProduction}kW)`,
  1008. xAxis: {
  1009. ...barxAxis,
  1010. data: Object.keys(chart.res1),
  1011. },
  1012. yAxis: baryAxis,
  1013. series: [
  1014. {
  1015. name: "",
  1016. type: "bar",
  1017. data: Object.values(chart.res1),
  1018. markLine: {
  1019. symbol: "none",
  1020. label: {
  1021. show: false,
  1022. },
  1023. lineStyle: {
  1024. color: "#F72C5B",
  1025. },
  1026. data: [
  1027. {
  1028. yAxis: 0,
  1029. },
  1030. ],
  1031. },
  1032. },
  1033. ],
  1034. });
  1035. chartId++;
  1036. }
  1037. if (actChartName.value === "lineChartCop") {
  1038. actCopList.value.push({
  1039. id: chartId,
  1040. isBrush: false,
  1041. actCop: shallowRef(lineChartCop),
  1042. title: chart.wt,
  1043. subtext: `额定功率温度分析(额定功率=${chart.power.powerProduction}kW)`,
  1044. xAxis: linexAxis,
  1045. yAxis: lineyAxis,
  1046. dataset: lineDataSet,
  1047. series: [
  1048. {
  1049. type: "effectScatter",
  1050. showEffectOn: "emphasis",
  1051. rippleEffect: {
  1052. scale: 1,
  1053. },
  1054. legendHoverLink: false,
  1055. name: "",
  1056. symbolSize: 5,
  1057. data: chart.res2,
  1058. yAxisIndex: 0,
  1059. markLine: {
  1060. symbol: "none",
  1061. label: {
  1062. show: false,
  1063. },
  1064. lineStyle: {
  1065. color: "#F72C5B",
  1066. },
  1067. data: [
  1068. {
  1069. yAxis: chart.power.powerProduction,
  1070. },
  1071. ],
  1072. },
  1073. },
  1074. ],
  1075. });
  1076. chartId++;
  1077. }
  1078. }
  1079. actCopListBak.value = actCopList.value;
  1080. }
  1081. }
  1082. }
  1083. };
  1084. const funDiaExport = () => {
  1085. exportLoading.value = true;
  1086. tools.scrollToPDF(diaPanelRef.value, actDiaTitle.value, () => {
  1087. exportLoading.value = false;
  1088. });
  1089. };
  1090. const funDbClick = (obj) => {
  1091. if (actCopListBak.value.length > 1) {
  1092. //判断大于1时, 才有双击放大功能
  1093. if (actCopList.value.length === 1) {
  1094. actCopList.value = actCopListBak.value;
  1095. } else {
  1096. actCopList.value = [obj];
  1097. }
  1098. }
  1099. };
  1100. /**tab */
  1101. const activeTab = ref("1");
  1102. /**created */
  1103. // funGetProcessTree()
  1104. const theme = ref(null);
  1105. const echartsTheme = ref("");
  1106. const store = useStore();
  1107. watch(
  1108. () => store.state.theme,
  1109. (newVal, oldVal) => {
  1110. theme.value = newVal;
  1111. echartsTheme.value = !newVal ? "dark" : "";
  1112. funGetProcessTree();
  1113. },
  1114. {
  1115. deep: true,
  1116. }
  1117. );
  1118. const initPageData = () => {
  1119. //flag控制是否获取tree的第一项 true为可获取
  1120. actTreeNode.value = null;
  1121. excelList.value = [];
  1122. processTreeData.value = funRepeatMap(
  1123. JSON.parse(JSON.stringify(jsonData.treeData))
  1124. ); //flag控制对actTreeNode赋值
  1125. if (actTreeNode.value) {
  1126. if (actTreeNode.value.childs) {
  1127. excelList.value = actTreeNode.value.childs.map((o) => {
  1128. return {
  1129. id: o.id,
  1130. interval: o.interval,
  1131. path: o.path,
  1132. prepareid: o.prepareid,
  1133. station: o.station,
  1134. time: o.time,
  1135. type: o.type,
  1136. windturbine: o.windturbine,
  1137. isCheck: false,
  1138. name: o.path.substring(
  1139. o.path.indexOf(o.station + "_") + (o.station + "_").length
  1140. ),
  1141. };
  1142. });
  1143. } else {
  1144. excelList.value = [];
  1145. }
  1146. const child = actTreeNode.value.childs[0];
  1147. const obj = {
  1148. id: child.id,
  1149. interval: child.interval,
  1150. path: child.path,
  1151. prepareid: child.prepareid,
  1152. station: child.station,
  1153. time: child.time,
  1154. type: child.type,
  1155. windturbine: child.windturbine,
  1156. name: child.path.substring(
  1157. child.path.indexOf(child.station + "_") + (child.station + "_").length
  1158. ),
  1159. };
  1160. currentNodeKey.value = actTreeNode.value?.id || "";
  1161. excelCheckIds.value = [obj.id]; //当为单选展示风机图表时
  1162. chartExcelList.value = excelList.value.map((o) => {
  1163. return {
  1164. ...o,
  1165. name: o.name.split("_")[0],
  1166. };
  1167. }); // 选中excel当前项时, excel列表赋值给dialog 下拉框
  1168. queryForm.checkIds = excelList.value.map((o) => o.id);
  1169. checkAll.value = true;
  1170. for (const chart of jsonData.powerData) {
  1171. powerproduction.value = `(额定功率=${chart.power.powerProduction}kW)`;
  1172. powerproductionNum.value = chart.power.powerProduction;
  1173. barxAxis.data = Object.keys(chart.res1);
  1174. barSeries[0].data = Object.values(chart.res1);
  1175. barSeries[0].markLine.data = [
  1176. {
  1177. yAxis: 0,
  1178. },
  1179. ];
  1180. chartId++;
  1181. lineSeries.value = [
  1182. {
  1183. type: "effectScatter",
  1184. showEffectOn: "emphasis",
  1185. rippleEffect: {
  1186. scale: 1,
  1187. },
  1188. legendHoverLink: false,
  1189. name: "",
  1190. symbolSize: 5,
  1191. data: chart.res2,
  1192. yAxisIndex: 0,
  1193. markLine: {
  1194. symbol: "none",
  1195. label: {
  1196. show: false,
  1197. },
  1198. lineStyle: {
  1199. color: "#F72C5B",
  1200. },
  1201. data: [
  1202. {
  1203. yAxis: powerproductionNum.value,
  1204. },
  1205. ],
  1206. },
  1207. },
  1208. ];
  1209. chartId++;
  1210. }
  1211. tableColumn.value = jsonData.tableData.title.map((o) => {
  1212. return {
  1213. prop: o.key,
  1214. label: o.des,
  1215. width: o.des === "时间" ? 100 : 80,
  1216. };
  1217. });
  1218. tableData.value = jsonData.tableData.data;
  1219. /**---------------------------- */
  1220. // activeTab.value = '1'
  1221. isChartArea.value = false;
  1222. const chartRes = jsonData.analysisData;
  1223. maxMinData.value = [chartRes.maxhjwd, chartRes.minhjwd];
  1224. markDot.pcl5 = chartRes.obj.pc5ratio;
  1225. markDot.pcl10 = chartRes.obj.pc10ratio;
  1226. markDot.pcl12 = chartRes.obj.pc12ratio;
  1227. markDot.pcl25 = chartRes.obj.pc25ratio;
  1228. avgObj.title = chartRes.obj.path
  1229. .substring(
  1230. chartRes.obj.path.indexOf(chartRes.obj.station + "_") +
  1231. (chartRes.obj.station + "_").length
  1232. )
  1233. .split("_")[0];
  1234. avgObj.cpavg = Number(chartRes.obj.cpavg).toFixed(2);
  1235. avgObj.frequency = Number(chartRes.obj.frequency).toFixed(2);
  1236. avgObj.pcratio = Number(chartRes.obj.pcratio).toFixed(2);
  1237. const color = [
  1238. "#1C99FF",
  1239. "#FF8700",
  1240. "#3D54BE",
  1241. "#fa8c16",
  1242. "#1DA0D7",
  1243. "#DD5044",
  1244. ];
  1245. seriesData.value = [
  1246. {
  1247. name: "拟合功率",
  1248. type: "line",
  1249. symbol: "line", //设定为实心点
  1250. symbolSize: 0, //设定实心点的大小
  1251. smooth: true, //这个是把线变成曲线
  1252. data: chartRes.sjgl,
  1253. xAxisIndex: 0,
  1254. },
  1255. {
  1256. name: "保证功率",
  1257. type: "line",
  1258. symbol: "line", //设定为实心点
  1259. symbolSize: 0, //设定实心点的大小
  1260. smooth: true, //这个是把线变成曲线
  1261. data: chartRes.llgl,
  1262. xAxisIndex: 0,
  1263. },
  1264. {
  1265. type: "effectScatter",
  1266. showEffectOn: "emphasis",
  1267. rippleEffect: {
  1268. scale: 1,
  1269. },
  1270. name: "数据散点",
  1271. symbolSize: 5,
  1272. // symbolSize: (data) => {
  1273. // return data.s ? data.s > 10 ? 10 : data.s : 4
  1274. // },
  1275. // datasetIndex: 1,
  1276. // encode: {
  1277. // x: 'x',
  1278. // y: 'y'
  1279. // },
  1280. data: chartRes.scatter,
  1281. xAxisIndex: 0,
  1282. yAxisIndex: 0,
  1283. },
  1284. ];
  1285. }
  1286. };
  1287. /**mounted */
  1288. onMounted(() => {
  1289. initPageData();
  1290. funGetProcessTree();
  1291. theme.value = store.state.theme;
  1292. echartsTheme.value = !theme.value ? "dark" : "";
  1293. tableHeight.value = window.innerHeight - 171 + "px";
  1294. excelHeight.value = window.innerHeight - 111 + "px";
  1295. treeHeight.value = window.innerHeight - 111 + "px";
  1296. window.addEventListener("resize", () => {
  1297. tableHeight.value = window.innerHeight - 171 + "px";
  1298. excelHeight.value = window.innerHeight - 111 + "px";
  1299. treeHeight.value = window.innerHeight - 111 + "px";
  1300. });
  1301. /**test */
  1302. // funExcelChange({
  1303. // id: 1,
  1304. // name: 'excel',
  1305. // type: 'fitting',
  1306. // })
  1307. });
  1308. /**activated */
  1309. onActivated(() => {
  1310. // funGetProcessTree()
  1311. });
  1312. </script>
  1313. <style lang="less" scoped>
  1314. .dataAnalysisHotAns {
  1315. height: 100%;
  1316. .dataAnalysisHotAnsMain {
  1317. height: 100%;
  1318. .main_top {
  1319. height: 40px;
  1320. display: flex;
  1321. align-items: center;
  1322. .topPsty {
  1323. position: relative;
  1324. top: 5px;
  1325. padding: 7px 20px;
  1326. font-size: 12px;
  1327. font-weight: 600;
  1328. margin-left: 10px;
  1329. border-radius: 3px;
  1330. }
  1331. }
  1332. .main {
  1333. display: flex;
  1334. width: 100%;
  1335. .treeDataMain,
  1336. .excelDataMain,
  1337. .tableDataMain {
  1338. border-radius: 10px;
  1339. }
  1340. .treeDataMain {
  1341. margin-right: 10px;
  1342. padding: 10px 0 10px 10px;
  1343. width: calc(19% - 20px);
  1344. }
  1345. .excelDataMain {
  1346. margin-right: 10px;
  1347. padding: 10px 0 10px 10px;
  1348. width: calc(15% - 20px);
  1349. }
  1350. .tableDataMain {
  1351. padding: 10px;
  1352. width: calc(66% - 20px);
  1353. position: relative;
  1354. .chartIcon {
  1355. cursor: pointer;
  1356. }
  1357. .butten_com {
  1358. position: absolute;
  1359. right: 20px;
  1360. z-index: 111111;
  1361. }
  1362. }
  1363. }
  1364. }
  1365. }
  1366. .themeDark {
  1367. .dataAnalysisHotAnsMain {
  1368. .main_top {
  1369. .topPsty {
  1370. color: #1c99ff;
  1371. background: #1e2126;
  1372. }
  1373. }
  1374. .main {
  1375. background: #13171e;
  1376. .treeDataMain {
  1377. background: transparent;
  1378. }
  1379. .excelDataMain {
  1380. background: #313233;
  1381. }
  1382. .tableDataMain {
  1383. margin-top: 5px;
  1384. background: #212223;
  1385. }
  1386. }
  1387. }
  1388. }
  1389. .themeLight {
  1390. padding: 0;
  1391. .dataAnalysisHotAnsMain {
  1392. .main_top {
  1393. .topPsty {
  1394. color: #2778ff;
  1395. background: #ffffff;
  1396. }
  1397. }
  1398. .main {
  1399. background: #e6e8f2;
  1400. .treeDataMain {
  1401. background: transparent;
  1402. }
  1403. .excelDataMain {
  1404. background: #f4f6fb;
  1405. }
  1406. .tableDataMain {
  1407. background: #fff;
  1408. margin-top: 5px;
  1409. }
  1410. }
  1411. }
  1412. }
  1413. </style>