Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop
This commit is contained in:
		| @ -1,16 +1,31 @@ | |||||||
| import { Inject, Injectable, Injector } from '@angular/core'; | import { Inject, Injectable, Injector } from '@angular/core'; | ||||||
| import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router'; | import { | ||||||
| import { ACLGuard, ACLService } from '@delon/acl'; |   ActivatedRouteSnapshot, | ||||||
|  |   CanActivate, | ||||||
|  |   CanActivateChild, | ||||||
|  |   CanDeactivate, | ||||||
|  |   CanLoad, | ||||||
|  |   Data, | ||||||
|  |   Route, | ||||||
|  |   Router, | ||||||
|  |   RouterStateSnapshot, | ||||||
|  |   UrlTree | ||||||
|  | } from '@angular/router'; | ||||||
|  | import { ACLCanType, ACLGuard, ACLGuardType, ACLService } from '@delon/acl'; | ||||||
| import { MenuService } from '@delon/theme'; | import { MenuService } from '@delon/theme'; | ||||||
| import { BaseService, EAUserService } from '@shared'; | import { BaseService, EAUserService } from '@shared'; | ||||||
| import { Observable, of } from 'rxjs'; | import { Observable, of } from 'rxjs'; | ||||||
| import { map } from 'rxjs/operators'; | import { delay, map, switchMap, tap } from 'rxjs/operators'; | ||||||
|  |  | ||||||
| const auths = ['YUNLI-CART-SEARCH', 'YUNLI-CART-DAOC1HU', 'YUNLI-CART-DETAIL', 'YUNLI-CART-AUDIT-SEARCH']; |  | ||||||
|  |  | ||||||
| @Injectable() | @Injectable() | ||||||
| export class AuthGuard implements CanActivate, CanActivateChild { | export class AuthGuard implements CanActivate, CanActivateChild { | ||||||
|   constructor(private srv: ACLService, private baseService: BaseService, private menuService: MenuService) {} |   constructor( | ||||||
|  |     private srv: ACLService, | ||||||
|  |     private baseService: BaseService, | ||||||
|  |     private menuService: MenuService, | ||||||
|  |     private router: Router, | ||||||
|  |     private injector: Injector | ||||||
|  |   ) {} | ||||||
|  |  | ||||||
|   canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> { |   canActivate(route: ActivatedRouteSnapshot, _state: RouterStateSnapshot | null): Observable<boolean> { | ||||||
|     if (Object.keys(route.params)?.length > 0 || !route.routeConfig?.path) { |     if (Object.keys(route.params)?.length > 0 || !route.routeConfig?.path) { | ||||||
| @ -28,24 +43,29 @@ export class AuthGuard implements CanActivate, CanActivateChild { | |||||||
|     if (!route) { |     if (!route) { | ||||||
|       return of(true); |       return of(true); | ||||||
|     } |     } | ||||||
|     console.log(route); |  | ||||||
|  |  | ||||||
|     return this.baseService.request('/api/mdc/cuc/functionButton/getPermissionsCodeoByLink', { link: route }).pipe( |     return this.baseService.request('/api/mdc/cuc/functionButton/getPermissionsCodeoByLink', { link: route }).pipe( | ||||||
|       map(_ => { |       switchMap(res => { | ||||||
|         this.srv.setAbility(auths); |         if (res) { | ||||||
|  |           this.srv.setAbility(res.permissionsCodeList || []); | ||||||
|           this.menuService.resume(); |           this.menuService.resume(); | ||||||
|         return true; |         } | ||||||
|  |  | ||||||
|  |         return of(true); | ||||||
|       }) |       }) | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   private settingRoute(params: any, route: string) { |   private settingRoute(params: any, route: string) { | ||||||
|     let _route = route; |     let _route = route; | ||||||
|  |     if (_route.indexOf('?') > -1) { | ||||||
|  |       _route = route.split('?')[0]; | ||||||
|  |     } | ||||||
|     for (const key of Object.keys(params)) { |     for (const key of Object.keys(params)) { | ||||||
|       if (_route.indexOf(params[key]) > -1) { |       if (_route.indexOf(params[key]) > -1) { | ||||||
|         _route = _route.replace(params[key], ':id'); |         _route = _route.replace(params[key], ':id'); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return _route; |     return _route; | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -92,7 +92,7 @@ export class StartupService { | |||||||
|       enterpriseId: userData?.enterpriseId || sysConf.enterpriseId |       enterpriseId: userData?.enterpriseId || sysConf.enterpriseId | ||||||
|     }); |     }); | ||||||
|     // ACL:设置权限为全量 |     // ACL:设置权限为全量 | ||||||
|     this.aclService.setFull(true); |     this.aclService.setFull(false); | ||||||
|     // 初始化菜单 |     // 初始化菜单 | ||||||
|     this.menuService.add(menuData); |     this.menuService.add(menuData); | ||||||
|     // 设置页面标题的后缀 |     // 设置页面标题的后缀 | ||||||
|  | |||||||
| @ -15,6 +15,7 @@ import { RouterModule, Routes } from '@angular/router'; | |||||||
| import { LayoutProComponent } from '@brand'; | import { LayoutProComponent } from '@brand'; | ||||||
| import { EATokenGuard } from '@core'; | import { EATokenGuard } from '@core'; | ||||||
| import { environment } from '@env/environment'; | import { environment } from '@env/environment'; | ||||||
|  | import { AuthGuard } from '../core/guards/auth.guard'; | ||||||
|  |  | ||||||
| // dashboard pages | // dashboard pages | ||||||
| import { DashboardComponent } from './dashboard/dashboard.component'; | import { DashboardComponent } from './dashboard/dashboard.component'; | ||||||
| @ -23,8 +24,8 @@ const routes: Routes = [ | |||||||
|   { |   { | ||||||
|     path: '', |     path: '', | ||||||
|     component: LayoutProComponent, |     component: LayoutProComponent, | ||||||
|     canActivate: [EATokenGuard], |     canActivate: [AuthGuard, EATokenGuard], | ||||||
|     canActivateChild: [EATokenGuard], |     canActivateChild: [AuthGuard, EATokenGuard], | ||||||
|     children: [ |     children: [ | ||||||
|       { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, |       { path: '', redirectTo: 'dashboard', pathMatch: 'full' }, | ||||||
|       { path: 'dashboard', component: DashboardComponent }, |       { path: 'dashboard', component: DashboardComponent }, | ||||||
|  | |||||||
| @ -182,10 +182,11 @@ export class VehicleComponentsAuditComponent implements OnInit { | |||||||
|         title: '操作', |         title: '操作', | ||||||
|         fixed: 'right', |         fixed: 'right', | ||||||
|         width: '100px', |         width: '100px', | ||||||
|         className: 'text-left', |         className: 'text-center', | ||||||
|         buttons: [ |         buttons: [ | ||||||
|           { |           { | ||||||
|             text: '查看', |             text: '查看', | ||||||
|  |             acl: { ability: ['VEHICLE-AUDIT-view'] }, | ||||||
|             click: (item) => { |             click: (item) => { | ||||||
|               this.router.navigate(['./detail', item.id], { relativeTo: this.ar,queryParams: { carId: item.carId } }); |               this.router.navigate(['./detail', item.id], { relativeTo: this.ar,queryParams: { carId: item.carId } }); | ||||||
|               // this.router.navigate(['./view', item.id], { relativeTo: this.ar, queryParams: { tenantId: item.tenantId } }); |               // this.router.navigate(['./view', item.id], { relativeTo: this.ar, queryParams: { tenantId: item.tenantId } }); | ||||||
|  | |||||||
| @ -17,9 +17,9 @@ | |||||||
|         <span *ngIf="detailData?.approvalStatus === 40 || detailData?.approvalStatus === '40'">证件过期</span> |         <span *ngIf="detailData?.approvalStatus === 40 || detailData?.approvalStatus === '40'">证件过期</span> | ||||||
|         <div style="float: right;" *ngIf="detailData?.approvalStatus === 10 || detailData?.approvalStatus === '10'"> |         <div style="float: right;" *ngIf="detailData?.approvalStatus === 10 || detailData?.approvalStatus === '10'"> | ||||||
|           <ng-container *ngIf="!isEdit "> |           <ng-container *ngIf="!isEdit "> | ||||||
|             <button nz-button nzType="default" nzDanger (click)="approveDriver()">通过</button> |             <button nz-button nzType="default" nzDanger (click)="approveDriver()" acl acl-ability="VEHICLE-AUDIT-DETAIL-pass">通过</button> | ||||||
|             <button nz-button nzType="default" nzDanger (click)="rejectedDriver()">驳回</button> |             <button nz-button nzType="default" nzDanger (click)="rejectedDriver()" acl acl-ability="VEHICLE-AUDIT-DETAIL-reject">驳回</button> | ||||||
|             <button nz-button nzType="default" nzDanger (click)="ratify()">修改</button> |             <button nz-button nzType="default" nzDanger (click)="ratify()" acl acl-ability="VEHICLE-AUDIT-DETAIL-save">修改</button> | ||||||
|           </ng-container> |           </ng-container> | ||||||
|           <ng-container *ngIf="isEdit"> |           <ng-container *ngIf="isEdit"> | ||||||
|             <button nz-button nzType="default" (click)="reset()">取消</button> |             <button nz-button nzType="default" (click)="reset()">取消</button> | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ | |||||||
|       <sv-title style="font-weight: 700;"> |       <sv-title style="font-weight: 700;"> | ||||||
|         <div style="float: right;"> |         <div style="float: right;"> | ||||||
|           <ng-container *ngIf="!isEdit"> |           <ng-container *ngIf="!isEdit"> | ||||||
|             <button nz-button nzType="default" nzDanger (click)="ratify()">修改</button> |             <button nz-button nzType="default" nzDanger (click)="ratify()" acl acl-ability="VEHICLE-LIST-DETAIL-save">修改</button> | ||||||
|           </ng-container> |           </ng-container> | ||||||
|           <ng-container *ngIf="isEdit"> |           <ng-container *ngIf="isEdit"> | ||||||
|             <button nz-button nzType="default" (click)="reset()">取消</button> |             <button nz-button nzType="default" (click)="reset()">取消</button> | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ | |||||||
|     <div nz-col [nzSpan]="_$expand ? 24 : 6" class="text-right"> |     <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" [nzLoading]="service.http.loading" (click)="st?.load(1)">查询</button> | ||||||
|       <button nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportFire()" acl |       <button nz-button nzType="primary" [disabled]="service.http.loading" (click)="exportFire()" acl | ||||||
|         [acl-ability]="'YUNLI-CART-DAOCHU'">导出</button> |         [acl-ability]="'VEHICLE-LIST-view'">导出</button> | ||||||
|       <button nz-button [disabled]="service.http.loading" (click)="resetSF()">重置</button> |       <button nz-button [disabled]="service.http.loading" (click)="resetSF()">重置</button> | ||||||
|       <button nz-button nzType="link" (click)="expandToggle()"> |       <button nz-button nzType="link" (click)="expandToggle()"> | ||||||
|         {{ !_$expand ? '展开' : '收起' }} |         {{ !_$expand ? '展开' : '收起' }} | ||||||
|  | |||||||
| @ -245,12 +245,13 @@ export class VehicleComponentsListComponent implements OnInit { | |||||||
|         title: '操作', |         title: '操作', | ||||||
|         fixed: 'right', |         fixed: 'right', | ||||||
|         width: '100px', |         width: '100px', | ||||||
|         className: 'text-left', |         className: 'text-center', | ||||||
|         buttons: [ |         buttons: [ | ||||||
|           { |           { | ||||||
|             text: '查看', |             text: '查看', | ||||||
|  |             acl: { ability: ['VEHICLE-LIST-view'] }, | ||||||
|             click: item => { |             click: item => { | ||||||
|               this.router.navigate(['./detail', item.id], { relativeTo: this.ar, queryParams: { carId: item.carId } }); |               this.router.navigate(['/vehicle/list/detail/' + item.id], { queryParams: { carId: item.carId } }); | ||||||
|               // this.router.navigate(['./view', item.id], { relativeTo: this.ar, queryParams: { tenantId: item.tenantId } }); |               // this.router.navigate(['./view', item.id], { relativeTo: this.ar, queryParams: { tenantId: item.tenantId } }); | ||||||
|             } |             } | ||||||
|           } |           } | ||||||
|  | |||||||
| @ -16,29 +16,10 @@ import { VehicleComponentsListDetailComponent } from './components/list/detail/d | |||||||
| import { VehicleComponentsListComponent } from './components/list/list.component'; | import { VehicleComponentsListComponent } from './components/list/list.component'; | ||||||
|  |  | ||||||
| const routes: Routes = [ | const routes: Routes = [ | ||||||
|   { |   { path: 'list', component: VehicleComponentsListComponent }, | ||||||
|     path: '', |   { path: 'list/detail/:id', component: VehicleComponentsListDetailComponent }, | ||||||
|     canActivate: [AuthGuard], |   { path: 'audit', component: VehicleComponentsAuditComponent }, | ||||||
|     canActivateChild: [AuthGuard], |  | ||||||
|     children: [ |  | ||||||
|       { |  | ||||||
|         path: 'list', |  | ||||||
|         component: VehicleComponentsListComponent, |  | ||||||
|         data: { guard: { ability: ['YUNLI-CART-SEARCH'] } as ACLGuardType } |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         path: 'list/detail/:id', |  | ||||||
|         component: VehicleComponentsListDetailComponent, |  | ||||||
|         data: { guard: { ability: ['YUNLI-CART-DETAIL'] } as ACLGuardType } |  | ||||||
|       }, |  | ||||||
|       { |  | ||||||
|         path: 'audit', |  | ||||||
|         component: VehicleComponentsAuditComponent, |  | ||||||
|         data: { guard: { ability: ['YUNLI-CART--AUDIT-SEARCH1'] } as ACLGuardType } |  | ||||||
|       }, |  | ||||||
|   { path: 'audit/detail/:id', component: VehicleComponentsAuditDetailComponent } |   { path: 'audit/detail/:id', component: VehicleComponentsAuditDetailComponent } | ||||||
|     ] |  | ||||||
|   } |  | ||||||
| ]; | ]; | ||||||
|  |  | ||||||
| @NgModule({ | @NgModule({ | ||||||
|  | |||||||
| @ -14,9 +14,6 @@ | |||||||
|                 <h2 style="font-weight: 800;">{{selectedTab?.name}}</h2> |                 <h2 style="font-weight: 800;">{{selectedTab?.name}}</h2> | ||||||
|                 <div nz-row nzGutter="8"> |                 <div nz-row nzGutter="8"> | ||||||
|                     <div nz-col nzSpan="24" se-container [labelWidth]="labelWidth"> |                     <div nz-col nzSpan="24" se-container [labelWidth]="labelWidth"> | ||||||
|                         <!-- <se col="1"> |  | ||||||
|                             <app-freight-table></app-freight-table> |  | ||||||
|                         </se> --> |  | ||||||
|                         <se [label]="item.name" *ngFor="let item of configList" col="1"> |                         <se [label]="item.name" *ngFor="let item of configList" col="1"> | ||||||
|                             <ng-container [ngSwitch]="item.itemType"> |                             <ng-container [ngSwitch]="item.itemType"> | ||||||
|                                 <ng-container *ngSwitchCase="1"> |                                 <ng-container *ngSwitchCase="1"> | ||||||
| @ -62,6 +59,9 @@ | |||||||
|                                             style="margin-left: 0;" class=" mr-xl"> |                                             style="margin-left: 0;" class=" mr-xl"> | ||||||
|                                     </div> |                                     </div> | ||||||
|                                 </ng-container> |                                 </ng-container> | ||||||
|  |                                 <ng-container *ngSwitchCase="7"> | ||||||
|  |                                     <app-freight-table></app-freight-table> | ||||||
|  |                                 </ng-container> | ||||||
|                             </ng-container> |                             </ng-container> | ||||||
|  |  | ||||||
|                         </se> |                         </se> | ||||||
| @ -71,7 +71,8 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
|             <div class="mb-md save-btn"> |             <div class="mb-md save-btn"> | ||||||
|                 <button class="ml-lg" nz-button nzSize="large" nzType="primary" (click)="saveAction()">保存</button> |                 <button class="ml-lg" nz-button nzSize="large" nzType="primary" (click)="saveAction()" | ||||||
|  |                     *ngIf="selectedTab?.configKey!=='freight'">保存</button> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|  | |||||||
| @ -33,6 +33,8 @@ export class DynamicSettingH5Component implements OnInit { | |||||||
|  |  | ||||||
|   changeType(type: any): void { |   changeType(type: any): void { | ||||||
|     this.selectedTab = type; |     this.selectedTab = type; | ||||||
|  |     console.log(type); | ||||||
|  |      | ||||||
|     this.selectedEvent.emit(this.selectedTab); |     this.selectedEvent.emit(this.selectedTab); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,22 +1,63 @@ | |||||||
|  | <div nz-row> | ||||||
|  |     <div nz-col nzSpan="24"> | ||||||
|  |         <div class="mb-md ml-xl" style="text-align: right;"> | ||||||
|  |             <button nz-button nzType="primary" (click)="add()">新增公里数</button> | ||||||
|  |             <button class="ml-md" nz-button nzType="primary" (click)="save()">保存</button> | ||||||
|  |         </div> | ||||||
|  |  | ||||||
|         <nz-table #groupingTable [nzData]="data" nzBordered nzSize="small" [nzFrontPagination]="false" |         <nz-table #groupingTable [nzData]="data" nzBordered nzSize="small" [nzFrontPagination]="false" | ||||||
|     [nzScroll]="{ x: '500px' }" [nzShowPagination]="false"> |             [nzScroll]="{ x: '1200px' }" [nzShowPagination]="false" class="ml-xl" style="max-width: 1100px;"> | ||||||
|             <thead> |             <thead> | ||||||
|                 <tr> |                 <tr> | ||||||
|             <th nzWidth="200px" nzAlign="center">公里数</th> |                     <th rowspan="2" nzWidth="200px" nzAlign="center" nzLeft>公里数</th> | ||||||
|             <th  nzWidth="130px" nzAlign="center">计算方式</th> |                     <th rowspan="2" nzWidth="130px" nzAlign="center">计算方式</th> | ||||||
|             <th nzWidth="200px" nzAlign="center" *ngFor="let item of headers">车长(米)</th> |                     <th nzWidth="220px" nzAlign="center" *ngFor="let item of headers">车长(米)</th> | ||||||
|             <th nzWidth="60px" nzAlign="center" nzRight>操作</th> |                     <th rowspan="2" nzWidth="60px" nzAlign="center" nzRight>操作</th> | ||||||
|                 </tr> |                 </tr> | ||||||
|                 <tr> |                 <tr> | ||||||
|  |                     <th nzWidth="220px" nzAlign="center" *ngFor="let item of headers;let i = index"> | ||||||
|  |                         <div style="display: flex;align-items: center;justify-content: space-between;"> | ||||||
|  |                             <label style="width: 65px;text-align: right;"> {{item.startLength}}</label> | ||||||
|  |                             <label>-</label> | ||||||
|  |                             <nz-input-number [ngModel]="item.endLength" (ngModelChange)="changeEndLength($event,i)" | ||||||
|  |                                 [nzMin]="0" [nzFormatter]="formatterDollar" nzSize="small" class="mr-sm" disabled> | ||||||
|  |                             </nz-input-number> | ||||||
|  |                         </div> | ||||||
|  |                     </th> | ||||||
|                 </tr> |                 </tr> | ||||||
|             </thead> |             </thead> | ||||||
|             <tbody> |             <tbody> | ||||||
|         <tr *ngFor="let item of groupingTable.data"> |                 <tr *ngFor="let item of groupingTable.data;let i = index"> | ||||||
|             <td nzWidth="200px" nzAlign="center">{{ item.startKm }} - {{ item.endKm }}</td> |                     <td nzWidth="200px" nzAlign="center" nzLeft> | ||||||
|             <td nzWidth="130px" nzAlign="center">{{ item.computeMode }}</td> |                         <div style="display: flex;align-items: center;justify-content: space-between;"> | ||||||
|             <td nzWidth="200px" nzAlign="center" *ngFor="let node of item.configValue">最高{{ node.maxPrice }} 预警{{ |                             <label style="width: 65px;text-align: right;"> {{item.startKm}}</label> | ||||||
|                 node.ewPrice }}</td> |                             <label>-</label> | ||||||
|             <td nzWidth="60px" nzAlign="center" nzRight>删除</td> |                             <nz-input-number [ngModel]="item.endKm" (ngModelChange)="changeEndKm($event,i)" [nzMin]="0" | ||||||
|  |                                 [nzFormatter]="formatterDollar" nzSize="small"> | ||||||
|  |                             </nz-input-number> | ||||||
|  |                         </div> | ||||||
|  |                     </td> | ||||||
|  |                     <td nzWidth="130px" nzAlign="center">{{computeMode[item.computeMode] }}</td> | ||||||
|  |                     <td nzWidth="220px" nzAlign="center" *ngFor="let node of item.configValue"> | ||||||
|  |                         <div style="display: flex;align-items: center;justify-content: center;"> | ||||||
|  |                             <label>最高</label> | ||||||
|  |                             <nz-input-number [(ngModel)]="node.maxPrice" [nzMin]="0" nzSize="small" style="width: 55px;" | ||||||
|  |                                 class="ml-sm mr-sm"> | ||||||
|  |                             </nz-input-number> | ||||||
|  |                             <label>预警</label> | ||||||
|  |                             <nz-input-number [(ngModel)]="node.ewPrice" [nzMin]="0" nzSize="small" style="width: 55px;" | ||||||
|  |                                 class="ml-sm"> | ||||||
|  |                             </nz-input-number> | ||||||
|  |                         </div> | ||||||
|  |                     </td> | ||||||
|  |                     <td nzWidth="60px" nzAlign="center" nzRight> | ||||||
|  |                         <a *ngIf="i === groupingTable.data.length-1 && groupingTable.data.length>2" nz-popconfirm | ||||||
|  |                             nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteRow(i)">删除</a> | ||||||
|  |                     </td> | ||||||
|                 </tr> |                 </tr> | ||||||
|             </tbody> |             </tbody> | ||||||
|         </nz-table> |         </nz-table> | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     </div> | ||||||
|  | </div> | ||||||
| @ -0,0 +1,14 @@ | |||||||
|  | :host::ng-deep { | ||||||
|  |     nz-input-number { | ||||||
|  |         width: 85px; | ||||||
|  |  | ||||||
|  |         input { | ||||||
|  |             width : 100%; | ||||||
|  |             margin: 0; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         .ant-input-number-handler-wrap { | ||||||
|  |             display: none; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -9,6 +9,12 @@ import { BaseService } from '@shared'; | |||||||
| export class FreightTableComponent implements OnInit { | export class FreightTableComponent implements OnInit { | ||||||
|   data: any[] = []; |   data: any[] = []; | ||||||
|   headers: any[] = []; |   headers: any[] = []; | ||||||
|  |  | ||||||
|  |   formatterDollar = (value: number): string => `${value} (含)`; | ||||||
|  |   computeMode: any = { | ||||||
|  |     0: '总运价', | ||||||
|  |     1: '单公里运价' | ||||||
|  |   }; | ||||||
|   constructor(public service: BaseService) {} |   constructor(public service: BaseService) {} | ||||||
|  |  | ||||||
|   ngOnInit(): void { |   ngOnInit(): void { | ||||||
| @ -32,7 +38,99 @@ export class FreightTableComponent implements OnInit { | |||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 修改结束车长 | ||||||
|  |    * @param event 车长 | ||||||
|  |    * @param i 下标 | ||||||
|  |    */ | ||||||
|   changeEndLength(event: any, i: number) { |   changeEndLength(event: any, i: number) { | ||||||
|     console.log(event, i); |     if (event <= this.headers[i].startLength) { | ||||||
|  |       this.headers[i].endLength = this.headers[i].startLength + 1; | ||||||
|  |       this.changeNextStartLength(event, i + 1); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     this.headers[i].endLength = event; | ||||||
|  |     this.changeNextStartLength(event, i + 1); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 修改结束公里数 | ||||||
|  |    * @param event 车长 | ||||||
|  |    * @param i 下标 | ||||||
|  |    */ | ||||||
|  |   changeEndKm(event: any, i: number) { | ||||||
|  |     if (event <= this.data[i].startKm) { | ||||||
|  |       this.data[i].endKm = this.data[i].startKm + 1; | ||||||
|  |       this.changeNextStartKm(event, i + 1); | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     this.data[i].endKm = event; | ||||||
|  |     this.changeNextStartKm(event, i + 1); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   add() { | ||||||
|  |     console.log(this.data); | ||||||
|  |  | ||||||
|  |     const tem = this.data[this.data?.length - 1]; | ||||||
|  |     if (tem && tem.endKm) { | ||||||
|  |       const list = this.headers.map(item => ({ | ||||||
|  |         ewPrice: null, | ||||||
|  |         itemId: item.id, | ||||||
|  |         maxPrice: null | ||||||
|  |       })); | ||||||
|  |       this.data.push({ | ||||||
|  |         computeMode: 1, | ||||||
|  |         configValue: list, | ||||||
|  |         endKm: '', | ||||||
|  |         startKm: tem.endKm | ||||||
|  |       }); | ||||||
|  |       this.data = [...this.data]; | ||||||
|  |     } else { | ||||||
|  |       this.service.msgSrv.warning('请填写完整公里数'); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   deleteRow(index: number) { | ||||||
|  |     this.data = this.data.filter((d, i) => index !== i); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   save() { | ||||||
|  |     this.service.request('/api/mdc/cuc/freightConfig/saveBatch', this.data).subscribe(res => { | ||||||
|  |       if (res) { | ||||||
|  |         console.log(res); | ||||||
|  |         this.service.msgSrv.success('修改成功'); | ||||||
|  |         this.loadData(); | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 遍历同步后置位车长 | ||||||
|  |    * @param event  车长 | ||||||
|  |    * @param i 下标 | ||||||
|  |    */ | ||||||
|  |   private changeNextStartLength(event: number, i: number) { | ||||||
|  |     if (this.headers[i]) { | ||||||
|  |       this.headers[i].startLength = event; | ||||||
|  |       if (this.headers[i].endLength <= event) { | ||||||
|  |         this.headers[i].endLength = this.headers[i].startLength + 0.5; | ||||||
|  |         this.changeNextStartLength(event + 0.5, i + 1); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   /** | ||||||
|  |    * 遍历同步后置位公里数 | ||||||
|  |    * @param event  车长 | ||||||
|  |    * @param i 下标 | ||||||
|  |    */ | ||||||
|  |   private changeNextStartKm(event: number, i: number) { | ||||||
|  |     if (this.data[i]) { | ||||||
|  |       this.data[i].startKm = event; | ||||||
|  |       if (this.data[i].endKm <= event) { | ||||||
|  |         this.data[i].endKm = this.data[i].startKm + 1; | ||||||
|  |         this.changeNextStartKm(event + 1, i + 1); | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -103,12 +103,7 @@ | |||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 "text": "车辆审核列表", |                 "text": "车辆审核列表", | ||||||
|                 "link": "/vehicle/audit", |                 "link": "/vehicle/audit" | ||||||
|                 "acl": { |  | ||||||
|                   "ability": [ |  | ||||||
|                     "YUNLI-CART-AUDIT-SEARCH" |  | ||||||
|                   ] |  | ||||||
|                 } |  | ||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 "hide": true, |                 "hide": true, | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user