This commit is contained in:
Taric Xin
2022-01-24 14:33:53 +08:00
parent e72b3727af
commit 6b92227e4a
6 changed files with 18 additions and 100 deletions

View File

@ -18,20 +18,23 @@ import { BaseService, EAUserService } from '@shared';
import { Observable, of } from 'rxjs';
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()
export class AuthGuard implements CanActivate, CanActivateChild, CanLoad {
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> {
console.log(route);
return true;
}
canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> {
console.log(route);
return this.handle();
}
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
console.log(childRoute);
return this.handle();
}

View File

@ -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();
});
});

View File

@ -12,30 +12,19 @@
<!-- 搜索区 -->
<!-- 搜索表单 -->
<div nz-row nzGutter="8">
<!-- 查询字段小于或等于3个时不显示伸缩按钮 -->
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4">
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" (formSubmit)="st?.load(1)"
(formReset)="resetSF()"></sf>
<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>
<!-- [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>
</nz-card>
<nz-card>

View File

@ -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();
});
});

View File

@ -13,7 +13,6 @@ import { VehicleService } from '../../../vehicle/services/vehicle.service';
})
export class VehicleComponentsListComponent implements OnInit {
_$expand = false;
url = `/rule?_allow_anonymous=true`;
ui!: SFUISchema;
schema!: SFSchema;
@ -22,12 +21,6 @@ export class VehicleComponentsListComponent implements OnInit {
@ViewChild('sf', { static: false }) sf!: SFComponent;
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;
}
get selectedRows() {
return this.st?.list.filter((item) => item.checked) || [];
}
ngOnInit() {
this.initSF();
this.initST();
@ -91,9 +80,6 @@ export class VehicleComponentsListComponent implements OnInit {
return of([]);
}
},
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
carNoColor: {

View File

@ -18,7 +18,9 @@ import { VehicleComponentsListComponent } from './components/list/list.component
const routes: Routes = [
{
path: '',
canLoad: [AuthGuard],
canActivate: [AuthGuard],
canActivateChild: [AuthGuard],
children: [
{
path: 'list',