数据可视化大屏
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

219 líneas
6.7KB

  1. import { Component, Input, OnInit, ViewChild, inject } from '@angular/core';
  2. import { STColumn, STComponent } from '@delon/abc/st';
  3. import { SFSchema } from '@delon/form';
  4. import { ModalHelper, _HttpClient } from '@delon/theme';
  5. import { SHARED_IMPORTS } from '@shared';
  6. import { AgGridAngular } from 'ag-grid-angular';
  7. import { ColDef, GridApi } from 'ag-grid-community';
  8. import { LjCarAgGridComponentComponent } from './lj-car-ag-grid-component/lj-car-ag-grid-component.component';
  9. import { DataVCardComponent } from '../card/card.component';
  10. import { LJDataVCardComponent } from '../lj-card/lj-card.component';
  11. import { TableColumn, DataVLjTableComponent } from '../lj-table/lj-table.component';
  12. import { GridButtonValueRenderer } from '../workstation/grid-button/grid-button';
  13. import { LjAgGridComponentComponent } from '../workstation/lj-ag-grid-component/lj-ag-grid-component.component';
  14. @Component({
  15. selector: 'app-data-v-lj-car-info-table',
  16. standalone: true,
  17. templateUrl: './lj-car-info-table.component.html',
  18. styleUrl: './lj-car-info-table.component.css',
  19. imports: [
  20. ...SHARED_IMPORTS,
  21. AgGridAngular,
  22. DataVCardComponent,
  23. DataVLjTableComponent,
  24. LjAgGridComponentComponent,
  25. LjCarAgGridComponentComponent
  26. ]
  27. })
  28. export class DataVLjCarInfoTableComponent implements OnInit {
  29. public gridThemedClass: string = 'ag-theme-quartz ag-theme-datav';
  30. [x: string]: any;
  31. @ViewChild('myGrid') grid!: AgGridAngular;
  32. @Input() title: string = '';
  33. public pageSize!: number;
  34. /**当前页 */
  35. public pageIndex!: number;
  36. /**总数 */
  37. public pageRowTotal!: number;
  38. //默认列配置
  39. @Input() defaultColDef: ColDef = {
  40. // width: 130,
  41. editable: false,
  42. // headerClass: 'ag-header-center',
  43. cellStyle: { 'font-weight': 'bold', textAlign: 'center', 'justify-content': 'center', 'line-height': '38px' }
  44. };
  45. /** 列头 */
  46. @Input() columnDefs: ColDef[] = [];
  47. /**行数据 */
  48. @Input() rowData1: any[] = [];
  49. @Input() rowData2: any[] = [];
  50. @Input() rowData3: any[] = [];
  51. @Input() rowData4: any[] = [];
  52. /**表格主题 */
  53. @Input() gridThemeClass: string = 'ag-theme-quartz';
  54. @Input() paginationThemeClass: string = 'ag-theme-quartz';
  55. /** 构造函数 */
  56. constructor() {}
  57. // 在父组件的类中
  58. tableColumns: TableColumn[] = [
  59. { key: 'sort', title: '序号' },
  60. { key: 'time', title: '时间' },
  61. { key: 'option', title: '操作' },
  62. { key: 'optionDesc', title: '操作描述' },
  63. { key: 'optionMan', title: '操作人员' },
  64. { key: 'mark', title: '备注' },
  65. { key: 'edit', title: '编辑' }
  66. // 其他列配置...
  67. ];
  68. colDefs1: ColDef[] = [
  69. {
  70. headerName: '序号',
  71. valueGetter: function (params: any) {
  72. return parseInt(params.node.id) + 1;
  73. },
  74. minWidth: 50,
  75. cellStyle: { 'font-size': '13px' },
  76. field: 'xh'
  77. },
  78. {
  79. headerName: '时间',
  80. field: 'time',
  81. minWidth: 60,
  82. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  83. },
  84. {
  85. headerName: '车牌',
  86. field: 'carNo',
  87. minWidth: 50,
  88. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  89. },
  90. {
  91. headerName: '车型',
  92. field: 'carType',
  93. minWidth: 50,
  94. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  95. },
  96. {
  97. headerName: '卡号',
  98. field: 'no',
  99. minWidth: 50,
  100. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  101. },
  102. {
  103. headerName: '供应商',
  104. minWidth: 55,
  105. field: 'supplier',
  106. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  107. },
  108. {
  109. headerName: '毛重',
  110. minWidth: 55,
  111. field: 'grossWeight',
  112. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  113. },
  114. {
  115. headerName: '上报热值',
  116. minWidth: 55,
  117. field: 'reportHotValue',
  118. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  119. },
  120. {
  121. headerName: '估算热值',
  122. minWidth: 55,
  123. field: 'estimateValue',
  124. cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
  125. }
  126. // { headerName: '操作', width: 90, field: 'cz', cellRenderer: GridButtonValueRenderer }
  127. ];
  128. /**初始化 */
  129. ngOnInit() {
  130. this.rowData1.push({
  131. xh: 1,
  132. time: '13:25',
  133. carNo: 'A4132',
  134. carType: '重卡',
  135. no: '6-*',
  136. supplier: '大同',
  137. grossWeight: '7.15',
  138. reportHotValue: '7.6',
  139. estimateValue: '7.51'
  140. });
  141. this.rowData1.push({
  142. xh: 1,
  143. time: '13:25',
  144. carNo: 'A4132',
  145. carType: '重卡',
  146. no: '6-*',
  147. supplier: '大同',
  148. grossWeight: '7.15',
  149. reportHotValue: '7.6',
  150. estimateValue: '7.51'
  151. });
  152. this.rowData1.push({
  153. xh: 1,
  154. time: '13:25',
  155. carNo: 'A4132',
  156. carType: '重卡',
  157. no: '6-*',
  158. supplier: '大同',
  159. grossWeight: '7.15',
  160. reportHotValue: '7.6',
  161. estimateValue: '7.51'
  162. });
  163. // for (var i = 1; i < 30; i++) {
  164. // this.rowData.push({
  165. // rwmc: `任务${i}`,
  166. // rwms: `任务描述${i}`,
  167. // kssj: `2024-1-${i} 13:38:${i * 11}`,
  168. // jhwcsj: `2024-1-${i} 13:38:${i * 10}`,
  169. // sfcq: '否',
  170. // dqzt: '正常',
  171. // dqjd: `节点${i}`,
  172. // sjwcsj: `2024-1-${i} 13:38:${i * 27}`,
  173. // bjmc: '报警5',
  174. // bjms: '报警描述5',
  175. // bjsj: `2024-1-${i} 13:38:${i * 12}`,
  176. // gzyy: '-',
  177. // clff: '-',
  178. // tzsj: `2024-1-${i} 13:38:${i * 19}`,
  179. // zycd: '一般',
  180. // tzmc: '系统提示',
  181. // tznr: '账户登录',
  182. // fj: '-',
  183. // cz: '操作'
  184. // });
  185. // }
  186. console.log('-----表格初始化-----');
  187. // this.title = '';
  188. this.pageSize = 5;
  189. this.pageIndex = 1;
  190. this.pageRowTotal = this.rowData1.length;
  191. }
  192. //每页数
  193. nzPageSizeChange(_pageSize: any) {
  194. this.pageSize = _pageSize;
  195. }
  196. //当前页
  197. nzPageIndexChange(_pageIndex: any) {
  198. console.log(`nzPageIndexChange${_pageIndex}`);
  199. if (this.grid.api) {
  200. if (_pageIndex == 1) {
  201. /**去首页 */
  202. this.grid.api.paginationGoToFirstPage();
  203. } else {
  204. /** 页面跳转 */
  205. this.grid.api.paginationGoToPage(_pageIndex);
  206. }
  207. }
  208. }
  209. }