From 696d85238a734a4b691f486fde05c93fc5dba3ab Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 一月 2021 19:16:18 +0800 Subject: [PATCH] 2021-01-07 --- src/locales/zh-CN/model.js | 2 src/tabviews/custom/index.jsx | 129 +++++++++++++++----------------- src/tabviews/zshare/actionList/popupbutton/index.jsx | 12 +- src/menu/components/share/actioncomponent/formconfig.jsx | 4 src/tabviews/zshare/actionList/popupbutton/index.scss | 6 + src/menu/popview/index.jsx | 50 +++++++++++- src/views/menudesign/index.jsx | 2 src/menu/pastecontroller/index.jsx | 15 +++ src/assets/css/main.scss | 5 9 files changed, 140 insertions(+), 85 deletions(-) diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index b5e917f..7031e4b 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -255,10 +255,11 @@ } } -.popview-modal { +.ant-modal.popview-modal { + top: 80px; .ant-modal-body { min-height: 250px; - max-height: calc(100vh - 190px); + max-height: calc(100vh - 210px); overflow-y: auto; } .ant-modal-body::-webkit-scrollbar { diff --git a/src/locales/zh-CN/model.js b/src/locales/zh-CN/model.js index 40a089c..bbdcebd 100644 --- a/src/locales/zh-CN/model.js +++ b/src/locales/zh-CN/model.js @@ -98,7 +98,7 @@ 'header.form.refresh.maingrid': '鍒锋柊涓昏〃锛堣锛�', 'header.form.refresh.equaltab': '鍒锋柊鍚岀骇鏍囩', 'header.form.refresh.subgrid': '鍒锋柊瀛愯〃', - 'header.form.popClose': '鏍囩鍏抽棴', + 'header.form.popClose': '鍏抽棴鍚�', 'header.form.toolbar': '宸ュ叿鏍�', 'header.form.grid': '琛ㄦ牸', 'header.form.intertype': '鎺ュ彛绫诲瀷', diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 40b5761..c76a0b0 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -52,7 +52,7 @@ opentypes = opentypes.filter(item => item.value !== 'popview') refresh.push({ value: 'popclose', - text: '鏍囩鍏抽棴鍒锋柊' + text: '鏍囩鍒锋柊' }) } @@ -231,7 +231,7 @@ key: 'execSuccess', label: Formdict['model.form.afterSuccess'], initVal: card.execSuccess || 'never', - tooltip: refresh.length ? '鎵ц鏍囩鍏抽棴鍒锋柊鏃讹紝浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�', + tooltip: refresh.length ? '鎵ц鏍囩鍒锋柊鏃讹紝浼氬悓姝ュ埛鏂板綋鍓嶇粍浠跺拰涓婄骇缁勪欢-琛屻��' : '鍒锋柊涓婄骇缁勪欢-琛屾椂锛屼細鍚屾鍒锋柊褰撳墠缁勪欢锛屾敞锛氫笂绾х粍浠跺湪鏁版嵁婧愪腑娣诲姞銆�', required: true, options: [{ value: 'never', diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 647a073..12a510d 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -62,12 +62,18 @@ item.subcards.forEach(card => { card.uuid = Utils.getuuid() if (card.elements) { + if (sessionStorage.getItem('editMenuType') === 'popview') { + card.elements = card.elements.filter(b => b.OpenType !== 'popview') + } card.elements = card.elements.map(cell => { cell.uuid = Utils.getuuid() return cell }) } if (card.backElements) { + if (sessionStorage.getItem('editMenuType') === 'popview') { + card.elements = card.elements.filter(b => b.OpenType !== 'popview') + } card.backElements = card.backElements.map(cell => { cell.uuid = Utils.getuuid() return cell @@ -87,6 +93,9 @@ return cell }) } else if (c.type === 'action' && c.elements) { + if (sessionStorage.getItem('editMenuType') === 'popview') { + c.elements = c.elements.filter(b => b.OpenType !== 'popview') + } c.elements = c.elements.map(cell => { cell.uuid = Utils.getuuid() return cell @@ -109,6 +118,9 @@ return cell }) } else if (col.type === 'action' && col.elements) { + if (sessionStorage.getItem('editMenuType') === 'popview') { + col.elements = col.elements.filter(c => c.OpenType !== 'popview') + } col.elements = col.elements.map(cell => { cell.uuid = Utils.getuuid() return cell @@ -123,6 +135,9 @@ } if (item.action) { + if (sessionStorage.getItem('editMenuType') === 'popview') { + item.action = item.action.filter(c => c.OpenType !== 'popview') + } item.action = item.action.map(cell => { cell.uuid = Utils.getuuid() return cell diff --git a/src/menu/popview/index.jsx b/src/menu/popview/index.jsx index a90b4c0..097040e 100644 --- a/src/menu/popview/index.jsx +++ b/src/menu/popview/index.jsx @@ -24,7 +24,9 @@ const SourceWrap = asyncComponent(() => import('@/menu/modelsource')) const MenuShell = asyncComponent(() => import('@/menu/menushell')) const BgController = asyncComponent(() => import('@/menu/bgcontroller')) +const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const PaddingController = asyncComponent(() => import('@/menu/padcontroller')) +const StyleCombControlButton = asyncComponent(() => import('@/menu/stylecombcontrolbutton')) const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) sessionStorage.setItem('isEditState', 'true') @@ -61,6 +63,7 @@ componentDidMount () { MKEmitter.addListener('delButtons', this.delButtons) + MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } shouldComponentUpdate (nextProps, nextState) { @@ -75,6 +78,28 @@ return } MKEmitter.removeListener('delButtons', this.delButtons) + MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) + } + + updateComponentStyle = (parentId, keys, style) => { + const { config } = this.state + + if (config.uuid !== parentId) return + + let components = config.components.map(item => { + if (keys.includes(item.uuid)) { + item.style = {...item.style, ...style} + } + return item + }) + + this.setState({ + config: {...config, components: []} + }, () => { + this.setState({ + config: {...config, components: components} + }) + }) } delButtons = (items) => { @@ -154,6 +179,8 @@ config: fromJS(config).toJS(), openEdition: result.open_edition || '', }) + + this.props.modifyCustomMenu(config) } else { notification.warning({ top: 92, @@ -241,6 +268,7 @@ } submitConfig = () => { + const { btn } = this.props const { openEdition, delButtons } = this.state let config = fromJS(this.state.config).toJS() @@ -262,14 +290,15 @@ let _config = fromJS(config).toJS() delete _config.tableFields + let _name = (btn.component.name ? btn.component.name + '-' : '') + btn.label + let param = { - func: 'sPC_Tab_AddUpt', + func: 'sPC_ButtonParam_AddUpt', + ParentID: btn.config.uuid, MenuID: _config.uuid, - MenuNo: _config.MenuNo, + MenuNo: _config.MenuNo || '', Template: 'CustomPage', - MenuName: _config.MenuName, - Remark: '', - Sort: 0, + MenuName: _name, PageParam: JSON.stringify({Template: 'CustomPage'}), LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(_config))) } @@ -459,6 +488,15 @@ this.props.modifyCustomMenu(config) } + insert = (item) => { + let config = fromJS(this.state.config).toJS() + + config.components.push(item) + + this.setState({config}) + this.props.modifyCustomMenu(config) + } + render () { const { btn } = this.props const { activeKey, MenuType, dict, config, menuloading } = this.state @@ -492,6 +530,8 @@ <div> {config && config.MenuName} </div> } bordered={false} extra={ <div> + <StyleCombControlButton menu={config} /> + <PasteController type="menu" Tab={null} insert={this.insert} /> {config ? <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button> <Button type="default" onClick={this.closeView}>{dict['mob.return']}</Button> diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 10940f8..47a8849 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -248,87 +248,78 @@ } // 鏉冮檺杩囨护 - if (this.props.menuType !== 'HS') { - if (item.action && item.action.length > 0) { - item.action = item.action.filter(cell => { - cell.logLabel = item.name + '-' + cell.label - cell.ContainerId = this.state.ContainerId - cell.$menuId = item.uuid + let isHS = this.props.menuType === 'HS' + if (item.action && item.action.length > 0) { + item.action = item.action.filter(cell => { + cell.logLabel = item.name + '-' + cell.label + cell.ContainerId = this.state.ContainerId + cell.$menuId = item.uuid - return permAction[cell.uuid] - }) - } - if (item.type === 'card') { - item.subcards.forEach(card => { - let _hasheight = card.style.height && card.style.height !== 'auto' + return isHS || permAction[cell.uuid] + }) + } + if (item.type === 'card') { + item.subcards.forEach(card => { + let _hasheight = card.style.height && card.style.height !== 'auto' - if (card.style.shadow) { // 鍗$墖闃村奖 - card.style.boxShadow = '0 0 4px ' + card.style.shadow - delete card.style.shadow - } + if (card.style.shadow) { // 鍗$墖闃村奖 + card.style.boxShadow = '0 0 4px ' + card.style.shadow + delete card.style.shadow + } - card.elements = card.elements.filter(cell => { - if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label - cell.Ot = 'requiredSgl' - cell.ContainerId = this.state.ContainerId - cell.$menuId = item.uuid - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { - cell.innerHeight = 'auto' - } - - return cell.eleType !== 'button' || permAction[cell.uuid] - }) - card.backElements = card.backElements.filter(cell => { - if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label - cell.Ot = 'requiredSgl' - cell.ContainerId = this.state.ContainerId - cell.$menuId = item.uuid - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { - cell.innerHeight = 'auto' - } - return cell.eleType !== 'button' || permAction[cell.uuid] - }) - }) - } else if (item.type === 'table' && item.subtype === 'tablecard') { - item.subcards.forEach(card => { - let _hasheight = card.style.height && card.style.height !== 'auto' - card.elements = card.elements.filter(cell => { - if (cell.eleType === 'button') { - cell.logLabel = item.name + '-' + cell.label - cell.Ot = 'requiredSgl' - cell.ContainerId = this.state.ContainerId - cell.$menuId = item.uuid - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { - cell.innerHeight = 'auto' - } - return cell.eleType !== 'button' || permAction[cell.uuid] - }) - }) - } else if (item.type === 'table' && item.subtype === 'normaltable') { - item.cols = item.cols.filter(col => { - if (col.type !== 'action') return true - col.elements = col.elements.filter(cell => { + card.elements = card.elements.filter(cell => { + if (cell.eleType === 'button') { cell.logLabel = item.name + '-' + cell.label cell.Ot = 'requiredSgl' cell.ContainerId = this.state.ContainerId cell.$menuId = item.uuid + } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { + cell.innerHeight = 'auto' + } - return permAction[cell.uuid] - }) - return col.elements.length !== 0 + return cell.eleType !== 'button' || isHS || permAction[cell.uuid] }) - } - } else { - if (item.action && item.action.length > 0) { - item.action = item.action.map(cell => { + card.backElements = card.backElements.filter(cell => { + if (cell.eleType === 'button') { + cell.logLabel = item.name + '-' + cell.label + cell.Ot = 'requiredSgl' + cell.ContainerId = this.state.ContainerId + cell.$menuId = item.uuid + } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { + cell.innerHeight = 'auto' + } + return cell.eleType !== 'button' || isHS || permAction[cell.uuid] + }) + }) + } else if (item.type === 'table' && item.subtype === 'tablecard') { + item.subcards.forEach(card => { + let _hasheight = card.style.height && card.style.height !== 'auto' + card.elements = card.elements.filter(cell => { + if (cell.eleType === 'button') { + cell.logLabel = item.name + '-' + cell.label + cell.Ot = 'requiredSgl' + cell.ContainerId = this.state.ContainerId + cell.$menuId = item.uuid + } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { + cell.innerHeight = 'auto' + } + return cell.eleType !== 'button' || isHS || permAction[cell.uuid] + }) + }) + } else if (item.type === 'table' && item.subtype === 'normaltable') { + item.cols = item.cols.filter(col => { + if (col.type !== 'action') return true + col.elements = col.elements.filter(cell => { cell.logLabel = item.name + '-' + cell.label + cell.Ot = 'requiredSgl' + cell.ContainerId = this.state.ContainerId cell.$menuId = item.uuid - return cell + + return isHS || permAction[cell.uuid] }) - } - } + return col.elements.length !== 0 + }) + } if (item.setting && item.setting.supModule) { let pid = item.setting.supModule.slice(-1)[0] diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index c29a385..2a5c6fa 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -11,8 +11,9 @@ import './index.scss' const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable')) +const CustomPage = asyncSpinComponent(() => import('@/tabviews/custom')) -class NormalButton extends Component { +class PopupButton extends Component { static propTpyes = { show: PropTypes.any, // 鎸夐挳鏄剧ず鏍峰紡鎺у埗 position: PropTypes.any, // 鎸夐挳浣嶇疆锛屽伐鍏锋爮涓簍oolbar @@ -154,7 +155,7 @@ onClick={() => {this.actionTrigger()}} >{show === 'icon' && btn.icon ? '' : btn.label}</Button> : null} <Modal - className="popview-modal" + className={'popview-modal ' + (btn.$menuId ? 'custom-popview' : '')} title={btn.label} width={'80vw'} maskClosable={false} @@ -165,14 +166,15 @@ ]} destroyOnClose > - <SubTabTable + {!btn.$menuId ? <SubTabTable Tab={btn} MenuID={btn.linkTab} BID={popData ? primaryId : this.props.BID} BData={popData || this.props.BData} SupMenuID={this.props.MenuID} refreshSupView={this.reloadtable} - /> + /> : null} + {btn.$menuId ? <CustomPage MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null} </Modal> </div> ) @@ -189,4 +191,4 @@ return {} } -export default connect(mapStateToProps, mapDispatchToProps)(NormalButton) \ No newline at end of file +export default connect(mapStateToProps, mapDispatchToProps)(PopupButton) \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/popupbutton/index.scss b/src/tabviews/zshare/actionList/popupbutton/index.scss index 8b13789..bd9cd43 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.scss +++ b/src/tabviews/zshare/actionList/popupbutton/index.scss @@ -1 +1,5 @@ - +.custom-popview.popview-modal { + >.ant-modal-content >.ant-modal-body { + padding: 0; + } +} diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 7ba908b..a813b51 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -163,6 +163,7 @@ handleBack = () => { this.setState({popBtn: null, delButtons: []}, () => { sessionStorage.setItem('editMenuType', 'menu') + this.props.modifyCustomMenu(this.state.config) this.setState({visible: false}) }) } @@ -257,6 +258,7 @@ openEdition: result.open_edition || '', }) + this.props.modifyCustomMenu(config) this.getRoleFields() } else { notification.warning({ -- Gitblit v1.8.0