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

SYSTEM 发布系统代码

上级 fceb3c4d
...@@ -11,6 +11,7 @@ import ExampleMain4EditView from './pages/exapmple/example-main4-edit-view/examp ...@@ -11,6 +11,7 @@ import ExampleMain4EditView from './pages/exapmple/example-main4-edit-view/examp
import ExampleDLFEditView from './pages/exapmple/example-dlfedit-view/example-dlfedit-view'; import ExampleDLFEditView from './pages/exapmple/example-dlfedit-view/example-dlfedit-view';
import Entity2EditView from './pages/module2/entity2-edit-view/entity2-edit-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 ExampleMain2EditView from './pages/exapmple/example-main2-edit-view/example-main2-edit-view';
import ExampleMain6EditView from './pages/exapmple/example-main6-edit-view/example-main6-edit-view';
import './App.less'; import './App.less';
import { Layout, Menu, Breadcrumb, Icon } from 'antd'; import { Layout, Menu, Breadcrumb, Icon } from 'antd';
const { Header, Content, Footer, Sider } = Layout; const { Header, Content, Footer, Sider } = Layout;
...@@ -83,6 +84,9 @@ export default class App extends PureComponent { ...@@ -83,6 +84,9 @@ export default class App extends PureComponent {
if (Object.is(this.currentPage, "ExampleMain2EditView")) { if (Object.is(this.currentPage, "ExampleMain2EditView")) {
return <ExampleMain2EditView/>; return <ExampleMain2EditView/>;
} }
if (Object.is(this.currentPage, "ExampleMain6EditView")) {
return <ExampleMain6EditView/>;
}
} }
/** /**
...@@ -107,7 +111,7 @@ export default class App extends PureComponent { ...@@ -107,7 +111,7 @@ export default class App extends PureComponent {
<Layout id="components-layout-demo-custom-trigger"> <Layout id="components-layout-demo-custom-trigger">
<Sider trigger={null} collapsible style={{ minHeight: '100vh' }}> <Sider trigger={null} collapsible style={{ minHeight: '100vh' }}>
<div className="logo"><img src="assets/images/logo.png" /></div> <div className="logo"><img src="assets/images/logo.png" /></div>
<Menu theme="dark" mode="inline" defaultSelectedKeys={['"EntityEditView""ExampleEditorType""ExampleEditView""Entity3EditView""ExampleMain3EditView""ExampleMain5EditView""Entity4EditView""Entity5EditView""ExampleMain4EditView""ExampleDLFEditView""Entity2EditView""ExampleMain2EditView"']} onClick={({ item, key, keyPath, domEvent }) => { this.handleMenuClick(item, key, keyPath, domEvent) }}> <Menu theme="dark" mode="inline" defaultSelectedKeys={['"EntityEditView""ExampleEditorType""ExampleEditView""Entity3EditView""ExampleMain3EditView""ExampleMain5EditView""Entity4EditView""Entity5EditView""ExampleMain4EditView""ExampleDLFEditView""Entity2EditView""ExampleMain2EditView""ExampleMain6EditView"']} onClick={({ item, key, keyPath, domEvent }) => { this.handleMenuClick(item, key, keyPath, domEvent) }}>
<Menu.Item key="EntityEditView"> <Menu.Item key="EntityEditView">
<Icon type="user" /> <Icon type="user" />
<span>实体编辑视图</span> <span>实体编辑视图</span>
...@@ -156,6 +160,10 @@ export default class App extends PureComponent { ...@@ -156,6 +160,10 @@ export default class App extends PureComponent {
<Icon type="upload" /> <Icon type="upload" />
<span>表单2</span> <span>表单2</span>
</Menu.Item> </Menu.Item>
<Menu.Item key="ExampleMain6EditView">
<Icon type="user" />
<span>表单6</span>
</Menu.Item>
</Menu> </Menu>
</Sider> </Sider>
<Layout> <Layout>
......
...@@ -34,6 +34,13 @@ export class MainFormData { ...@@ -34,6 +34,13 @@ export class MainFormData {
* @memberof MainFormData * @memberof MainFormData
*/ */
entityname?: any; entityname?: any;
/**
*
*
* @type {*}
* @memberof MainFormData
*/
formitem?: any;
/** /**
* 建立人 * 建立人
* *
...@@ -201,6 +208,11 @@ export default class Main extends PureComponent<MainProps> { ...@@ -201,6 +208,11 @@ export default class Main extends PureComponent<MainProps> {
{ required: false, type: 'string', message: '实体名称 值不能为空', trigger: 'change' }, { required: false, type: 'string', message: '实体名称 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '实体名称 值不能为空', trigger: 'blur' }, { required: false, type: 'string', message: '实体名称 值不能为空', trigger: 'blur' },
], ],
formitem: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
createman: [ createman: [
{ type: 'string', message: '建立人 值必须为字符串类型', trigger: 'change' }, { type: 'string', message: '建立人 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '建立人 值不能为空', trigger: 'change' }, { required: false, type: 'string', message: '建立人 值不能为空', trigger: 'change' },
...@@ -260,6 +272,8 @@ export default class Main extends PureComponent<MainProps> { ...@@ -260,6 +272,8 @@ export default class Main extends PureComponent<MainProps> {
srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', 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 })
, ,
entityname: new FormItemModel({ caption: '实体名称', detailType: 'FORMITEM', name: 'entityname', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 }) entityname: new FormItemModel({ caption: '实体名称', detailType: 'FORMITEM', name: 'entityname', 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 }) createman: new FormItemModel({ caption: '建立人', detailType: 'FORMITEM', name: 'createman', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
, ,
...@@ -310,6 +324,7 @@ export default class Main extends PureComponent<MainProps> { ...@@ -310,6 +324,7 @@ export default class Main extends PureComponent<MainProps> {
} }
...@@ -439,6 +454,20 @@ export default class Main extends PureComponent<MainProps> { ...@@ -439,6 +454,20 @@ export default class Main extends PureComponent<MainProps> {
</div> </div>
</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'} type={'password'} disabled={this.detailsModel.formitem.disabled} value={this.data.formitem} onChange={($event) =>{this.formItemChange('formitem',$event.target.value)}}/>
</Form.Item>
</div>
</div>
</Col>:""} </Col>:""}
</Row> </Row>
......
// 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 './main6.less';
const { TabPane } = Tabs;
const { Panel } = Collapse;
const { Option } = Select;
const { TextArea } = Input;
/**
* 表单属性
*
* @export
* @interface Main6FormData
*/
export class Main6FormData {
/**
* 示例标识
*
* @type {*}
* @memberof Main6FormData
*/
exampleid?: any;
}
/**
* 输入属性
*
* @export
* @interface Main6Props
*/
export interface Main6Props {
/**
* 表单数据对象
*
* @type {Main6FormData}
* @memberof Main6Props
*/
data?: Main6FormData;
/**
* 表单分页切换
*
* @memberof Main6Props
*/
tabChange?: (key: string) => void;
/**
* 表单项之变化
*
* @memberof MainProps
*/
formItemChange?:(key:any) => void;
}
/**
* Main6
*
* @export
* @class Main6
* @extends {PureComponent}
*/
export default class Main6 extends PureComponent<Main6Props> {
/**
* 表单数据
*
* @type {*}
* @memberof Main6
*/
public data: Main6FormData = new Main6FormData();
/**
* 初始化实例
*
* @type {*}
* @memberof Main6
*/
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<Main6Props>, 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 Main6
*/
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 Main6
*/
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 Main6
*/
public codelistModel:any = {
}
/**
* 表单逻辑
*
* @private
* @param { name, newVal, oldVal }
* @memberof Main6
*/
private formLogic(name: string, newVal: any, oldVal?: any): void {
}
/**
* 表单分页切换
*
* @param {string} key 分页标识
* @memberof Main6
*/
public tabChange(key: string): void {
if (this.props.tabChange) {
this.props.tabChange(key);
}
}
/**
* 表单值变化事件
*
* @memberof Main6
*/
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 Main6
*/
public buttonClick($event:any,value:String){
message.info('点击了'+value);
}
/**
* 初始化表单
*
* @memberof Main6
*/
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 Main6
*/
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 Main6
*/
public render(): any {
return <>
<div className="ibiz-form main6">
<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-main6-edit-view.less';
import Main6form from '../../../forms/example/main6/main6';
/**
* ExampleMain6EditView
*
* @export
* @class ExampleMain6EditView
* @extends {PureComponent}
*/
export default class ExampleMain6EditView 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 ExampleMain6EditView
*/
public render() {
return <>
<div>
<Main6form data={{}} formItemChange={(value:any) =>{this.formItemChange(value)}}></Main6form>
</div>
</>;
}
/**
* 表单项变化
* @param value
*/
public formItemChange(value:any){
console.log(value);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册