diff --git a/src/app/routes/account/form/form.component.html b/src/app/routes/account/form/form.component.html
index 310163b..1ea5827 100644
--- a/src/app/routes/account/form/form.component.html
+++ b/src/app/routes/account/form/form.component.html
@@ -1,9 +1,42 @@
-
-
-
+
+
+
diff --git a/src/app/routes/account/form/form.component.ts b/src/app/routes/account/form/form.component.ts
index 5d6886a..7a0c039 100644
--- a/src/app/routes/account/form/form.component.ts
+++ b/src/app/routes/account/form/form.component.ts
@@ -1,61 +1,30 @@
-import { Component } from '@angular/core';
-import { SFSchema, SFSelectWidgetSchema } from '@delon/form';
+import { Component, OnInit } from '@angular/core';
import { _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalRef } from 'ng-zorro-antd/modal';
-import { map } from 'rxjs/operators';
@Component({
selector: 'app-account-form',
templateUrl: './form.component.html',
})
-export class AccountFormComponent {
+export class AccountFormComponent implements OnInit {
record: any = {};
- schema: SFSchema = {
- properties: {
- name: { type: 'string', title: '名称', maxLength: 50 },
- type: {
- type: 'string',
- title: '帐户类别',
- default: 'general_account',
- ui: {
- widget: 'select',
- asyncData: () => {
- return this.http.get('/api/accounts/types').pipe(
- map((res) => {
- return res.data.map((item: any) => {
- return { value: item.type, label: item.name };
- });
- }),
- );
- },
- } as SFSelectWidgetSchema,
- },
- currency_balance: { type: 'number', title: '起始金额', default: 0, ui: { widgetWidth: 200 } },
- currency_code: {
- type: 'string',
- title: '货币',
- default: 'CNY',
- enum: [
- { value: 'CNY', label: 'CNY' },
- // { value: 'USD', label: 'USD' },
- ],
- },
- // exclude_from_stats: {
- // type: 'boolean',
- // title: '从统计中排除',
- // },
- default: {
- type: 'boolean',
- title: '默认账户',
- },
- },
- required: ['name', 'type', 'balance', 'currency_code'],
- ui: {
- spanLabelFixed: 150,
- grid: { span: 24 },
- },
+ accountTypes: [];
+
+ form = {
+ name: '',
+ type: 'general_account',
+ currency_balance: '',
+ currency_code: 'CNY',
+ status: 'active',
+ default: false,
+ exclude_from_stats: false,
};
+ ngOnInit(): void {
+ if (this.record) {
+ this.form = this.record;
+ }
+ }
constructor(private http: _HttpClient, private modal: NzModalRef, private msgSrv: NzMessageService) {}
diff --git a/src/app/routes/account/index/index.component.html b/src/app/routes/account/index/index.component.html
index 8f79875..e816f91 100644
--- a/src/app/routes/account/index/index.component.html
+++ b/src/app/routes/account/index/index.component.html
@@ -77,6 +77,7 @@
{{ item.type_name }}
默认账户
+ 冻结
diff --git a/src/app/routes/account/index/index.component.ts b/src/app/routes/account/index/index.component.ts
index 3748492..7d5e3ee 100644
--- a/src/app/routes/account/index/index.component.ts
+++ b/src/app/routes/account/index/index.component.ts
@@ -90,7 +90,9 @@ export class AccountIndexComponent implements OnInit {
}
form(record: { id?: number } = {}): void {
- this.modal.create(AccountFormComponent, { record }, { size: 'md' }).subscribe((res) => {
+ console.log(this.accountTypes);
+
+ this.modal.create(AccountFormComponent, { record, accountTypes: this.accountTypes }, { size: 'md' }).subscribe((res) => {
this.getData();
this.getOverview();
this.cdr.detectChanges();
diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts
index ef9f6cc..f5fd48d 100644
--- a/src/app/shared/search/search.component.ts
+++ b/src/app/shared/search/search.component.ts
@@ -31,7 +31,7 @@ export class RecordSearchComponent implements OnInit {
ngOnInit() {
this.initQ = deepCopy(this.q);
- this.loadSelect('/api/accounts', 'account_id');
+ this.loadSelect('/api/accounts?status=active', 'account_id');
this.loadSelect('/api/categories', 'category_id');
this.loadSelect('/api/tags', 'tags');
this.loadSelect('/api/transactions/types', 'transaction_type');