index.vue 13 KB

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