This commit is contained in:
Taric Xin
2021-12-27 17:06:31 +08:00
parent 1a41c2999e
commit 7e6d86d00e
15 changed files with 229 additions and 99 deletions

View File

@ -1,4 +1,4 @@
<page-header-wrapper title="系统日志">
<page-header-wrapper title="系统操作日志">
</page-header-wrapper>
<nz-card class="search-box">
@ -19,9 +19,9 @@
</nz-card>
<nz-card class="content-box">
<st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
<st #st [data]="service.$api_get_systemt_logs" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st>
[loading]="service.http.loading" [scroll]="{ y: '370px' }"></st>
</nz-card>

View File

@ -17,5 +17,16 @@
}
.expend-options {
margin-top: -40px;
margin-top: 0px;
}
@media (min-width: 1200px) {
.expend-options {
max-width: 400px;
position : absolute;
right : 0;
bottom : 25px;
}
}

View File

@ -1,6 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
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';
@ -15,8 +16,6 @@ export class SystemLogsComponent implements OnInit {
@ViewChild('sf', { static: false })
sf!: SFComponent;
url = `/rule?_allow_anonymous=true`;
searchSchema: SFSchema = {
properties: {
expand: {
@ -25,24 +24,24 @@ export class SystemLogsComponent implements OnInit {
hidden: true
}
},
receiveName: {
operator: {
type: 'string',
title: '操作人',
ui: { placeholder: '请输入' }
},
phone: {
telephone: {
type: 'string',
title: '手机号码',
ui: { placeholder: '请输入' }
},
page: {
operatePage: {
type: 'string',
title: '操作页面',
ui: {
placeholder: '请输入'
}
},
content: {
operationContent: {
type: 'string',
title: '操作内容',
ui: {
@ -52,13 +51,14 @@ export class SystemLogsComponent implements OnInit {
}
}
},
createTime: {
title: '操作时间',
time: {
title: '登录时间',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd',
widget: 'item-date',
format: 'yyyy-MM-dd HH:mm:ss',
placeholder: '请选择',
nzShowTime: true,
visibleIf: {
expand: (value: boolean) => value
}
@ -68,28 +68,29 @@ export class SystemLogsComponent implements OnInit {
};
columns: STColumn[] = [
{ title: '操作时间', index: 'updatedAt', type: 'date' },
{ title: '操作人', index: 'description' },
{ title: '操作人手机号码', index: 'description' },
{ title: '操作页面', index: 'description' },
{ title: '操作内容', index: 'description' },
{
title: '创建时间',
index: 'updatedAt',
type: 'date'
}
{ title: '操作时间', index: 'operatorTimestamp', type: 'date' },
{ title: '操作人', index: 'operator' },
{ title: '操作人手机号码', index: 'telephone' },
{ title: '操作页面', index: 'operatePage' },
{ title: '操作内容', index: 'operationContent' }
];
selectedRows: any[] = [];
reqParams = { pageIndex: 1, pageSize: 10 };
_$expand = false;
constructor(public service: SystemService, private nzModalService: NzModalService) {}
ngOnInit(): void {}
stChange(e: STChange): 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;
};
/**
* 重置表单

View File

@ -19,9 +19,9 @@
</nz-card>
<nz-card class="content-box">
<st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
<st #st [data]="service.$api_user_login_logs" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' },process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st>
[loading]="service.http.loading" [scroll]="{ y: '370px' }"></st>
</nz-card>

View File

@ -17,5 +17,16 @@
}
.expend-options {
margin-top: -40px;
margin-top: 0px;
}
@media (min-width: 1200px) {
.expend-options {
max-width: 400px;
position : absolute;
right : 0;
bottom : 25px;
}
}

View File

@ -1,7 +1,9 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema } from '@delon/form';
import { dateTimePickerUtil } from '@delon/util';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SFItemDateWidget } from 'src/app/shared/widget/sl-form-item-date/sl-form-item-date.widget';
import { SystemService } from '../../services/system.service';
@Component({
@ -25,24 +27,34 @@ export class UserLogsComponent implements OnInit {
hidden: true
}
},
receiveName: {
roleName: {
type: 'string',
title: '登录端口',
ui: { placeholder: '请输入' }
},
phone: {
loginType: {
type: 'string',
title: '登录方式',
ui: { placeholder: '请输入' }
enum: [
{ label: '全部', value: null },
{ label: 'PC', value: '1' },
{ label: 'APP', value: '2' },
{ label: '小程序', value: '3' }
],
ui: {
widget: 'select',
placeholder: '请选择'
},
default: null
},
page: {
address: {
type: 'string',
title: '位置',
ui: {
placeholder: '请输入'
}
},
content: {
terminalIp: {
type: 'string',
title: 'ip',
ui: {
@ -52,13 +64,14 @@ export class UserLogsComponent implements OnInit {
}
}
},
createTime: {
time: {
title: '登录时间',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd',
widget: 'item-date',
format: 'yyyy-MM-dd HH:mm:ss',
placeholder: '请选择',
nzShowTime: true,
visibleIf: {
expand: (value: boolean) => value
}
@ -68,36 +81,36 @@ export class UserLogsComponent implements OnInit {
};
columns: STColumn[] = [
{ title: '登录时间', index: 'updatedAt', type: 'date' },
{ title: '登录端口', index: 'description' },
{ title: '姓名', index: 'description' },
{ title: '登录方式', index: 'description' },
{ title: '位置', index: 'description' },
{ title: 'ip', index: 'description' }
{ title: '登录时间', index: 'createTime', type: 'date' },
{ title: '登录端口', index: 'roleName' },
{ title: '姓名', index: 'userName' },
{ title: '登录方式', index: 'loginType', enum: { '1': 'PC', '2': 'APP', '3': '小程序' }, type: 'enum' },
{ title: '位置', index: 'address' },
{ title: 'ip', index: 'terminalIp' }
];
selectedRows: any[] = [];
reqParams = { pageIndex: 1, pageSize: 10 };
_$expand = false;
constructor(public service: SystemService, private nzModalService: NzModalService) {}
constructor(public service: SystemService) {}
ngOnInit(): void {}
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
break;
case 'filter':
this.st.load();
break;
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value,
time: {
start: this.sf.value.time?.start ? dateTimePickerUtil.format(this.sf.value.time?.start, 'yyyy-MM-dd HH:mm:ss') : null,
end: this.sf.value.time?.end ? dateTimePickerUtil.format(this.sf.value.time?.end, 'yyyy-MM-dd HH:mm:ss') : null
}
});
}
}
return requestOptions;
};
roleAction(item?: any) {}
/**
/**
* 重置表单
*/
resetSF() {

View File

@ -19,9 +19,9 @@
</nz-card>
<nz-card class="content-box">
<st #st [data]="url" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
<st #st [data]="service.$api_get_version_logs" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' },process: beforeReq }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }"
[loading]="service.http.loading" [scroll]="{ y: '370px' }" (change)="stChange($event)"></st>
[loading]="service.http.loading" [scroll]="{ y: '370px' }"></st>
</nz-card>

View File

@ -17,5 +17,16 @@
}
.expend-options {
margin-top: -40px;
margin-top: 0px;
}
@media (min-width: 1200px) {
.expend-options {
max-width: 400px;
position : absolute;
right : 0;
bottom : 25px;
}
}

View File

@ -1,6 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { STComponent, STColumn, STChange, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFSchema } from '@delon/form';
import { dateTimePickerUtil } from '@delon/util';
import { NzModalService } from 'ng-zorro-antd/modal';
import { SystemService } from '../../services/system.service';
@ -15,8 +16,6 @@ export class VersionLogsComponent implements OnInit {
@ViewChild('sf', { static: false })
sf!: SFComponent;
url = `/rule?_allow_anonymous=true`;
searchSchema: SFSchema = {
properties: {
expand: {
@ -25,17 +24,37 @@ export class VersionLogsComponent implements OnInit {
hidden: true
}
},
receiveName: {
publishPort: {
type: 'string',
title: '端口',
ui: { placeholder: '请输入' }
enum: [
{ label: '全部', value: null },
{ label: '司机', value: '1' },
{ label: '货主', value: '2' },
{ label: '运营平台', value: '3' }
],
ui: {
widget: 'select',
placeholder: '请选择'
},
default: null
},
phone: {
publishType: {
type: 'string',
title: '端口方式',
ui: { placeholder: '请输入' }
enum: [
{ label: '全部', value: null },
{ label: 'PC ', value: '1' },
{ label: 'APP', value: '2' },
{ label: '小程序', value: '3' }
],
ui: {
widget: 'select',
placeholder: '请选择'
},
default: null
},
page: {
publishVersion: {
type: 'string',
title: '版本号',
ui: {
@ -58,38 +77,35 @@ export class VersionLogsComponent implements OnInit {
};
columns: STColumn[] = [
{ title: '端口', index: 'no' },
{ title: '端口方式', index: 'description' },
{ title: '版本号', index: 'description' },
{ title: '端口', index: 'publishPort', type: 'enum', enum: { 1: '司机', 2: '货主', 3: '运营平台' } },
{ title: '端口方式', index: 'publishType', type: 'enum', enum: { 1: 'PC', 2: 'APP', 3: '小程序' } },
{ title: '版本号', index: 'publishVersion' },
{
title: '发布时间',
index: 'updatedAt',
index: 'createTime',
type: 'date'
},
{ title: '更新内容', index: 'description' }
{ title: '更新内容', index: 'publicshContext' }
];
selectedRows: any[] = [];
reqParams = { pageIndex: 1, pageSize: 10 };
_$expand = false;
constructor(public service: SystemService, private nzModalService: NzModalService) {}
ngOnInit(): void {}
stChange(e: STChange): void {
switch (e.type) {
case 'checkbox':
this.selectedRows = e.checkbox!;
break;
case 'filter':
this.st.load();
break;
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
Object.assign(requestOptions.body, {
...this.sf.value,
publishTime: {
start: this.sf.value.time?.start ? dateTimePickerUtil.format(this.sf.value.time?.start, 'yyyy-MM-dd HH:mm:ss') : null,
end: this.sf.value.time?.end ? dateTimePickerUtil.format(this.sf.value.time?.end, 'yyyy-MM-dd HH:mm:ss') : null
}
});
}
}
return requestOptions;
};
roleAction(item?: any) {}
ngOnInit(): void {}
/**
* 重置表单

View File

@ -80,6 +80,13 @@ export class SystemService extends BaseService {
// 获取货主企业列表
public $api_enterpriceList = '/api/mdc/cuc/enterpriseInfo/operate/enterpriceList';
// 查询用户登录记录表
public $api_user_login_logs = '/api/mdc/userLoginLog/list/page';
// 获取操作日志列表
public $api_get_systemt_logs = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList';
// 查询版本发布表
public $api_get_version_logs = '/api/mdc/versionPublish/list/page';
$api_getRoleTemplateInfo: string = '';
$api_getFunctionButtonInfo: string = '';
$api_getFunctionDataInfo: string = '';

View File

@ -0,0 +1,11 @@
<sf-item-wrap [id]="id" [schema]="schema" [ui]="ui" [showError]="showError" [error]="error" [showTitle]="schema.title">
<div style="justify-content: space-between;display: flex;align-items: center;">
<nz-date-picker style="min-width: 45%;" [nzFormat]="format" [nzPlaceHolder]="placeholder" [nzShowTime]="nzShowTime"
(ngModelChange)="change($event,'start')" [ngModel]="data?.start">
</nz-date-picker>
-
<nz-date-picker style="min-width: 45%; " [nzFormat]="format" [nzPlaceHolder]="placeholder" [nzShowTime]="nzShowTime"
(ngModelChange)="change($event,'end')" [ngModel]="data?.end">
</nz-date-picker>
</div>
</sf-item-wrap>

View File

@ -0,0 +1,46 @@
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup, Validators } from '@angular/forms';
import { ControlWidget } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
import setHours from 'date-fns/setHours';
import { DisabledTimeFn, DisabledTimePartial } from 'ng-zorro-antd/date-picker';
@Component({
selector: 'sf-item-date',
templateUrl: './sl-form-item-date.widget.html',
styleUrls: ['./sl-form-item-date.widget.less']
})
export class SFItemDateWidget extends ControlWidget implements OnInit {
/* 用于注册小部件 KEY 值 */
static readonly KEY = 'item-date';
// 组件所需要的参数,建议使用 `ngOnInit` 获取
format: any;
placeholder: string = '';
nzShowTime = false;
data: any = {
start: null,
end: null
};
ngOnInit(): void {
this.format = this.ui.format || 'yyyy-mm-dd';
this.placeholder = this.ui.placeholder || '';
this.nzShowTime = this.ui.nzShowTime || false;
this.data = this.value;
}
// reset 可以更好的解决表单重置过程中所需要的新数据问题
reset(value: string) {}
change(value: Date, key: string) {
if (this.data) {
this.data[key] = value;
} else {
this.data = { [key]: value };
}
if (this.ui.change) this.ui.change(this.data);
this.setValue(this.data);
}
}

View File

@ -30,6 +30,7 @@ import { EAFromToWidget } from './from-to/from-to.widget';
import { ImgWidget } from './img/img.widget';
import { NounWidget } from './noun/noun.widget';
import { PropertyValuesWidget } from './property-values/property-values.widget';
import { SFItemDateWidget } from './sl-form-item-date/sl-form-item-date.widget';
import { SpecValuesWidget } from './spec-values/spec-values.widget';
import { TinymceWidget } from './tinymce/tinymce.widget';
@ -43,7 +44,8 @@ export const STWIDGET_COMPONENTS = [
SpecValuesWidget,
PropertyValuesWidget,
SLFromToSearchWidget,
DictSelectWidget
DictSelectWidget,
SFItemDateWidget
];
@NgModule({
@ -78,6 +80,7 @@ export class STWidgetModule {
widgetRegistry.register(SpecValuesWidget.KEY, SpecValuesWidget);
widgetRegistry.register(PropertyValuesWidget.KEY, PropertyValuesWidget);
widgetRegistry.register(SLFromToSearchWidget.KEY, SLFromToSearchWidget);
widgetRegistry.register(DictSelectWidget.KEY, DictSelectWidget)
widgetRegistry.register(DictSelectWidget.KEY, DictSelectWidget);
widgetRegistry.register(SFItemDateWidget.KEY, SFItemDateWidget);
}
}

View File

@ -430,7 +430,7 @@
"link": "/system/basic-config"
},
{
"text": "系统日志",
"text": "系统操作日志",
"link": "/system/system-logs"
},
{