About.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <template>
  2. <div class="about">
  3. <template v-if="false">
  4. <h1 @click="showDialog">This is an about page</h1>
  5. <HealthReport
  6. :show="show"
  7. :params="{ wtId: 'QG01_11', recorddate: '2021-06-19' }"
  8. @closed="
  9. (res) => {
  10. this.show = false;
  11. }
  12. "
  13. />
  14. <div class="fjBox1">
  15. <!-- 风机 SVG 使用方法 -->
  16. <FJ id="fj-1" speed="5s" color="red" width="43px" height="46px" />
  17. <FJ :speed="0.1" color="#1890ff" width="200px" height="210px" />
  18. <FJ id="fj-3" speed="2s" width="80px" height="82px" />
  19. <FJ />
  20. <FJ :speed="1" />
  21. <clock style="display: inline-block" />
  22. </div>
  23. <el-table
  24. :data="tableData"
  25. :span-method="arraySpanMethod"
  26. border
  27. style="width: 100%"
  28. >
  29. <el-table-column prop="name" label="部件" />
  30. <el-table-column
  31. prop="amount1"
  32. sortable
  33. label="隐患类新"
  34. ></el-table-column>
  35. <el-table-column
  36. prop="amount2"
  37. sortable
  38. label="频次1"
  39. ></el-table-column>
  40. <el-table-column
  41. prop="amount2"
  42. sortable
  43. label="频次2"
  44. ></el-table-column>
  45. <el-table-column
  46. prop="amount2"
  47. sortable
  48. label="频次3"
  49. ></el-table-column>
  50. <el-table-column
  51. prop="amount2"
  52. sortable
  53. label="频次4"
  54. ></el-table-column>
  55. </el-table>
  56. <!-- <list-bar-chart /> -->
  57. </template>
  58. <!-- <cesium /> -->
  59. <div id="box" style="width: 1000px; height: 600px"></div>
  60. </div>
  61. </template>
  62. <script>
  63. import ListBarChart from "../components/chart/bar/list-bar-chart.vue";
  64. import HealthReport from "@com/other/healthReport/index.vue";
  65. import FJ from "@com/other/fj/index.vue";
  66. import clock from "@com/other/clock/index.vue";
  67. import cesium from "@com/other/cesium/index.vue";
  68. import * as echarts from "echarts";
  69. import util from "@/helper/util.js";
  70. import partten from "@/helper/partten.js";
  71. // 导入header.vue文件
  72. export default {
  73. data() {
  74. return {
  75. show: true,
  76. tableData: [],
  77. };
  78. },
  79. components: {
  80. // ListBarChart,
  81. HealthReport,
  82. FJ,
  83. clock,
  84. cesium,
  85. },
  86. created() {
  87. let tableData = [];
  88. let item = {
  89. id: "12987122",
  90. name: "王小虎",
  91. amount1: "234",
  92. amount2: "3.2",
  93. amount3: 10,
  94. };
  95. for (let i = 0; i < 100; i++) {
  96. tableData.push(item);
  97. }
  98. this.tableData = tableData;
  99. },
  100. mounted() {
  101. const that = this;
  102. that.API.requestData({
  103. method: "POST",
  104. baseURL: "http://192.168.1.18:9002/",
  105. subUrl: "scatter/list",
  106. data: {
  107. station: "NSS_FDC",
  108. wtId: "NG01_01",
  109. time: "2022-02",
  110. },
  111. success(res) {
  112. that.initChart(res);
  113. },
  114. });
  115. return;
  116. let thArray = [
  117. [
  118. { field: "name", name: "表1姓名" },
  119. { field: "age", name: "表1年龄" },
  120. { field: "sex", name: "表1性别" },
  121. ],
  122. [
  123. { field: "name", name: "表2姓名" },
  124. { field: "age", name: "表2年龄" },
  125. { field: "sex", name: "表2性别" },
  126. ],
  127. [
  128. { field: "name", name: "表3姓名" },
  129. { field: "age", name: "表3年龄" },
  130. { field: "sex", name: "表3性别" },
  131. ],
  132. ];
  133. let dataArray = [
  134. [
  135. { name: "张三", age: 12, sex: "男" },
  136. { name: "李四", age: 19, sex: "男" },
  137. ],
  138. [
  139. { name: "王五", age: 9, sex: "女" },
  140. { name: "赵六", age: 21, sex: "男" },
  141. ],
  142. [
  143. { name: "吴七", age: 26, sex: "男" },
  144. { name: "沈八", age: 17, sex: "女" },
  145. { name: "刘九", age: 18, sex: "女" },
  146. ],
  147. ];
  148. let sheetNameArray = ["这是sheet-1", "这是sheet-2", "这是sheet-3"];
  149. // this.BASE.exportMultiple(thArray, dataArray, sheetNameArray, "单表格多sheet示例");
  150. },
  151. methods: {
  152. initChart(res) {
  153. let myChart = echarts.init(document.getElementById("box"));
  154. let sjgl = [];
  155. let zygl = [];
  156. let xAxisData = [];
  157. res.data.lineactual.forEach((ele, index) => {
  158. sjgl.push(ele[1]);
  159. xAxisData.push(index);
  160. });
  161. res.data.lineoptimal.forEach((ele) => {
  162. zygl.push(ele[1]);
  163. });
  164. const series = [
  165. {
  166. name: "风速功率",
  167. type: "effectScatter",
  168. showEffectOn: "emphasis",
  169. symbolSize: 5,
  170. data: res.data.scatter || [
  171. [174.0, 65.6],
  172. [175.3, 71.8],
  173. [193.5, 80.7],
  174. [186.5, 72.6],
  175. [187.2, 78.8],
  176. [181.5, 74.8],
  177. [184.0, 86.4],
  178. [184.5, 78.4],
  179. [175.0, 62.0],
  180. [184.0, 81.6],
  181. [180.0, 76.6],
  182. [177.8, 83.6],
  183. [192.0, 90.0],
  184. [176.0, 74.6],
  185. [174.0, 71.0],
  186. [184.0, 79.6],
  187. [192.7, 93.8],
  188. [171.5, 70.0],
  189. [173.0, 72.4],
  190. [176.0, 85.9],
  191. [176.0, 78.8],
  192. [180.5, 77.8],
  193. ],
  194. xAxisIndex: 1,
  195. },
  196. {
  197. name: "实际功率",
  198. type: "line",
  199. smooth: true, //这个是把线变成曲线
  200. data: sjgl || [
  201. 10, 20, 30, 40, 30, 20, 50, 80, 50, 80, 50, 80, 60, 40, 20, 40, 60,
  202. 80, 60, 40, 20,
  203. ],
  204. itemStyle: {
  205. normal: {
  206. color: "#05bb4c",
  207. lineStyle: {
  208. color: "#05bb4c",
  209. },
  210. },
  211. },
  212. xAxisIndex: 0,
  213. },
  214. {
  215. name: "最优功率",
  216. type: "line",
  217. smooth: true, //这个是把线变成曲线
  218. data: zygl || [
  219. 0, 10, 20, 30, 40, 50, 60, 70, 80, 80, 80, 80, 90, 90, 90, 95, 95,
  220. 100, 100, 100, 100,
  221. ],
  222. itemStyle: {
  223. normal: {
  224. color: "#f8de5b",
  225. lineStyle: {
  226. color: "#f8de5b",
  227. },
  228. },
  229. },
  230. xAxisIndex: 0,
  231. },
  232. ];
  233. //指定图表的配置项和数据
  234. var option = {
  235. //标题
  236. title: {
  237. text: "折线散点图",
  238. textStyle: {
  239. fontSize: util.vh(16),
  240. color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
  241. },
  242. },
  243. backgroundColor:
  244. this.$store.state.themeName === "dark"
  245. ? "rgba(0,0,0,0.4)"
  246. : "rgba(255,255,255,0.5)",
  247. //工具箱
  248. toolbox: {
  249. show: true,
  250. x: "right",
  251. position: [10, 10],
  252. backgroundColor:
  253. this.$store.state.themeName === "dark"
  254. ? "rgba(0,0,0,0.4)"
  255. : "rgba(255,255,255,0.5)",
  256. borderColor:
  257. this.$store.state.themeName === "dark"
  258. ? partten.getColor("gray")
  259. : "#000",
  260. textStyle: {
  261. fontSize: util.vh(16),
  262. color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
  263. },
  264. iconStyle: {
  265. borderColor:
  266. this.$store.state.themeName === "dark" ? "#fff" : "#000",
  267. },
  268. emphasis: {
  269. iconStyle: {
  270. borderColor:
  271. this.$store.state.themeName === "dark" ? "#fff" : "#000",
  272. },
  273. },
  274. // feature: {
  275. // dataZoom: {
  276. // yAxisIndex: "none",
  277. // },
  278. // dataView: { readOnly: false },
  279. // magicType: { type: ["line", "bar"] },
  280. // restore: {},
  281. // saveAsImage: {},
  282. // },
  283. },
  284. tooltip: {
  285. trigger: "item",
  286. axisPointer: {
  287. type: "cross",
  288. },
  289. backgroundColor:
  290. this.$store.state.themeName === "dark"
  291. ? "rgba(0,0,0,0.4)"
  292. : "rgba(255,255,255,0.5)",
  293. borderColor:
  294. this.$store.state.themeName === "dark"
  295. ? partten.getColor("gray")
  296. : "#000",
  297. textStyle: {
  298. fontSize: util.vh(16),
  299. color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
  300. },
  301. formatter(params) {
  302. return params.name
  303. ? `${params.seriesName}<br />风速:${params.name}米/s<br />功率:${params.value}KW`
  304. : `${params.seriesName}<br />风速:${params.data[0]}米/s<br />功率:${params.data[1]}KW`;
  305. },
  306. },
  307. brush: {
  308. xAxisIndex: "all",
  309. yAxisIndex: "all",
  310. transformable: true,
  311. throttleType: "debounce",
  312. throttleDelay: 600,
  313. removeOnClick: false,
  314. brushType: "polygon",
  315. brushMode: "multiple",
  316. brushStyle: {
  317. borderWidth: 1,
  318. color: "rgba(255,36,36,0.2)",
  319. borderColor: "#ff2424",
  320. },
  321. // outOfBrush: {
  322. // colorAlpha: 0.5,
  323. // },
  324. },
  325. dataZoom: [
  326. {
  327. type: "inside", //图表下方的伸缩条
  328. show: true, //是否显示
  329. realtime: true, //拖动时,是否实时更新系列的视图
  330. start: 0, //伸缩条开始位置(1-100),可以随时更改
  331. end: 100, //伸缩条结束位置(1-100),可以随时更改
  332. },
  333. {
  334. type: "slider", //图表下方的伸缩条
  335. show: true, //是否显示
  336. realtime: true, //拖动时,是否实时更新系列的视图
  337. start: 0, //伸缩条开始位置(1-100),可以随时更改
  338. end: 100, //伸缩条结束位置(1-100),可以随时更改
  339. },
  340. ],
  341. textStyle: {
  342. fontSize: util.vh(16),
  343. color: this.$store.state.themeName === "dark" ? "#fff" : "#000",
  344. },
  345. //图例-每一条数据的名字叫销量
  346. legend: {
  347. show: true,
  348. data: ["风速功率", "实际功率", "最优功率"],
  349. right: "120",
  350. top:"5",
  351. icon: "circle",
  352. itemWidth: 6,
  353. inactiveColor: this.$store.state.themeName === "dark" ? partten.getColor("gray") : "#000",
  354. textStyle: {
  355. color: this.$store.state.themeName === "dark" ? partten.getColor("grayl") : "#000",
  356. fontSize: 12,
  357. },
  358. },
  359. grid: {
  360. top: 32,
  361. left: 40,
  362. right: 40,
  363. bottom: 24,
  364. },
  365. //x轴
  366. xAxis: [
  367. {
  368. type: "category",
  369. boundaryGap: false,
  370. data: xAxisData || [
  371. "0",
  372. "1",
  373. "2",
  374. "3",
  375. "4",
  376. "5",
  377. "6",
  378. "7",
  379. "8",
  380. "9",
  381. "10",
  382. "11",
  383. "12",
  384. "13",
  385. "14",
  386. "15",
  387. "16",
  388. "17",
  389. "18",
  390. "19",
  391. "20",
  392. "21",
  393. "22",
  394. "23",
  395. "24",
  396. "25",
  397. ],
  398. min: 0,
  399. axisLabel: {
  400. formatter: "{value}",
  401. fontSize: util.vh(14),
  402. },
  403. textStyle: {
  404. color:
  405. this.$store.state.themeName === "dark"
  406. ? partten.getColor("gray")
  407. : "#000",
  408. },
  409. },
  410. {
  411. // name: this.xTitle,
  412. show: false,
  413. type: "value",
  414. boundaryGap: false,
  415. min: xAxisData[0],
  416. max: xAxisData[xAxisData.length - 1],
  417. scale: true,
  418. axisLabel: {
  419. formatter: "{value}",
  420. },
  421. splitLine: {
  422. show: false,
  423. },
  424. },
  425. ],
  426. //y轴没有显式设置,根据值自动生成y轴
  427. yAxis: {
  428. splitLine: { show: false },
  429. },
  430. //数据-data是最终要显示的数据
  431. series,
  432. };
  433. myChart.on("brushSelected", (params) => {
  434. const selected = params.batch[0]?.selected;
  435. let selectRes = [];
  436. selected?.forEach((pEle) => {
  437. if (pEle.dataIndex.length) {
  438. let item = {
  439. name: pEle.seriesName,
  440. data: [],
  441. };
  442. pEle.dataIndex.forEach((cEle) => {
  443. item.data.push(
  444. Array.isArray(series[pEle.seriesIndex].data[cEle])
  445. ? series[pEle.seriesIndex].data[cEle][
  446. series[pEle.seriesIndex].data[cEle].length - 1
  447. ]
  448. : series[pEle.seriesIndex].data[cEle]
  449. );
  450. });
  451. selectRes.push(item);
  452. }
  453. });
  454. let altMsg = "选中了";
  455. if (selectRes.length) {
  456. selectRes.forEach((ele) => {
  457. altMsg +=
  458. ele.data.length +
  459. "条" +
  460. ele.name +
  461. ":[" +
  462. ele.data.toString() +
  463. "].";
  464. });
  465. this.BASE.showMsg({
  466. type: "success",
  467. msg: altMsg,
  468. });
  469. }
  470. });
  471. //使用刚刚指定的配置项和数据项显示图表
  472. myChart.setOption(option);
  473. myChart.dispatchAction({
  474. type: "takeGlobalCursor",
  475. // 如果想变为“可刷选状态”,必须设置。不设置则会关闭“可刷选状态”。
  476. key: "brush",
  477. brushOption: {
  478. // 参见 brush 组件的 brushType。如果设置为 false 则关闭“可刷选状态”。
  479. brushType: "polygon",
  480. // 参见 brush 组件的 brushMode。如果不设置,则取 brush 组件的 brushMode 设置。
  481. brushMode: "multiple",
  482. },
  483. });
  484. },
  485. showDialog() {
  486. this.show = true;
  487. },
  488. arraySpanMethod({ row, column, rowIndex, columnIndex }) {
  489. if (!rowIndex && !columnIndex) {
  490. return [1, 3];
  491. } else if (rowIndex === 5 && !columnIndex) {
  492. return [10, 1];
  493. }
  494. },
  495. },
  496. };
  497. </script>
  498. <style lang="less" scoped>
  499. .fjBox {
  500. display: flex;
  501. justify-content: flex-start;
  502. align-items: center;
  503. flex-wrap: wrap;
  504. }
  505. </style>