From f3d4db769ba9b51b799d981511a710fd443d0e08 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 四月 2025 12:18:03 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/menu/tablenodes/index.jsx | 333 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 326 insertions(+), 7 deletions(-) diff --git a/src/menu/tablenodes/index.jsx b/src/menu/tablenodes/index.jsx index 36281b2..4174e4d 100644 --- a/src/menu/tablenodes/index.jsx +++ b/src/menu/tablenodes/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal, Button, notification, Spin, Input } from 'antd' +import { Modal, Button, notification, Spin, Input, message } from 'antd' import { ForkOutlined } from '@ant-design/icons' import Api from '@/api' @@ -109,6 +109,293 @@ return {tbs, ptbs} } + getFuncAndInterface = (config) => { + let ptbs = [] + + let filterBtn = (cell, tbs) => { + if (cell.intertype === 'inner') { + tbs.push({ + label: cell.innerFunc + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } else if (cell.intertype === 'outer' || cell.intertype === 'custom') { + if (cell.innerFunc) { + tbs.push({ + label: cell.innerFunc + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (cell.outerFunc) { + tbs.push({ + label: cell.outerFunc + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (cell.interface && cell.sysInterface !== 'true') { + tbs.push({ + label: cell.interface + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (cell.proInterface) { + tbs.push({ + label: cell.proInterface + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (cell.exInterface) { + let url = '' + + try { + url = JSON.parse(cell.exInterface).url + } catch(e) { + url = '' + } + + if (url) { + tbs.push({ + label: url + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + } + if (cell.exProInterface) { + let url = '' + + try { + url = JSON.parse(cell.exProInterface).url + } catch(e) { + url = '' + } + + if (url) { + tbs.push({ + label: url + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + } + if (cell.callbackFunc) { + tbs.push({ + label: cell.callbackFunc + ' (' + cell.label + ')', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + } + } + + let filterSetting = (item, tbs) => { + if (!item.setting) return + if (item.setting.interType === 'inner') { + tbs.push({ + label: item.setting.innerFunc + ' (鏁版嵁婧�)', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } else if (item.setting.interType === 'outer') { + if (item.setting.outerFunc) { + tbs.push({ + label: item.setting.outerFunc + ' (鏁版嵁婧�)', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (item.setting.interface && item.setting.sysInterface !== 'true') { + tbs.push({ + label: item.setting.interface + ' (鏁版嵁婧�)', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (item.setting.proInterface) { + tbs.push({ + label: item.setting.proInterface + ' (鏁版嵁婧�)', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + if (item.setting.exInterface) { + let url = '' + + try { + url = JSON.parse(item.setting.exInterface).url + } catch(e) { + url = '' + } + + if (url) { + tbs.push({ + label: url + ' (鏁版嵁婧�)', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + } + if (item.setting.exProInterface) { + let url = '' + + try { + url = JSON.parse(item.setting.exProInterface).url + } catch(e) { + url = '' + } + + if (url) { + tbs.push({ + label: url + ' (鏁版嵁婧�)', + color: 'orange', + id: Utils.getuuid(), + direction: 'left' + }) + } + } + } + } + + let traversal = (components, extra) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + traversal(tab.components, extra) + }) + } else if (item.type === 'group') { + traversal(item.components, extra) + } else { + let tbs = [] + + filterSetting(item, tbs) + + if (item.action) { + item.action.forEach(cell => { + if (cell.OpenType === 'popview') { + if (cell.config.components) { + traversal(cell.config.components, `-${cell.label}(寮圭獥)`) + } + } else { + filterBtn(cell, tbs) + } + }) + } + + if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { + item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') return + + if (cell.OpenType === 'popview') { + if (cell.config.components) { + traversal(cell.config.components, `-${cell.label}(寮圭獥)`) + } + } else { + filterBtn(cell, tbs) + } + }) + card.backElements && card.backElements.forEach(cell => { + if (cell.eleType !== 'button') return + + if (cell.OpenType === 'popview') { + if (cell.config.components) { + traversal(cell.config.components, `-${cell.label}(寮圭獥)`) + } + } else { + filterBtn(cell, tbs) + } + }) + }) + } else if (item.type === 'balcony') { + item.elements && item.elements.forEach(cell => { + if (cell.eleType !== 'button') return + + if (cell.OpenType === 'popview') { + if (cell.config.components) { + traversal(cell.config.components, `-${cell.label}(寮圭獥)`) + } + } else { + filterBtn(cell, tbs) + } + }) + } else if (item.type === 'table') { + let loopCol = (cols) => { + cols.forEach(col => { + if (col.type === 'colspan') { + loopCol(col.subcols) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType !== 'button') return + + if (cell.OpenType === 'popview') { + if (cell.config.components) { + traversal(cell.config.components, `-${cell.label}(寮圭獥)`) + } + } else { + filterBtn(cell, tbs) + } + }) + } + }) + } + loopCol(item.cols) + } else if (item.type === 'form') { + item.subcards.forEach(group => { + filterBtn(group.subButton, tbs) + }) + } + + if (tbs.length) { + ptbs.push({ + label: item.name + extra, + id: Utils.getuuid(), + direction: 'left', + color: 'orange', + children: tbs + }) + } + } + }) + } + + if (config.interfaces) { + config.interfaces.forEach(item => { + let tbs = [] + filterSetting(item, tbs) + if (tbs.length) { + ptbs.push({ + label: item.name, + id: Utils.getuuid(), + direction: 'left', + color: 'orange', + children: tbs + }) + } + }) + } + + traversal(config.components, '') + + return ptbs + } + trigger = () => { const { config } = this.props @@ -122,7 +409,7 @@ MenuID: config.uuid } - Api.getSystemConfig(param).then(result => { + Api.getCloudConfig(param).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -158,6 +445,7 @@ id: 'par' + i, direction: 'left', color: '#5AD8A6', + node: 'table', children: [] } @@ -169,6 +457,12 @@ data.children.push(cell) }) + } + + let funcs = this.getFuncAndInterface(config) + + if (funcs.length) { + data.children.push(...funcs) } if (result.tb_list) { @@ -191,9 +485,12 @@ if (m.debug_url) { let _param = JSON.parse(window.decodeURIComponent(window.atob(m.debug_url))) let label = _param.MenuName + _param.lang = _param.lang || 'zh-CN' if (_param && _param.type === 'app') { - label += ` (${_param.kei_no} | ${_param.typename}${param.lang !== 'zh-CN' ? ' | ' + param.lang : ''})` + label += ` (${_param.kei_no} | ${_param.typename}${_param.lang !== 'zh-CN' ? ' | ' + _param.lang : ''})` + } else if (_param && _param.lang && _param.lang !== 'zh-CN') { + label += ` (${_param.lang})` } cell.children.push({ @@ -232,10 +529,15 @@ if (menu.direction !== 'right') return if (menu.depth === 1) { + sessionStorage.setItem('mk-table-node', menu.label) window.open('#/hs') + + setTimeout(() => { + sessionStorage.removeItem('mk-table-node') + }, 50) } else if (menu.param) { if (menu.param.type === 'admin') { - if (menu.param.MenuType === 'custom') { + if (['custom', 'home', 'billPrint'].includes(menu.param.MenuType)) { let _param = {...menu.param} delete _param.type _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) @@ -353,6 +655,23 @@ this.graph.updateItem(node, _model, false) } }) + + if (model.direction === 'left') { + if (model.node === 'table') { + model.fontcolor = '#1890ff' + this.graph.updateItem(item, model, false) + + let oInput = document.createElement('input') + oInput.value = model.label + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + + message.success('琛ㄥ悕澶嶅埗鎴愬姛銆�') + } + return + } model.fontcolor = '#1890ff' this.graph.updateItem(item, model, false) @@ -484,7 +803,7 @@ const { visible, loading, empty } = this.state return ( - <div style={{display: 'inline-block'}}> + <> <Button style={{borderColor: '#8E44AD', color: '#8E44AD'}} onClick={this.trigger}><ForkOutlined /> 琛ㄥ叧绯诲浘</Button> <Modal title="" @@ -505,10 +824,10 @@ </div> <div className="footer"> <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>鍏抽棴</Button> - <span className="tip">娉細鐐瑰嚮琛ㄥ悕鍙睍寮�/鏀惰捣鑿滃崟</span> + <span className="tip">娉細鐐瑰嚮琛ㄥ悕锛堝彸渚э級鍙睍寮�/鏀惰捣鑿滃崟锛屽乏渚ф鑹叉爣娉ㄤ负鎺ュ彛鎴栧嚱鏁板悕銆�</span> </div> </Modal> - </div> + </> ) } } -- Gitblit v1.8.0