This commit is contained in:
Taric Xin
2022-04-28 16:58:58 +08:00
parent f25fdea3db
commit 4a05490585
3 changed files with 21 additions and 20 deletions

View File

@ -2,7 +2,7 @@
<nz-card>
<div class="filter-wrap">
<button nz-button nzType="primary" (click)="add()">新增</button>
<button nz-button nzType="primary" (click)="add()" acl [acl-ability]="['SMS_TEMPLATE-add']">新增</button>
<button nz-button nzType="primary" (click)="open()"><i nz-icon nzType="plus" nzTheme="outline"></i>筛选</button>
</div>
<st #st [data]="this.service.$api_smsTemplate_page " [columns]="columns" [req]="{ process: beforeReq }"
@ -24,9 +24,10 @@
</ng-template>
</nz-drawer>
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="!isEdit?'新增':'编辑'" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" [nzOkDisabled]="!sfEdit?.valid">
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="!isEdit?'新增':'编辑'" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()"
[nzOkDisabled]="!sfEdit?.valid">
<ng-container *nzModalContent>
<sf #sfEdit [formData]="tempData" [schema]="editSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}" [compact]="true"
[button]="'none'"></sf>
<sf #sfEdit [formData]="tempData" [schema]="editSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}"
[compact]="true" [button]="'none'"></sf>
</ng-container>
</nz-modal>

View File

@ -1,4 +1,3 @@
import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { STColumn, STComponent, STRequestOptions } from '@delon/abc/st';
@ -23,7 +22,7 @@ export class SmsTemplateComponent implements OnInit {
isVisible = false;
tempData = {};
isEdit = false;
searchSchema: SFSchema = {
properties: {
templateName: {
@ -50,27 +49,27 @@ export class SmsTemplateComponent implements OnInit {
templateName: {
type: 'string',
title: '模板名称',
ui: { placeholder: '请输入模板名称', errors: { require: '必填项'} }
ui: { placeholder: '请输入模板名称', errors: { require: '必填项' } }
},
templateCode: {
type: 'string',
title: '模板编码',
readOnly: this.isEdit,
ui: { placeholder: '请输入模板编码', errors: { require: '必填项'} }
ui: { placeholder: '请输入模板编码', errors: { require: '必填项' } }
},
templateContent: {
type: 'string',
title: '模板内容',
ui: { placeholder: '请输入模板内容', errors: { require: '必填项'} }
ui: { placeholder: '请输入模板内容', errors: { require: '必填项' } }
}
},
required: ['templateName','templateCode','templateContent']
}
required: ['templateName', 'templateCode', 'templateContent']
};
}
columns: STColumn[] = [
{ title: '模板名称', className: 'text-center', index: 'templateName' },
{ title: '模板编码', className: 'text-center', index: 'templateCode' },
{ title: '模板名称', className: 'text-center', width: '200px', index: 'templateName' },
{ title: '模板编码', className: 'text-center', width: '140px', index: 'templateCode' },
{ title: '模板内容', className: 'text-center', index: 'templateContent' },
// {
// title: '创建人', className: 'text-center', index: 'content',
@ -79,21 +78,23 @@ export class SmsTemplateComponent implements OnInit {
title: '更新时间',
index: 'modifyTime',
type: 'date',
width: '160px',
className: 'text-center'
},
{
title: '操作',
width: '90px',
buttons: [
{
text: '编辑',
click: i => this.edit(i),
acl: { ability: ['SMS_TEMPLATE-save'] },
click: i => this.edit(i)
}
]
}
];
constructor(public service: SystemService, private nzModalService: NzModalService, private route: ActivatedRoute) {
}
constructor(public service: SystemService, private nzModalService: NzModalService, private route: ActivatedRoute) {}
ngOnInit(): void {
this.initSF();
@ -144,7 +145,7 @@ export class SmsTemplateComponent implements OnInit {
templateCode,
templateName,
templateContent
}
};
this.service.request(this.service.$api_smsTemplate_edit, params).subscribe(res => {
// console.log(res);
@ -152,8 +153,7 @@ export class SmsTemplateComponent implements OnInit {
this.isVisible = false;
this.st.reload();
}
})
});
}
handleCancel(): void {

View File

@ -56,7 +56,7 @@ const routes: Routes = [
// { path: 'btn-management', component: BtnManagementComponent },
{ path: 'announcement-message', component: AnnouncementMessageComponent },
{ path: 'insurance-set', component: InsuranceSetComponent },
{ path: 'sms-template', component: SmsTemplateComponent }
{ path: 'sms-template', component: SmsTemplateComponent, data: { guard: { ability: ['SMS_TEMPLATE-search'] } } }
];
@NgModule({