| | |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { wrap, columns } = this.state.card |
| | | const { wrap, columns, action } = this.state.card |
| | | |
| | | return getWrapForm(wrap, columns) |
| | | return getWrapForm(wrap, columns, action.findIndex(item => item.Ot === 'requiredSgl') > -1) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | |
| | | render() { |
| | | const { card } = this.state |
| | | let _style = resetStyle(card.style) |
| | | if (card.wrap.lineHeight) { |
| | | _style['--mk-tree-line-height'] = card.wrap.lineHeight + 'px' |
| | | } |
| | | |
| | | return ( |
| | | <div className="menu-tree-box" style={_style} onClick={this.clickComponent} id={card.uuid}> |
| | |
| | | background-size: cover; |
| | | min-height: 100px; |
| | | overflow-y: auto; |
| | | --mk-tree-line-height: 24px; |
| | | |
| | | .anticon-tool { |
| | | position: absolute; |
| | |
| | | .model-menu-action-list:not(.length0) { |
| | | margin: 10px 0px; |
| | | } |
| | | .model-menu-action-list { |
| | | .ant-btn { |
| | | border-width: 0px; |
| | | } |
| | | } |
| | | .ant-tree li .ant-tree-node-content-wrapper, .ant-tree li span.ant-tree-switcher, .ant-tree li span.ant-tree-iconEle { |
| | | height: var(--mk-tree-line-height); |
| | | line-height: var(--mk-tree-line-height); |
| | | } |
| | | } |
| | | .menu-tree-box::after { |
| | | display: block; |
| | |
| | | /** |
| | | * @description Wrap表单配置信息 |
| | | */ |
| | | export default function (wrap, columns = []) { |
| | | export default function (wrap, columns = [], hasLineAction) { |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | let appType = sessionStorage.getItem('appType') |
| | | let ispop = sessionStorage.getItem('editMenuType') === 'popview' |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'lineHeight', |
| | | label: '行高', |
| | | initval: wrap.lineHeight || 24, |
| | | min: 24, |
| | | max: 200, |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'showIcon', |
| | | label: '图标', |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'actShow', |
| | | label: '按钮显示', |
| | | initval: wrap.actShow || 'dropdown', |
| | | tooltip: '选择单行按钮的显示方式。', |
| | | required: false, |
| | | forbid: !hasLineAction, |
| | | options: [ |
| | | {value: 'dropdown', label: '下拉'}, |
| | | {value: 'line', label: '行内'}, |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'permission', |
| | | label: '权限验证', |
| | | initval: wrap.permission || 'false', |
| | |
| | | treeNodes: null, // 列表数据集 |
| | | expandedKeys: [], // 展开的树节点 |
| | | selectedKeys: [], // 选中的树节点 |
| | | lineActions: [], |
| | | selected: false // 选中首行 |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | let lineActions = [] |
| | | _config.action = _config.action || [] |
| | | _config.action = _config.action.filter(item => { |
| | | if (item.Ot === 'requiredSgl') { |
| | | lineActions.push(item) |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | |
| | | _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%' |
| | | |
| | | if (_config.wrap.lineHeight) { |
| | | _config.style['--mk-tree-line-height'] = _config.wrap.lineHeight + 'px' |
| | | } |
| | | |
| | | this.setState({ |
| | | selected: _config.wrap.selected === 'true', |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '' |
| | | BID: BID || '', |
| | | lineActions |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | renderActionTreeNodes = (nodes) => { |
| | | renderActionTreeNodes = (nodes, actShow) => { |
| | | return nodes.map(item => { |
| | | let title = <> |
| | | {item.$title} |
| | | <Dropdown overlay={ |
| | | <div className="mk-tree-dropdown-wrap" onClick={(e) => e.stopPropagation()}> |
| | | <MainAction |
| | | BID={this.state.BID} |
| | | BData={this.state.BData} |
| | | setting={this.state.config.setting} |
| | | actions={this.state.config.action} |
| | | columns={this.state.config.columns} |
| | | selectedData={[{...item, children: ''}]} |
| | | /> |
| | | </div> |
| | | } placement="bottomCenter" trigger={['hover']}> |
| | | <MoreOutlined onClick={(e) => e.stopPropagation()}/> |
| | | </Dropdown> |
| | | </> |
| | | let title = null |
| | | if (actShow === 'line') { |
| | | title = <> |
| | | {item.$title} |
| | | <MainAction |
| | | BID={this.state.BID} |
| | | BData={this.state.BData} |
| | | setting={this.state.config.setting} |
| | | actions={this.state.lineActions} |
| | | columns={this.state.config.columns} |
| | | selectedData={[{...item, children: ''}]} |
| | | /> |
| | | </> |
| | | } else { |
| | | title = <> |
| | | {item.$title} |
| | | <Dropdown overlay={ |
| | | <div className="mk-tree-dropdown-wrap" onClick={(e) => e.stopPropagation()}> |
| | | <MainAction |
| | | BID={this.state.BID} |
| | | BData={this.state.BData} |
| | | setting={this.state.config.setting} |
| | | actions={this.state.lineActions} |
| | | columns={this.state.config.columns} |
| | | selectedData={[{...item, children: ''}]} |
| | | /> |
| | | </div> |
| | | } placement="bottomCenter" trigger={['hover']}> |
| | | <MoreOutlined onClick={(e) => e.stopPropagation()}/> |
| | | </Dropdown> |
| | | </> |
| | | } |
| | | |
| | | if (item.children) { |
| | | return ( |
| | | <TreeNode icon={<span><FolderOpenOutlined /><FolderOutlined /></span>} title={title} key={item.$key} dataRef={item}> |
| | | {this.renderActionTreeNodes(item.children)} |
| | | {this.renderActionTreeNodes(item.children, actShow)} |
| | | </TreeNode> |
| | | ) |
| | | } |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { BID, BData, config, loading, treeNodes, expandedKeys, selectedKeys } = this.state |
| | | |
| | | let extra = config.action && config.action.length > 0 |
| | | const { BID, BData, config, loading, treeNodes, expandedKeys, selectedKeys, lineActions } = this.state |
| | | |
| | | return ( |
| | | <div className="custom-tree-box" id={'anchor' + config.uuid} style={config.style}> |
| | |
| | | <span className={'title ' + (config.wrap.searchable !== 'true' ? 'search-unable' : '')}>{config.wrap.title}</span> |
| | | {config.wrap.searchable === 'true' ? <Search allowClear onSearch={this.treeFilter} /> : null} |
| | | </div> : null} |
| | | {extra ? <MainAction |
| | | {config.action.length ? <MainAction |
| | | BID={BID} |
| | | setting={config.setting} |
| | | actions={config.action} |
| | |
| | | onSelect={this.selectTreeNode} |
| | | expandedKeys={expandedKeys} |
| | | selectedKeys={selectedKeys} |
| | | onRightClick={!extra ? this.changeExpandedAllKeys : null} |
| | | onRightClick={!lineActions.length ? this.changeExpandedAllKeys : null} |
| | | onExpand={this.changeExpandedKeys} |
| | | showIcon={config.wrap.showIcon === 'true'} |
| | | showLine={config.wrap.showLine === 'true'} |
| | | > |
| | | {!extra ? this.renderTreeNodes(treeNodes) : this.renderActionTreeNodes(treeNodes)} |
| | | {!lineActions.length ? this.renderTreeNodes(treeNodes) : this.renderActionTreeNodes(treeNodes, config.wrap.actShow)} |
| | | </Tree> |
| | | </div> : null} |
| | | {treeNodes && treeNodes.length === 0 ? <Empty description={false}/> : null} |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | min-height: 50px; |
| | | --mk-tree-line-height: 24px; |
| | | |
| | | .tree-header { |
| | | position: relative; |
| | |
| | | } |
| | | } |
| | | } |
| | | .ant-tree-title { |
| | | .button-list.toolbar-button { |
| | | position: absolute; |
| | | right: 0px; |
| | | top: 0px; |
| | | padding: 0px; |
| | | min-height: 24px; |
| | | height: var(--mk-tree-line-height); |
| | | |
| | | button { |
| | | min-width: 20px; |
| | | margin-bottom: 0px !important; |
| | | min-height: 24px; |
| | | border-width: 0px; |
| | | vertical-align: middle; |
| | | } |
| | | } |
| | | } |
| | | .ant-tree-node-content-wrapper { |
| | | .button-list.toolbar-button { |
| | | opacity: 0; |
| | | transition: all 0.3s; |
| | | } |
| | | } |
| | | .ant-tree-node-content-wrapper:hover { |
| | | .button-list.toolbar-button { |
| | | opacity: 1; |
| | | } |
| | | } |
| | | .ant-tree li .ant-tree-node-content-wrapper, .ant-tree li span.ant-tree-switcher, .ant-tree li span.ant-tree-iconEle { |
| | | height: var(--mk-tree-line-height); |
| | | line-height: var(--mk-tree-line-height); |
| | | } |
| | | .tree-box { |
| | | overflow: auto; |
| | | padding-bottom: 10px; |
| | |
| | | right: 0px; |
| | | padding: 5px 10px; |
| | | color: var(--mk-sys-color); |
| | | height: var(--mk-tree-line-height); |
| | | line-height: var(--mk-tree-line-height); |
| | | } |
| | | } |
| | | } |
| | |
| | | .mk-tree-dropdown-wrap { |
| | | box-shadow: 0 0 2px #bcbcbc; |
| | | background: #ffffff; |
| | | min-width: 85px; |
| | | min-width: 100px; |
| | | .button-list.toolbar-button { |
| | | padding: 0px; |
| | | min-height: 36px; |
| | | button { |
| | | display: block; |
| | | margin: 0!important; |
| | | width: 100%; |
| | | border-radius: 0px; |
| | | padding-left: 15px!important; |
| | | .anticon { |
| | | display: none; |
| | | } |
| | | .anticon + span { |
| | | margin-left: 0px; |
| | | } |
| | | border: 0px !important; |
| | | color: rgba(0, 0, 0, 0.85)!important; |
| | | background: transparent !important; |
| | | min-height: 36px; |
| | | } |
| | | button:not(:last-child) { |
| | | border-bottom: 1px solid #d8d8d8 !important; |
| | | } |
| | | } |
| | | } |
| | |
| | | } else { |
| | | return (<InputNumber id={config.uuid} value={value} precision={precision} disabled={config.readonly} onChange={this.handleChange} onPressEnter={this.handleSubmit} />) |
| | | } |
| | | // <InputNumber |
| | | // id={config.uuid} |
| | | // formatter={value => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')} |
| | | // parser={value => value.replace(/,*/g, '')} |
| | | // value={value} |
| | | // precision={precision} |
| | | // disabled={config.readonly} |
| | | // onChange={this.handleChange} |
| | | // onPressEnter={this.handleSubmit} |
| | | // /> |
| | | } |
| | | } |
| | | |