货源修改

This commit is contained in:
wangshiming
2021-12-03 15:22:55 +08:00
parent a9ef21e333
commit db95de90fb
42 changed files with 2466 additions and 7 deletions

View File

@ -0,0 +1,15 @@
<nz-spin *ngIf="!i" class="modal-spin"></nz-spin>
<sf *ngIf="i" #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none">
<ng-template sf-template="description3" let-me let-ui="ui" let-schema="schema">
<input placeholder="请输入1-30" type="number" [ngModel]="sf.value.description3" style="width: 200px;" nz-input />
<span> 天内支付运费</span>
</ng-template>
<ng-template sf-template="description1" let-me let-ui="ui" let-schema="schema">
<div>{{sf.value.description1 | currency: 'CNY' }}(费率:<a>5.3%</a>)</div>
</ng-template>
<div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button>
<button nz-button type="submit" nzType="primary" (click)="save(sf.value)" [disabled]="!sf.valid"
[nzLoading]="http.loading">确认修改</button>
</div>
</sf>

View File

@ -0,0 +1,24 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SupplyManagementUpdateFreightComponent } from './update-freight.component';
describe('SupplyManagementUpdateFreightComponent', () => {
let component: SupplyManagementUpdateFreightComponent;
let fixture: ComponentFixture<SupplyManagementUpdateFreightComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ SupplyManagementUpdateFreightComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SupplyManagementUpdateFreightComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,140 @@
import { Component, OnInit } from '@angular/core';
import { SFCustomWidgetSchema, SFNumberWidgetSchema, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef } from 'ng-zorro-antd/modal';
@Component({
selector: 'app-supply-management-update-freight',
templateUrl: './update-freight.component.html',
})
export class SupplyManagementUpdateFreightComponent implements OnInit {
record: any = {};
i: any;
schema: SFSchema = {};
ui: SFUISchema = {};
constructor(
private modal: NzModalRef,
private msgSrv: NzMessageService,
public http: _HttpClient,
) { }
ngOnInit(): void {
this.initSF();
if (this.record.id > 0)
this.http.get(`/user/${this.record.id}`).subscribe(res => (this.i = res));
}
initSF() {
this.schema = {
properties: {
no1: {
type: 'string',
title: '是否回单',
enum: [
{ label: '需要', value: 0 },
{ label: '不需要', value: 1 },
],
ui: {
widget: 'radio'
} as SFRadioWidgetSchema,
default: 0
},
owner1: {
type: 'number',
title: '预付',
max: 99999999,
ui: {
prefix: '¥',
widgetWidth: 200,
precision: 2,
change: (val: any) => this.changeNumVal(val, 1)
} as SFNumberWidgetSchema
},
callNo1: {
type: 'number',
title: '到付',
ui: {
prefix: '¥',
widgetWidth: 200,
precision: 2,
change: (val: any) => this.changeNumVal(val, 2)
} as SFNumberWidgetSchema
},
href1: {
type: 'number',
title: '油卡',
ui: {
prefix: '¥',
widgetWidth: 200,
precision: 2,
change: (val: any) => this.changeNumVal(val, 3)
} as SFNumberWidgetSchema
},
description5: {
type: 'number', title: '回单付', maxLength: 140, ui: {
prefix: '¥',
widgetWidth: 200,
precision: 2,
change: (val: any) => this.changeNumVal(val, 4)
} as SFNumberWidgetSchema
},
href2: {
type: 'string',
title: '小计',
ui: {
widget: 'text'
}
},
description1: {
type: 'string',
title: '附加费',
ui: {
widget: 'custom'
}
},
description2: {
type: 'string',
title: '总费用',
ui: {
widget: 'text'
}
},
description3: {
type: 'number',
title: '到货后',
maximum: 30,
minimum: 1,
ui: {
widget: 'custom',
} as SFCustomWidgetSchema
},
},
required: ['owner', 'callNo', 'href', 'description'],
};
this.ui = {
'*': {
spanLabelFixed: 100,
grid: { span: 16 },
},
};
}
save(value: any): void {
this.http.post(`/user/${this.record.id}`, value).subscribe(res => {
this.msgSrv.success('保存成功');
this.modal.close(true);
});
}
close(): void {
this.modal.destroy();
}
/**
* 更新数字框
* @param value
* @param type
*/
changeNumVal(value: any, type: number) {
}
}