From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 12 十二月 2023 21:05:37 +0800 Subject: [PATCH] 2023-12-12 --- src/menu/components/form/formaction/index.jsx | 61 ++++++++++++++++++++---------- 1 files changed, 41 insertions(+), 20 deletions(-) diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx index b5ac2d0..dc697e0 100644 --- a/src/menu/components/form/formaction/index.jsx +++ b/src/menu/components/form/formaction/index.jsx @@ -4,8 +4,6 @@ import { Modal, Button, Popover } from 'antd' import { FontColorsOutlined, EditOutlined, ProfileOutlined } from '@ant-design/icons' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import asyncComponent from '@/utils/asyncComponent' import { getActionForm } from './formconfig' import { resetStyle } from '@/utils/utils-custom.js' @@ -24,7 +22,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, appType: sessionStorage.getItem('appType'), card: null, // 缂栬緫涓厓绱� formlist: null, // 琛ㄥ崟淇℃伅 @@ -66,6 +63,10 @@ group.subButton.style = style } else if (card.type === 'next') { group.nextButton.style = style + } else if (card.type === 'close') { + group.closeButton.style = style + } else if (card.type === 'reset') { + group.resetButton.style = style } this.props.updateconfig(group) @@ -75,7 +76,7 @@ * @description 鎸夐挳缂栬緫锛岃幏鍙栨寜閽〃鍗曚俊鎭� */ handleAction = (card) => { - const { config } = this.props + const { config, group } = this.props let usefulFields = sessionStorage.getItem('permFuncField') if (usefulFields) { @@ -89,8 +90,9 @@ } let ableField = usefulFields.join(', ') + let msg = `鍑芥暟鍚嶇О闇�浠�${ableField}绛夊瓧绗﹀紑濮�;` let functip = <div> - <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p> + <p style={{marginBottom: '5px'}}>{msg}</p> </div> let supId = '' @@ -98,7 +100,7 @@ supId = config.wrap.supModule[config.wrap.supModule.length - 1] } - let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId) || [] + let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, config.uuid, supId) let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, config.uuid) || [] if (card.type === 'submit' && !card.Ot) { @@ -108,7 +110,7 @@ this.setState({ visible: true, card: card, - formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors) + formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors, group.uuid, group.fields) }) } @@ -138,11 +140,20 @@ let group = fromJS(this.props.group).toJS() if (res.type === 'prev') { + res.enable = group.prevButton.enable || 'true' group.prevButton = res } else if (res.type === 'submit') { + res.enable = group.subButton.enable || 'true' group.subButton = res } else if (res.type === 'next') { + res.enable = group.nextButton.enable || 'true' group.nextButton = res + } else if (res.type === 'close') { + res.enable = group.closeButton.enable || 'true' + group.closeButton = res + } else if (res.type === 'reset') { + res.enable = group.resetButton.enable || 'true' + group.resetButton = res } this.setState({ @@ -159,7 +170,6 @@ this.setState({ profVisible: true }) - MKEmitter.emit('modalStatus', '楠岃瘉淇℃伅') } /** @@ -175,7 +185,6 @@ profVisible: false }) this.props.updateconfig(group) - MKEmitter.emit('modalStatus', false) }) } @@ -196,11 +205,11 @@ render() { const { group, config } = this.props - const { visible, profVisible, card, dict } = this.state + const { visible, profVisible, card } = this.state return ( <div className="mk-form-action"> - {group.prevButton && group.prevButton.enable !== 'false' && group.sort !== 1 ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + {group.prevButton && group.prevButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.prevButton)} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.prevButton)}/> @@ -217,7 +226,23 @@ } trigger="hover"> <Button type="link" className="submit mk-primary" onDoubleClick={this.changeMenu} style={resetStyle(group.subButton.style)}>{group.subButton.label}</Button> </Popover> - {group.nextButton && group.nextButton.enable !== 'false' && group.sort !== config.subcards.length ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + {group.resetButton && group.resetButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.resetButton)} /> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.resetButton)}/> + </div> + } trigger="hover"> + <Button type="link" className="reset" style={resetStyle(group.resetButton.style)}>{group.resetButton.label}</Button> + </Popover> : null} + {group.closeButton && group.closeButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.closeButton)} /> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.closeButton)}/> + </div> + } trigger="hover"> + <Button type="link" className="reset" style={resetStyle(group.closeButton.style)}>{group.closeButton.label}</Button> + </Popover> : null} + {group.nextButton && group.nextButton.enable === 'true' ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.nextButton)} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.nextButton)}/> @@ -227,19 +252,18 @@ </Popover> : null} {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} <Modal - title={dict['model.edit']} + title="缂栬緫" visible={visible} width={920} maskClosable={false} onCancel={this.editModalCancel} footer={[ - <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>, - <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>{dict['model.confirm']}</Button> + <Button key="cancel" onClick={this.editModalCancel}>鍙栨秷</Button>, + <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>纭畾</Button> ]} destroyOnClose > <ActionForm - dict={dict} card={card} setting={config.setting} formlist={this.state.formlist} @@ -253,24 +277,21 @@ visible={profVisible} width={'90vw'} maskClosable={false} - okText={dict['model.submit']} + okText="鎻愪氦" onOk={this.verifySubmit} onCancel={() => { if (this.verifyRef.handleCancel) { this.verifyRef.handleCancel().then(() => { this.setState({ profVisible: false }) - MKEmitter.emit('modalStatus', false) }) } else { this.setState({ profVisible: false }) - MKEmitter.emit('modalStatus', false) } }} destroyOnClose > <VerifyCard card={{...group.subButton, modal: {fields: group.fields}}} - dict={dict} config={config} columns={config.columns} wrappedComponentRef={(inst) => this.verifyRef = inst} -- Gitblit v1.8.0