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

SYSTEM 发布系统代码

上级 6ae4a57e
......@@ -3,10 +3,12 @@ import EntityEditView from './pages/module/entity-edit-view/entity-edit-view';
import ExampleEditorType from './pages/exapmple/example-editor-type/example-editor-type';
import ExampleEditView from './pages/exapmple/example-edit-view/example-edit-view';
import Entity3EditView from './pages/module3/entity3-edit-view/entity3-edit-view';
import ExampleMain3EditView from './pages/exapmple/example-main3-edit-view/example-main3-edit-view';
import Entity4EditView from './pages/module4/entity4-edit-view/entity4-edit-view';
import Entity5EditView from './pages/module5/entity5-edit-view/entity5-edit-view';
import ExampleDLFEditView from './pages/exapmple/example-dlfedit-view/example-dlfedit-view';
import Entity2EditView from './pages/module2/entity2-edit-view/entity2-edit-view';
import ExampleMain2EditView from './pages/exapmple/example-main2-edit-view/example-main2-edit-view';
import './App.less';
import { Layout, Menu, Breadcrumb, Icon } from 'antd';
const { Header, Content, Footer, Sider } = Layout;
......@@ -55,6 +57,9 @@ export default class App extends PureComponent {
if (Object.is(this.currentPage, "Entity3EditView")) {
return <Entity3EditView/>;
}
if (Object.is(this.currentPage, "ExampleMain3EditView")) {
return <ExampleMain3EditView/>;
}
if (Object.is(this.currentPage, "Entity4EditView")) {
return <Entity4EditView/>;
}
......@@ -67,6 +72,9 @@ export default class App extends PureComponent {
if (Object.is(this.currentPage, "Entity2EditView")) {
return <Entity2EditView/>;
}
if (Object.is(this.currentPage, "ExampleMain2EditView")) {
return <ExampleMain2EditView/>;
}
}
/**
......@@ -91,7 +99,7 @@ export default class App extends PureComponent {
<Layout id="components-layout-demo-custom-trigger">
<Sider trigger={null} collapsible style={{ minHeight: '100vh' }}>
<div className="logo"><img src="assets/images/logo.png" /></div>
<Menu theme="dark" mode="inline" defaultSelectedKeys={['"EntityEditView""ExampleEditorType""ExampleEditView""Entity3EditView""Entity4EditView""Entity5EditView""ExampleDLFEditView""Entity2EditView"']} onClick={({ item, key, keyPath, domEvent }) => { this.handleMenuClick(item, key, keyPath, domEvent) }}>
<Menu theme="dark" mode="inline" defaultSelectedKeys={['"EntityEditView""ExampleEditorType""ExampleEditView""Entity3EditView""ExampleMain3EditView""Entity4EditView""Entity5EditView""ExampleDLFEditView""Entity2EditView""ExampleMain2EditView"']} onClick={({ item, key, keyPath, domEvent }) => { this.handleMenuClick(item, key, keyPath, domEvent) }}>
<Menu.Item key="EntityEditView">
<Icon type="user" />
<span>实体编辑视图</span>
......@@ -108,22 +116,30 @@ export default class App extends PureComponent {
<Icon type="user" />
<span>实体3编辑视图</span>
</Menu.Item>
<Menu.Item key="Entity4EditView">
<Menu.Item key="ExampleMain3EditView">
<Icon type="video-camera" />
<span>表单3</span>
</Menu.Item>
<Menu.Item key="Entity4EditView">
<Icon type="upload" />
<span>实体4编辑视图</span>
</Menu.Item>
<Menu.Item key="Entity5EditView">
<Icon type="upload" />
<Icon type="user" />
<span>实体5编辑视图</span>
</Menu.Item>
<Menu.Item key="ExampleDLFEditView">
<Icon type="user" />
<Icon type="video-camera" />
<span>表单项动态逻辑示例</span>
</Menu.Item>
<Menu.Item key="Entity2EditView">
<Icon type="video-camera" />
<Icon type="upload" />
<span>实体2编辑视图</span>
</Menu.Item>
<Menu.Item key="ExampleMain2EditView">
<Icon type="user" />
<span>表单2</span>
</Menu.Item>
</Menu>
</Sider>
<Layout>
......
......@@ -41,34 +41,6 @@ export class MainFormData {
* @memberof MainFormData
*/
formitem?: any;
/**
* 建立人
*
* @type {*}
* @memberof MainFormData
*/
createman?: any;
/**
* 建立时间
*
* @type {*}
* @memberof MainFormData
*/
createdate?: any;
/**
* 更新人
*
* @type {*}
* @memberof MainFormData
*/
updateman?: any;
/**
* 更新时间
*
* @type {*}
* @memberof MainFormData
*/
updatedate?: any;
/**
* 实体4标识
*
......@@ -213,26 +185,6 @@ export default class Main extends PureComponent<MainProps> {
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
createman: [
{ type: 'string', message: '建立人 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '建立人 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '建立人 值不能为空', trigger: 'blur' },
],
createdate: [
{ type: 'string', message: '建立时间 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '建立时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '建立时间 值不能为空', trigger: 'blur' },
],
updateman: [
{ type: 'string', message: '更新人 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '更新人 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新人 值不能为空', trigger: 'blur' },
],
updatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
entity4id: [
{ type: 'string', message: '实体4标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '实体4标识 值不能为空', trigger: 'change' },
......@@ -250,10 +202,6 @@ export default class Main extends PureComponent<MainProps> {
group1: new FormGroupPanelModel({ caption: '实体4基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
group2: new FormGroupPanelModel({ caption: '操作信息', detailType: 'GROUPPANEL', name: 'group2', visible: true, isShowCaption: true, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
formpage2: new FormPageModel({ caption: '其它', detailType: 'FORMPAGE', name: 'formpage2', visible: true, isShowCaption: true, form: this })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
......@@ -274,18 +222,9 @@ export default class Main extends PureComponent<MainProps> {
entity4name: new FormItemModel({ caption: '实体4名称', detailType: 'FORMITEM', name: 'entity4name', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
formitem: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
createman: new FormItemModel({ caption: '建立人', detailType: 'FORMITEM', name: 'createman', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
createdate: new FormItemModel({ caption: '建立时间', detailType: 'FORMITEM', name: 'createdate', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
updateman: new FormItemModel({ caption: '更新人', detailType: 'FORMITEM', name: 'updateman', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
updatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'updatedate', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
entity4id: new FormItemModel({ caption: '实体4标识', detailType: 'FORMITEM', name: 'entity4id', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [{ name: 'formpage1', index: 0, visible: true }, { name: 'formpage2', index: 1, visible: true }] }),
}
/**
......@@ -319,12 +258,6 @@ export default class Main extends PureComponent<MainProps> {
}
......@@ -428,130 +361,46 @@ export default class Main extends PureComponent<MainProps> {
return <>
<div className="ibiz-form main">
<Form layout="inline">
<Tabs defaultActiveKey="1" onChange={(key: string) => this.tabChange(key)}>
<TabPane
tab={
<span className='caption'>
基本信息
</span>
}
key="0">
{this.detailsModel.group1.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<Collapse defaultActiveKey={['group1']} className=''>
<Panel header="实体4基本信息" key="group1">
<Row>
{this.detailsModel.entity4name.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.entity4name.isShowCaption && !this.detailsModel.entity4name.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.entity4name.required ? <span className="isrequired">*</span> : ""}实体4名称
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'entity4name'} validateStatus={this.detailsModel.entity4name.validateStatus} help={this.detailsModel.entity4name.error}>
<Input id={'entity4name'} disabled={this.detailsModel.entity4name.disabled} value={this.data.entity4name} onChange={($event) =>{this.formItemChange('entity4name',$event.target.value)}}/>
</Form.Item>
</div>
</div>
</Col>:""}
{this.detailsModel.formitem.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.formitem.isShowCaption && !this.detailsModel.formitem.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.formitem.required ? <span className="isrequired">*</span> : ""}
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'formitem'} validateStatus={this.detailsModel.formitem.validateStatus} help={this.detailsModel.formitem.error}>
<Input id={'formitem'} disabled={this.detailsModel.formitem.disabled} value={this.data.formitem} onChange={($event) =>{this.formItemChange('formitem',$event.target.value)}}/>
</Form.Item>
</div>
</div>
</Col>:""}
</Row>
</Panel>
</Collapse>
</Col>:""}
</TabPane>
<TabPane
tab={
<span className='caption'>
其它
</span>
}
key="1">
{this.detailsModel.group2.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<Collapse defaultActiveKey={['group2']} className=''>
<Panel header="操作信息" key="group2">
<Row>
{this.detailsModel.createman.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.createman.isShowCaption && !this.detailsModel.createman.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.createman.required ? <span className="isrequired">*</span> : ""}建立人
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'createman'} validateStatus={this.detailsModel.createman.validateStatus} help={this.detailsModel.createman.error}>
<span>{this.data.createman}</span>
</Form.Item>
</div>
</div>
</Col>:""}
{this.detailsModel.createdate.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.createdate.isShowCaption && !this.detailsModel.createdate.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.createdate.required ? <span className="isrequired">*</span> : ""}建立时间
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'createdate'} validateStatus={this.detailsModel.createdate.validateStatus} help={this.detailsModel.createdate.error}>
<span>{this.data.createdate}</span>
</Form.Item>
</div>
</div>
</Col>:""}
{this.detailsModel.updateman.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.updateman.isShowCaption && !this.detailsModel.updateman.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.updateman.required ? <span className="isrequired">*</span> : ""}更新人
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'updateman'} validateStatus={this.detailsModel.updateman.validateStatus} help={this.detailsModel.updateman.error}>
<span>{this.data.updateman}</span>
</Form.Item>
</div>
</div>
</Col>:""}
{this.detailsModel.updatedate.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.updatedate.isShowCaption && !this.detailsModel.updatedate.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.updatedate.required ? <span className="isrequired">*</span> : ""}更新时间
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'updatedate'} validateStatus={this.detailsModel.updatedate.validateStatus} help={this.detailsModel.updatedate.error}>
<span>{this.data.updatedate}</span>
</Form.Item>
</div>
</div>
</Col>:""}
</Row>
</Panel>
</Collapse>
</Col>:""}
</TabPane>
</Tabs>
{this.detailsModel.group1.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<Collapse defaultActiveKey={['group1']} className=''>
<Panel header="实体4基本信息" key="group1">
<Row>
{this.detailsModel.entity4name.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.entity4name.isShowCaption && !this.detailsModel.entity4name.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.entity4name.required ? <span className="isrequired">*</span> : ""}实体4名称
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'entity4name'} validateStatus={this.detailsModel.entity4name.validateStatus} help={this.detailsModel.entity4name.error}>
<Input id={'entity4name'} disabled={this.detailsModel.entity4name.disabled} value={this.data.entity4name} onChange={($event) =>{this.formItemChange('entity4name',$event.target.value)}}/>
</Form.Item>
</div>
</div>
</Col>:""}
{this.detailsModel.formitem.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.formitem.isShowCaption && !this.detailsModel.formitem.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.formitem.required ? <span className="isrequired">*</span> : ""}
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'formitem'} validateStatus={this.detailsModel.formitem.validateStatus} help={this.detailsModel.formitem.error}>
<Input id={'formitem'} disabled={this.detailsModel.formitem.disabled} value={this.data.formitem} onChange={($event) =>{this.formItemChange('formitem',$event.target.value)}}/>
</Form.Item>
</div>
</div>
</Col>:""}
</Row>
</Panel>
</Collapse>
</Col>:""}
</Form>
</div>
</>;
......
......@@ -175,10 +175,6 @@ export default class Main2 extends PureComponent<Main2Props> {
* @memberof Main2
*/
public detailsModel: any = {
tabpanel1: new FormTabPanelModel({ caption: '', detailType: 'TABPANEL', name: 'tabpanel1', visible: true, isShowCaption: false, form: this, tabPages: [] })
,
formpage1: new FormPageModel({ caption: '表单分页', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
......@@ -197,6 +193,7 @@ export default class Main2 extends PureComponent<Main2Props> {
,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
}
/**
......@@ -226,8 +223,6 @@ export default class Main2 extends PureComponent<Main2Props> {
}
......@@ -331,13 +326,8 @@ export default class Main2 extends PureComponent<Main2Props> {
return <>
<div className="ibiz-form main2">
<Form layout="inline">
{this.detailsModel.tabpanel1.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<Tabs className="">
</Tabs>
</Col>:""}
<Tabs defaultActiveKey="1" onChange={(key: string) => this.tabChange(key)}>
</Tabs>
</Form>
</div>
</>;
......
// this is less
.app-form-item {
display: flex;
justify-content: space-between;
padding-right: 16px;
margin-bottom: 6px;
.app-form-item-label {
text-align: right;
height: 32px;
line-height: 32px;
padding-right: 16px;
.isrequired {
display: inline-block;
margin-right: 4px;
font-family: SimSun;
line-height: 1;
font-size: 14px;
color: #f5222d;
}
}
.app-form-item-container {
.ant-form-item {
width: 100%;
.ant-form-item-control-wrapper {
width: 100%;
height: auto;
min-height: 59px;
}
}
}
}
.app-form-item-left {
flex-direction: row;
}
.app-form-item-right {
flex-direction: row-reverse;
}
.app-form-item-top {
flex-direction: column;
}
.app-form-item-bottom {
flex-direction: column-reverse;
}
.ant-form-inline .ant-form-item-with-help {
margin-bottom: 0px !important;
}
import React, { PureComponent } from 'react';
import { Form, Input, Row, Col, Tabs, Icon, Collapse, Button, Select, message } from 'antd';
import Schema from "async-validator";
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '../../../ibizsys/form-detail';
import { Util } from '../../../ibizsys/utils/util';
import AppDropDownList from '../../../ibizsys/components/app-dropdown-list/app-dropdown-list';
import AppRadioGroup from '../../../ibizsys/components/app-radio-group/app-radio-group';
import AppCheckBox from '../../../ibizsys/components/app-checkbox/app-checkbox';
import AppCheckBoxGroup from '../../../ibizsys/components/app-checkbox-group/app-checkbox-group';
import AppDatePicker from '../../../ibizsys/components/app-date-picker/app-date-picker';
import AppTimePicker from '../../../ibizsys/components/app-time-picker/app-time-picker';
import AppImageUpload from '../../../ibizsys/components/app-image-upload/app-image-upload';
import AppFileUpload from '../../../ibizsys/components/app-file-upload/app-file-upload';
import AppRichTextEditor from '../../../ibizsys/components/app-rich-text-editor/app-rich-text-editor';
import './main3.less';
const { TabPane } = Tabs;
const { Panel } = Collapse;
const { Option } = Select;
const { TextArea } = Input;
/**
* 表单属性
*
* @export
* @interface Main3FormData
*/
export class Main3FormData {
/**
* 示例标识
*
* @type {*}
* @memberof Main3FormData
*/
exampleid?: any;
}
/**
* 输入属性
*
* @export
* @interface Main3Props
*/
export interface Main3Props {
/**
* 表单数据对象
*
* @type {Main3FormData}
* @memberof Main3Props
*/
data?: Main3FormData;
/**
* 表单分页切换
*
* @memberof Main3Props
*/
tabChange?: (key: string) => void;
/**
* 表单项之变化
*
* @memberof MainProps
*/
formItemChange?:(key:any) => void;
}
/**
* Main3
*
* @export
* @class Main3
* @extends {PureComponent}
*/
export default class Main3 extends PureComponent<Main3Props> {
/**
* 表单数据
*
* @type {*}
* @memberof Main3
*/
public data: Main3FormData = new Main3FormData();
/**
* 初始化实例
*
* @type {*}
* @memberof Main3
*/
constructor(props) {
super(props);
if (this.data && this.props.data && !Object.is(JSON.stringify(this.data), JSON.stringify(this.props.data))) {
Object.assign(this.data, this.props.data);
}
this.initForm();
}
/**
* 在组件接收到一个新的 prop (或更新后)时被调用
*
* @memberof IBizViewController
*/
public componentWillReceiveProps(nextProps: Readonly<Main3Props>, nextContext: any) {
if (this.data && nextProps.data && !Object.is(JSON.stringify(this.data), JSON.stringify(nextProps.data))) {
Object.assign(this.data, nextProps.data);
}
}
/**
* 在组件从 DOM 中移除的时候立刻被调用
*
* @memberof IBizViewController
*/
public componentWillUnmount() {
}
/**
* 属性值规则
*
* @type {*}
* @memberof Main3
*/
public rules: any = {
srfupdatedate: [
{ type: 'string', message: '更新时间 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '更新时间 值不能为空', trigger: 'blur' },
],
srforikey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfkey: [
{ type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'blur' },
],
srfmajortext: [
{ type: 'string', message: '示例名称 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例名称 值不能为空', trigger: 'blur' },
],
srftempmode: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfuf: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfdeid: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
srfsourcekey: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
exampleid: [
{ type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main3
*/
public detailsModel: any = {
srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srfkey: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srfmajortext: new FormItemModel({ caption: '示例名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
form: new FormTabPanelModel({ caption: 'form', detailType: 'TABPANEL', name: 'form', visible: true, isShowCaption: true, form: this, tabPages: [] }),
}
/**
* 代码表模型
*
* @type {*}
* @memberof Main3
*/
public codelistModel:any = {
}
/**
* 表单逻辑
*
* @private
* @param { name, newVal, oldVal }
* @memberof Main3
*/
private formLogic(name: string, newVal: any, oldVal?: any): void {
}
/**
* 表单分页切换
*
* @param {string} key 分页标识
* @memberof Main3
*/
public tabChange(key: string): void {
if (this.props.tabChange) {
this.props.tabChange(key);
}
}
/**
* 表单值变化事件
*
* @memberof Main3
*/
public formItemChange(item: string, value: any, isFirst?: boolean) {
this.data[item] = value;
this.formLogic(item, value);
if (!isFirst) {
this.validateItem(item, value);
if (this.props.formItemChange) {
this.props.formItemChange({name:item,value:value});
}
}
this.tick();
}
/**
* 按钮点击事件
*
* @memberof Main3
*/
public buttonClick($event:any,value:String){
message.info('点击了'+value);
}
/**
* 初始化表单
*
* @memberof Main3
*/
public initForm() {
if (Object.keys(this.data).length > 0) {
Object.keys(this.data).forEach((item) => {
this.formItemChange(item, this.data[item], true);
})
}
}
/**
* 校验单个表单项
* @param item
* @param value
*/
public validateItem(item: string, value: any) {
// 做校验
// 1.获取数值和规则
const rule = this.rules[item];
// 2.创建校验规则
const schema = new Schema({ [item]: rule })
// 校验返回Promise
return schema.validate({ [item]: value },undefined,errors => {
if (errors) {
// 有错
this.detailsModel[item].setError(errors[0].message);
} else {
this.detailsModel[item].setError('');
}
})
}
/**
* 校验表单
*
* @memberof Main3
*/
public validateForm(callback:Function) {
let tasks: any;
if (Object.keys(this.data).length > 0) {
tasks = Object.keys(this.data).map((item) => {
this.validateItem(item, this.data[item]);
})
}
Promise.all(tasks)
.then(() => callback(true))
.catch(() => callback(false))
}
/**
* 绘制内容
*
* @returns
* @memberof Main3
*/
public render(): any {
return <>
<div className="ibiz-form main3">
<Form layout="inline">
<Tabs defaultActiveKey="1" onChange={(key: string) => this.tabChange(key)}>
</Tabs>
</Form>
</div>
</>;
}
/**
* 变更监测
*
* @protected
* @memberof Main
*/
protected tick(): void {
this.setState({
date: new Date()
});
}
}
\ No newline at end of file
import React, { PureComponent } from 'react';
import './example-main3-edit-view.less';
import Main3form from '../../../forms/example/main3/main3';
/**
* ExampleMain3EditView
*
* @export
* @class ExampleMain3EditView
* @extends {PureComponent}
*/
export default class ExampleMain3EditView extends PureComponent {
public formData = {
"bookname":"test1",
"input":"文本test",
"label":"标签test",
"group1":"书籍基本信息test",
"formpage1":"基本信息test",
"createman":"建立人test",
"createdate":"建立时间test",
"updateman":"更新人test",
"updatedate":"更新时间test",
"group2":"操作信息test",
"formpage2":"其它test"
}
/**
* 绘制内容
*
* @returns
* @memberof ExampleMain3EditView
*/
public render() {
return <>
<div>
<Main3form data={{}} formItemChange={(value:any) =>{this.formItemChange(value)}}></Main3form>
</div>
</>;
}
/**
* 表单项变化
* @param value
*/
public formItemChange(value:any){
console.log(value);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册