From f267d04e0561a0a20d1f2a9f558a273558ece90d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 24 五月 2021 17:50:19 +0800 Subject: [PATCH] 2021-05-24 --- src/menu/components/form/normal-form/index.jsx | 54 ++++++++++++++++++++++++++++++------------------------ 1 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx index 07a76d1..5c7f303 100644 --- a/src/menu/components/form/normal-form/index.jsx +++ b/src/menu/components/form/normal-form/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import {connect} from 'react-redux' import { is, fromJS } from 'immutable' import { Icon, Popover, Modal, Button, Switch, notification } from 'antd' import moment from 'moment' @@ -19,6 +18,7 @@ const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) const WrapComponent = asyncIconComponent(() => import('@/menu/components/form/wrapsetting')) const CardComponent = asyncComponent(() => import('@/templates/modalconfig/dragelement')) +const MobCardComponent = asyncComponent(() => import('@/mob/components/formdragelement')) const FormTitle = asyncComponent(() => import('../dragtitle')) const GroupForm = asyncComponent(() => import('./groupform')) const FormAction = asyncComponent(() => import('../formaction')) @@ -38,6 +38,7 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + appType: sessionStorage.getItem('appType'), card: null, back: false, group: null, @@ -119,7 +120,7 @@ } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) || (!this.props.menu && nextProps.menu) + return !is(fromJS(this.state), fromJS(nextState)) } /** @@ -405,9 +406,13 @@ } addForm = () => { + const { appType } = this.state let group = fromJS(this.state.group).toJS() let lastItem = group.fields[group.fields.length - 1] - let span = lastItem ? lastItem.span : 12 + let span = appType === 'mob' ? 24 : 12 + if (lastItem && lastItem.span) { + span = lastItem.span + } let newcard = { uuid: Utils.getuuid(), @@ -446,7 +451,7 @@ * @description 琛ㄥ崟缂栬緫 */ handleForm = (_item) => { - const { card, group } = this.state + const { card, group, appType } = this.state let _form = fromJS(_item).toJS() let _inputfields = [] let _tabfields = [] @@ -458,7 +463,11 @@ let standardform = null _inputfields = group.fields.filter(item => item.type === 'text' || item.type === 'number' || item.type === 'textarea' || item.type === 'color') - _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) + if (appType === 'mob') { + _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number'].includes(item.type)) + } else { + _tabfields = group.fields.filter(item => _form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) + } _tabfields.unshift({field: '', text: '鍘熻〃鍗�'}) let uniq = new Map() @@ -506,7 +515,7 @@ _form.linkSubField = _form.linkSubField.filter(item => fields.includes(item)) } - if (!_form.span && standardform && standardform.span) { + if (appType !== 'mob' && !_form.span && standardform && standardform.span) { _form.span = standardform.span _form.labelwidth = standardform.labelwidth } @@ -616,7 +625,7 @@ } render() { - const { card, dict, group } = this.state + const { card, dict, group, appType } = this.state return ( <div className="menu-normal-form-edit-box" style={{...card.style}} onClick={this.clickComponent} id={card.uuid}> @@ -647,12 +656,12 @@ <Icon className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm} type="plus" /> <FieldsComponent config={group} type="form" updatefield={this.updateGroup} /> <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> - <Button className="mk-cols-change" onClick={() => this.changecols(1)}>1鍒�</Button> - <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button> - <Button className="mk-cols-change" onClick={() => this.changecols(3)}>3鍒�</Button> - <Button className="mk-cols-change" onClick={() => this.changecols(4)}>4鍒�</Button> + {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(1)}>1鍒�</Button> : null} + {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button> : null} + {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(3)}>3鍒�</Button> : null} + {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(4)}>4鍒�</Button> : null} <div style={{clear: 'both'}}></div> - <CardComponent + {appType !== 'mob' ? <CardComponent list={group.fields} setting={group.setting} showField={this.state.showField} @@ -660,7 +669,14 @@ handleList={this.handleList} handleForm={this.handleForm} closeForm={this.closeForm} - /> + /> : <MobCardComponent + list={group.fields} + setting={group.setting} + showField={this.state.showField} + handleList={this.handleList} + handleForm={this.handleForm} + closeForm={this.closeForm} + />} <FormAction config={card} group={group} updateconfig={this.updateGroup}/> </div> : null} <Modal @@ -702,14 +718,4 @@ } } -const mapStateToProps = (state) => { - return { - menu: state.customMenu - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(PropCardEditComponent) \ No newline at end of file +export default PropCardEditComponent \ No newline at end of file -- Gitblit v1.8.0