数据可视化大屏
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

second1.component.ts 10KB

1 rok temu
1 rok temu
1 rok temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. import { CommonModule } from '@angular/common';
  2. import { AfterViewInit, Component, ElementRef, OnInit, ViewChild, inject } from '@angular/core';
  3. import { ModalHelper, TitleService, _HttpClient } from '@delon/theme';
  4. import { SHARED_IMPORTS } from '@shared';
  5. import { AgGridAngular } from 'ag-grid-angular';
  6. import { ColDef, GridApi } from 'ag-grid-community';
  7. import autofit from 'autofit.js';
  8. import * as echarts from 'echarts';
  9. import { NzCarouselModule } from 'ng-zorro-antd/carousel';
  10. import { NzPaginationModule } from 'ng-zorro-antd/pagination';
  11. import { MqttService } from 'ngx-mqtt';
  12. import { BlockbusterComponent } from './blockbuster/blockbuster.component';
  13. import { DataVCardComponent } from '../card/card.component';
  14. import { DataVLjCarInfoTableComponent } from '../lj-car-info-table/lj-car-info-table.component';
  15. import { DataVLjDashboardComponent } from '../lj-dashboard/lj-dashboard.component';
  16. import { DataVT1Component } from '../t1/t1.component';
  17. import { DataVTitleComponent } from '../title/title.component';
  18. import { AgGridComponentComponent } from '../workstation/ag-grid-component/ag-grid-component.component';
  19. import { GridButtonValueRenderer } from '../workstation/grid-button/grid-button';
  20. import { LjAgGridComponentComponent } from '../workstation/lj-ag-grid-component/lj-ag-grid-component.component';
  21. @Component({
  22. selector: 'app-data-v-s1',
  23. standalone: true,
  24. templateUrl: './second1.component.html',
  25. styleUrls: ['./second1.component.less'],
  26. imports: [
  27. NzCarouselModule,
  28. DataVT1Component,
  29. DataVLjCarInfoTableComponent,
  30. AgGridAngular,
  31. AgGridComponentComponent,
  32. LjAgGridComponentComponent,
  33. NzPaginationModule,
  34. DataVCardComponent,
  35. GridButtonValueRenderer,
  36. DataVTitleComponent,
  37. DataVLjDashboardComponent,
  38. CommonModule,
  39. ...SHARED_IMPORTS,
  40. DataVLjCarInfoTableComponent,
  41. DataVT1Component,
  42. BlockbusterComponent
  43. ]
  44. })
  45. export class DataVSecond1Component implements OnInit {
  46. private readonly http = inject(_HttpClient);
  47. private readonly modal = inject(ModalHelper);
  48. private readonly elementRef = inject(ElementRef);
  49. private readonly titleService = inject(TitleService);
  50. public items = [
  51. {
  52. tmpimg: '/assets/blockbuster/tmp1.png',
  53. status: 0
  54. },
  55. {
  56. tmpimg: '/assets/blockbuster/tmp2.png',
  57. status: 1
  58. },
  59. {
  60. tmpimg: '/assets/blockbuster/tmp3.png',
  61. status: 0
  62. },
  63. {
  64. tmpimg: '/assets/blockbuster/tmp4.png',
  65. status: 1
  66. }
  67. ];
  68. public chartDom = document.getElementById('main')!;
  69. // public myChart = echarts.init(this.chartDom);
  70. // public option!: EChartsOption;
  71. @ViewChild('myGrid') grid!: AgGridAngular;
  72. public defaultColDef: ColDef = {
  73. // width: 150,
  74. editable: false
  75. };
  76. public gridThemedClass: string = 'ag-theme-quartz ag-theme-datav';
  77. //多模拟几行数据出来
  78. rowData: object[] = [];
  79. todayRowData: object[] = [];
  80. runInfoRowData: object[] = [];
  81. systemWarnInfoRowData: object[] = [];
  82. array = [1, 2, 3, 4];
  83. effect = 'scrollx';
  84. colDefs0: ColDef[] = [
  85. {
  86. headerName: '时间',
  87. headerClass: 'head-class',
  88. field: 'time',
  89. autoHeaderHeight: true,
  90. // width: 130,
  91. // flex: 1,
  92. cellStyle: {
  93. 'text-align': 'start',
  94. 'padding-top': '0px',
  95. 'padding-right': '0px',
  96. 'padding-bottom': '0px',
  97. 'padding-left': '18px'
  98. }
  99. },
  100. {
  101. headerName: '操作',
  102. field: 'option',
  103. headerClass: 'head-class',
  104. autoHeaderHeight: true,
  105. // width: 70,
  106. cellStyle: {
  107. 'text-align': 'start',
  108. 'padding-top': '0px',
  109. 'padding-right': '0px',
  110. 'padding-bottom': '0px',
  111. 'padding-left': '18px'
  112. }
  113. },
  114. {
  115. headerName: '操作描述',
  116. // width: 130,
  117. autoHeaderHeight: true,
  118. field: 'optionDesc',
  119. cellStyle: {
  120. 'text-align': 'start',
  121. 'padding-top': '0px',
  122. 'padding-right': '0px',
  123. 'padding-bottom': '0px',
  124. 'padding-left': '18px'
  125. }
  126. },
  127. {
  128. headerName: '操作人员',
  129. // width: 130,
  130. field: 'optionMan',
  131. autoHeaderHeight: true,
  132. cellStyle: {
  133. 'text-align': 'start',
  134. 'padding-top': '0px',
  135. 'padding-right': '0px',
  136. 'padding-bottom': '0px',
  137. 'padding-left': '18px'
  138. }
  139. }
  140. ];
  141. colDefs1: ColDef[] = [
  142. {
  143. headerName: '序号',
  144. field: 'sort',
  145. // width: 70,
  146. cellStyle: {
  147. 'text-align': 'start',
  148. 'padding-top': '0px',
  149. 'padding-right': '0px',
  150. 'padding-bottom': '0px',
  151. 'padding-left': '18px'
  152. }
  153. },
  154. {
  155. headerName: '时间',
  156. field: 'time',
  157. // width: 140,
  158. cellStyle: {
  159. 'text-align': 'start',
  160. 'padding-top': '0px',
  161. 'padding-right': '0px',
  162. 'padding-bottom': '0px',
  163. 'padding-left': '18px'
  164. }
  165. },
  166. {
  167. headerName: '任务描述',
  168. // width: 130,
  169. field: 'taskDesc',
  170. cellStyle: {
  171. 'text-align': 'start',
  172. 'padding-top': '0px',
  173. 'padding-right': '0px',
  174. 'padding-bottom': '0px',
  175. 'padding-left': '18px'
  176. }
  177. },
  178. {
  179. headerName: '等级',
  180. // width: 70,
  181. field: 'level',
  182. autoHeaderHeight: true,
  183. cellStyle: {
  184. 'text-align': 'start',
  185. 'padding-top': '0px',
  186. 'padding-right': '0px',
  187. 'padding-bottom': '0px',
  188. 'padding-left': '18px'
  189. }
  190. }
  191. ];
  192. colDefs2: ColDef[] = [
  193. {
  194. headerName: '',
  195. // minWidth: 130,
  196. field: 'rwmc',
  197. flex: 1
  198. // cellStyle: {
  199. // 'padding-top': '0px',
  200. // 'padding-right': '0px',
  201. // 'padding-bottom': '0px',
  202. // 'padding-left': '18px',
  203. // color: '#75F9FD'
  204. // }
  205. },
  206. {
  207. headerName: '1#重磅',
  208. // minWidth: 60,
  209. field: 'one',
  210. flex: 1,
  211. cellStyle: {
  212. 'padding-top': '0px',
  213. 'padding-right': '0px',
  214. 'padding-bottom': '0px',
  215. 'padding-left': '18px',
  216. color: '#75F9FD'
  217. }
  218. },
  219. {
  220. headerName: '2#重磅',
  221. // minWidth: 60,
  222. field: 'two',
  223. flex: 1,
  224. cellStyle: {
  225. 'padding-top': '0px',
  226. 'padding-right': '0px',
  227. 'padding-bottom': '0px',
  228. 'padding-left': '18px'
  229. }
  230. },
  231. {
  232. headerName: '3#重磅',
  233. // minWidth: 60,
  234. field: 'three',
  235. flex: 1,
  236. cellStyle: {
  237. 'padding-top': '0px',
  238. 'padding-right': '0px',
  239. 'padding-bottom': '0px',
  240. 'padding-left': '18px'
  241. }
  242. },
  243. {
  244. headerName: '4#重磅',
  245. // minWidth: 60,
  246. field: 'four',
  247. flex: 1,
  248. cellStyle: {
  249. 'padding-top': '0px',
  250. 'padding-right': '0px',
  251. 'padding-bottom': '0px',
  252. 'padding-left': '18px'
  253. }
  254. },
  255. {
  256. headerName: '汇总',
  257. // minWidth: 60,
  258. autoHeaderHeight: true,
  259. field: 'all',
  260. flex: 1,
  261. cellStyle: {
  262. 'padding-top': '0px',
  263. 'padding-right': '0px',
  264. 'padding-bottom': '0px',
  265. 'padding-left': '18px'
  266. }
  267. }
  268. // { headerName: '操作', width: 0, autoHeaderHeight: true, field: 'cz', cellRenderer: GridButtonValueRenderer }
  269. ];
  270. client: any;
  271. constructor(private _mqttService: MqttService) {
  272. this.client = _mqttService;
  273. }
  274. initCharts(): void {
  275. // 获取DOM
  276. const lineChart = echarts.init(document.getElementById('lineChart')); // console.log(lineChart);
  277. const option = {
  278. tooltip: {
  279. formatter: '{a} <br/>{b} : {c}%'
  280. },
  281. series: [
  282. {
  283. name: 'Pressure',
  284. type: 'gauge',
  285. progress: {
  286. show: true
  287. },
  288. detail: {
  289. valueAnimation: true,
  290. formatter: '{value}'
  291. },
  292. data: [
  293. {
  294. value: 50,
  295. name: 'SCORE'
  296. }
  297. ]
  298. }
  299. ]
  300. };
  301. lineChart.setOption(option);
  302. }
  303. ngOnInit(): void {
  304. autofit.init();
  305. this.todayRowData.push({
  306. rwmc: `车辆数`,
  307. one: `4(辆)`,
  308. two: `6(辆)`,
  309. three: `9(辆)`,
  310. four: '3(辆)',
  311. all: '22(辆)'
  312. });
  313. this.todayRowData.push({
  314. rwmc: `总吨数`,
  315. one: `25.1(吨)`,
  316. two: `45.2(吨)`,
  317. three: `87.9(吨)`,
  318. four: '15.5(吨)',
  319. all: '155(吨)'
  320. });
  321. this.todayRowData.push({
  322. rwmc: `上报热值/估算热值`,
  323. one: `1/1 (MJ)`,
  324. two: `2/1 (MJ)`,
  325. three: `3/3 (MJ)`,
  326. four: '4/3(MJ)',
  327. all: '10/8(MJ)'
  328. });
  329. for (var i = 1; i < 10; i++) {
  330. this.runInfoRowData.push({ time: '2024-09-09', option: '锁定', optionDesc: '锁定1号重磅', optionMan: '甲' });
  331. this.runInfoRowData.push({ time: '2024-09-19', option: '解除', optionDesc: '接触1号重磅', optionMan: '甲' });
  332. this.systemWarnInfoRowData.push({ sort: 1, time: '2024.01.25-18:32', taskDesc: '2#重磅停止', level: '1级' });
  333. this.systemWarnInfoRowData.push({ sort: 2, time: '2024.01.26-18:32', taskDesc: '4#重磅停止', level: '3级' });
  334. }
  335. this.titleService.setTitle('我的工作站');
  336. for (var i = 1; i < 30; i++) {
  337. this.rowData.push({
  338. rwmc: `任务${i}`,
  339. rwms: `任务描述${i}`,
  340. kssj: `2024-1-${i} 13:38:${i * 11}`,
  341. jhwcsj: `2024-1-${i} 13:38:${i * 10}`,
  342. sfcq: '否',
  343. dqzt: '正常',
  344. dqjd: `节点${i}`,
  345. sjwcsj: `2024-1-${i} 13:38:${i * 27}`,
  346. bjmc: '报警5',
  347. bjms: '报警描述5',
  348. bjsj: `2024-1-${i} 13:38:${i * 12}`,
  349. gzyy: '-',
  350. clff: '-',
  351. tzsj: `2024-1-${i} 13:38:${i * 19}`,
  352. zycd: '一般',
  353. tzmc: '系统提示',
  354. tznr: '账户登录',
  355. fj: '-',
  356. cz: '操作'
  357. });
  358. }
  359. this.initCharts();
  360. }
  361. ngAfterViewInit(): void {
  362. // 获取 ag-grid 元素
  363. const gridDiv = this.elementRef.nativeElement.querySelector('.ag-theme-datav');
  364. // 获取 ag-grid 内部滚动容器元素
  365. const scrollContainer = gridDiv.querySelector('.ag-body-viewport');
  366. // 获取滚动条元素
  367. const scrollBar = gridDiv.querySelector('.ag-scroller');
  368. console.log('scrollBar');
  369. console.log(scrollBar);
  370. }
  371. add(): void {
  372. // this.modal
  373. // .createStatic(FormEditComponent, { i: { id: 0 } })
  374. // .subscribe(() => this.st.reload());
  375. }
  376. }