This commit is contained in:
wangshiming
2022-04-26 16:52:20 +08:00
parent c7f22dbde0
commit c9afdb19d4
2 changed files with 36 additions and 25 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-02-24 20:09:49 * @Date : 2022-02-24 20:09:49
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-04-26 16:04:31 * @LastEditTime : 2022-04-26 16:51:07
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html * @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -38,10 +38,10 @@
<sv col="1"> <sv col="1">
<div style="width: 850px" *ngIf="configType == '1'"> <div style="width: 850px" *ngIf="configType == '1'">
<app-rebate-table #table [(data)]="tabelData" [type]="1"></app-rebate-table> <app-rebate-table #table [(data)]="tabelData" [type]="1" [hiden]="hiden"></app-rebate-table>
</div> </div>
<div style="width: 850px" *ngIf="configType == '2'"> <div style="width: 850px" *ngIf="configType == '2'">
<app-rebate-table #table [(data)]="tabelData" [type]="2"></app-rebate-table> <app-rebate-table #table [(data)]="tabelData" [type]="2" [hiden]="hiden"></app-rebate-table>
</div> </div>
</sv> </sv>

View File

@ -3,32 +3,52 @@ import { Subject } from 'rxjs';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, Output, ViewChild } from '@angular/core'; import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, Output, ViewChild } from '@angular/core';
import { BaseService } from '@shared'; import { BaseService } from '@shared';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { EventEmitter} from '@angular/core' import { EventEmitter } from '@angular/core';
@Component({ @Component({
selector: 'app-rebate-table', selector: 'app-rebate-table',
templateUrl: './rebate-table.component.html', templateUrl: './rebate-table.component.html',
styleUrls: ['./rebate-table.component.less'] styleUrls: ['./rebate-table.component.less']
}) })
export class RebateTableComponent implements OnInit { export class RebateTableComponent implements OnInit {
@Input() data: any =[]; @Input() data: any = [];
@Input() type: any; @Input() type: any;
@Input() hiden!: boolean;
@Output() @Output()
private dataChange: EventEmitter<any> = new EventEmitter(); private dataChange: EventEmitter<any> = new EventEmitter();
emit() { emit() {
this.dataChange.emit(this.data) this.dataChange.emit(this.data);
} }
headers: any[] = []; headers: any[] = [];
gradeConfigId: string =''; gradeConfigId: string = '';
grage: any[] = []; grage: any[] = [];
formatterDollar = (value: number): string => `${value}`; formatterDollar = (value: number): string => `${value}`;
changeSub = new Subject<string>(); changeSub = new Subject<string>();
constructor(public service: BaseService, private cdr: ChangeDetectorRef) {} constructor(public service: BaseService, private cdr: ChangeDetectorRef) {}
ngOnInit(): void { ngOnInit(): void {
if(this.type == '2') { if (this.type == '2') {
this.loadData(); this.loadData();
} }
if (!this.hiden && this.type == '2') {
this.data = [
{
gradeConfigId: '',
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
} else if (!this.hiden && this.type == '1'){
this.data = [
{
gradeConfigId: 0,
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
}
console.log(this.type); console.log(this.type);
console.log(this.data); console.log(this.data);
@ -39,21 +59,12 @@ export class RebateTableComponent implements OnInit {
this.service.request('/api/mdc/partnerGradeConfig/listPartnerGradeConfig').subscribe(res => { this.service.request('/api/mdc/partnerGradeConfig/listPartnerGradeConfig').subscribe(res => {
if (res) { if (res) {
console.log(res); console.log(res);
this.grage = res; this.grage = res;
this.cdr.detectChanges(); this.cdr.detectChanges();
} }
}); });
// this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
// "rebate.config.minrebatePrice"
// ]).subscribe(res => {
// if (res) {
// console.log(res);
// }
// });
} }
/** /**
* 修改结束公里数 * 修改结束公里数
* @param event 车长 * @param event 车长
@ -79,7 +90,7 @@ export class RebateTableComponent implements OnInit {
console.log(this.data[i].endAmount); console.log(this.data[i].endAmount);
this.data[i].endAmount = null; this.data[i].endAmount = null;
setTimeout(() => { setTimeout(() => {
this.data[i].endAmount = this.data[i]?.startAmount + 1 ; this.data[i].endAmount = this.data[i]?.startAmount + 1;
}, 0); }, 0);
this.changeNextstartAmount(this.data[i]?.startAmount + 1, i + 1); this.changeNextstartAmount(this.data[i]?.startAmount + 1, i + 1);
return; return;
@ -99,7 +110,7 @@ export class RebateTableComponent implements OnInit {
gradeConfigId: '', gradeConfigId: '',
startAmount: 0, startAmount: 0,
endAmount: 0, endAmount: 0,
managementFeeRatio: 0, managementFeeRatio: 0
}); });
this.data = [...this.data]; this.data = [...this.data];
} }
@ -108,7 +119,7 @@ export class RebateTableComponent implements OnInit {
deleteRow(index: number) { deleteRow(index: number) {
console.log(index); console.log(index);
var newArr = this.data.concat(); var newArr = this.data.concat();
newArr.splice(this.data.length-1,1) newArr.splice(this.data.length - 1, 1);
// this.data = this.data.pop() // this.data = this.data.pop()
console.log(newArr); console.log(newArr);
this.data = [...newArr]; this.data = [...newArr];