This commit is contained in:
wangshiming
2022-03-30 14:41:49 +08:00
parent 60e26f7792
commit 1eef137381
6 changed files with 179 additions and 12 deletions

View File

@ -0,0 +1,8 @@
<nz-spin [nzSpinning]="!i"></nz-spin>
<sf *ngIf="i" #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none">
<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]="service.http.loading">修改</button>
</div>
</sf>

View File

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

View File

@ -0,0 +1,110 @@
import { Component, OnInit } from '@angular/core';
import { SFSchema, SFUISchema } from '@delon/form';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { TaxManagementService } from '../../../services/tax-management.service';
@Component({
selector: 'app-datatable-upload-setting',
templateUrl: './upload-setting.component.html',
})
export class TaxManagementUploadSettingComponent implements OnInit {
record: any = {};
i: any = {};
schema!: SFSchema;
ui!: SFUISchema;
constructor(
private modal: NzModalRef,
public service: TaxManagementService
) { }
ngOnInit(): void {
this.initSF();
// this.loadData();
}
/**
* 初始化查询表单
*/
initSF() {
this.schema = {
properties: {
no: {
type: 'string',
title: '订单数据',
enum: [
{
label: '手动上传',
value: '1'
},
{
label: '自动上传',
value: '2'
}
],
description: '开启自动上传后,订单将在支付完成且风险单校验通过后自动上传',
ui: {
widget: 'radio',
}
},
owner: {
type: 'string',
title: '资金数据',
enum: [
{
label: '手动上传',
value: '1'
},
{
label: '自动上传',
value: '2'
}
],
description: '开启自动上传后,订单将在支付完成且风险单校验通过后自动上传',
ui: {
widget: 'radio',
}
},
},
required: ['owner', 'no'],
}
this.ui = {
'*': {
spanLabelFixed: 100,
grid: { span: 24 },
},
};
}
/**
* 获取设置数据
*/
loadData() {
this.service.request(this.service.$api_get_upload_setting, {}).subscribe(res => {
if (res) {
this.i = res;
}
})
}
/**
* 修改
* @param value
*/
save(value: any): void {
this.service.request(this.service.$api_upload_setting_save, { ...value }).subscribe(res => {
if (res) {
this.service.msgSrv.success('保存成功');
this.modal.close(true);
}
})
}
close(): void {
this.modal.destroy();
}
}