From 9a11e62adeb8d435b52a361eb62d5b59e1deef2a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 23 五月 2024 21:14:50 +0800 Subject: [PATCH] 2024-05-23 --- src/menu/modalconfig/index.jsx | 92 ++++++++++----------------------------------- 1 files changed, 21 insertions(+), 71 deletions(-) diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 65a7158..9124c01 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -3,8 +3,8 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, Switch, message } from 'antd' -import { SettingOutlined, CopyOutlined } from '@ant-design/icons' +import { Button, Card, Modal, Collapse, Switch, message, Popover } from 'antd' +import { SettingOutlined, CopyOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' import { getModalForm } from '@/templates/zshare/formconfig' import SourceElement from '@/templates/modalconfig/dragelement/source' @@ -21,6 +21,7 @@ const TableComponent = asyncComponent(() => import('./tablecomponent')) const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) const PasteForms = asyncComponent(() => import('@/menu/components/share/pasteforms')) +// const FormFork = asyncComponent(() => import('@/menu/modalconfig/formfork')) const DragElement = asyncComponent(() => import('@/templates/modalconfig/dragelement')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -97,81 +98,21 @@ /** * @description 琛ㄥ崟缂栬緫 - * 1銆佹樉绀虹紪杈戝脊绐�-visible - * 2銆佷繚瀛樼紪杈戦」-card - * 3銆佽缃紪杈戝弬鏁伴」-formlist */ handleForm = (_card) => { const { componentConfig, btn } = this.props const { config } = this.state + let card = fromJS(_card).toJS() - let _inputfields = [] - let _tabfields = [] - let _linkableFields = [] - let _linksupFields = [] - - config.fields.forEach((item, i) => { - if (!item.field || card.field === item.field) return - - if (['text', 'number', 'textarea', 'select'].includes(item.type)) { - _inputfields.push({ - field: item.field, - label: item.label - }) - } - if (item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { - _tabfields.push({ - field: item.field, - label: item.label - }) - } - - if (['switch', 'check', 'popSelect'].includes(item.type)) { - _linksupFields.push({ - field: item.field, - label: item.label - }) - } - - if (!['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) return - - _linksupFields.push({ - field: item.field, - label: item.label - }) - - if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return - - _linkableFields.push({ - field: item.field, - label: item.label + '-琛ㄥ崟' - }) - }) - let columns = componentConfig.columns if (btn.$sub) { columns = componentConfig.subColumns || [] } - let _fields = _linkableFields.map(cell => cell.field) - columns.forEach(col => { - if (col.field && !_fields.includes(col.field)) { - _linkableFields.push({ - field: col.field, - label: col.label + '-鏄剧ず鍒�' - }) - } - }) - - if (card.linkSubField && card.linkSubField.length > 0) { - let fields = _inputfields.map(item => item.field) - card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) - } - this.setState({ visible: true, card: card, - formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, columns) + formlist: getModalForm(card, config.fields, columns) }) } @@ -451,7 +392,6 @@ <div className="setting"> <Card title="琛ㄥ崟閰嶇疆" bordered={false} extra={ <div> - <Button type="danger" onClick={this.clearConfig}>娓呯┖</Button> <PasteForms type="toolbar" config={config} update={this.pasteFields}/> <Button type="primary" id="save-modal-config" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button> <Button onClick={this.cancelConfig}>杩斿洖</Button> @@ -461,12 +401,22 @@ <div className="ant-modal-content" style={{width: config.setting.width > 100 ? config.setting.width : config.setting.width + '%'}}> <div className="ant-modal-header"> <div className="ant-modal-title">{config.setting.icon ? <span className={'mk-modal-icon-' + config.setting.iconType} style={{background: config.setting.iconColor || 'unset', color: config.setting.iconColor || 'inherit'}}><MkIcon type={config.setting.icon}/></span> : null}{btn.label}</div> - <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> - <CopyOutlined title="澶嶅埗" onClick={this.triggerCopy} /> - <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> + <div className="mk-form-tool"> + <DeleteOutlined title="娓呯┖" onClick={this.clearConfig} /> + <Popover title="鍒囨崲甯冨眬" overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <> + <Button style={{marginRight: '10px'}} onClick={() => this.changecols(1)}>1鍒�</Button> + <Button style={{marginRight: '10px'}} onClick={() => this.changecols(2)}>2鍒�</Button> + <Button style={{marginRight: '10px'}} onClick={() => this.changecols(3)}>3鍒�</Button> + <Button onClick={() => this.changecols(4)}>4鍒�</Button> + </> + } trigger="hover"> + <SwapOutlined /> + </Popover> + {/* <FormFork forms={config.fields}/> */} + <CopyOutlined title="澶嶅埗" onClick={this.triggerCopy} /> + <Switch checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> + </div> </div> <div className="ant-modal-body"> <div className="modal-form"> -- Gitblit v1.8.0