merge partner

This commit is contained in:
Taric Xin
2022-03-23 14:24:21 +08:00
226 changed files with 15751 additions and 993 deletions

View File

@ -27,7 +27,7 @@ export class DictSelectComponent implements OnInit, ControlValueAccessor {
@Input() params = {};// 请求参数
dictList: any[] = [];
@Input() containsAllLable = true; // 是否包含全部这一选项
@Input() containsAllLabel = true; // 是否包含全部这一选项
@Input() mode: 'multiple' | 'tags' | 'default' = 'default';
@ -55,7 +55,7 @@ export class DictSelectComponent implements OnInit, ControlValueAccessor {
this.service.getDictList(this.url || this.defaultUrl, this.params).subscribe(res => {
if (res) {
this.dictList = res || [];
if (this.dictList.length > 0 && this.containsAllLable) {
if (this.dictList.length > 0 && this.containsAllLabel) {
const obj = { label: '全部', value: '' };
this.dictList.unshift(obj);
}

View File

@ -13,11 +13,11 @@ import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
import { NzTableModule } from 'ng-zorro-antd/table';
import { InsuranceTableComponent } from './insurance-table.component';
import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
import { NzInputModule } from 'ng-zorro-antd/input';
import { DelonFormModule } from '@delon/form';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { InsuranceTableComponent } from './insurance-table.component';
const COMPONENTS = [InsuranceTableComponent];
const MODULES = [NzTableModule, NzInputNumberModule, NzPopconfirmModule, NzInputModule, NzButtonModule, DelonFormModule];

View File

@ -0,0 +1,13 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-25 20:20:07
* @LastEditors : Shiming
* @LastEditTime : 2022-01-26 11:05:44
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\insurance-table\\index.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
export * from './rebate-table.module'
export * from './rebate-table.service'
export * from './rebate-table.component'

View File

@ -0,0 +1,91 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-25 20:18:52
* @LastEditors : Shiming
* @LastEditTime : 2022-03-21 14:14:06
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<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"
[nzScroll]="{ x: '900px' }" [nzShowPagination]="false" class="ml-xl" style="max-width: 1200px;">
<thead>
<tr>
<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 rowspan="2" nzWidth="60px" nzAlign="center" nzRight>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of groupingTable.data;let i = index">
<td nzWidth="250px" nzAlign="center" nzLeft>
<div style="text-align: center;">
<div>
{{i + 1}}
</div>
</div>
</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>
</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>
</nz-input-group>
</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>
</td>
<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>
</nz-input-group>
<ng-template #addOnAfterTemplate2>
<span >%</span>
</ng-template>
</div>
</td>
<td nzWidth="60px" nzAlign="center" nzRight>
<a nz-popconfirm
nzPopconfirmTitle="是否新增?" (nzOnConfirm)="add()"
>+</a>
<a *ngIf="i === groupingTable.data.length-1 && groupingTable.data.length>1"
nz-popconfirm
nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteRow(i)"
>-</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
</div>

View File

@ -0,0 +1,19 @@
:host::ng-deep {
nz-input-number {
width: 85px;
input {
width : 100%;
margin: 0;
}
.ant-input-number-handler-wrap {
display: none;
}
}
.ant-input-group {
display: -webkit-inline-box !important;
}
}

View File

@ -0,0 +1,157 @@
import { debounceTime } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { BaseService } from '@shared';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
@Component({
selector: 'app-rebate-table',
templateUrl: './rebate-table.component.html',
styleUrls: ['./rebate-table.component.less']
})
export class RebateTableComponent implements OnInit {
data: any[] = [];
headers: any[] = [];
formatterDollar = (value: number): string => `${value}`;
changeSub = new Subject<string>();
constructor(public service: BaseService, private cdr: ChangeDetectorRef) {}
ngOnInit(): void {
this.loadData();
this.changeEndKmAction();
}
loadData() {
this.service.request('/api/mdc/cuc/insuranceConfig/list').subscribe(res => {
if (res) {
console.log(res);
this.data = res;
this.cdr.detectChanges();
}
});
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) {
if (event) {
console.log(event);
this.changeSub.next(`${event},${i}`);
}
}
changeEndKmAction() {
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;
setTimeout(() => {
this.data[i].endKm = this.data[i].startKm + 1 ;
}, 0);
this.changeNextStartKm(this.data[i].startKm + 1, i + 1);
return;
}
this.data[i].endKm = num;
this.changeNextStartKm(num, i + 1);
}
});
}
add() {
console.log(this.data);
const tem = this.data[this.data?.length - 1];
if (tem && tem.endKm) {
this.data.push({
endKm: '',
startKm: tem.endKm
});
this.data = [...this.data];
} else {
this.service.msgSrv.warning('请填写完整公里数');
}
}
deleteRow(index: number) {
console.log(index);
var newArr = this.data.concat();
newArr.splice(this.data.length-1,1)
// this.data = this.data.pop()
console.log(newArr);
this.data = [...newArr];
}
save() {
console.log(this.data)
let params= {
rebateConfigDTOS: this.data
}
console.log(params);
this.service.request('/api/mdc/cuc/rebateConfig/saveBatch', params).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);
}
}
}
}

View File

@ -0,0 +1,30 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-25 20:23:54
* @LastEditors : Shiming
* @LastEditTime : 2022-03-21 14:11:56
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.module.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
import { NzTableModule } from 'ng-zorro-antd/table';
import { RebateTableComponent } from './rebate-table.component';
import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
import { NzInputModule } from 'ng-zorro-antd/input';
import { DelonFormModule } from '@delon/form';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzSelectModule } from 'ng-zorro-antd/select';
const COMPONENTS = [RebateTableComponent];
const MODULES = [NzTableModule, NzInputNumberModule, NzPopconfirmModule, NzInputModule, NzButtonModule, DelonFormModule,NzSelectModule];
@NgModule({
declarations: COMPONENTS,
imports: [CommonModule, FormsModule, ...MODULES],
exports: COMPONENTS
})
export class rebateTableModule {}

View File

@ -0,0 +1,18 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-01-25 20:21:04
* @LastEditors : Shiming
* @LastEditTime : 2022-01-25 20:35:52
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\insurance-table\\insurance-table.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class RebateService {
}