fix bug
This commit is contained in:
@ -29,7 +29,7 @@ export class DictSelectComponent implements OnInit, ControlValueAccessor {
|
||||
@Input() containsAllLabel = true; // 是否包含全部这一选项
|
||||
@Input() mode: 'multiple' | 'tags' | 'default' = 'default';
|
||||
|
||||
constructor(public service: DictSelectService, public cdr: ChangeDetectorRef) {}
|
||||
constructor(public service: DictSelectService, public cdr: ChangeDetectorRef) { }
|
||||
|
||||
writeValue(geo: string): void {
|
||||
if (geo == null) {
|
||||
@ -56,7 +56,6 @@ export class DictSelectComponent implements OnInit, ControlValueAccessor {
|
||||
if (this.dictList.length > 0 && this.containsAllLabel !== false) {
|
||||
const obj = { label: '全部', value: '' };
|
||||
this.dictList.unshift(obj);
|
||||
console.log(this.dictList);
|
||||
}
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-01-25 20:18:52
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-21 14:14:06
|
||||
* @LastEditTime : 2022-03-29 10:34:14
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
-->
|
||||
@ -37,16 +37,15 @@
|
||||
</td>
|
||||
<td nzWidth="220px" nzAlign="center" >
|
||||
<div >
|
||||
<nz-select ngModel="lucy">
|
||||
<nz-option nzValue="jack" nzLabel="Jack154654564654"></nz-option>
|
||||
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
|
||||
</nz-select>
|
||||
<nz-select style="min-width: 150px;" [(ngModel)]="item.gradeConfigId" >
|
||||
<nz-option *ngFor="let item of grage" [nzValue]="item.id" [nzLabel]="item.gradeName"></nz-option>
|
||||
</nz-select>
|
||||
</div>
|
||||
</td>
|
||||
<td nzWidth="220px" nzAlign="center" >
|
||||
<div style=" margin-left: 26%">
|
||||
<nz-input-group nzPrefix="=">
|
||||
<nz-input-number [(ngModel)]="item.baserebateRate" [nzMin]="0" nzSize="small"
|
||||
<nz-input-number [(ngModel)]="item.startAmount" [nzMin]="0" nzSize="small" (ngModelChange)="changeendAmount($event,i)"
|
||||
>
|
||||
</nz-input-number>
|
||||
</nz-input-group>
|
||||
@ -56,7 +55,7 @@
|
||||
<td nzWidth="220px" nzAlign="center" >
|
||||
<div style=" margin-left: 26%">
|
||||
<nz-input-group nzPrefix="<">
|
||||
<nz-input-number [(ngModel)]="item.blanketrebateRate" [nzMin]="0" nzSize="small" >
|
||||
<nz-input-number [(ngModel)]="item.endAmount" [nzMin]="0" nzSize="small" >
|
||||
</nz-input-number>
|
||||
</nz-input-group>
|
||||
</div>
|
||||
@ -64,7 +63,7 @@
|
||||
<td nzWidth="220px" nzAlign="center" >
|
||||
<div style=" margin-left: 26%">
|
||||
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate2">
|
||||
<nz-input-number [(ngModel)]="item.baserebateRate" [nzMin]="0" nzSize="small"
|
||||
<nz-input-number [(ngModel)]="item.managementFeeRatio" [nzMin]="0" nzSize="small"
|
||||
>
|
||||
</nz-input-number>
|
||||
</nz-input-group>
|
||||
|
||||
@ -1,87 +1,90 @@
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { BaseService } from '@shared';
|
||||
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
|
||||
|
||||
import { EventEmitter} from '@angular/core'
|
||||
@Component({
|
||||
selector: 'app-rebate-table',
|
||||
templateUrl: './rebate-table.component.html',
|
||||
styleUrls: ['./rebate-table.component.less']
|
||||
})
|
||||
export class RebateTableComponent implements OnInit {
|
||||
data: any[] = [];
|
||||
@Input() data: any =[];
|
||||
@Output()
|
||||
private dataChange: EventEmitter<any> = new EventEmitter();
|
||||
emit() {
|
||||
this.dataChange.emit(this.data)
|
||||
}
|
||||
headers: any[] = [];
|
||||
gradeConfigId: string ='';
|
||||
grage: any[] = [];
|
||||
formatterDollar = (value: number): string => `${value}`;
|
||||
changeSub = new Subject<string>();
|
||||
constructor(public service: BaseService, private cdr: ChangeDetectorRef) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.data = [
|
||||
{
|
||||
gradeConfigId: '',
|
||||
startAmount: 0,
|
||||
endAmount: 0,
|
||||
managementFeeRatio: 0,
|
||||
}
|
||||
];
|
||||
this.loadData();
|
||||
this.changeEndKmAction();
|
||||
this.changeendAmountAction();
|
||||
}
|
||||
|
||||
loadData() {
|
||||
this.service.request('/api/mdc/cuc/insuranceConfig/list').subscribe(res => {
|
||||
this.service.request('/api/mdc/partnerGradeConfig/listPartnerGradeConfig').subscribe(res => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
this.data = res;
|
||||
this.grage = res;
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
});
|
||||
this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
|
||||
"rebate.config.minrebatePrice"
|
||||
]).subscribe(res => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
// this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
|
||||
// "rebate.config.minrebatePrice"
|
||||
// ]).subscribe(res => {
|
||||
// if (res) {
|
||||
// console.log(res);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改结束车长
|
||||
* @param event 车长
|
||||
* @param i 下标
|
||||
*/
|
||||
changeEndLength(event: any, i: number) {
|
||||
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) {
|
||||
changeendAmount(event: any, i: number) {
|
||||
if (event) {
|
||||
console.log(event);
|
||||
|
||||
this.changeSub.next(`${event},${i}`);
|
||||
}
|
||||
}
|
||||
changeEndKmAction() {
|
||||
changeendAmountAction() {
|
||||
this.changeSub.pipe(debounceTime(500)).subscribe((res: string) => {
|
||||
if (res) {
|
||||
const paras = res.split(',');
|
||||
const num = Number(paras[0]);
|
||||
const i = Number(paras[1]);
|
||||
|
||||
if (num <= this.data[i].startKm) {
|
||||
this.data[i].endKm = null;
|
||||
if (num <= this.data[i]?.startAmount) {
|
||||
console.log(this.data[i].endAmount);
|
||||
this.data[i].endAmount = null;
|
||||
setTimeout(() => {
|
||||
this.data[i].endKm = this.data[i].startKm + 1 ;
|
||||
this.data[i].endAmount = this.data[i]?.startAmount + 1 ;
|
||||
}, 0);
|
||||
this.changeNextStartKm(this.data[i].startKm + 1, i + 1);
|
||||
this.changeNextstartAmount(this.data[i]?.startAmount + 1, i + 1);
|
||||
return;
|
||||
}
|
||||
this.data[i].endKm = num;
|
||||
this.changeNextStartKm(num, i + 1);
|
||||
this.data[i].endAmount = num;
|
||||
this.changeNextstartAmount(num, i + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -90,14 +93,14 @@ export class RebateTableComponent implements OnInit {
|
||||
console.log(this.data);
|
||||
|
||||
const tem = this.data[this.data?.length - 1];
|
||||
if (tem && tem.endKm) {
|
||||
if (tem) {
|
||||
this.data.push({
|
||||
endKm: '',
|
||||
startKm: tem.endKm
|
||||
gradeConfigId: '',
|
||||
startAmount: 0,
|
||||
endAmount: 0,
|
||||
managementFeeRatio: 0,
|
||||
});
|
||||
this.data = [...this.data];
|
||||
} else {
|
||||
this.service.msgSrv.warning('请填写完整公里数');
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,32 +128,18 @@ export class RebateTableComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 遍历同步后置位车长
|
||||
* @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) {
|
||||
private changeNextstartAmount(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);
|
||||
this.data[i].startAmount = event;
|
||||
if (this.data[i].endAmount <= event) {
|
||||
this.data[i].endAmount = this.data[i].startAmount + 1;
|
||||
this.changeNextstartAmount(event + 1, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ export class ShipperBaseService extends BaseService {
|
||||
map(res => {
|
||||
if (res) {
|
||||
return res.map((m: any) => {
|
||||
return { label: `${m.employeeVO?.empName}/${m.employeeVO?.mobile}`, value: m.id };
|
||||
return { label: `${m.employeeVO?.empName}/${m.employeeVO?.mobile}`, value: m.userAppId };
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user