From 8a1ee7d651500f848a3c2f05c7fe3be2b7114a43 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 10 四月 2024 00:47:56 +0800 Subject: [PATCH] 2024-04-10 --- src/menu/components/form/formaction/formconfig.jsx | 17 - src/menu/components/card/cardsimplecomponent/index.scss | 13 + src/tabviews/custom/components/card/prop-card/index.jsx | 18 + src/templates/sharecomponent/actioncomponent/formconfig.jsx | 2 src/menu/components/card/cardcellcomponent/index.jsx | 9 src/tabviews/zshare/actionList/popupbutton/index.jsx | 4 src/templates/modalconfig/settingform/index.jsx | 23 + src/menu/components/share/actioncomponent/formconfig.jsx | 64 ++-- src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 2 src/menu/components/form/formaction/actionform/index.jsx | 2 src/templates/zshare/pasteform/index.jsx | 2 src/utils/utils-custom.js | 36 ++ src/menu/components/card/cardcellcomponent/elementform/index.jsx | 93 ++++-- src/menu/components/card/doublecardcomponent/index.scss | 13 + src/menu/components/card/doublecardcomponent/index.jsx | 128 +++++++++ src/menu/components/card/cardcomponent/index.jsx | 128 +++++++++ src/menu/components/card/cardsimplecomponent/index.jsx | 107 +++++++ src/tabviews/zshare/mutilform/index.jsx | 3 src/menu/components/card/cardcellcomponent/formconfig.jsx | 30 + src/menu/components/share/actioncomponent/actionform/index.jsx | 6 src/menu/components/card/cardcomponent/index.scss | 13 + src/menu/components/card/cardcellcomponent/elementform/index.scss | 4 src/tabviews/zshare/actionList/normalbutton/index.jsx | 10 23 files changed, 600 insertions(+), 127 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 651535c..ae23509 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Popover, message } from 'antd' +import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Popover, message, AutoComplete } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import { formRule } from '@/utils/option.js' @@ -61,7 +61,7 @@ formlist: formlist.map(item => { item.hidden = !_options.includes(item.key) - if (item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') { + if ((item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') && item.type === 'select') { item.options = [] if (side === 'sub') { @@ -156,7 +156,7 @@ item.required = card.eleType !== 'qrcode' } if (item.key === 'linkurl') { - item.type = card.link === 'dynamic' ? 'select' : 'textarea' + item.type = card.link === 'dynamic' ? item.defType : 'textarea' } return item @@ -264,7 +264,7 @@ item.initVal = this.record[item.key] item.hidden = !_options.includes(item.key) - if (item.key === 'field') { + if (item.key === 'field' && item.type === 'select') { item.options = [] if (side === 'sub') { @@ -364,7 +364,7 @@ item.hidden = !_options.includes(item.key) if (item.key === 'linkurl') { - item.type = value === 'dynamic' ? 'select' : 'textarea' + item.type = value === 'dynamic' ? item.defType : 'textarea' } return item }) @@ -399,30 +399,65 @@ if (item.hidden || item.forbid) return if (item.type === 'text') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: item.readonly ? false : !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - ) + if (item.options && item.options.length > 0) { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + message: '璇疯緭鍏�' + item.label + '!' + }, + { + pattern: formRule.field.pattern, + message: formRule.field.message + }, + { + max: formRule.input.max, + message: formRule.input.message + } + ] + })( + <AutoComplete + dataSource={item.options.map((cell, i) => <AutoComplete.Option value={cell.value} key={i}> + {cell.value} + </AutoComplete.Option>)} + filterOption={(input, option) => option.props.children.indexOf(input) > -1} + > + <Input autoComplete="off" onPressEnter={this.handleSubmit} /> + </AutoComplete> + )} + </Form.Item> + </Col> + ) + } else { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.tooltip ? + <Tooltip placement="topLeft" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: item.readonly ? false : !!item.required, + message: '璇疯緭鍏�' + item.label + '!' + }, + { + max: formRule.input.max, + message: formRule.input.message + } + ] + })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} + </Form.Item> + </Col> + ) + } } else if (item.type === 'textarea') { fields.push( <Col span={24} className="textarea" key={index}> diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.scss b/src/menu/components/card/cardcellcomponent/elementform/index.scss index b6273fd..e2aa807 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.scss +++ b/src/menu/components/card/cardcellcomponent/elementform/index.scss @@ -39,6 +39,10 @@ .ant-form-explain, .ant-form-extra { font-size: 13px; } + .ant-select-search__field__mirror { + max-width: 100%; + overflow: hidden; + } } .formula-fields { z-index: 1200!important; diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 7599bad..61c27e7 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -127,6 +127,18 @@ appMenus.push({value: 'goback', text: '杩斿洖锛堜笂涓�椤碉級'}) } + let fields = [] + if (cards.subtype === 'propcard' && cards.wrap.datatype === 'static') { + if (cards.wrap.supModule && cards.wrap.supModule.length) { + let cell = MenuUtils.getComponent(cards.wrap.supModule[cards.wrap.supModule.length - 1]) + if (cell && cell.columns) { + fields = cell.columns.map(col => ({ value: col.field })) + } + } else { + fields = cards.columns.map(col => ({ value: col.field })) + } + } + let forms = [ { type: 'select', @@ -160,12 +172,12 @@ ] }, { - type: 'select', + type: cards.subtype === 'propcard' && cards.wrap.datatype === 'static' ? 'text' : 'select', key: 'field', label: '瀛楁', initVal: card.field || '', required: true, - options: [] + options: fields }, { type: 'icon', @@ -244,11 +256,12 @@ required: true }, { - type: 'select', + type: cards.subtype === 'propcard' && cards.wrap.datatype === 'static' ? 'text' : 'select', key: 'posterField', label: '棰勮鍦板潃', initVal: card.posterField || '', - required: true + required: true, + options: fields }, { type: 'radio', @@ -462,14 +475,14 @@ required: false }, { - type: 'select', + type: cards.subtype === 'propcard' && cards.wrap.datatype === 'static' ? 'text' : 'select', key: 'bgImage', label: '鍔ㄦ�佽儗鏅�', initVal: card.bgImage || '', tooltip: '缁戝畾鏁版嵁婧愬瓧娈碉紝鍙牴鎹繑鍥炲�兼敼鍙樿儗鏅浘銆�', required: false, allowClear: true, - options: [], + options: fields, forbid: isHeader }, { @@ -642,13 +655,14 @@ forbid: ['pc', 'mob'].includes(appType) }, { - type: 'select', + type: cards.subtype === 'propcard' && cards.wrap.datatype === 'static' ? 'text' : 'select', + defType: cards.subtype === 'propcard' && cards.wrap.datatype === 'static' ? 'text' : 'select', key: 'linkurl', label: '閾炬帴鍦板潃', initVal: card.linkurl || '', tooltip: ['pc', 'mob'].includes(appType) ? '褰撻摼鎺ョ被鍨嬩负鈥滃叾浠栤�濓紝涓旈摼鎺ュ湴鍧�浠menuid@寮�澶存椂锛屽叾鍚庡唴瀹瑰皢琚涓鸿彍鍗旾D銆�' : '', required: true, - options: [] + options: fields }, { type: 'radio', diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 44495b6..9c1dbd3 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -24,11 +24,12 @@ class CardCellComponent extends Component { static propTpyes = { - cards: PropTypes.object, // 鑿滃崟閰嶇疆淇℃伅 + cards: PropTypes.object, cardCell: PropTypes.object, side: PropTypes.string, - elements: PropTypes.array, // 鍏冪礌闆� - updateElement: PropTypes.func // 鑿滃崟閰嶇疆鏇存柊 + timestamp: PropTypes.any, + elements: PropTypes.array, + updateElement: PropTypes.func } state = { @@ -74,7 +75,7 @@ } UNSAFE_componentWillReceiveProps(nextProps) { - if (this.props.side !== nextProps.side && nextProps.side) { + if (this.props.timestamp !== nextProps.timestamp && nextProps.timestamp) { this.setState({ elements: fromJS(nextProps.elements).toJS() }) diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index fec3526..823a4b6 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -33,6 +33,7 @@ formlist: null, // 璁剧疆琛ㄥ崟淇℃伅 elements: null, // 缂栬緫缁� side: 'front', + timestamp: '', appType: sessionStorage.getItem('appType'), visible: false } @@ -44,6 +45,7 @@ const { card } = this.props this.setState({ + timestamp: new Date().getTime() + '', card: fromJS(card).toJS(), elements: fromJS(card.elements).toJS(), }) @@ -117,7 +119,7 @@ _elements = fromJS(card.backElements).toJS() } - this.setState({side: _side, elements: _elements}) + this.setState({side: _side, elements: _elements, timestamp: new Date().getTime() + ''}) } addElement = () => { @@ -215,9 +217,7 @@ okText: '纭畾', cancelText: '鍙栨秷', onOk() { - that.setState({ card: _card, side: '', elements: fromJS(_card.elements).toJS() }, () => { - that.setState({ side: 'front' }) - }) + that.setState({ card: _card, side: 'front', timestamp: new Date().getTime() + '', elements: fromJS(_card.elements).toJS() }) that.props.updateElement(_card) }, onCancel() {} @@ -267,6 +267,7 @@ if (side === 'back' && res.type === 'simple') { this.setState({ side: 'front', + timestamp: new Date().getTime() + '', elements: fromJS(_card.elements).toJS() }) } @@ -274,8 +275,121 @@ this.props.updateElement(_card) } + updateFields = (elements, resolve, type) => { + const { card, side } = this.state + + let items = elements + + if (type === 'form') { + items = [] + + elements.forEach(item => { + let cell = { + uuid: Utils.getuuid(), + eleType: 'text', + height: 1, + innerHeight: 21, + prefix: item.label ? item.label + ': ' : '', + datatype: item.field ? 'dynamic' : 'static', + field: item.field || '', + width: item.span || 12, + value: '', + style: {marginBottom: '15px'} + } + + if (item.type === 'number') { + cell.eleType = 'number' + cell.decimal = typeof(item.decimal) === 'number' ? item.decimal : '' + } + + items.push(cell) + }) + } + + if (items.length === 0) { + resolve({status: false, message: '鍏冪礌涓嶅彲涓虹┖锛�'}) + return + } + + let _card = { ...card } + let _card2 = { ...card } + let pass = false + + if (side === 'back') { + if (!_card.backElements || _card.backElements.length === 0) { + _card.backElements = items + pass = true + } else { + _card.backElements = items + _card2.backElements = [...card.backElements, ...items] + } + } else { + if (!_card.elements || _card.elements.length === 0) { + _card.elements = items + pass = true + } else { + _card.elements = items + _card2.elements = [...card.elements, ...items] + } + } + + if (pass) { + this.setState({ + card: _card, + timestamp: new Date().getTime() + '', + elements: side === 'back' ? fromJS(_card.backElements).toJS() : fromJS(_card.elements).toJS() + }) + + this.props.updateElement(_card) + } else { + const that = this + const _modal = confirm({ + title: '鍗$墖涓凡瀛樺湪鍏冪礌锛岃閫夋嫨瑕佽繘琛岀殑鎿嶄綔銆�', + className: 'mk-confirm-modal', + content: <div className="footer"> + <Button key="cancel" onClick={() => _modal.destroy()}>鍙栨秷</Button> + <Button key="replace" className="mk-border-purple" onClick={() => { + that.setState({ + card: _card, + timestamp: new Date().getTime() + '', + elements: side === 'back' ? fromJS(_card.backElements).toJS() : fromJS(_card.elements).toJS() + }) + + that.props.updateElement(_card) + _modal.destroy() + }}>鏇挎崲</Button> + <Button key="confirm" className="mk-border-green" onClick={() => { + that.setState({ + card: _card2, + timestamp: new Date().getTime() + '', + elements: side === 'back' ? fromJS(_card2.backElements).toJS() : fromJS(_card2.elements).toJS() + }) + + that.props.updateElement(_card2) + _modal.destroy() + }}>娣诲姞</Button> + </div> + }) + } + + resolve({status: true}) + } + paste = (element, resolve) => { const { card } = this.state + + if (['simpleform', 'forms', 'formgroup', 'cardcell'].includes(element.copyType)) { + if (element.copyType === 'simpleform') { + this.updateFields(element.subcards[0].fields, resolve, 'form') + } else if (element.copyType === 'forms') { + this.updateFields(element.fields, resolve, 'form') + } else if (element.copyType === 'formgroup') { + this.updateFields(element.fields, resolve, 'form') + } else { + this.updateFields(element.elements, resolve) + } + return + } let _uuid = Utils.getuuid() @@ -343,7 +457,7 @@ render() { const { cards } = this.props - const { card, elements, side, visible } = this.state + const { card, elements, side, visible, timestamp } = this.state let _style = {...card.style} @@ -390,7 +504,7 @@ <Col span={card.setting.width || 6} style={_style_}> <div className={'card-item ' + (card.setting.btnControl || '') + checkAll + tablerole} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> <span className="circle-select"></span> - <CardCellComponent cards={cards} cardCell={card} side={side} elements={elements} updateElement={this.updateCard}/> + <CardCellComponent cards={cards} cardCell={card} side={side} timestamp={timestamp} elements={elements} updateElement={this.updateCard}/> <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -400,7 +514,7 @@ <EditOutlined className="edit" title="缂栬緫"/> </NormalForm> <CopyComponent type="cardcell" card={card}/> - <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} /> + <PasteController options={['action', 'customCardElement', 'simpleform', 'forms', 'formgroup', 'cardcell']} updateConfig={this.paste} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} /> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> diff --git a/src/menu/components/card/cardcomponent/index.scss b/src/menu/components/card/cardcomponent/index.scss index 35933f8..fd413e5 100644 --- a/src/menu/components/card/cardcomponent/index.scss +++ b/src/menu/components/card/cardcomponent/index.scss @@ -99,3 +99,16 @@ display: inline; } } + +.mk-confirm-modal { + .ant-modal-confirm-btns { + display: none; + } + .footer { + margin-top: 24px; + text-align: right; + .ant-btn { + margin-left: 8px; + } + } +} diff --git a/src/menu/components/card/cardsimplecomponent/index.jsx b/src/menu/components/card/cardsimplecomponent/index.jsx index 2eb816e..d7d2fe6 100644 --- a/src/menu/components/card/cardsimplecomponent/index.jsx +++ b/src/menu/components/card/cardsimplecomponent/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Popover } from 'antd' +import { Popover, Modal, Button } from 'antd' import { PlusOutlined, PlusSquareOutlined, EditOutlined, ArrowLeftOutlined, ArrowRightOutlined, SwapOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' @@ -11,6 +11,8 @@ import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import './index.scss' + +const { confirm } = Modal const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const NodesWrap = asyncComponent(() => import('./node-wrap')) @@ -30,7 +32,8 @@ state = { card: null, // 鍗$墖淇℃伅 formlist: null, // 璁剧疆琛ㄥ崟淇℃伅 - appType: sessionStorage.getItem('appType') + appType: sessionStorage.getItem('appType'), + timestamp: '' } /** @@ -40,7 +43,8 @@ const { card } = this.props this.setState({ - card: fromJS(card).toJS() + card: fromJS(card).toJS(), + timestamp: new Date().getTime() + '' }) } @@ -187,8 +191,99 @@ this.props.updateElement(_card) } + updateFields = (elements, resolve, type) => { + const { card } = this.state + + let items = elements + + if (type === 'form') { + items = [] + + elements.forEach(item => { + let cell = { + uuid: Utils.getuuid(), + eleType: 'text', + height: 1, + innerHeight: 21, + prefix: item.label ? item.label + ': ' : '', + datatype: item.field ? 'dynamic' : 'static', + field: item.field || '', + width: item.span || 12, + value: '', + style: {marginBottom: '15px'} + } + + if (item.type === 'number') { + cell.eleType = 'number' + cell.decimal = typeof(item.decimal) === 'number' ? item.decimal : '' + } + + items.push(cell) + }) + } + + if (items.length === 0) { + resolve({status: false, message: '鍏冪礌涓嶅彲涓虹┖锛�'}) + return + } + + let _card = { ...card, elements: items } + let _card2 = { ...card, elements: [...card.elements, ...items] } + + if (card.elements.length === 0) { + this.setState({ + card: _card, + timestamp: new Date().getTime() + '' + }) + + this.props.updateElement(_card) + } else { + const that = this + const _modal = confirm({ + title: '鍗$墖涓凡瀛樺湪鍏冪礌锛岃閫夋嫨瑕佽繘琛岀殑鎿嶄綔銆�', + className: 'mk-confirm-modal', + content: <div className="footer"> + <Button key="cancel" onClick={() => _modal.destroy()}>鍙栨秷</Button> + <Button key="replace" className="mk-border-purple" onClick={() => { + that.setState({ + card: _card, + timestamp: new Date().getTime() + '' + }) + + that.props.updateElement(_card) + _modal.destroy() + }}>鏇挎崲</Button> + <Button key="confirm" className="mk-border-green" onClick={() => { + that.setState({ + card: _card2, + timestamp: new Date().getTime() + '' + }) + + that.props.updateElement(_card2) + _modal.destroy() + }}>娣诲姞</Button> + </div> + }) + } + + resolve({status: true}) + } + paste = (element, resolve) => { const { card } = this.state + + if (['simpleform', 'forms', 'formgroup', 'cardcell'].includes(element.copyType)) { + if (element.copyType === 'simpleform') { + this.updateFields(element.subcards[0].fields, resolve, 'form') + } else if (element.copyType === 'forms') { + this.updateFields(element.fields, resolve, 'form') + } else if (element.copyType === 'formgroup') { + this.updateFields(element.fields, resolve, 'form') + } else { + this.updateFields(element.elements, resolve) + } + return + } let _uuid = Utils.getuuid() @@ -208,7 +303,7 @@ render() { const { cards } = this.props - const { card } = this.state + const { card, timestamp } = this.state let _style = {...card.style} @@ -225,7 +320,7 @@ return ( <div className="card-item" style={_style}> - <CardCellComponent cards={cards} cardCell={card} elements={card.elements} updateElement={this.updateCard}/> + <CardCellComponent cards={cards} cardCell={card} timestamp={timestamp} elements={card.elements} updateElement={this.updateCard}/> <div className="card-control"> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -235,7 +330,7 @@ <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> : <NodesWrap card={card} updateMenus={this.updateNodes}/>} {cards.type !== 'timeline' ? <CopyComponent type="cardcell" card={card}/> : null} - <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} /> + <PasteController options={['action', 'customCardElement', 'simpleform', 'forms', 'formgroup', 'cardcell']} updateConfig={this.paste} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {control ? <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> diff --git a/src/menu/components/card/cardsimplecomponent/index.scss b/src/menu/components/card/cardsimplecomponent/index.scss index 0f6054d..a41bcf9 100644 --- a/src/menu/components/card/cardsimplecomponent/index.scss +++ b/src/menu/components/card/cardsimplecomponent/index.scss @@ -12,4 +12,17 @@ cursor: pointer; background: rgba(255, 255, 255, 0.55); } +} + +.mk-confirm-modal { + .ant-modal-confirm-btns { + display: none; + } + .footer { + margin-top: 24px; + text-align: right; + .ant-btn { + margin-left: 8px; + } + } } \ No newline at end of file diff --git a/src/menu/components/card/doublecardcomponent/index.jsx b/src/menu/components/card/doublecardcomponent/index.jsx index cc2e64a..0507417 100644 --- a/src/menu/components/card/doublecardcomponent/index.jsx +++ b/src/menu/components/card/doublecardcomponent/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Popover, Col } from 'antd' +import { Popover, Col, Modal, Button } from 'antd' import { UpOutlined, PlusOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, FontColorsOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' @@ -11,6 +11,8 @@ import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import './index.scss' + +const { confirm } = Modal const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) @@ -28,6 +30,7 @@ card: null, // 鍗$墖淇℃伅锛屽寘鎷鍙嶉潰 appType: sessionStorage.getItem('appType'), visible: false, + timestamp: '', side: '' } @@ -38,7 +41,8 @@ const { card } = this.props this.setState({ - card: fromJS(card).toJS() + card: fromJS(card).toJS(), + timestamp: new Date().getTime() + '' }) } @@ -208,8 +212,118 @@ this.props.updateElement(_card) } + updateFields = (elements, resolve, position, type) => { + const { card } = this.state + + let items = elements + + if (type === 'form') { + items = [] + + elements.forEach(item => { + let cell = { + uuid: Utils.getuuid(), + eleType: 'text', + height: 1, + innerHeight: 21, + prefix: item.label ? item.label + ': ' : '', + datatype: item.field ? 'dynamic' : 'static', + field: item.field || '', + width: item.span || 12, + value: '', + style: {marginBottom: '15px'} + } + + if (item.type === 'number') { + cell.eleType = 'number' + cell.decimal = typeof(item.decimal) === 'number' ? item.decimal : '' + } + + items.push(cell) + }) + } + + if (items.length === 0) { + resolve({status: false, message: '鍏冪礌涓嶅彲涓虹┖锛�'}) + return + } + + let _card = { ...card } + let _card2 = { ...card } + let pass = false + + if (position === 'sub') { + if (_card.backElements.length === 0) { + _card.backElements = items + pass = true + } else { + _card.backElements = items + _card2.backElements = [...card.backElements, ...items] + } + } else { + if (_card.elements.length === 0) { + _card.elements = items + pass = true + } else { + _card.elements = items + _card2.elements = [...card.elements, ...items] + } + } + + if (pass) { + this.setState({ + card: _card, + timestamp: new Date().getTime() + '' + }) + + this.props.updateElement(_card) + } else { + const that = this + const _modal = confirm({ + title: '鍗$墖涓凡瀛樺湪鍏冪礌锛岃閫夋嫨瑕佽繘琛岀殑鎿嶄綔銆�', + className: 'mk-confirm-modal', + content: <div className="footer"> + <Button key="cancel" onClick={() => _modal.destroy()}>鍙栨秷</Button> + <Button key="replace" className="mk-border-purple" onClick={() => { + that.setState({ + card: _card, + timestamp: new Date().getTime() + '' + }) + + that.props.updateElement(_card) + _modal.destroy() + }}>鏇挎崲</Button> + <Button key="confirm" className="mk-border-green" onClick={() => { + that.setState({ + card: _card2, + timestamp: new Date().getTime() + '' + }) + + that.props.updateElement(_card2) + _modal.destroy() + }}>娣诲姞</Button> + </div> + }) + } + + resolve({status: true}) + } + paste = (element, resolve, type) => { const { card } = this.state + + if (['simpleform', 'forms', 'formgroup', 'cardcell'].includes(element.copyType)) { + if (element.copyType === 'simpleform') { + this.updateFields(element.subcards[0].fields, resolve, type, 'form') + } else if (element.copyType === 'forms') { + this.updateFields(element.fields, resolve, type, 'form') + } else if (element.copyType === 'formgroup') { + this.updateFields(element.fields, resolve, type, 'form') + } else { + this.updateFields(element.elements, resolve, type) + } + return + } let _uuid = Utils.getuuid() @@ -238,7 +352,7 @@ render() { const { cards } = this.props - const { card } = this.state + const { card, timestamp } = this.state let _style = {...card.style} let _backStyle = {...card.backStyle} @@ -288,14 +402,14 @@ <EditOutlined className="edit" title="缂栬緫"/> </NormalForm> <CopyComponent type="cardcell" card={{...card, backElements: []}}/> - <PasteController options={['action', 'customCardElement']} updateConfig={(element, resolve) => this.paste(element, resolve, 'main')} /> + <PasteController options={['action', 'customCardElement', 'simpleform', 'forms', 'formgroup', 'cardcell']} updateConfig={(element, resolve) => this.paste(element, resolve, 'main')} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.changeStyle()} /> </div> } trigger="hover"> <ToolOutlined /> </Popover> </div> - <CardCellComponent cards={cards} cardCell={card} side="main" elements={card.elements} updateElement={(elements, btn) => this.updateCard(elements, btn)}/> + <CardCellComponent cards={cards} cardCell={card} side="main" timestamp={timestamp} elements={card.elements} updateElement={(elements, btn) => this.updateCard(elements, btn)}/> </div> <Col span={card.backSetting.width || 24}> <div className={'card-item ' + (card.backSetting.btnControl || '')} style={_backStyle} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard('sub')}} id={card.uuid}> @@ -308,14 +422,14 @@ <EditOutlined className="edit" title="缂栬緫"/> </NormalForm> <CopyComponent type="cardcell" card={{...card, elements: card.backElements, backElements: []}}/> - <PasteController options={['action', 'customCardElement']} updateConfig={(element, resolve) => this.paste(element, resolve, 'sub')} /> + <PasteController options={['action', 'customCardElement', 'simpleform', 'forms', 'formgroup', 'cardcell']} updateConfig={(element, resolve) => this.paste(element, resolve, 'sub')} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.changeStyle('sub')} /> </div> } trigger="hover"> <ToolOutlined /> </Popover> </div> - <CardCellComponent cards={cards} cardCell={card} side="sub" elements={card.backElements} updateElement={(elements, btn) => this.updateCard(elements, btn, 'sub')}/> + <CardCellComponent cards={cards} cardCell={card} side="sub" timestamp={timestamp} elements={card.backElements} updateElement={(elements, btn) => this.updateCard(elements, btn, 'sub')}/> </div> </Col> </div> diff --git a/src/menu/components/card/doublecardcomponent/index.scss b/src/menu/components/card/doublecardcomponent/index.scss index 63e0e13..cc9f94f 100644 --- a/src/menu/components/card/doublecardcomponent/index.scss +++ b/src/menu/components/card/doublecardcomponent/index.scss @@ -117,3 +117,16 @@ display: inline-block; } } + +.mk-confirm-modal { + .ant-modal-confirm-btns { + display: none; + } + .footer { + margin-top: 24px; + text-align: right; + .ant-btn { + margin-left: 8px; + } + } +} diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index 09c15d7..827b091 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -57,7 +57,7 @@ } else if (this.record.type === 'close' || this.record.type === 'reset') { shows = ['typeName', 'label'] } else { - shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'formCache'] // 閫夐」鍒楄〃 + shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 閫夐」鍒楄〃 if (this.record.execSuccess === 'never') { shows.push('resetForms') diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index 1a4e306..8bb1628 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -539,21 +539,6 @@ value: 'true', text: '鍒锋柊' }] - }, - // { - // type: 'radio', - // key: 'formCache', - // label: '琛ㄥ崟缂撳瓨', - // initVal: card.formCache || 'false', - // tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', - // required: false, - // options: [{ - // value: 'false', - // text: '涓嶆竻绌�' - // }, { - // value: 'clear', - // text: '娓呯┖' - // }] - // }, + } ] } diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index b3be041..a8028cf 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -15,9 +15,9 @@ const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) const MKTable = asyncComponent(() => import('@/components/normalform/modalform/mkTable')) const acTyOptions = { - pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hoverTitle', 'hidden', 'preButton', 'formCache'], - prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hoverTitle', 'hidden', 'preButton', 'formCache'], - exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hoverTitle', 'hidden', 'preButton', 'formCache'], + pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'hoverTitle', 'hidden', 'preButton'], + prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hoverTitle', 'hidden', 'preButton'], + exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hoverTitle', 'hidden', 'preButton'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'hover', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'hover', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], popview: ['label', 'Ot', 'OpenType', 'show', 'hover', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 469ee34..47e21cb 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -1068,7 +1068,7 @@ key: 'tipTitle', label: '纭鎻愮ず', initVal: card.tipTitle || '', - tooltip: '娉細寮圭獥锛堣〃鍗曪級鍦ㄦ樉绀轰负鏄惁妗嗘椂鏈夋晥銆�', + tooltip: '鎻愮ず妗嗙殑纭鎻愮ず淇℃伅銆�', required: false }, { @@ -1328,21 +1328,21 @@ initVal: card.reason || '', required: false }, - { - type: 'radio', - key: 'formCache', - label: '琛ㄥ崟缂撳瓨', - initVal: card.formCache || 'false', - tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', - required: false, - options: [{ - value: 'false', - text: '涓嶆竻绌�' - }, { - value: 'clear', - text: '娓呯┖' - }] - }, + // { + // type: 'radio', + // key: 'formCache', + // label: '琛ㄥ崟缂撳瓨', + // initVal: card.formCache || 'false', + // tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + // required: false, + // options: [{ + // value: 'false', + // text: '涓嶆竻绌�' + // }, { + // value: 'clear', + // text: '娓呯┖' + // }] + // }, { type: 'radio', key: 'hidden', @@ -2338,7 +2338,7 @@ key: 'tipTitle', label: '纭鎻愮ず', initVal: card.tipTitle || '', - tooltip: '娉細寮圭獥锛堣〃鍗曪級鍦ㄦ樉绀轰负鏄惁妗嗘椂鏈夋晥銆�', + tooltip: '鎻愮ず妗嗙殑纭鎻愮ず淇℃伅銆�', required: false }, { @@ -2519,21 +2519,21 @@ initVal: card.reason || '', required: false }, - { - type: 'radio', - key: 'formCache', - label: '琛ㄥ崟缂撳瓨', - initVal: card.formCache || 'false', - tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', - required: false, - options: [{ - value: 'false', - text: '涓嶆竻绌�' - }, { - value: 'clear', - text: '娓呯┖' - }] - }, + // { + // type: 'radio', + // key: 'formCache', + // label: '琛ㄥ崟缂撳瓨', + // initVal: card.formCache || 'false', + // tooltip: '涓昏鐢ㄤ簬鏁版嵁淇敼鍚庯紝鏇存柊鐩稿叧琛ㄥ崟鐨勯�夐」锛屾竻绌虹紦瀛樺悗琛ㄥ崟鍐嶆鎵撳紑鏃舵暟鎹細閲嶆柊鍔犺浇銆�', + // required: false, + // options: [{ + // value: 'false', + // text: '涓嶆竻绌�' + // }, { + // value: 'clear', + // text: '娓呯┖' + // }] + // }, { type: 'radio', key: 'hidden', diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 0901077..7885b03 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -76,6 +76,14 @@ _data.$$BID = BID || '' _data.$$BData = BData || '' + + if (_config.wrap.datatype === 'static' && BData) { + Object.keys(BData).forEach(key => { + if (/\$/.test(key)) return + _data[key] = BData[key] + }) + } + if (_config.setting.primaryKey) { _data.$$uuid = _data[_config.setting.primaryKey] || '' } @@ -494,8 +502,16 @@ } if (config.wrap.datatype === 'static') { + let _data = {$$BID: BID || '', $$BData: BData, $$empty: true, $$time: new Date().getTime()} + if (BData) { + Object.keys(BData).forEach(key => { + if (/\$/.test(key)) return + _data[key] = BData[key] + }) + } + this.setState({ - data: {$$BID: BID || '', $$BData: BData, $$empty: true, $$time: new Date().getTime()}, + data: _data, }) if (!btn) { diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 30162ab..30564b9 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2351,9 +2351,9 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } - if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 - window.GLOB.CacheMap = new Map() - } + // if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 + // window.GLOB.CacheMap = new Map() + // } if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 MKEmitter.emit('reloadMenuView', tabId, 'table') @@ -3205,7 +3205,7 @@ } modelconfirm = () => { - const { btn, BID } = this.props + const { BID } = this.props const { btnconfig, selines } = this.state let _this = this @@ -3350,7 +3350,7 @@ this.execSubmit(selines, () => {}, result) } else { confirm({ - title: btn.tipTitle || '纭畾瑕佹墽琛屽悧?', + title: btnconfig.setting.tipTitle || '纭畾瑕佹墽琛屽悧?', onOk() { return new Promise(resolve => { _this.execSubmit(selines, resolve, result) diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index 7a358c3..7c57f0a 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -174,9 +174,9 @@ let _data = null let primaryId = '' - if (btn.Ot === 'requiredSgl' && setting.primaryKey) { + if (btn.Ot === 'requiredSgl') { _data = data[0] - primaryId = _data.$$uuid || _data[setting.primaryKey] || '' + primaryId = _data.$$uuid || '' } this.setState({ diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 53ae1d3..97da891 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -148,6 +148,7 @@ item.readin = item.readin !== 'false' && item.readin !== 'top' item.readonly = check || item.readonly === 'true' item.writein = item.writein !== 'false' + item.defHidden = item.hidden === 'true' item.hidden = item.hidden === 'true' item.fieldlength = item.fieldlength || 50 @@ -497,7 +498,7 @@ let _hidden = false - if (supItem.hidden) { + if (supItem.hidden && !supItem.defHidden) { _hidden = true } else { let box = [...item.values] diff --git a/src/templates/modalconfig/settingform/index.jsx b/src/templates/modalconfig/settingform/index.jsx index febd8d8..7baf400 100644 --- a/src/templates/modalconfig/settingform/index.jsx +++ b/src/templates/modalconfig/settingform/index.jsx @@ -347,8 +347,13 @@ )} </Form.Item> </Col> : null} - {appType !== 'mob' ? <Col span={12}> - <Form.Item label="琛ㄥ崟绫诲瀷"> + {appType !== 'mob' && (display === 'drawer' || display === 'modal') ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="閫夋嫨鏌ョ湅鏃惰〃鍗曞潎涓哄彧璇伙紝浠呯敤浜庢暟鎹睍绀恒��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 琛ㄥ崟绫诲瀷 + </Tooltip> + }> {getFieldDecorator('formType', { initialValue: config.setting.formType || 'edit' })( @@ -359,6 +364,20 @@ )} </Form.Item> </Col> : null} + {display === 'prompt' ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鎻愮ず妗嗙殑纭鎻愮ず淇℃伅銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 纭鎻愮ず + </Tooltip> + }> + {getFieldDecorator('tipTitle', { + initialValue: config.setting.tipTitle || '' + })( + <Input autoComplete="off" onPressEnter={this.handleSubmit} /> + )} + </Form.Item> + </Col> : null} {!this.props.isSubTab && !appType && this.state.viewType !== 'popview' && display === 'modal' ? <Col span={12}> <Form.Item label="鎸傝浇瀵硅薄"> {getFieldDecorator('container', { diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index 3e9c1ae..e163b1c 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -13,7 +13,7 @@ const { TextArea } = Input const actionTypeOptions = { - pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'], + pop: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'hidden'], prompt: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'tipTitle', 'hidden'], exec: ['label', 'position', 'OpenType', 'intertype', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'openmenu', 'output', 'hidden'], excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'icon', 'class', 'sheet', 'execSuccess', 'execError', 'hidden'], diff --git a/src/templates/sharecomponent/actioncomponent/formconfig.jsx b/src/templates/sharecomponent/actioncomponent/formconfig.jsx index 0476049..6cdce8c 100644 --- a/src/templates/sharecomponent/actioncomponent/formconfig.jsx +++ b/src/templates/sharecomponent/actioncomponent/formconfig.jsx @@ -523,7 +523,7 @@ key: 'tipTitle', label: '纭鎻愮ず', initVal: card.tipTitle || '', - tooltip: '娉細寮圭獥锛堣〃鍗曪級鍦ㄦ樉绀轰负鏄惁妗嗘椂鏈夋晥銆�', + tooltip: '鎻愮ず妗嗙殑纭鎻愮ず淇℃伅銆�', required: false }, { diff --git a/src/templates/zshare/pasteform/index.jsx b/src/templates/zshare/pasteform/index.jsx index 3067ef0..73d666e 100644 --- a/src/templates/zshare/pasteform/index.jsx +++ b/src/templates/zshare/pasteform/index.jsx @@ -116,7 +116,7 @@ <Form {...formItemLayout} className="config-paste-form"> <Row gutter={24}> <Col span={24}> - <Form.Item label="閰嶇疆淇℃伅" className="textarea"> + <Form.Item label="" className="textarea"> {getFieldDecorator('config', { initialValue: '', rules: [ diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 209bc75..0bbb449 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -193,6 +193,42 @@ } /** + * @description 鑾峰彇鎸囧畾缁勪欢 + * @return {String} 缁勪欢id + */ + static getComponent (Id) { + let interfaces = window.GLOB.customMenu.interfaces + let components = window.GLOB.customMenu.components + let cell = null + + let mapComponents = (components = []) => { + components.forEach(item => { + if (item.uuid === Id) { + cell = item + }else if (item.type === 'tabs') { + item.subtabs.forEach(f_tab => { + mapComponents(f_tab.components) + }) + } else if (item.type === 'group') { + mapComponents(item.components) + } + }) + } + + mapComponents(components) + + if (!cell && interfaces) { + interfaces.forEach(m => { + if (m.uuid === Id && m.status === 'true') { + cell = m + } + }) + } + + return cell + } + + /** * @description 鑾峰彇涓婄骇妯″潡 * @return {String} selfId 褰撳墠缁勪欢id */ -- Gitblit v1.8.0