index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <div class="global-variable">
  3. <div class="searchbox">
  4. <el-collapse v-model="activeNames">
  5. <el-collapse-item title="数据筛选" name="1">
  6. <template slot="title">
  7. <div class="titleLeft">数据筛选</div>
  8. <div class="titleRight">
  9. <el-button type="primary" @click.stop="getTableData" size="small">
  10. 查询
  11. </el-button>
  12. <el-button
  13. v-if="tabActiveName === 'list'"
  14. type="primary"
  15. @click.stop="onSubmit"
  16. size="small"
  17. >
  18. 导出
  19. </el-button>
  20. </div>
  21. </template>
  22. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  23. <el-row :gutter="10">
  24. <el-col :xs="16" :sm="8" :md="7" :lg="6" :xl="4">
  25. <el-form-item label="单位">
  26. <selecttree
  27. style="width: 220px"
  28. placeholder="请选择上级单位"
  29. :list="parentOpt"
  30. type="1"
  31. v-model="formInline.companyCode"
  32. @change="parentChange"
  33. :defaultParentProps="{
  34. children: 'children',
  35. label: 'companyName',
  36. value: 'codeNumber',
  37. }"
  38. >
  39. </selecttree>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :xs="16" :sm="8" :md="7" :lg="6" :xl="4">
  43. <el-form-item label="风机">
  44. <el-select
  45. v-model="formInline.unitvalue"
  46. @change="getchedian"
  47. size="small"
  48. placeholder="请选择"
  49. >
  50. <el-option
  51. v-for="item in unitoptions"
  52. :key="item.engineCode"
  53. :label="item.engineName"
  54. :value="item.engineCode"
  55. >
  56. </el-option>
  57. </el-select>
  58. </el-form-item>
  59. </el-col>
  60. <el-col :xs="24" :sm="14" :md="12" :lg="10" :xl="6">
  61. <el-form-item label="时间">
  62. <el-date-picker
  63. size="small"
  64. v-model="formInline.timevalue"
  65. type="daterange"
  66. range-separator="至"
  67. start-placeholder="开始日期"
  68. end-placeholder="结束日期"
  69. >
  70. </el-date-picker>
  71. </el-form-item>
  72. </el-col>
  73. </el-row>
  74. </el-form>
  75. </el-collapse-item>
  76. </el-collapse>
  77. </div>
  78. <div class="main-body">
  79. <div class="data-map">
  80. <el-tabs type="border-card" v-model="tabActiveName">
  81. <el-tab-pane label="原始图" name="init">
  82. <span slot="label">
  83. <img
  84. style="width: 30px; height: 20px; display: inline-block"
  85. src="@/assets/analyse/04.png"
  86. alt=""
  87. />
  88. 原始图
  89. </span>
  90. <div class="boxContent">
  91. <div class="left" v-if="tabActiveName === 'init'">
  92. <el-empty
  93. :image-size="200"
  94. v-if="currentRow === null"
  95. ></el-empty>
  96. <div v-else>
  97. <InitCharts></InitCharts>
  98. <CylinderOfTower type="Waveformdiagram"></CylinderOfTower>
  99. <CylinderOfTower type="spectrogram"></CylinderOfTower>
  100. </div>
  101. </div>
  102. <div class="right">
  103. <DescrBox
  104. type="init"
  105. ref="initTable"
  106. @handleCurrentChange="handleCurrentChange"
  107. ></DescrBox>
  108. </div>
  109. </div>
  110. </el-tab-pane>
  111. <el-tab-pane label="拟合图" name="copy">
  112. <span slot="label">
  113. <img
  114. style="width: 25px; height: 20px; display: inline-block"
  115. src="@/assets/analyse/01.png"
  116. alt=""
  117. />
  118. 拟合图
  119. </span>
  120. <div class="boxContent" v-if="tabActiveName === 'copy'">
  121. <div class="left">
  122. <el-empty
  123. :image-size="200"
  124. v-if="currentRow === null"
  125. ></el-empty>
  126. <div v-else>
  127. <PlotOfFit type="LeafRootOutline"></PlotOfFit>
  128. <PlotOfFit type="LeafRootRelativeOutline"></PlotOfFit>
  129. <PlotOfFit type="LeafTipProfile"></PlotOfFit>
  130. <PlotOfFit type="LeafTipRelativeProfile"></PlotOfFit>
  131. </div>
  132. </div>
  133. <div class="right">
  134. <DescrBox
  135. type="copy"
  136. ref="copyTable"
  137. @handleCurrentChange="handleCurrentChange"
  138. ></DescrBox>
  139. </div>
  140. </div>
  141. </el-tab-pane>
  142. <el-tab-pane label="数据列表" name="list">
  143. <span slot="label">
  144. <img
  145. style="width: 20px; height: 20px; display: inline-block"
  146. src="@/assets/analyse/dataList1.png"
  147. alt=""
  148. />
  149. 数据列表
  150. </span>
  151. <div>
  152. <MultilevelTable></MultilevelTable>
  153. </div>
  154. </el-tab-pane>
  155. </el-tabs>
  156. </div>
  157. </div>
  158. </div>
  159. </template>
  160. <script>
  161. import * as echarts from "echarts";
  162. import {
  163. getSysOrganizationAuthTreeByRoleId,
  164. windEngineGrouPage,
  165. queryDetectionDic,
  166. } from "@/api/ledger.js";
  167. import DescrBox from "./components/descrBox.vue";
  168. import selecttree from "../../components/selecttree.vue";
  169. import MultilevelTable from "./components/MultilevelTable.vue";
  170. import InitCharts from "./components/initCharts.vue";
  171. import CylinderOfTower from "./components/CylinderOfTower.vue";
  172. import PlotOfFit from "./components/PlotOfFit.vue";
  173. import axios from "axios";
  174. //
  175. export default {
  176. data() {
  177. return {
  178. activeNames: ["1"],
  179. tabActiveName: "init",
  180. formInline: {
  181. companyCode: "", //单位
  182. unitvalue: "", //风机
  183. timevalue: "", //时间
  184. },
  185. companyCode: "", //单位表格中展示
  186. parentOpt: [],
  187. chartData: [],
  188. chartLabels: [],
  189. tableData: [],
  190. data: [10, 20, 30, 40], // 假设是图表的数据
  191. labels: ["2024/1/1", "2024/1/2", "2024/1/3", "2024/1/4"], // 假设是时间轴数据
  192. currentIndex: 0,
  193. tableData: [], // 假设是来自父组件的数据
  194. company: "",
  195. companyoptions: [],
  196. unitvalue: "",
  197. unitoptions: [],
  198. monitoringvalue: "",
  199. monitoringoptions: [],
  200. timevalue: "",
  201. tableData: [],
  202. fourList: [],
  203. currentRow: null, // 用于存储当前选中的行
  204. currentIndex: 0,
  205. isChartVisible: false,
  206. };
  207. },
  208. components: {
  209. DescrBox,
  210. PlotOfFit,
  211. MultilevelTable,
  212. selecttree,
  213. InitCharts,
  214. CylinderOfTower,
  215. },
  216. created() {
  217. this.GETtree();
  218. },
  219. methods: {
  220. //获取表格数据接口
  221. async getTableData() {
  222. try {
  223. console.log(this.formInline, "formInline");
  224. const res = await axios.post("/WZLapi/laserData/getLaserData");
  225. } catch (err) {
  226. this.$message.error(err);
  227. }
  228. },
  229. // 获取风场
  230. async GETtree() {
  231. try {
  232. const res = await getSysOrganizationAuthTreeByRoleId();
  233. const treedata = res.data;
  234. const processedData = this.processTreeData(treedata);
  235. this.parentOpt = processedData;
  236. this.defaultdata = res.data[0];
  237. } catch (err) {
  238. this.$message.error(err);
  239. }
  240. },
  241. processTreeData(treeData) {
  242. const processedData = [];
  243. function processNode(node) {
  244. if (node.codeType === "field") {
  245. node.companyName = node.fieldName;
  246. }
  247. if (node.children && node.children.length > 0) {
  248. node.children.forEach((child) => {
  249. processNode(child);
  250. });
  251. }
  252. }
  253. treeData.forEach((root) => {
  254. processNode(root);
  255. processedData.push(root);
  256. });
  257. return processedData;
  258. },
  259. parentChange(data) {
  260. this.maplist = data;
  261. this.maplistArr = data;
  262. let paramsData = {
  263. fieldCode: this.maplist.codeNumber,
  264. pageNum: 1,
  265. pageSize: 99,
  266. };
  267. this.unitvalue = "";
  268. // 获取风机
  269. windEngineGrouPage(paramsData).then((res) => {
  270. this.unitoptions = res.data.list;
  271. });
  272. if (data.codeType === "field") {
  273. if (this.parseCoordinates(data.longitudeAndLatitudeString).length > 0) {
  274. return;
  275. }
  276. } else {
  277. const dataMapList = data.children;
  278. dataMapList.forEach((element) => {
  279. console.log(element);
  280. if (
  281. this.parseCoordinates(element.longitudeAndLatitudeString).length >
  282. 0 &&
  283. element.codeType === "field"
  284. ) {
  285. return;
  286. }
  287. });
  288. }
  289. },
  290. parseCoordinates(input) {
  291. if (input && typeof input === "string") {
  292. return input.split(",").map(Number);
  293. }
  294. // debugger;
  295. return [];
  296. },
  297. // 获取测点
  298. getchedian(value) {
  299. queryDetectionDic({ engineCodes: value }).then((res) => {
  300. this.monitoringoptions = res.data;
  301. });
  302. },
  303. handleCurrentIndexUpdate(newIndex) {
  304. this.currentIndex = newIndex;
  305. },
  306. setCurrent(row) {
  307. this.$nextTick(() => {
  308. if (this.$refs.singleTable) {
  309. this.$refs.singleTable.setCurrentRow(row); // 设置当前行
  310. } else {
  311. console.warn("Cannot access $refs.singleTable: it's undefined.");
  312. }
  313. });
  314. },
  315. handleCurrentChange(val) {
  316. this.currentRow = val; // 处理当前选中行
  317. const index = this.tableData.indexOf(val); // 获取当前选中行的索引
  318. this.currentIndex = index; // 更新当前索引
  319. },
  320. generate(type) {
  321. if (!this.currentRow) {
  322. this.$message.warning("请先选择数据");
  323. return;
  324. }
  325. },
  326. // 缩小
  327. lessen(index) {
  328. if (!this.fourList[index].isMinimized) {
  329. this.fourList[index].isMinimized = true;
  330. }
  331. console.log("1");
  332. },
  333. // 放大
  334. amplifier(index) {
  335. const item = this.fourList[index];
  336. if (item.isMinimized) {
  337. item.isMinimized = false;
  338. }
  339. console.log("2");
  340. },
  341. // 关闭
  342. close(index) {
  343. this.fourList.splice(index, 1);
  344. console.log("3");
  345. },
  346. zhankai() {
  347. this.fourList.forEach((item) => {
  348. item.isMinimized = false;
  349. });
  350. },
  351. suoxiao() {
  352. this.fourList.forEach((item) => {
  353. item.isMinimized = true;
  354. });
  355. },
  356. guanbi() {
  357. this.fourList = [];
  358. },
  359. onSubmit() {
  360. console.log("事件触发了");
  361. },
  362. },
  363. };
  364. </script>
  365. <style lang="scss" scoped>
  366. .head {
  367. // border-top: 5px solid #088080;
  368. // border-bottom: 5px solid #088080;
  369. padding: 5px 0;
  370. display: flex;
  371. justify-content: space-between;
  372. .headleft {
  373. display: flex;
  374. }
  375. .headright {
  376. img {
  377. width: 20px;
  378. height: 20px;
  379. margin: 0 10px;
  380. cursor: pointer;
  381. }
  382. }
  383. }
  384. .searchbox {
  385. // display: flex;
  386. margin: 20px 0 0 0;
  387. p {
  388. margin-right: 20px;
  389. }
  390. .el-select {
  391. width: 180px;
  392. }
  393. .titleLeft {
  394. }
  395. .titleRight {
  396. display: flex;
  397. position: absolute;
  398. right: 100px;
  399. }
  400. }
  401. .dialog-actions {
  402. text-align: right;
  403. padding: 0 10px;
  404. display: flex;
  405. justify-content: space-between;
  406. position: relative;
  407. }
  408. .subject {
  409. height: 280px;
  410. transition: all 0.3s ease;
  411. padding: 0 10px;
  412. p {
  413. font-size: 10px;
  414. }
  415. }
  416. .main-body {
  417. display: flex;
  418. justify-content: space-between;
  419. .data-map {
  420. width: 100%;
  421. // height: 620px;
  422. overflow-y: auto;
  423. .chart-area {
  424. margin-bottom: 10px;
  425. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  426. }
  427. .boxContent {
  428. display: flex;
  429. justify-content: space-between;
  430. .left {
  431. width: 60%;
  432. }
  433. .right {
  434. width: 39%;
  435. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  436. }
  437. }
  438. .el-tabs--border-card {
  439. height: 100%;
  440. }
  441. ::v-deep .el-tabs--border-card > .el-tabs__content {
  442. padding: 0 !important;
  443. }
  444. }
  445. .data-map::-webkit-scrollbar {
  446. display: none; /* 隐藏滚动条 */
  447. }
  448. }
  449. .subject.minimized {
  450. height: 0px; /* Adjust height when minimized */
  451. overflow: hidden;
  452. }
  453. #main {
  454. width: 100%;
  455. height: 280px;
  456. }
  457. // .line-chart {
  458. // position: relative;
  459. // }
  460. </style>