|
- import { Component, Input, OnInit, ViewChild, inject } from '@angular/core';
- import { STColumn, STComponent } from '@delon/abc/st';
- import { SFSchema } from '@delon/form';
- import { ModalHelper, _HttpClient } from '@delon/theme';
- import { SHARED_IMPORTS } from '@shared';
- import { AgGridAngular } from 'ag-grid-angular';
- import { ColDef, GridApi } from 'ag-grid-community';
-
- import { LjCarAgGridComponentComponent } from './lj-car-ag-grid-component/lj-car-ag-grid-component.component';
- import { DataVCardComponent } from '../card/card.component';
- import { LJDataVCardComponent } from '../lj-card/lj-card.component';
- import { TableColumn, DataVLjTableComponent } from '../lj-table/lj-table.component';
- import { GridButtonValueRenderer } from '../workstation/grid-button/grid-button';
- import { LjAgGridComponentComponent } from '../workstation/lj-ag-grid-component/lj-ag-grid-component.component';
-
- @Component({
- selector: 'app-data-v-lj-car-info-table',
- standalone: true,
- templateUrl: './lj-car-info-table.component.html',
- styleUrl: './lj-car-info-table.component.css',
- imports: [
- ...SHARED_IMPORTS,
- AgGridAngular,
- DataVCardComponent,
- DataVLjTableComponent,
- LjAgGridComponentComponent,
-
- LjCarAgGridComponentComponent
- ]
- })
- export class DataVLjCarInfoTableComponent implements OnInit {
- public gridThemedClass: string = 'ag-theme-quartz ag-theme-datav';
- [x: string]: any;
- @ViewChild('myGrid') grid!: AgGridAngular;
- @Input() title: string = '';
- public pageSize!: number;
- /**当前页 */
- public pageIndex!: number;
- /**总数 */
- public pageRowTotal!: number;
-
- //默认列配置
- @Input() defaultColDef: ColDef = {
- // width: 130,
- editable: false,
- // headerClass: 'ag-header-center',
-
- cellStyle: { 'font-weight': 'bold', textAlign: 'center', 'justify-content': 'center', 'line-height': '38px' }
- };
- /** 列头 */
- @Input() columnDefs: ColDef[] = [];
- /**行数据 */
- @Input() rowData1: any[] = [];
- @Input() rowData2: any[] = [];
- @Input() rowData3: any[] = [];
- @Input() rowData4: any[] = [];
- /**表格主题 */
- @Input() gridThemeClass: string = 'ag-theme-quartz';
- @Input() paginationThemeClass: string = 'ag-theme-quartz';
- /** 构造函数 */
- constructor() {}
- // 在父组件的类中
- tableColumns: TableColumn[] = [
- { key: 'sort', title: '序号' },
- { key: 'time', title: '时间' },
- { key: 'option', title: '操作' },
- { key: 'optionDesc', title: '操作描述' },
- { key: 'optionMan', title: '操作人员' },
- { key: 'mark', title: '备注' },
- { key: 'edit', title: '编辑' }
-
- // 其他列配置...
- ];
-
- colDefs1: ColDef[] = [
- {
- headerName: '序号',
- valueGetter: function (params: any) {
- return parseInt(params.node.id) + 1;
- },
- minWidth: 50,
- cellStyle: { 'font-size': '13px' },
- field: 'xh'
- },
-
- {
- headerName: '时间',
- field: 'time',
- minWidth: 60,
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '车牌',
- field: 'carNo',
- minWidth: 50,
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '车型',
- field: 'carType',
- minWidth: 50,
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '卡号',
- field: 'no',
- minWidth: 50,
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '供应商',
- minWidth: 55,
- field: 'supplier',
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '毛重',
- minWidth: 55,
- field: 'grossWeight',
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '上报热值',
- minWidth: 55,
- field: 'reportHotValue',
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- },
- {
- headerName: '估算热值',
- minWidth: 55,
- field: 'estimateValue',
- cellStyle: { 'font-size': '13px', 'padding-top': '0px', 'padding-right': '0px', 'padding-bottom': '0px', 'padding-left': '0px' }
- }
- // { headerName: '操作', width: 90, field: 'cz', cellRenderer: GridButtonValueRenderer }
- ];
-
- /**初始化 */
- ngOnInit() {
- this.rowData1.push({
- xh: 1,
- time: '13:25',
- carNo: 'A4132',
- carType: '重卡',
- no: '6-*',
- supplier: '大同',
- grossWeight: '7.15',
- reportHotValue: '7.6',
- estimateValue: '7.51'
- });
- this.rowData1.push({
- xh: 1,
- time: '13:25',
- carNo: 'A4132',
- carType: '重卡',
- no: '6-*',
- supplier: '大同',
- grossWeight: '7.15',
- reportHotValue: '7.6',
- estimateValue: '7.51'
- });
- this.rowData1.push({
- xh: 1,
- time: '13:25',
- carNo: 'A4132',
- carType: '重卡',
- no: '6-*',
- supplier: '大同',
- grossWeight: '7.15',
- reportHotValue: '7.6',
- estimateValue: '7.51'
- });
- // for (var i = 1; i < 30; i++) {
- // this.rowData.push({
- // rwmc: `任务${i}`,
- // rwms: `任务描述${i}`,
- // kssj: `2024-1-${i} 13:38:${i * 11}`,
- // jhwcsj: `2024-1-${i} 13:38:${i * 10}`,
- // sfcq: '否',
- // dqzt: '正常',
- // dqjd: `节点${i}`,
- // sjwcsj: `2024-1-${i} 13:38:${i * 27}`,
- // bjmc: '报警5',
- // bjms: '报警描述5',
- // bjsj: `2024-1-${i} 13:38:${i * 12}`,
- // gzyy: '-',
- // clff: '-',
- // tzsj: `2024-1-${i} 13:38:${i * 19}`,
- // zycd: '一般',
- // tzmc: '系统提示',
- // tznr: '账户登录',
- // fj: '-',
- // cz: '操作'
- // });
- // }
- console.log('-----表格初始化-----');
- // this.title = '';
- this.pageSize = 5;
- this.pageIndex = 1;
- this.pageRowTotal = this.rowData1.length;
- }
- //每页数
- nzPageSizeChange(_pageSize: any) {
- this.pageSize = _pageSize;
- }
- //当前页
- nzPageIndexChange(_pageIndex: any) {
- console.log(`nzPageIndexChange${_pageIndex}`);
- if (this.grid.api) {
- if (_pageIndex == 1) {
- /**去首页 */
- this.grid.api.paginationGoToFirstPage();
- } else {
- /** 页面跳转 */
- this.grid.api.paginationGoToPage(_pageIndex);
- }
- }
- }
- }
|