From 0383744c6037f04495b1bb950c98644211fa0ad3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 24 一月 2025 22:44:25 +0800 Subject: [PATCH] 2025-01-24 --- src/menu/lowerField/index.jsx | 308 ++++++++++++++++++++++++++++++++++++++++++++ src/views/tabledesign/index.jsx | 12 + src/views/menudesign/index.scss | 33 ++-- src/views/pcdesign/index.jsx | 2 src/assets/css/design.scss | 23 +++ src/views/mobdesign/index.jsx | 2 src/views/tabledesign/index.scss | 21 ++ src/menu/lowerField/index.scss | 0 src/views/menudesign/index.jsx | 14 + 9 files changed, 392 insertions(+), 23 deletions(-) diff --git a/src/assets/css/design.scss b/src/assets/css/design.scss index ceaad14..2819b7c 100644 --- a/src/assets/css/design.scss +++ b/src/assets/css/design.scss @@ -153,3 +153,26 @@ color: #f5222d; } } + +.mk-opeartion-dropdown-wrap { + box-shadow: 0 0 2px #bcbcbc; + background: #ffffff; + min-width: 120px; + button { + display: block; + width: 100%; + height: 40px; + line-height: 40px; + border-radius: 0px; + border: none; + border-bottom: 1px solid #e8e8e8!important; + color: rgba(0, 0, 0, 0.85); + + .anticon { + display: none; + } + } + button:hover { + color: #1890ff; + } +} diff --git a/src/menu/lowerField/index.jsx b/src/menu/lowerField/index.jsx new file mode 100644 index 0000000..e0f5585 --- /dev/null +++ b/src/menu/lowerField/index.jsx @@ -0,0 +1,308 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { fromJS } from 'immutable' +import { Modal, Button, notification } from 'antd' +import { VerticalRightOutlined } from '@ant-design/icons' + +// import './index.scss' + +const { confirm } = Modal + +class LowerField extends Component { + static propTpyes = { + config: PropTypes.object, + updateConfig: PropTypes.func + } + + trigger = () => { + const that = this + confirm({ + content: `纭畾灏嗗瓧娈佃浆涓哄皬鍐欏悧锛焋, + onOk() { + that.exec() + }, + onCancel() {} + }) + } + + exec = () => { + let config = fromJS(this.props.config).toJS() + + let resetElement = (m) => { + if (m.datatype === 'dynamic' && m.field) { + m.field = m.field.toLowerCase() + } + if (m.posterField) { + m.posterField = m.posterField.toLowerCase() + } + if (m.bgImage) { + m.bgImage = m.bgImage.toLowerCase() + } + if (m.linkurl && /^[a-zA-Z0-9_]+$/.test(m.linkurl)) { + m.linkurl = m.linkurl.toLowerCase() + } + if (m.modal && m.modal.fields) { + m.modal.fields = m.modal.fields.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column) { + col.Column = col.Column.toLowerCase() + } + return col + }) + } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + } + let _replace = (components) => { + return components.map(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + tab.components = _replace(tab.components) + }) + return item + } else if (item.type === 'group') { + item.components = _replace(item.components) + return item + } + + if (item.columns) { + item.columns = item.columns.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + if (item.setting && item.setting.primaryKey) { + item.setting.primaryKey = item.setting.primaryKey.toLowerCase() + } + if (item.subColumns) { + item.subColumns = item.subColumns.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + if (item.search) { + if (item.type === 'topbar') { + if (item.search.fields) { + item.search.fields = item.search.fields.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + if (item.search.groups) { + item.search.groups = item.search.groups.map(group => { + group.fields = group.fields.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + return group + }) + } + } else if (Array.isArray(item.search)) { + item.search = item.search.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + } + + if (item.action) { + item.action.forEach(m => { + if (m.modal && m.modal.fields) { + m.modal.fields = m.modal.fields.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + if (m.verify && m.verify.columns) { + m.verify.columns = m.verify.columns.map(col => { + if (col.Column) { + col.Column = col.Column.toLowerCase() + } + return col + }) + } + if (m.config && m.config.components) { + m.config.components = _replace(m.config.components) + } + }) + } + + if (item.subcards) { + item.subcards.forEach(card => { + if (card.elements) { + card.elements = card.elements.map(m => { + resetElement(m) + return m + }) + } + + if (card.backElements) { + card.backElements = card.backElements.map(m => { + resetElement(m) + return m + }) + } + + if (card.fields) { + card.fields = card.fields.map(m => { + if (m.field) { + m.field = m.field.toLowerCase() + } + return m + }) + } + }) + } + + if (item.elements) { + item.elements = item.elements.map(m => { + resetElement(m) + return m + }) + } + + if (item.plot) { + if (item.plot.Xaxis) { + item.plot.Xaxis = item.plot.Xaxis.toLowerCase() + } + // 缁熻鍥� + if (item.plot.InfoValue) { + item.plot.InfoValue = item.plot.InfoValue.toLowerCase() + } + if (item.plot.InfoType) { + item.plot.InfoType = item.plot.InfoType.toLowerCase() + } + // 鍗犳瘮鍥� + if (item.plot.valueField) { + item.plot.valueField = item.plot.valueField.toLowerCase() + } + if (item.plot.labelField) { + item.plot.labelField = item.plot.labelField.toLowerCase() + } + // 楗煎浘 + if (item.plot.type) { + item.plot.type = item.plot.type.toLowerCase() + } + // 鏁g偣鍥� + if (item.plot.gender) { + item.plot.gender = item.plot.gender.toLowerCase() + } + if (item.Yaxis) { + if (Array.isArray(item.Yaxis)) { + item.Yaxis = item.Yaxis.map(m => { + if (m) return m.toLowerCase() + return m + }) + } else { + if (item.Yaxis) { + item.Yaxis = item.Yaxis.toLowerCase() + } + } + } + } + + if (item.cols) { + let _update = (cols) => { + return cols.map(col => { + if (col.type === 'custom' && col.elements) { + col.elements = col.elements.map(m => { + resetElement(m) + return m + }) + } else if (col.type === 'colspan') { + col.subcols = _update(col.subcols) + } else if (col.field) { + col.field = col.field.toLowerCase() + } + + return col + }) + } + + item.cols = _update(item.cols) + } + + if (item.wrap) { + if (item.wrap.tipField) { + item.wrap.tipField = item.wrap.tipField.toLowerCase() + } + if (item.wrap.controlField) { + item.wrap.controlField = item.wrap.controlField.toLowerCase() + } + if (item.wrap.valueField) { + item.wrap.valueField = item.wrap.valueField.toLowerCase() + } + if (item.wrap.labelField) { + item.wrap.labelField = item.wrap.labelField.toLowerCase() + } + if (item.wrap.parentField) { + item.wrap.parentField = item.wrap.parentField.toLowerCase() + } + if (item.wrap.broadcast) { + item.wrap.broadcast = item.wrap.broadcast.toLowerCase() + } + if (item.wrap.jumpField) { + item.wrap.jumpField = item.wrap.jumpField.toLowerCase() + } + if (item.wrap.link) { + item.wrap.link = item.wrap.link.toLowerCase() + } + } + + return item + }) + } + + config.components = _replace(config.components) + + config.interfaces && config.interfaces.forEach(item => { + if (item.columns) { + item.columns = item.columns.map(col => { + if (col.field) { + col.field = col.field.toLowerCase() + } + return col + }) + } + if (item.setting && item.setting.primaryKey) { + item.setting.primaryKey = item.setting.primaryKey.toLowerCase() + } + }) + + notification.success({ + top: 92, + message: '杞崲宸插畬鎴愩��', + duration: 3 + }) + + this.props.updateConfig(config) + } + + render() { + return ( + <Button className="mk-border-purple" onClick={this.trigger}><VerticalRightOutlined style={{transform: 'rotate(270deg)'}}/> 瀛楁杞皬鍐�</Button> + ) + } +} + +export default LowerField \ No newline at end of file diff --git a/src/menu/lowerField/index.scss b/src/menu/lowerField/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/menu/lowerField/index.scss diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 29eb9eb..6ca33fc 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -4,8 +4,8 @@ import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' -import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin, message } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined } from '@ant-design/icons' +import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin, message, Dropdown } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined, DownOutlined } from '@ant-design/icons' import html2canvas from 'html2canvas' import md5 from 'md5' @@ -35,6 +35,7 @@ const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const LowerField = asyncComponent(() => import('@/menu/lowerField')) const Debug = asyncComponent(() => import('@/menu/debug')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const Versions = asyncComponent(() => import('@/menu/versions')) @@ -1377,11 +1378,16 @@ <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button> {config ? <Versions MenuId={MenuId} Template="CustomPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <TableNodes config={config} /> - <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <SysInterface config={config} updateConfig={this.updateConfig}/> - <PictureController/> <StyleCombControlButton menu={config} /> <PasteController vType="admin" insert={this.insert} /> + {config ? <Dropdown placement="bottomCenter" overlay={<div className="mk-opeartion-dropdown-wrap"> + <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <LowerField config={config} updateConfig={this.resetConfig}/> + <PictureController/> + </div>} trigger={['hover']}> + <div className="mk-button-more">鏇村<DownOutlined/></div> + </Dropdown> : null} {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" id="save-config" disabled={!config} className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button> diff --git a/src/views/menudesign/index.scss b/src/views/menudesign/index.scss index 5521e68..5f94984 100644 --- a/src/views/menudesign/index.scss +++ b/src/views/menudesign/index.scss @@ -199,8 +199,25 @@ button { margin-left: 10px; } - .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { - padding: 0px 10px; + .mk-opeartion-list { + button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { + padding: 0px 10px; + } + .mk-button-more { + display: inline-block; + height: 32px; + border: 1px solid #26C281; + color: #26C281; + line-height: 32px; + padding: 0 10px 0px 20px; + border-radius: 4px; + cursor: pointer; + vertical-align: top; + margin-left: 10px; + .anticon-down { + margin-left: 3px; + } + } } .ant-switch.big { min-width: 60px; @@ -253,17 +270,5 @@ .ant-table-thead > tr > th { background: transparent!important; border-radius: 0!important; - } -} - -@media screen and (max-width: 1500px) { - .mk-opeartion-list .ant-btn { - min-width: 65px; - .anticon { - display: none; - } - .anticon + span { - margin-left: 0px; - } } } \ No newline at end of file diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 1dbe670..af25601 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -34,6 +34,7 @@ const TableNodes = asyncComponent(() => import('@/menu/tablenodes')) const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const LowerField = asyncComponent(() => import('@/menu/lowerField')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) const Quotecomponent = asyncComponent(() => import('@/pc/quotecomponent')) @@ -2316,6 +2317,7 @@ <Button className="mk-border-green set-home" disabled={MenuId === appHomeId} data-title="褰撳墠鑿滃崟涓哄簲鐢ㄩ椤�" onClick={this.setHomeView}><HomeOutlined /> 璁句负棣栭〉</Button> <Button className="mk-border-purple" disabled={MenuId === appLoginId} data-title="褰撳墠鑿滃崟涓哄簲鐢ㄧ櫥褰曢〉" onClick={this.setLoginView}><LoginOutlined /> 璁句负鐧诲綍椤�</Button> <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <LowerField config={config} updateConfig={this.resetConfig}/> <Transfer MenuID={MenuId} /> {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <Button type="default" onClick={this.closeView}>鍏抽棴</Button> diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index c5fc857..480cd9f 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -39,6 +39,7 @@ const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const LowerField = asyncComponent(() => import('@/menu/lowerField')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) @@ -1941,6 +1942,7 @@ <Button className="mk-border-green" disabled={MenuId === appHomeId} data-title="褰撳墠鑿滃崟涓哄簲鐢ㄩ椤�" onClick={this.setHomeView}><HomeOutlined /> 璁句负棣栭〉</Button> <Button className="mk-border-purple" disabled={MenuId === appLoginId} data-title="褰撳墠鑿滃崟涓哄簲鐢ㄧ櫥褰曢〉" onClick={this.setLoginView}><LoginOutlined/> 璁句负鐧诲綍椤�</Button> <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <LowerField config={config} updateConfig={this.resetConfig}/> <Transfer MenuID={MenuId} /> {config ? <Versions MenuId={MenuId} Template="webPage" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <Button type="default" onClick={this.closeView}>鍏抽棴</Button> diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index be78503..28e3c2b 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -4,8 +4,8 @@ import { is, fromJS } from 'immutable' import moment from 'moment' import HTML5Backend from 'react-dnd-html5-backend' -import { notification, Modal, Collapse, Card, Switch, Button, Typography, message } from 'antd' -import { DoubleLeftOutlined, DoubleRightOutlined, CopyOutlined } from '@ant-design/icons' +import { notification, Modal, Collapse, Card, Switch, Button, Typography, message, Dropdown } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined, CopyOutlined, DownOutlined } from '@ant-design/icons' import md5 from 'md5' import Api from '@/api' @@ -33,6 +33,7 @@ const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const LowerField = asyncComponent(() => import('@/menu/lowerField')) const Debug = asyncComponent(() => import('@/menu/debug')) const Versions = asyncComponent(() => import('@/menu/versions')) const Transfer = asyncComponent(() => import('@/menu/transfer')) @@ -1095,8 +1096,13 @@ {config ? <Unattended config={config} updateConfig={this.updateConfig}/> : null} {config ? <Versions MenuId={MenuId} Template="BaseTable" checklog={this.checklog} updateConfig={this.updateLogConfig}/> : null} <TableNodes config={config} /> - <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <PasteBaseTable type="page" insert={this.insert}/> + {config ? <Dropdown placement="bottomCenter" overlay={<div className="mk-opeartion-dropdown-wrap"> + <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <LowerField config={config} updateConfig={this.resetConfig}/> + </div>} trigger={['hover']}> + <div className="mk-button-more">鏇村<DownOutlined/></div> + </Dropdown> : null} {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" id="save-config" disabled={!config} onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button> diff --git a/src/views/tabledesign/index.scss b/src/views/tabledesign/index.scss index 84954ae..8ec16e2 100644 --- a/src/views/tabledesign/index.scss +++ b/src/views/tabledesign/index.scss @@ -151,8 +151,25 @@ button { margin-left: 15px; } - .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { - padding: 0px 10px; + .mk-opeartion-list { + button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { + padding: 0px 10px; + } + .mk-button-more { + display: inline-block; + height: 32px; + border: 1px solid #26C281; + color: #26C281; + line-height: 32px; + padding: 0 10px 0px 20px; + border-radius: 4px; + cursor: pointer; + vertical-align: top; + margin-left: 15px; + .anticon-down { + margin-left: 3px; + } + } } .ant-switch.big { min-width: 60px; -- Gitblit v1.8.0