import { Component, OnInit, ViewChild } from '@angular/core'; import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st'; import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form'; import { dateTimePickerUtil } from '@delon/util'; import { NzModalService } from 'ng-zorro-antd/modal'; import { SystemService } from '../../services/system.service'; @Component({ selector: 'app-system-logs', templateUrl: './system-logs.component.html', styleUrls: ['./system-logs.component.less'] }) export class SystemLogsComponent implements OnInit { @ViewChild('st', { static: true }) st!: STComponent; @ViewChild('sf', { static: false }) sf!: SFComponent; searchSchema: SFSchema = { properties: { expand: { type: 'boolean', ui: { hidden: true } }, operator: { type: 'string', title: '操作人', ui: { placeholder: '请输入' } }, telephone: { type: 'string', title: '手机号码', ui: { placeholder: '请输入' } }, operatePage: { type: 'string', title: '操作页面', ui: { placeholder: '请输入' } }, operationContent: { type: 'string', title: '操作内容', ui: { placeholder: '请输入', visibleIf: { expand: (value: boolean) => value } } }, time: { title: '登录时间', type: 'string', ui: { widget: 'item-date', format: 'yyyy-MM-dd HH:mm:ss', placeholder: '请选择', nzShowTime: true, visibleIf: { expand: (value: boolean) => value } } as SFDateWidgetSchema } } }; columns: STColumn[] = [ { title: '操作时间', index: 'operatorTimestamp', type: 'date' }, { title: '操作人', index: 'operator' }, { title: '操作人手机号码', index: 'telephone' }, { title: '操作页面', index: 'operatePage' }, { title: '操作内容', index: 'operationContent' } ]; _$expand = false; constructor(public service: SystemService, private nzModalService: NzModalService) {} ngOnInit(): void {} beforeReq = (requestOptions: STRequestOptions) => { if (this.sf) { Object.assign(requestOptions.body, { ...this.sf.value, endTime: this.sf.value.time?.end ? dateTimePickerUtil.format(this.sf.value.time?.end, 'yyyy-MM-dd HH:mm:ss') : null, startTime: this.sf.value.time?.start ? dateTimePickerUtil.format(this.sf.value.time?.start, 'yyyy-MM-dd HH:mm:ss') : null }); } return requestOptions; }; /** * 重置表单 */ resetSF() { this.sf.reset(); this._$expand = false; } /** * 伸缩查询条件 */ expandToggle() { this._$expand = !this._$expand; this.sf?.setValue('/expand', this._$expand); } }