Merge branch 'weiyu'

This commit is contained in:
weiyu
2022-04-22 17:29:59 +08:00
18 changed files with 656 additions and 37 deletions

View File

@ -24,7 +24,7 @@
</ng-template>
</nz-drawer>
<nz-modal [(nzVisible)]="isVisible" [nzTitle]="isEdit?'编辑':'新增'" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<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>

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { STColumn, STComponent, STRequestOptions } from '@delon/abc/st';
import { SFComponent, SFSchema } from '@delon/form';
@ -18,11 +18,12 @@ export class SmsTemplateComponent implements OnInit {
sf!: SFComponent;
@ViewChild('sfEdit', { static: false })
sfEdit!: SFComponent;
editSchema!: SFSchema;
visible = false;
isVisible = false;
tempData = {};
isEdit = false;
searchSchema: SFSchema = {
properties: {
templateName: {
@ -43,24 +44,27 @@ export class SmsTemplateComponent implements OnInit {
}
};
editSchema: SFSchema = {
properties: {
templateName: {
type: 'string',
title: '模板名称',
ui: { placeholder: '请输入模板名称' }
initSF() {
this.editSchema = {
properties: {
templateName: {
type: 'string',
title: '模板名称',
ui: { placeholder: '请输入模板名称', errors: { require: '必填项'} }
},
templateCode: {
type: 'string',
title: '模板编码',
readOnly: this.isEdit,
ui: { placeholder: '请输入模板编码', errors: { require: '必填项'} }
},
templateContent: {
type: 'string',
title: '模板内容',
ui: { placeholder: '请输入模板内容', errors: { require: '必填项'} }
}
},
templateCode: {
type: 'string',
title: '模板编码',
readOnly: this.isEdit,
ui: { placeholder: '请输入模板编码', }
},
templateContent: {
type: 'string',
title: '模板内容',
ui: { placeholder: '请输入模板内容' }
}
required: ['templateName','templateCode','templateContent']
}
}
@ -91,7 +95,9 @@ export class SmsTemplateComponent implements OnInit {
constructor(public service: SystemService, private nzModalService: NzModalService, private route: ActivatedRoute) {
}
ngOnInit(): void { }
ngOnInit(): void {
this.initSF();
}
beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) {
@ -132,7 +138,7 @@ export class SmsTemplateComponent implements OnInit {
handleOk(): void {
const value = this.sfEdit.value;
const { id, templateCode, templateName, templateContent } = value
const { id, templateCode, templateName, templateContent } = value;
const params = {
id,
templateCode,