eduit
This commit is contained in:
@ -18,20 +18,23 @@ import { BaseService, EAUserService } from '@shared';
|
|||||||
import { Observable, of } from 'rxjs';
|
import { Observable, of } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
const auths = ['YUNLI-CART-SEARCH', 'YUNLI-CART-DAOC1HU', 'YUNLI-CART-DETAIL','YUNLI-CART-AUDIT-SEARCH'];
|
const auths = ['YUNLI-CART-SEARCH', 'YUNLI-CART-DAOC1HU', 'YUNLI-CART-DETAIL', 'YUNLI-CART-AUDIT-SEARCH'];
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthGuard implements CanActivate, CanActivateChild, CanLoad {
|
export class AuthGuard implements CanActivate, CanActivateChild, CanLoad {
|
||||||
constructor(private srv: ACLService, router: Router, private baseService: BaseService, private menuService: MenuService) {}
|
constructor(private srv: ACLService, router: Router, private baseService: BaseService, private menuService: MenuService) {}
|
||||||
canLoad(route: Route, segments: UrlSegment[]): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {
|
canLoad(route: Route, segments: UrlSegment[]): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {
|
||||||
|
console.log(route);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {
|
canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {
|
||||||
|
console.log(route);
|
||||||
return this.handle();
|
return this.handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
||||||
|
console.log(childRoute);
|
||||||
return this.handle();
|
return this.handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: your name
|
|
||||||
* @Date: 2021-12-07 17:30:18
|
|
||||||
* @LastEditTime: 2021-12-09 17:47:33
|
|
||||||
* @LastEditors: your name
|
|
||||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
||||||
* @FilePath: \tms-obc-web\src\app\routes\vehicle\components\list\img-view\img-view.component.spec.ts
|
|
||||||
*/
|
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { VehicleImgViewComponent } from './img-view.component';
|
|
||||||
|
|
||||||
describe('VehicleImgViewComponent', () => {
|
|
||||||
let component: VehicleImgViewComponent;
|
|
||||||
let fixture: ComponentFixture<VehicleImgViewComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [VehicleImgViewComponent],
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(VehicleImgViewComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -12,30 +12,19 @@
|
|||||||
<!-- 搜索区 -->
|
<!-- 搜索区 -->
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<div nz-row nzGutter="8">
|
<div nz-row nzGutter="8">
|
||||||
<!-- 查询字段小于或等于3个时,不显示伸缩按钮 -->
|
<div nz-col [nzSpan]="_$expand ? 24 : 18">
|
||||||
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
|
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
|
||||||
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" (formSubmit)="st?.load(1)"
|
</div>
|
||||||
(formReset)="resetSF()"></sf>
|
<div nz-col [nzSpan]="_$expand ? 24 : 6" class="text-right">
|
||||||
|
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
|
||||||
|
<button nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportFire()" acl
|
||||||
|
[acl-ability]="'YUNLI-CART-DAOCHU'">导出</button>
|
||||||
|
<button nz-button [disabled]="service.http.loading" (click)="resetSF()">重置</button>
|
||||||
|
<button nz-button nzType="link" (click)="expandToggle()">
|
||||||
|
{{ !_$expand ? '展开' : '收起' }}
|
||||||
|
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- [loading]="service.http.loading" -->
|
|
||||||
|
|
||||||
<!-- 查询字段大于3个时,根据展开状态调整布局 -->
|
|
||||||
<ng-container *ngIf="queryFieldCount > 4">
|
|
||||||
<div nz-col [nzSpan]="_$expand ? 24 : 18">
|
|
||||||
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
|
|
||||||
</div>
|
|
||||||
<div nz-col [nzSpan]="_$expand ? 24 : 6" class="text-right">
|
|
||||||
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button>
|
|
||||||
<button nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportFire()" acl
|
|
||||||
[acl-ability]="'YUNLI-CART-DAOCHU'">导出</button>
|
|
||||||
<button nz-button [disabled]="service.http.loading" (click)="resetSF()">重置</button>
|
|
||||||
<button nz-button nzType="link" (click)="expandToggle()">
|
|
||||||
{{ !_$expand ? '展开' : '收起' }}
|
|
||||||
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
|
||||||
</div>
|
</div>
|
||||||
</nz-card>
|
</nz-card>
|
||||||
<nz-card>
|
<nz-card>
|
||||||
|
|||||||
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* @Author: your name
|
|
||||||
* @Date: 2021-12-01 20:05:59
|
|
||||||
* @LastEditTime: 2021-12-01 20:35:33
|
|
||||||
* @LastEditors: your name
|
|
||||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
||||||
* @FilePath: \tms-obc-web\src\app\routes\vehicle\components\list\list.component.spec.ts
|
|
||||||
*/
|
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
import { VehicleComponentsListComponent } from './list.component';
|
|
||||||
|
|
||||||
describe('VehicleComponentsListComponent', () => {
|
|
||||||
let component: VehicleComponentsListComponent;
|
|
||||||
let fixture: ComponentFixture<VehicleComponentsListComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [VehicleComponentsListComponent],
|
|
||||||
}).compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(VehicleComponentsListComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@ -13,7 +13,6 @@ import { VehicleService } from '../../../vehicle/services/vehicle.service';
|
|||||||
})
|
})
|
||||||
export class VehicleComponentsListComponent implements OnInit {
|
export class VehicleComponentsListComponent implements OnInit {
|
||||||
_$expand = false;
|
_$expand = false;
|
||||||
url = `/rule?_allow_anonymous=true`;
|
|
||||||
|
|
||||||
ui!: SFUISchema;
|
ui!: SFUISchema;
|
||||||
schema!: SFSchema;
|
schema!: SFSchema;
|
||||||
@ -22,12 +21,6 @@ export class VehicleComponentsListComponent implements OnInit {
|
|||||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||||
|
|
||||||
constructor(public service: VehicleService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {}
|
constructor(public service: VehicleService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {}
|
||||||
/**
|
|
||||||
* 查询字段个数navigate
|
|
||||||
*/
|
|
||||||
get queryFieldCount(): number {
|
|
||||||
return Object.keys(this.schema?.properties || {}).length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询参数
|
* 查询参数
|
||||||
@ -45,10 +38,6 @@ export class VehicleComponentsListComponent implements OnInit {
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
get selectedRows() {
|
|
||||||
return this.st?.list.filter((item) => item.checked) || [];
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.initSF();
|
this.initSF();
|
||||||
this.initST();
|
this.initST();
|
||||||
@ -91,9 +80,6 @@ export class VehicleComponentsListComponent implements OnInit {
|
|||||||
return of([]);
|
return of([]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
visibleIf: {
|
|
||||||
_$expand: (value: boolean) => value
|
|
||||||
}
|
|
||||||
} as SFSelectWidgetSchema
|
} as SFSelectWidgetSchema
|
||||||
},
|
},
|
||||||
carNoColor: {
|
carNoColor: {
|
||||||
|
|||||||
@ -18,7 +18,9 @@ import { VehicleComponentsListComponent } from './components/list/list.component
|
|||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
|
canLoad: [AuthGuard],
|
||||||
canActivate: [AuthGuard],
|
canActivate: [AuthGuard],
|
||||||
|
canActivateChild: [AuthGuard],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'list',
|
path: 'list',
|
||||||
|
|||||||
Reference in New Issue
Block a user