This commit is contained in:
wangshiming
2022-03-21 14:19:10 +08:00
parent 150489598e
commit f14441f420
3 changed files with 45 additions and 83 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-25 20:18:52 * @Date : 2022-01-25 20:18:52
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-03-11 15:12:01 * @LastEditTime : 2022-03-21 14:14:06
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -14,48 +14,52 @@
<button nz-button nzType="primary" (click)="add()">新增公里数</button> <button nz-button nzType="primary" (click)="add()">新增公里数</button>
<button class="ml-md" nz-button nzType="primary" (click)="save()">保存</button> <button class="ml-md" nz-button nzType="primary" (click)="save()">保存</button>
</div> --> </div> -->
<div>
<sf #sf [schema]="schema" [formData]="sfdata" [button]="'none'" [ui]="ui">
<ng-template sf-template="freightPrice" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate">
<nz-input-number [(ngModel)]="minrebatePrice" [nzMin]="0" ></nz-input-number>
</nz-input-group>
<ng-template #addOnAfterTemplate>
<span ></span>
</ng-template>
</ng-template>
</sf>
</div>
<nz-table #groupingTable [nzData]="data" nzBordered nzSize="small" [nzFrontPagination]="false" <nz-table #groupingTable [nzData]="data" nzBordered nzSize="small" [nzFrontPagination]="false"
[nzScroll]="{ x: '900px' }" [nzShowPagination]="false" class="ml-xl" style="max-width: 1200px;"> [nzScroll]="{ x: '900px' }" [nzShowPagination]="false" class="ml-xl" style="max-width: 1200px;">
<thead> <thead>
<tr> <tr>
<th rowspan="2" nzWidth="250px" nzAlign="center" nzLeft>险种</th> <th rowspan="2" nzWidth="250px" nzAlign="center" nzLeft>序号</th>
<th nzWidth="220px" nzAlign="center" >普货-基本险</th> <th nzWidth="220px" nzAlign="center" >合伙人等级</th>
<th nzWidth="220px" nzAlign="center" >普货-综合险</th> <th nzWidth="220px" nzAlign="center" >初始业务量(万/月)</th>
<th nzWidth="220px" nzAlign="center" >到达业务量(万/月)</th>
<th nzWidth="220px" nzAlign="center" >管理费比例%</th>
<th rowspan="2" nzWidth="60px" nzAlign="center" nzRight>操作</th> <th rowspan="2" nzWidth="60px" nzAlign="center" nzRight>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let item of groupingTable.data;let i = index"> <tr *ngFor="let item of groupingTable.data;let i = index">
<td nzWidth="250px" nzAlign="center" nzLeft> <td nzWidth="250px" nzAlign="center" nzLeft>
<div style="display: flex;align-items: center;justify-content: space-between;"> <div style="text-align: center;">
<div> <div>
公里数km {{i + 1}}
</div> </div>
<div style="color:#f0f0f0;">|</div> </div>
</td>
<td nzWidth="220px" nzAlign="center" >
<div > <div >
<label style="width: 65px;text-align: right;"> {{item.startKm}}</label> <nz-select ngModel="lucy">
<label>-</label> <nz-option nzValue="jack" nzLabel="Jack154654564654"></nz-option>
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
<nz-input-number [ngModel]="item.endKm" (ngModelChange)="changeEndKm($event,i)" [nzMin]="0" </nz-select>
[nzFormatter]="formatterDollar" nzSize="small"> </div>
</nz-input-number>(含) </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>
</nz-input-group>
</div> </div>
</td>
<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>
</nz-input-group>
</div> </div>
</td> </td>
<td nzWidth="220px" nzAlign="center" > <td nzWidth="220px" nzAlign="center" >
<div style=" margin-left: 26%"> <div style=" margin-left: 26%">
@ -69,19 +73,14 @@
</ng-template> </ng-template>
</div> </div>
</td> </td>
<td nzWidth="220px" nzAlign="center" >
<div style=" margin-left: 26%">
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate2">
<nz-input-number [(ngModel)]="item.blanketrebateRate" [nzMin]="0" nzSize="small" >
</nz-input-number>
</nz-input-group>
</div>
</td>
<td nzWidth="60px" nzAlign="center" nzRight> <td nzWidth="60px" nzAlign="center" nzRight>
<a nz-popconfirm
nzPopconfirmTitle="是否新增?" (nzOnConfirm)="add()"
>+</a>
<a *ngIf="i === groupingTable.data.length-1 && groupingTable.data.length>1" <a *ngIf="i === groupingTable.data.length-1 && groupingTable.data.length>1"
nz-popconfirm nz-popconfirm
nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteRow(i)" nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteRow(i)"
>删除</a> >-</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -12,26 +12,17 @@ import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
export class RebateTableComponent implements OnInit { export class RebateTableComponent implements OnInit {
data: any[] = []; data: any[] = [];
headers: any[] = []; headers: any[] = [];
sfdata: any; // 货源单设置回显
@ViewChild('sf', { static: false }) sf!: SFComponent;
schema: SFSchema = {};
ui!: SFUISchema;
formatterDollar = (value: number): string => `${value}`; formatterDollar = (value: number): string => `${value}`;
minrebatePrice: number = 0;
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 {
this.loadData(); this.loadData();
this.initSF()
this.changeEndKmAction(); this.changeEndKmAction();
this.minrebatePrice = 1000
} }
loadData() { loadData() {
this.service.request('/api/mdc/cuc/rebateConfig/list').subscribe(res => { this.service.request('/api/mdc/cuc/insuranceConfig/list').subscribe(res => {
if (res) { if (res) {
console.log(res); console.log(res);
this.data = res; this.data = res;
@ -43,35 +34,10 @@ export class RebateTableComponent implements OnInit {
]).subscribe(res => { ]).subscribe(res => {
if (res) { if (res) {
console.log(res); console.log(res);
this.minrebatePrice = Number(res[0].itemValue)
} }
}); });
} }
initSF() {
this.schema = {
properties: {
freightPrice: {
type: 'string',
title: '单票投保最低保费',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请填写' }
}
},
},
required: ['freightPrice']
};
this.ui = {
'*': {
spanLabelFixed: 160,
grid: { span: 24 }
},
$freightPrice: {
grid: { span: 8 }
},
};
}
/** /**
* 修改结束车长 * 修改结束车长
* @param event 车长 * @param event 车长
@ -145,12 +111,8 @@ export class RebateTableComponent implements OnInit {
} }
save() { save() {
if(!this.minrebatePrice) { console.log(this.data)
this.service.msgSrv.error('必填项为空!')
return
}
let params= { let params= {
minrebatePrice: this.minrebatePrice,
rebateConfigDTOS: this.data rebateConfigDTOS: this.data
} }
console.log(params); console.log(params);

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-25 20:23:54 * @Date : 2022-01-25 20:23:54
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-02-11 17:20:49 * @LastEditTime : 2022-03-21 14:11:56
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.module.ts * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.module.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -18,8 +18,9 @@ import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
import { NzInputModule } from 'ng-zorro-antd/input'; import { NzInputModule } from 'ng-zorro-antd/input';
import { DelonFormModule } from '@delon/form'; import { DelonFormModule } from '@delon/form';
import { NzButtonModule } from 'ng-zorro-antd/button'; import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzSelectModule } from 'ng-zorro-antd/select';
const COMPONENTS = [RebateTableComponent]; const COMPONENTS = [RebateTableComponent];
const MODULES = [NzTableModule, NzInputNumberModule, NzPopconfirmModule, NzInputModule, NzButtonModule, DelonFormModule]; const MODULES = [NzTableModule, NzInputNumberModule, NzPopconfirmModule, NzInputModule, NzButtonModule, DelonFormModule,NzSelectModule];
@NgModule({ @NgModule({
declarations: COMPONENTS, declarations: COMPONENTS,