vibration.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. <template>
  2. <div class="global-variable">
  3. <div class="head">
  4. <div class="headleft">
  5. <div @click="generate('1')" class="picture">
  6. <img src="@/assets/analyse/03.png" alt="" />
  7. <p>时域图</p>
  8. </div>
  9. <div @click="generate('2')" class="picture">
  10. <img src="@/assets/analyse/04.png" alt="" />
  11. <p>频谱图</p>
  12. </div>
  13. <div @click="generate('3')" class="picture">
  14. <img src="@/assets/analyse/01.png" alt="" />
  15. <p>包络谱图</p>
  16. </div>
  17. <div @click="tendency" class="picture">
  18. <img src="@/assets/analyse/02.png" alt="" />
  19. <p>趋势图</p>
  20. </div>
  21. </div>
  22. <div class="headright">
  23. <img src="@/assets/analyse/07.png" alt="全部缩小" @click="suoxiao" />
  24. <img src="@/assets/analyse/05.png" alt="全部展开" @click="zhankai" />
  25. <img src="@/assets/analyse/06.png" alt="全部关闭" @click="guanbi" />
  26. </div>
  27. </div>
  28. <div class="searchbox">
  29. <p>
  30. 单位:
  31. <selecttree
  32. style="width: 180px"
  33. placeholder="请选择所属公司"
  34. :list="parentOpt"
  35. type="1"
  36. v-model="companyCode"
  37. @change="parentChange"
  38. :defaultParentProps="{
  39. children: 'children',
  40. label: 'companyName',
  41. value: 'codeNumber',
  42. }"
  43. >
  44. </selecttree>
  45. </p>
  46. <p>
  47. 风机:
  48. <el-select
  49. style="width: 150px"
  50. v-model="unitvalue"
  51. @change="getchedian"
  52. placeholder="请选择"
  53. >
  54. <el-option
  55. v-for="item in unitoptions"
  56. :key="item.engineCode"
  57. :label="item.engineName"
  58. :value="item.engineCode"
  59. >
  60. </el-option>
  61. </el-select>
  62. </p>
  63. <p>
  64. 测点:
  65. <el-select v-model="monitoringvalue" clearable placeholder="请选择">
  66. <el-option
  67. v-for="item in monitoringoptions"
  68. :key="item.detectionPointEn"
  69. :label="item.detectionPointCn"
  70. :value="item.detectionPointEn"
  71. >
  72. </el-option>
  73. </el-select>
  74. </p>
  75. <p>
  76. 时间:
  77. <el-date-picker
  78. v-model="timevalue"
  79. type="datetimerange"
  80. range-separator="至"
  81. start-placeholder="开始日期"
  82. end-placeholder="结束日期"
  83. >
  84. </el-date-picker>
  85. </p>
  86. <el-button type="primary" size="small" @click="conditions"
  87. >查询</el-button
  88. >
  89. <el-button size="small" @click="outputFile">导出</el-button>
  90. </div>
  91. <div class="main-body">
  92. <div class="data-map">
  93. <div
  94. class="chart-area"
  95. v-for="(item, index) in fourList"
  96. :key="item.index"
  97. @mouseover="setCurrent(item.rowData)"
  98. @mouseleave="setCurrent(oldCurrentRow)"
  99. >
  100. <div class="dialog-actions">
  101. <p>{{ item.name }}</p>
  102. <span>
  103. <i
  104. class="el-icon-minus"
  105. @click="lessen(index)"
  106. style="cursor: pointer; margin-right: 10px"
  107. ></i>
  108. <i
  109. class="el-icon-full-screen"
  110. @click="amplifier(index)"
  111. style="cursor: pointer; margin-right: 10px"
  112. ></i>
  113. <i
  114. class="el-icon-close"
  115. @click="close(index)"
  116. style="cursor: pointer"
  117. ></i>
  118. </span>
  119. </div>
  120. <div
  121. class="subject"
  122. :class="{
  123. minimized: item.isMinimized,
  124. }"
  125. v-loading="item.loading"
  126. >
  127. <!-- {{ item.rowData }} -->
  128. <p v-if="item.name != '趋势图'">
  129. 测点路径:{{
  130. getDetectionPointCn(item?.rowData?.mesurePointName)
  131. }}-{{ item?.rowData?.windTurbineNumber }}
  132. <span>采样频率: {{ item?.rowData?.samplingFrequency }}(Hz)</span>
  133. <span
  134. >发电机转速: {{ item?.rowData?.rotationalSpeed }}(rpm)
  135. </span>
  136. <span>采样时间: {{ item?.rowData?.timeStamp }} </span>
  137. <!-- <span>有效值: {{XrmsValue}} (m/s2)</span> -->
  138. </p>
  139. <!-- {{ samplingTime }} -->
  140. <div v-if="item.name === '时域图'">
  141. <timedomaincharts
  142. :timeListTwo="item.timeListTwo"
  143. :currentIndex="currentIndex"
  144. :activeIndex="index"
  145. :tableDataList="tableDataList"
  146. :ids="[currentRow.id]"
  147. :currentRow="currentRow"
  148. :windCode="windCode"
  149. @update:currentIndex="handleCurrentIndexUpdate"
  150. @update-previous-row="goToPreviousRow"
  151. @update-next-row="goToNextRow"
  152. @handleLoading="handleLoading"
  153. ></timedomaincharts>
  154. </div>
  155. <div v-if="item.name === '频谱图'">
  156. <spectrogramcharts
  157. @updateXrms="handleXrmsUpdate"
  158. :spectrumListTwo="item.spectrumListTwo"
  159. :currentIndex="currentIndex"
  160. :tableDataList="tableDataList"
  161. :activeIndex="index"
  162. :ids="[currentRow.id]"
  163. :currentRow="currentRow"
  164. :windCode="windCode"
  165. @update:currentIndex="handleCurrentIndexUpdate"
  166. @update-previous-row="goToPreviousRow"
  167. @update-next-row="goToNextRow"
  168. @handleLoading="handleLoading"
  169. ></spectrogramcharts>
  170. </div>
  171. <div v-if="item.name === '包络谱图'">
  172. <envelopecharts
  173. @updateXrms="handleXrmsUpdate"
  174. :envelopeListTwo="item.envelopeListTwo"
  175. :currentIndex="currentIndex"
  176. :tableDataList="tableDataList"
  177. :activeIndex="index"
  178. :currentRow="currentRow"
  179. :ids="[currentRow.id]"
  180. :windCode="windCode"
  181. @update:currentIndex="handleCurrentIndexUpdate"
  182. @update-previous-row="goToPreviousRow"
  183. @update-next-row="goToNextRow"
  184. @update:modelValue="handleModelUpdate"
  185. @handleLoading="handleLoading"
  186. ></envelopecharts>
  187. </div>
  188. <div v-if="item.name === '趋势图'">
  189. <tendencycharts
  190. :qsList="qsList"
  191. :activeIndex="index"
  192. ></tendencycharts>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <div class="data-origin">
  198. <el-table
  199. height="600"
  200. ref="singleTable"
  201. :data="tableDataList"
  202. :current-row-key="currentIndex"
  203. @current-change="handleCurrentChange"
  204. highlight-current-row
  205. style="width: 100%"
  206. :row-class-name="tableRowClassName"
  207. id="Table1"
  208. >
  209. <el-table-column type="index" label="排序" fixed> </el-table-column>
  210. <el-table-column prop="timeStamp" label="采样时间" width="180px">
  211. </el-table-column>
  212. <el-table-column
  213. prop="mesurePointName"
  214. label="测点名称"
  215. width="150px"
  216. >
  217. <template slot-scope="scope">
  218. {{ getDetectionPointCn(scope.row.mesurePointName) }}
  219. </template>
  220. </el-table-column>
  221. <!-- <el-table-column prop="companyName" label="场站">
  222. {{ getCompanyLabel(scope.row.companyCode) }}
  223. </el-table-column> -->
  224. <el-table-column prop="windTurbineNumber" label="风机" width="120px">
  225. </el-table-column>
  226. <el-table-column
  227. prop="samplingFrequency"
  228. label="采样频率(Hz)"
  229. align="center"
  230. width="120px"
  231. >
  232. </el-table-column>
  233. <el-table-column
  234. prop="rotationalSpeed"
  235. label="发电机转速(rpm)"
  236. align="center"
  237. width="150px"
  238. >
  239. </el-table-column>
  240. </el-table>
  241. </div>
  242. </div>
  243. </div>
  244. </template>
  245. <script>
  246. import * as FileSaver from "file-saver";
  247. import * as XLSX from "xlsx";
  248. import {
  249. getSysOrganizationAuthTreeByRoleId,
  250. windEngineGrouPage,
  251. queryDetectionDic,
  252. } from "@/api/ledger.js";
  253. import selecttree from "../../components/selecttree.vue";
  254. import envelopecharts from "./components/envelopecharts.vue";
  255. import spectrogramcharts from "./components/spectrogramcharts.vue";
  256. import tendencycharts from "./components/tendencycharts.vue";
  257. import timedomaincharts from "./components/timedomaincharts.vue";
  258. import axios from "axios";
  259. export default {
  260. components: {
  261. envelopecharts,
  262. spectrogramcharts,
  263. tendencycharts,
  264. timedomaincharts,
  265. selecttree,
  266. },
  267. data() {
  268. return {
  269. chartData: [],
  270. chartLabels: [],
  271. unitvale: "",
  272. company: "",
  273. companyoptions: [],
  274. unitvalue: "",
  275. unitoptions: [],
  276. monitoringvalue: "",
  277. monitoringoptions: [
  278. // {
  279. // detectionPointEn: "name",
  280. // detectionPointCn: "中文",
  281. // },
  282. ],
  283. fourList: [],
  284. currentRow: null, // 用于存储当前选中的行
  285. currentIndex: 0,
  286. isChartVisible: false,
  287. parentOpt: [],
  288. defaultdata: {},
  289. companyCode: "",
  290. windCode: "",
  291. maplist: {},
  292. timevalue: [], // 绑定 el-date-picker 的值
  293. startTime: "", // 开始时间
  294. endTime: "", // 结束时间
  295. tableDataList: [],
  296. samplingTime: "", // 采样时间
  297. timeListTwo: {},
  298. spectrumList: {},
  299. envelopeList: {},
  300. qsList: {},
  301. CdNamw: "",
  302. chartsData: {},
  303. shuju: {},
  304. spectrumListTwo: {},
  305. envelopeListTwo: {},
  306. oldCurrentRow: {},
  307. XrmsValue: 0, // 默认值
  308. };
  309. },
  310. created() {
  311. this.GETtree();
  312. },
  313. watch: {
  314. // 监听 timeList 的变化
  315. currentRow(newVal, oldVal) {
  316. if (newVal) {
  317. // console.log(newVal, oldVal);
  318. this.oldCurrentRow = oldVal;
  319. } else {
  320. console.error("currentRow is undefined or null");
  321. }
  322. },
  323. },
  324. methods: {
  325. handleXrmsUpdate(value) {
  326. this.XrmsValue = value; // 更新有效值
  327. },
  328. handleLoading(currentRow, loading, activeIndex, params) {
  329. if (loading) {
  330. this.$set(this.fourList[activeIndex], "loading", loading);
  331. return;
  332. }
  333. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  334. this.$set(this.fourList[activeIndex], "loading", false);
  335. },
  336. onRowClick(row) {
  337. this.currentRow = row; // 选中行数据
  338. },
  339. getDetectionPointCn(detectionPointEn) {
  340. const point = this.monitoringoptions?.find(
  341. (option) => option.detectionPointEn === detectionPointEn
  342. );
  343. return point ? point?.detectionPointCn : null; // 如果没有找到对应项,返回 null
  344. },
  345. getCompanyLabel(companyCode) {
  346. const selectedOption = this.parentOpt?.find(
  347. (option) => option.codeNumber === companyCode
  348. );
  349. return selectedOption ? selectedOption.companyName : ""; // Return companyName or empty string if not found
  350. },
  351. // 获取风场
  352. async GETtree() {
  353. const res = await getSysOrganizationAuthTreeByRoleId();
  354. const treedata = res.data;
  355. const processedData = this.processTreeData(treedata);
  356. this.parentOpt = processedData;
  357. this.defaultdata = res.data[0];
  358. },
  359. parentChange(data) {
  360. this.maplist = data;
  361. this.maplistArr = data;
  362. let paramsData = {
  363. fieldCode: this.maplist.codeNumber,
  364. pageNum: 1,
  365. pageSize: 99,
  366. };
  367. this.unitvalue = "";
  368. // 获取风机
  369. windEngineGrouPage(paramsData).then((res) => {
  370. this.unitoptions = res.data.list;
  371. this.windCode = this.companyCode;
  372. });
  373. if (data.codeType === "field") {
  374. if (this.parseCoordinates(data.longitudeAndLatitudeString).length > 0) {
  375. return;
  376. }
  377. } else {
  378. const dataMapList = data.children;
  379. dataMapList.forEach((element) => {
  380. if (
  381. this.parseCoordinates(element.longitudeAndLatitudeString).length >
  382. 0 &&
  383. element.codeType === "field"
  384. ) {
  385. return;
  386. }
  387. });
  388. }
  389. },
  390. processTreeData(treeData) {
  391. const processedData = [];
  392. function processNode(node) {
  393. if (node.codeType === "field") {
  394. node.companyName = node.fieldName;
  395. }
  396. if (node.children && node.children.length > 0) {
  397. node.children.forEach((child) => {
  398. processNode(child);
  399. });
  400. }
  401. }
  402. treeData.forEach((root) => {
  403. processNode(root);
  404. processedData.push(root);
  405. });
  406. return processedData;
  407. },
  408. parseCoordinates(input) {
  409. if (input && typeof input === "string") {
  410. return input.split(",").map(Number);
  411. }
  412. // debugger;
  413. return [];
  414. },
  415. // 获取测点
  416. getchedian(value) {
  417. queryDetectionDic({ engineCodes: value }).then((res) => {
  418. this.monitoringoptions = res.data;
  419. });
  420. },
  421. handleModelUpdate(data) {
  422. // 将子组件的值作为查询参数传递给查询接口
  423. this.xiaoval = data.xiaoval;
  424. this.daval = data.daval;
  425. },
  426. // 上一条数据
  427. goToPreviousRow(type, activeIndex) {
  428. if (this.tableDataList.length === 0) return;
  429. // 更新当前索引,向前循环
  430. this.currentIndex =
  431. this.currentIndex === 0
  432. ? this.tableDataList.length - 1
  433. : this.currentIndex - 1;
  434. const currentRow = this.tableDataList[this.currentIndex];
  435. this.setCurrent(currentRow);
  436. const params = {
  437. ids: currentRow.id,
  438. windCode: this.companyCode,
  439. // windCode: "SKF001",
  440. };
  441. // 根据type加载不同的数据
  442. if (type === 1) {
  443. // Type 1: 加载时域数据
  444. this.$set(this.fourList[activeIndex], "loading", true);
  445. params.analysisType = "time";
  446. axios
  447. .post("/WJapi/analysis/time", params)
  448. .then((res) => {
  449. const timeListTwo = JSON.parse(res.data);
  450. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  451. this.$set(this.fourList[activeIndex], "timeListTwo", timeListTwo);
  452. })
  453. .catch((error) => {
  454. console.error("Error fetching time domain data:", error);
  455. })
  456. .finally(() => {
  457. this.$set(this.fourList[activeIndex], "loading", false);
  458. });
  459. } else if (type === 2) {
  460. // Type 2: 加载频域数据
  461. this.$set(this.fourList[activeIndex], "loading", true);
  462. params.analysisType = "frequency";
  463. axios
  464. .post("/WJapi/analysis/frequency", params)
  465. .then((res) => {
  466. const spectrumListTwo = JSON.parse(res.data);
  467. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  468. this.$set(
  469. this.fourList[activeIndex],
  470. "spectrumListTwo",
  471. spectrumListTwo
  472. );
  473. })
  474. .catch((error) => {
  475. console.error("Error fetching frequency domain data:", error);
  476. })
  477. .finally(() => {
  478. this.$set(this.fourList[activeIndex], "loading", false);
  479. });
  480. } else if (type === 3) {
  481. // Type 3: 加载包络分析数据
  482. this.$set(this.fourList[activeIndex], "loading", true);
  483. params.analysisType = "envelope";
  484. params.fmin = this.xiaoval; // 最小频率参数
  485. params.fmax = this.daval; // 最大频率参数
  486. axios
  487. .post("/WJapi/analysis/envelope", params)
  488. .then((res) => {
  489. const envelopeListTwo = JSON.parse(res.data);
  490. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  491. this.$set(
  492. this.fourList[activeIndex],
  493. "envelopeListTwo",
  494. envelopeListTwo
  495. );
  496. })
  497. .catch((error) => {
  498. console.error("Error fetching envelope analysis data:", error);
  499. })
  500. .finally(() => {
  501. this.$set(this.fourList[activeIndex], "loading", false);
  502. });
  503. } else {
  504. console.warn("Unknown type provided:", type);
  505. }
  506. },
  507. // 下一条数据,向后循环
  508. goToNextRow(type, activeIndex) {
  509. if (this.tableDataList.length === 0) return;
  510. // 更新当前索引
  511. this.currentIndex =
  512. this.currentIndex === this.tableDataList.length - 1
  513. ? 0
  514. : this.currentIndex + 1;
  515. const currentRow = this.tableDataList[this.currentIndex];
  516. this.setCurrent(currentRow);
  517. const params = {
  518. ids: currentRow.id,
  519. // windCode: "SKF001",
  520. windCode: this.companyCode,
  521. };
  522. // 根据type加载不同的数据
  523. if (type === 1) {
  524. // Type 1: 加载时域数据
  525. this.$set(this.fourList[activeIndex], "loading", true);
  526. params.analysisType = "time";
  527. axios
  528. .post("/WJapi/analysis/time", params)
  529. .then((res) => {
  530. const timeListTwo = JSON.parse(res.data);
  531. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  532. this.$set(this.fourList[activeIndex], "timeListTwo", timeListTwo);
  533. })
  534. .catch((error) => {
  535. console.error("Error fetching time data:", error);
  536. })
  537. .finally(() => {
  538. this.$set(this.fourList[activeIndex], "loading", false);
  539. });
  540. } else if (type === 2) {
  541. // Type 2: 加载频域数据
  542. this.$set(this.fourList[activeIndex], "loading", true);
  543. params.analysisType = "frequency";
  544. axios
  545. .post("/WJapi/analysis/frequency", params)
  546. .then((res) => {
  547. const spectrumListTwo = JSON.parse(res.data);
  548. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  549. this.$set(
  550. this.fourList[activeIndex],
  551. "spectrumListTwo",
  552. spectrumListTwo
  553. );
  554. })
  555. .catch((error) => {
  556. console.error("Error fetching frequency data:", error);
  557. })
  558. .finally(() => {
  559. this.$set(this.fourList[activeIndex], "loading", false);
  560. });
  561. } else if (type === 3) {
  562. // Type 3: 加载包络分析数据
  563. this.$set(this.fourList[activeIndex], "loading", true);
  564. params.analysisType = "envelope";
  565. params.fmin = this.xiaoval; // 最小频率
  566. params.fmax = this.daval; // 最大频率
  567. axios
  568. .post("/WJapi/analysis/envelope", params)
  569. .then((res) => {
  570. const envelopeListTwo = JSON.parse(res.data);
  571. this.$set(this.fourList[activeIndex], "rowData", currentRow);
  572. this.$set(
  573. this.fourList[activeIndex],
  574. "envelopeListTwo",
  575. envelopeListTwo
  576. );
  577. })
  578. .catch((error) => {
  579. console.error("Error fetching envelope analysis data:", error);
  580. })
  581. .finally(() => {
  582. this.$set(this.fourList[activeIndex], "loading", false);
  583. });
  584. }
  585. },
  586. // 更新父组件的 currentIndex
  587. handleCurrentIndexUpdate(newIndex) {
  588. this.currentIndex = newIndex;
  589. this.handleCurrentChange(newIndex);
  590. },
  591. tableRowClassName({ row }) {
  592. if (row === this.currentRow) {
  593. return "current-row-highlight"; // 自定义的高亮类名
  594. }
  595. return "";
  596. },
  597. // setCurrent(row) {
  598. // this.currentRow = row; // 设置当前行
  599. // },
  600. // 当前所在行高亮提示
  601. setCurrent(row) {
  602. if (!row) {
  603. return false;
  604. }
  605. this.$refs.singleTable.setCurrentRow(row);
  606. },
  607. // 当前单选
  608. handleCurrentChange(val) {
  609. this.currentRow = val;
  610. const index = this.tableDataList.indexOf(val);
  611. this.currentIndex = index; // 更新当前索引
  612. console.log(this.currentIndex);
  613. },
  614. generate(type) {
  615. if (!this.currentRow) {
  616. this.$message.warning("请先选择数据");
  617. return;
  618. }
  619. const nameMap = {
  620. 1: "时域图", // Time Domain Chart
  621. 2: "频谱图", // Spectrogram Chart
  622. 3: "包络谱图", // Envelope Spectrum Chart
  623. };
  624. const chartName = nameMap[type];
  625. if (chartName) {
  626. const newItem = {
  627. name: chartName,
  628. isMinimized: false,
  629. id: `chart-${Date.now()}`,
  630. };
  631. this.fourList.push(newItem);
  632. }
  633. },
  634. tendency() {
  635. if (this.tableDataList.length === 0) {
  636. this.$message.warning("数据为空,无法生成图表");
  637. return;
  638. }
  639. const newItem = {
  640. name: "趋势图",
  641. isMinimized: false,
  642. id: `chart-${Date.now()}`,
  643. };
  644. const params = {
  645. ids: this.tableDataList.map((item) => item.id),
  646. // windCode: "SKF001",
  647. windCode: this.companyCode,
  648. analysisType: "trend",
  649. };
  650. axios
  651. .post("/WJapi/analysis/trend", params)
  652. .then((res) => {
  653. this.qsList = JSON.parse(res.data);
  654. this.fourList.push(newItem);
  655. })
  656. .catch((error) => {});
  657. },
  658. conditions() {
  659. const params = {
  660. windCode: this.maplist.codeNumber,
  661. windTurbineNumberList: [this.unitvalue],
  662. mesureNameList: [this.monitoringvalue],
  663. startTime: this.$formatDateTWO(this.timevalue[0]),
  664. endTime: this.$formatDateTWO(this.timevalue[1]),
  665. };
  666. console.log(params, "params");
  667. // const params = {
  668. // endTime: "2024-07-02 00:00:00",
  669. // mesureNameList: ["gearbox_input_end_radial_vibration"],
  670. // startTime: "2024-07-01 00:00:00",
  671. // windCode: "SKF001",
  672. // windTurbineNumberList: ["F004"],
  673. // };
  674. const areParamsValid = (params) => {
  675. return (
  676. params.endTime &&
  677. params.startTime &&
  678. params.mesureNameList?.length > 0 &&
  679. params.windCode &&
  680. params.windTurbineNumberList?.length > 0
  681. );
  682. };
  683. if (areParamsValid(params)) {
  684. axios
  685. .post("/ETLapi/waveData/getMesureData", params)
  686. .then((res) => {
  687. this.tableDataList = res.data.datas;
  688. })
  689. .catch((error) => {
  690. console.error("Error:", error);
  691. // Handle the error here
  692. });
  693. } else {
  694. this.$message({
  695. message: "请填写全部条件",
  696. type: "warning",
  697. });
  698. }
  699. },
  700. // 缩小
  701. lessen(index) {
  702. if (!this.fourList[index].isMinimized) {
  703. this.fourList[index].isMinimized = true;
  704. }
  705. },
  706. // 放大
  707. amplifier(index) {
  708. const item = this.fourList[index];
  709. if (item.isMinimized) {
  710. item.isMinimized = false;
  711. }
  712. },
  713. // 关闭
  714. close(index) {
  715. this.fourList.splice(index, 1);
  716. },
  717. zhankai() {
  718. this.fourList.forEach((item) => {
  719. item.isMinimized = false;
  720. });
  721. },
  722. suoxiao() {
  723. this.fourList.forEach((item) => {
  724. item.isMinimized = true;
  725. });
  726. },
  727. guanbi() {
  728. this.fourList = [];
  729. },
  730. outputFile() {
  731. var ws1 = XLSX.utils.table_to_book(document.querySelector("#Table1")); //对应要导出的表格id
  732. var wbOut = XLSX.write(ws1, {
  733. bookType: "xlsx",
  734. bookSST: true,
  735. type: "array",
  736. });
  737. try {
  738. FileSaver.saveAs(
  739. new Blob([wbOut], { type: "application/octet-stream" }),
  740. "demo.xlsx"
  741. );
  742. } catch (e) {
  743. if (typeof console !== "undefined") console.log(e, wbOut);
  744. }
  745. return wbOut;
  746. },
  747. },
  748. };
  749. </script>
  750. <style lang="scss" scoped>
  751. .head {
  752. // border-top: 5px solid #088080;
  753. // border-bottom: 5px solid #088080;
  754. padding: 5px 0;
  755. display: flex;
  756. justify-content: space-between;
  757. .headleft {
  758. display: flex;
  759. .picture {
  760. cursor: pointer;
  761. display: inline-block;
  762. text-align: center;
  763. margin: 0 20px;
  764. font-size: 12px;
  765. img {
  766. width: 50px;
  767. height: 20px;
  768. }
  769. }
  770. }
  771. .headright {
  772. line-height: 38px;
  773. img {
  774. width: 20px;
  775. height: 20px;
  776. margin: 0 10px;
  777. cursor: pointer;
  778. }
  779. }
  780. }
  781. .searchbox {
  782. display: flex;
  783. margin: 20px 0;
  784. p {
  785. margin-right: 20px;
  786. }
  787. .el-select {
  788. width: 180px;
  789. }
  790. }
  791. .dialog-actions {
  792. text-align: right;
  793. padding: 0 10px;
  794. display: flex;
  795. justify-content: space-between;
  796. position: relative;
  797. }
  798. .subject {
  799. height: 300px;
  800. transition: all 0.3s ease;
  801. padding: 0 10px;
  802. p {
  803. font-size: 10px;
  804. }
  805. }
  806. .main-body {
  807. display: flex;
  808. justify-content: space-between;
  809. align-items: flex-start;
  810. .data-map {
  811. width: 60%;
  812. // height: 620px;
  813. // overflow-y: auto;
  814. .chart-area {
  815. margin-bottom: 10px;
  816. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  817. &:hover {
  818. box-shadow: 0 2px 4px rgb(8, 128, 128, 0.13),
  819. 0 0 6px rgb(8, 128, 128, 0.11);
  820. // border: 1px solid #088080;
  821. }
  822. }
  823. }
  824. .data-map::-webkit-scrollbar {
  825. display: none; /* 隐藏滚动条 */
  826. }
  827. .data-origin {
  828. width: 39%;
  829. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  830. }
  831. }
  832. .subject.minimized {
  833. height: 0px; /* Adjust height when minimized */
  834. overflow: hidden;
  835. }
  836. // ::v-deep .current-row td {
  837. // background-color: rgba(147, 226, 226, 0.2) !important; /* 高亮的背景颜色 */
  838. // color: #088080;
  839. // font-weight: 600;
  840. // }
  841. .el-input__inner {
  842. width: 340px;
  843. }
  844. </style>