This commit is contained in:
Taric Xin
2021-12-17 16:03:27 +08:00
parent 6d65ead997
commit 92c844a2b5
11 changed files with 149 additions and 225 deletions

View File

@ -1,9 +0,0 @@
<div class="modal-header">
<div class="modal-title">编辑 {{ record.id }} 信息</div>
</div>
<sf #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]="http.loading">保存</button>
</div>
</sf>

View File

@ -1,6 +0,0 @@
@import '~@delon/theme/index';
:host {
::ng-deep {
}
}

View File

@ -1,66 +1,8 @@
import { Component, ChangeDetectionStrategy, ChangeDetectorRef, TemplateRef, ViewChild } from '@angular/core';
import { STComponent, STColumn, STData, STChange } from '@delon/abc/st';
import { SFSchema, SFUISchema } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { map, tap } from 'rxjs/operators';
import { Component } from '@angular/core';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.less'],
changeDetection: ChangeDetectionStrategy.OnPush
styleUrls: ['./dashboard.component.less']
})
export class DashboardComponent {
@ViewChild('sf')
sf!: SFSchema;
record: any = {};
i: any;
schema: any = {
properties: {
no: { type: 'string', title: '编号' },
owner: { type: 'string', title: '姓名' },
callNo: { type: 'number', title: '调用次数' },
href: { type: 'string', title: '链接', format: 'uri', ui: { errors: { uri: '11' } } },
description: { type: 'string', title: '描述' }
},
required: ['owner', 'callNo', 'href', 'description']
};
ui: SFUISchema = {
'*': {
spanLabelFixed: 100,
grid: { span: 12 }
},
$no: {
widget: 'text'
},
$href: {
widget: 'string'
},
$description: {
widget: 'textarea',
grid: { span: 24 }
}
};
constructor(private msgSrv: NzMessageService, public http: _HttpClient) {}
ngOnInit(): void {
// if (this.record.id > 0) this.http.get(`/user/${this.record.id}`).subscribe(res => (this.i = res));
}
save(value: any): void {
console.log(this.sf.value);
// this.http.post(`/user/${this.record.id}`, value).subscribe(res => {
// this.msgSrv.success('保存成功');
// // this.modal.close(true);
// });
}
close(): void {
// this.modal.destroy();
}
}
export class DashboardComponent {}