提交 ded3dc37 编写于 作者: ibizdev's avatar ibizdev

SYSTEM 发布系统代码

上级 3fc7ed66
......@@ -18,6 +18,10 @@ const routes: Routes = [
path: 'exapmple_examplemain3editview',
loadChildren: '@pages/exapmple/example-main3-edit-view/example-main3-edit-view.module#ExampleMain3EditViewModule'
},
{
path: 'module3_entity3main9editview',
loadChildren: '@pages/module3/entity3-main9-edit-view/entity3-main9-edit-view.module#Entity3Main9EditViewModule'
},
{
path: 'module_entityeditview',
loadChildren: '@pages/module/entity-edit-view/entity-edit-view.module#EntityEditViewModule'
......@@ -66,6 +70,10 @@ const routes: Routes = [
path: 'module2_entity2editview',
loadChildren: '@pages/module2/entity2-edit-view/entity2-edit-view.module#Entity2EditViewModule'
},
{
path: 'exapmple_examplemain8editview',
loadChildren: '@pages/exapmple/example-main8-edit-view/example-main8-edit-view.module#ExampleMain8EditViewModule'
},
{
path: 'exapmple_examplemain4editview',
loadChildren: '@pages/exapmple/example-main4-edit-view/example-main4-edit-view.module#ExampleMain4EditViewModule'
......
......@@ -4,6 +4,7 @@
<li nz-menu-item (click)="onClick('module5_entity5main5editview')">表单5</li>
<li nz-menu-item (click)="onClick('module4_entity4main7editview')">111111</li>
<li nz-menu-item (click)="onClick('exapmple_examplemain3editview')">模拟</li>
<li nz-menu-item (click)="onClick('module3_entity3main9editview')">表单9</li>
<li nz-menu-item (click)="onClick('module_entityeditview')">实体编辑视图</li>
<li nz-menu-item (click)="onClick('exapmple_exampleeditortype')">基础编辑器</li>
<li nz-menu-item (click)="onClick('exapmple_exampleeditview')">基础表单项</li>
......@@ -16,6 +17,7 @@
<li nz-menu-item (click)="onClick('exapmple_exampledlfeditview')">表单项动态逻辑示例</li>
<li nz-menu-item (click)="onClick('exapmple_examplemain5editview')">表单5</li>
<li nz-menu-item (click)="onClick('module2_entity2editview')">实体2编辑视图</li>
<li nz-menu-item (click)="onClick('exapmple_examplemain8editview')">表单8</li>
<li nz-menu-item (click)="onClick('exapmple_examplemain4editview')">表单4</li>
</ul>
</nz-sider>
......
<div style="background: #fff;height: 100%;padding: 16px;overflow: auto;">
<main8-form (dataChangeEvent)="onFormDataChange($event)"></main8-form></div>
\ No newline at end of file
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { RouterModule } from '@angular/router';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { EditFormModule } from '@widgets/example/main8/main8.module';
import { ExampleMain8EditViewPage } from './example-main8-edit-view';
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: ExampleMain8EditViewPage,
data: { name: 'exapmple_examplemain8editview' }
}
])
],
exports: [ RouterModule ]
})
export class ExampleMain8EditViewRouteModule {}
@NgModule({
imports: [
NgZorroAntdModule,
CommonModule,
FormsModule,
ExampleMain8EditViewRouteModule,
EditFormModule,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [ExampleMain8EditViewPage],
entryComponents: [ExampleMain8EditViewPage],
exports: [ExampleMain8EditViewPage]
})
export class ExampleMain8EditViewModule {}
import { Component } from '@angular/core';
import { Subject, Unsubscribable } from 'rxjs';
@Component({
selector: 'view-example-main8-edit-view',
templateUrl: './example-main8-edit-view.html',
styleUrls: ['./example-main8-edit-view.less']
})
export class ExampleMain8EditViewPage {
/**
* 表单数据变化
*
* @param {*} $event
* @memberof BookTestEditViewPage
*/
public onFormDataChange($event: any) {
console.log($event);
}
}
<div style="background: #fff;height: 100%;padding: 16px;overflow: auto;">
<main9-form (dataChangeEvent)="onFormDataChange($event)"></main9-form></div>
\ No newline at end of file
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { RouterModule } from '@angular/router';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { EditFormModule } from '@widgets/entity3/main9/main9.module';
import { Entity3Main9EditViewPage } from './entity3-main9-edit-view';
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: Entity3Main9EditViewPage,
data: { name: 'module3_entity3main9editview' }
}
])
],
exports: [ RouterModule ]
})
export class Entity3Main9EditViewRouteModule {}
@NgModule({
imports: [
NgZorroAntdModule,
CommonModule,
FormsModule,
Entity3Main9EditViewRouteModule,
EditFormModule,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [Entity3Main9EditViewPage],
entryComponents: [Entity3Main9EditViewPage],
exports: [Entity3Main9EditViewPage]
})
export class Entity3Main9EditViewModule {}
import { Component } from '@angular/core';
import { Subject, Unsubscribable } from 'rxjs';
@Component({
selector: 'view-entity3-main9-edit-view',
templateUrl: './entity3-main9-edit-view.html',
styleUrls: ['./entity3-main9-edit-view.less']
})
export class Entity3Main9EditViewPage {
/**
* 表单数据变化
*
* @param {*} $event
* @memberof BookTestEditViewPage
*/
public onFormDataChange($event: any) {
console.log($event);
}
}
<form nz-form nz-row class="app-form">
<div nz-row>
<nz-tabset>
</nz-tabset>
</div>
</form>
\ No newline at end of file
// this is less
.hidden {
display: none;
}
.app-form {
.app-form-group {
height: 100%;
/deep/ .ant-card-body {
height: calc(100% - 58px);
}
}
.no-error {
margin-bottom: 24px;
}
/deep/ .ant-tabs-tabpane {
padding: 0 16px;
}
}
\ No newline at end of file
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { RouterModule } from '@angular/router';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { EditForm } from './main9';
import { AppTimePickerModule } from '@components/app-time-picker/app-time-picker.module';
import { AppDatePickerModule } from '@components/app-date-picker/app-date-picker.module';
import { AppSelectModule } from '@components/app-select/app-select.module';
import { AppRadioModule } from '@components/app-radio/app-radio.module';
import { AppCheckboxListModule } from '@components/app-checkbox-list/app-checkbox-list.module';
import { AppCheckboxModule } from '@components/app-checkbox/app-checkbox.module';
import { AppImageUploadModule } from '@components/app-image-upload/app-image-upload.module';
import { AppFileUploadModule } from '@components/app-file-upload/app-file-upload.module';
@NgModule({
imports: [
NgZorroAntdModule,
CommonModule,
FormsModule,
AppDatePickerModule,
AppTimePickerModule,
AppSelectModule,
AppRadioModule,
AppCheckboxListModule,
AppCheckboxModule,
AppImageUploadModule,
AppFileUploadModule
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EditForm],
exports: [EditForm]
})
export class EditFormModule { }
import { Component, OnInit, Input, Output, EventEmitter, ViewContainerRef, ViewChild, OnDestroy, AfterViewInit } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { NzNotificationService } from 'ng-zorro-antd/notification';
import { Util } from '@global/util/util';
import { NzModalService } from 'ng-zorro-antd/modal';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@global/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
selector: 'main9-form',
templateUrl: './main9.html',
styleUrls: ['./main9.less'],
})
export class EditForm implements OnInit {
constructor(private $util: Util) {
}
/**
* 数据对象
*
* @type {*}
* @memberof EditForm
*/
@Input()
set formData(val: any) {
if (val) {
this.data = JSON.parse(JSON.stringify(val));
this.formLogic('', null, null);
}
}
/**
* 表单数据对象
*
* @type {*}
* @memberof EditForm
*/
public data: any = {};
/**
* 表单数据变化
*
* @type {Subject<any>}
* @memberof EditForm
*/
public formDataChange: Subject<any> = new Subject<any>();
/**
* 表单数据变化抛出事件
*
* @type {EventEmitter<any>}
* @memberof EditForm
*/
@Output() dataChangeEvent: EventEmitter<any> = new EventEmitter<any>();
/**
* 代码表模型
*
* @type {*}
* @memberof Main9
*/
public codelistModel: any = {
};
/**
* 属性值规则
*
* @type {*}
* @memberof Main9
*/
public rules: any = {
srfupdatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型' },
{ required: false, type: 'string', message: '更新时间 值不能为空' },
],
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfkey: [
{ type: 'string', message: '实体3标识 值必须为字符串类型' },
{ required: false, type: 'string', message: '实体3标识 值不能为空' },
],
srfmajortext: [
{ type: 'string', message: '实体3名称 值必须为字符串类型' },
{ required: false, type: 'string', message: '实体3名称 值不能为空' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
entity3id: [
{ type: 'string', message: '实体3标识 值必须为字符串类型' },
{ required: false, type: 'string', message: '实体3标识 值不能为空' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main9
*/
public detailsModel: any = {
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '实体3标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '实体3名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
entity3id: new FormItemModel({ caption: '实体3标识', detailType: 'FORMITEM', name: 'entity3id', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
};
/**
* 生命周期
*
* @memberof EditForm
*/
ngOnInit(): void {
this.formLogic('', null, null);
this.formDataChange.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe(data => {
this.dataChangeEvent.emit(JSON.parse(data.data));
const field = data.field;
if (field) {
this.formLogic(field.name, field.value, field.oldVal);
this.validateFormItem(field.name);
}
});
}
/**
* 表单项值变化事件
*
* @param {{name: string, value: any}} {name, value}
* @memberof EditForm
*/
public onFormDataChange(name: string, value: any): void {
if (Object.is(this.data[name], value)) {
return;
}
let oldVal: any = this.data[name];
this.data[name] = value;
this.formDataChange.next({ data: JSON.stringify(this.data), field: { name: name, value: value, oldVal: oldVal } });
}
/**
* 校验表单项
*
* @param {string} name
* @memberof EditForm
*/
public validateFormItem(name: string) {
if (!name) {
return;
}
const rule: any[] = this.rules[name];
let message = '';
let status = '';
const val: any = this.data[name];
rule.every((rule: any) => {
if (rule.required && (!val || Object.is(val, '')) ) {
message = rule.message;
status = 'error';
return false;
} else if (val && rule.pattern && !rule.pattern.test(val)) {
message = rule.message;
status = 'error';
return false;
}
return true;
});
this.detailsModel[name].error = message;
this.detailsModel[name].validateStatus = status;
}
/**
* 获取代码表集合
*
* @param {string} name
* @memberof EditForm
*/
public getCodeList(name: string) {
if (!name || !this.codelistModel[name]) {
return [];
}
return this.codelistModel[name];
}
/**
* 表单逻辑
*
* @param {string} name
* @param {*} newVal
* @param {*} oldVal
* @memberof EditForm
*/
public formLogic(name: string, newVal: any, oldVal: any) {
}
}
\ No newline at end of file
<form nz-form nz-row class="app-form">
<div nz-row>
<nz-tabset>
</nz-tabset>
</div>
</form>
\ No newline at end of file
// this is less
.hidden {
display: none;
}
.app-form {
.app-form-group {
height: 100%;
/deep/ .ant-card-body {
height: calc(100% - 58px);
}
}
.no-error {
margin-bottom: 24px;
}
/deep/ .ant-tabs-tabpane {
padding: 0 16px;
}
}
\ No newline at end of file
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { RouterModule } from '@angular/router';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { EditForm } from './main8';
import { AppTimePickerModule } from '@components/app-time-picker/app-time-picker.module';
import { AppDatePickerModule } from '@components/app-date-picker/app-date-picker.module';
import { AppSelectModule } from '@components/app-select/app-select.module';
import { AppRadioModule } from '@components/app-radio/app-radio.module';
import { AppCheckboxListModule } from '@components/app-checkbox-list/app-checkbox-list.module';
import { AppCheckboxModule } from '@components/app-checkbox/app-checkbox.module';
import { AppImageUploadModule } from '@components/app-image-upload/app-image-upload.module';
import { AppFileUploadModule } from '@components/app-file-upload/app-file-upload.module';
@NgModule({
imports: [
NgZorroAntdModule,
CommonModule,
FormsModule,
AppDatePickerModule,
AppTimePickerModule,
AppSelectModule,
AppRadioModule,
AppCheckboxListModule,
AppCheckboxModule,
AppImageUploadModule,
AppFileUploadModule
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
declarations: [EditForm],
exports: [EditForm]
})
export class EditFormModule { }
import { Component, OnInit, Input, Output, EventEmitter, ViewContainerRef, ViewChild, OnDestroy, AfterViewInit } from '@angular/core';
import { Subject, Subscription } from 'rxjs';
import { NzNotificationService } from 'ng-zorro-antd/notification';
import { Util } from '@global/util/util';
import { NzModalService } from 'ng-zorro-antd/modal';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@global/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
selector: 'main8-form',
templateUrl: './main8.html',
styleUrls: ['./main8.less'],
})
export class EditForm implements OnInit {
constructor(private $util: Util) {
}
/**
* 数据对象
*
* @type {*}
* @memberof EditForm
*/
@Input()
set formData(val: any) {
if (val) {
this.data = JSON.parse(JSON.stringify(val));
this.formLogic('', null, null);
}
}
/**
* 表单数据对象
*
* @type {*}
* @memberof EditForm
*/
public data: any = {};
/**
* 表单数据变化
*
* @type {Subject<any>}
* @memberof EditForm
*/
public formDataChange: Subject<any> = new Subject<any>();
/**
* 表单数据变化抛出事件
*
* @type {EventEmitter<any>}
* @memberof EditForm
*/
@Output() dataChangeEvent: EventEmitter<any> = new EventEmitter<any>();
/**
* 代码表模型
*
* @type {*}
* @memberof Main8
*/
public codelistModel: any = {
};
/**
* 属性值规则
*
* @type {*}
* @memberof Main8
*/
public rules: any = {
srfupdatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型' },
{ required: false, type: 'string', message: '更新时间 值不能为空' },
],
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfkey: [
{ type: 'string', message: '示例标识 值必须为字符串类型' },
{ required: false, type: 'string', message: '示例标识 值不能为空' },
],
srfmajortext: [
{ type: 'string', message: '示例名称 值必须为字符串类型' },
{ required: false, type: 'string', message: '示例名称 值不能为空' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型' },
{ required: false, type: 'string', message: ' 值不能为空' },
],
exampleid: [
{ type: 'string', message: '示例标识 值必须为字符串类型' },
{ required: false, type: 'string', message: '示例标识 值不能为空' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main8
*/
public detailsModel: any = {
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '示例名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
};
/**
* 生命周期
*
* @memberof EditForm
*/
ngOnInit(): void {
this.formLogic('', null, null);
this.formDataChange.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe(data => {
this.dataChangeEvent.emit(JSON.parse(data.data));
const field = data.field;
if (field) {
this.formLogic(field.name, field.value, field.oldVal);
this.validateFormItem(field.name);
}
});
}
/**
* 表单项值变化事件
*
* @param {{name: string, value: any}} {name, value}
* @memberof EditForm
*/
public onFormDataChange(name: string, value: any): void {
if (Object.is(this.data[name], value)) {
return;
}
let oldVal: any = this.data[name];
this.data[name] = value;
this.formDataChange.next({ data: JSON.stringify(this.data), field: { name: name, value: value, oldVal: oldVal } });
}
/**
* 校验表单项
*
* @param {string} name
* @memberof EditForm
*/
public validateFormItem(name: string) {
if (!name) {
return;
}
const rule: any[] = this.rules[name];
let message = '';
let status = '';
const val: any = this.data[name];
rule.every((rule: any) => {
if (rule.required && (!val || Object.is(val, '')) ) {
message = rule.message;
status = 'error';
return false;
} else if (val && rule.pattern && !rule.pattern.test(val)) {
message = rule.message;
status = 'error';
return false;
}
return true;
});
this.detailsModel[name].error = message;
this.detailsModel[name].validateStatus = status;
}
/**
* 获取代码表集合
*
* @param {string} name
* @memberof EditForm
*/
public getCodeList(name: string) {
if (!name || !this.codelistModel[name]) {
return [];
}
return this.codelistModel[name];
}
/**
* 表单逻辑
*
* @param {string} name
* @param {*} newVal
* @param {*} oldVal
* @memberof EditForm
*/
public formLogic(name: string, newVal: any, oldVal: any) {
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册