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> <nz-card>
<div class="filter-wrap"> <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> <button nz-button nzType="primary" (click)="open()"><i nz-icon nzType="plus" nzTheme="outline"></i>筛选</button>
</div> </div>
<st #st [data]="this.service.$api_smsTemplate_page " [columns]="columns" [req]="{ process: beforeReq }" <st #st [data]="this.service.$api_smsTemplate_page " [columns]="columns" [req]="{ process: beforeReq }"
@ -24,9 +24,10 @@
</ng-template> </ng-template>
</nz-drawer> </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> <ng-container *nzModalContent>
<sf #sfEdit [formData]="tempData" [schema]="editSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}" [compact]="true" <sf #sfEdit [formData]="tempData" [schema]="editSchema" [ui]="{ '*': { spanLabelFixed: 90,grid: { span: 24 } }}"
[button]="'none'"></sf> [compact]="true" [button]="'none'"></sf>
</ng-container> </ng-container>
</nz-modal> </nz-modal>

View File

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

View File

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