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

SYSTEM 发布系统代码

上级 c47db25c
......@@ -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 Entity2EditView from './pages/module2/entity2-edit-view/entity2-edit-view';
import ExampleMain2EditView from './pages/exapmple/example-main2-edit-view/example-main2-edit-view';
import ExampleMain7EditView from './pages/exapmple/example-main7-edit-view/example-main7-edit-view';
import ExampleMain6EditView from './pages/exapmple/example-main6-edit-view/example-main6-edit-view';
import './App.less';
import { Layout, Menu, Breadcrumb, Icon } from 'antd';
......@@ -84,6 +85,9 @@ export default class App extends PureComponent {
if (Object.is(this.currentPage, "ExampleMain2EditView")) {
return <ExampleMain2EditView/>;
}
if (Object.is(this.currentPage, "ExampleMain7EditView")) {
return <ExampleMain7EditView/>;
}
if (Object.is(this.currentPage, "ExampleMain6EditView")) {
return <ExampleMain6EditView/>;
}
......@@ -111,7 +115,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""ExampleMain3EditView""ExampleMain5EditView""Entity4EditView""Entity5EditView""ExampleMain4EditView""ExampleDLFEditView""Entity2EditView""ExampleMain2EditView""ExampleMain6EditView"']} 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""ExampleMain7EditView""ExampleMain6EditView"']} onClick={({ item, key, keyPath, domEvent }) => { this.handleMenuClick(item, key, keyPath, domEvent) }}>
<Menu.Item key="EntityEditView">
<Icon type="user" />
<span>实体编辑视图</span>
......@@ -160,8 +164,12 @@ export default class App extends PureComponent {
<Icon type="upload" />
<span>表单2</span>
</Menu.Item>
<Menu.Item key="ExampleMain6EditView">
<Menu.Item key="ExampleMain7EditView">
<Icon type="user" />
<span>表单7</span>
</Menu.Item>
<Menu.Item key="ExampleMain6EditView">
<Icon type="video-camera" />
<span>表单6</span>
</Menu.Item>
</Menu>
......
// 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 './main7.less';
const { TabPane } = Tabs;
const { Panel } = Collapse;
const { Option } = Select;
const { TextArea } = Input;
/**
* 表单属性
*
* @export
* @interface Main7FormData
*/
export class Main7FormData {
/**
*
*
* @type {*}
* @memberof Main7FormData
*/
formitem?: any;
/**
*
*
* @type {*}
* @memberof Main7FormData
*/
formitem1?: any;
/**
* 建立人
*
* @type {*}
* @memberof Main7FormData
*/
createman?: any;
/**
* 示例标识
*
* @type {*}
* @memberof Main7FormData
*/
exampleid?: any;
}
/**
* 输入属性
*
* @export
* @interface Main7Props
*/
export interface Main7Props {
/**
* 表单数据对象
*
* @type {Main7FormData}
* @memberof Main7Props
*/
data?: Main7FormData;
/**
* 表单分页切换
*
* @memberof Main7Props
*/
tabChange?: (key: string) => void;
/**
* 表单项之变化
*
* @memberof MainProps
*/
formItemChange?:(key:any) => void;
}
/**
* Main7
*
* @export
* @class Main7
* @extends {PureComponent}
*/
export default class Main7 extends PureComponent<Main7Props> {
/**
* 表单数据
*
* @type {*}
* @memberof Main7
*/
public data: Main7FormData = new Main7FormData();
/**
* 初始化实例
*
* @type {*}
* @memberof Main7
*/
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<Main7Props>, 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 Main7
*/
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' },
],
formitem: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
],
formitem1: [
{ type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
{ 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' },
],
exampleid: [
{ type: 'string', message: '示例标识 值必须为字符串类型', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '示例标识 值不能为空', trigger: 'blur' },
],
}
/**
* 详情模型集合
*
* @type {*}
* @memberof Main7
*/
public detailsModel: any = {
grouppanel3: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel3', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
grouppanel4: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel4', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
grouppanel5: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel5', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
grouppanel6: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel6', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
grouppanel2: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel2', visible: true, isShowCaption: false, form: this, uiActionGroup: { caption: '', langbase: '', extractMode: 'ITEM', details: [] } })
,
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 })
,
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 })
,
formitem: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
formitem1: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'formitem1', 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 })
,
exampleid: new FormItemModel({ caption: '示例标识', detailType: 'FORMITEM', name: 'exampleid', visible: true, isShowCaption: true, form: this, disabled: false,error:"",isEmptyCaption:"false",validateStatus:"",required:false,enableCond: 3 })
,
}
/**
* 代码表模型
*
* @type {*}
* @memberof Main7
*/
public codelistModel:any = {
}
/**
* 表单逻辑
*
* @private
* @param { name, newVal, oldVal }
* @memberof Main7
*/
private formLogic(name: string, newVal: any, oldVal?: any): void {
}
/**
* 表单分页切换
*
* @param {string} key 分页标识
* @memberof Main7
*/
public tabChange(key: string): void {
if (this.props.tabChange) {
this.props.tabChange(key);
}
}
/**
* 表单值变化事件
*
* @memberof Main7
*/
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 Main7
*/
public buttonClick($event:any,value:String){
message.info('点击了'+value);
}
/**
* 初始化表单
*
* @memberof Main7
*/
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 Main7
*/
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 Main7
*/
public render(): any {
return <>
<div className="ibiz-form main7">
<Form layout="inline">
{this.detailsModel.grouppanel2.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<Collapse defaultActiveKey={['grouppanel2']} className=''>
<Panel header="分组面板" key="grouppanel2">
<Row>
{this.detailsModel.grouppanel3.visible?<Col style={{}} sm={{ span: 6, offset: 0 }} md={{span: 6, offset: 0}} lg={{ span: 6, offset: 0}} xl={{ span: 6, offset: 0}}>
<Collapse defaultActiveKey={['grouppanel3']} className=''>
<Panel header="分组面板" key="grouppanel3">
<Row>
{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}>
<div>{this.data.formitem}</div>
</Form.Item>
</div>
</div>
</Col>:""}
</Row>
</Panel>
</Collapse>
</Col>:""}
{this.detailsModel.grouppanel4.visible?<Col style={{}} sm={{ span: 6, offset: 0 }} md={{span: 6, offset: 0}} lg={{ span: 6, offset: 0}} xl={{ span: 6, offset: 0}}>
<Collapse defaultActiveKey={['grouppanel4']} className=''>
<Panel header="分组面板" key="grouppanel4">
<Row>
{this.detailsModel.formitem1.visible?<Col style={{}} lg={{ span: 24, offset: 0}}>
<div className={`app-form-item app-form-item-left`}>
{this.detailsModel.formitem1.isShowCaption && !this.detailsModel.formitem1.isEmptyCaption ?
<div className="app-form-item-label" style={{ width: '130px' }}>
{this.detailsModel.formitem1.required ? <span className="isrequired">*</span> : ""}
</div> : ""}
<div className="app-form-item-container" style={{ width: "calc(100% - 130px)" }}>
<Form.Item key={'formitem1'} validateStatus={this.detailsModel.formitem1.validateStatus} help={this.detailsModel.formitem1.error}>
<AppDropDownList value={this.data.formitem1} disabled={this.detailsModel.formitem1.disabled} codelist={this.codelistModel} placeholder={'请选择...'} onChange={($event) =>{this.formItemChange('formitem1', $event)}}></AppDropDownList>
</Form.Item>
</div>
</div>
</Col>:""}
</Row>
</Panel>
</Collapse>
</Col>:""}
{this.detailsModel.grouppanel5.visible?<Col style={{}} sm={{ span: 6, offset: 0 }} md={{span: 6, offset: 0}} lg={{ span: 6, offset: 0}} xl={{ span: 6, offset: 0}}>
<Collapse defaultActiveKey={['grouppanel5']} className=''>
<Panel header="分组面板" key="grouppanel5">
<Row>
</Row>
</Panel>
</Collapse>
</Col>:""}
{this.detailsModel.grouppanel6.visible?<Col style={{}} sm={{ span: 6, offset: 0 }} md={{span: 6, offset: 0}} lg={{ span: 6, offset: 0}} xl={{ span: 6, offset: 0}}>
<Collapse defaultActiveKey={['grouppanel6']} className=''>
<Panel header="分组面板" key="grouppanel6">
<Row>
</Row>
</Panel>
</Collapse>
</Col>:""}
</Row>
</Panel>
</Collapse>
</Col>:""}
{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>:""}
</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-main7-edit-view.less';
import Main7form from '../../../forms/example/main7/main7';
/**
* ExampleMain7EditView
*
* @export
* @class ExampleMain7EditView
* @extends {PureComponent}
*/
export default class ExampleMain7EditView 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 ExampleMain7EditView
*/
public render() {
return <>
<div>
<Main7form data={{}} formItemChange={(value:any) =>{this.formItemChange(value)}}></Main7form>
</div>
</>;
}
/**
* 表单项变化
* @param value
*/
public formItemChange(value:any){
console.log(value);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册