From af6486b3629d23e426ce85b87dbc20dfa15b1afe Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 07 十一月 2022 18:50:27 +0800 Subject: [PATCH] 2022-11-07 --- src/tabviews/zshare/settingcomponent/index.jsx | 44 +++++++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/tabviews/zshare/settingcomponent/index.jsx b/src/tabviews/zshare/settingcomponent/index.jsx index e5820fb..2f137ee 100644 --- a/src/tabviews/zshare/settingcomponent/index.jsx +++ b/src/tabviews/zshare/settingcomponent/index.jsx @@ -5,7 +5,7 @@ import Api from '@/api' import MKEmitter from '@/utils/events.js' -import UtilsUpdate from '@/utils/utils-update.js' +import { updateSubTable } from '@/utils/utils-update.js' import options from '@/store/options.js' import asyncComponent from '@/utils/asyncSpinComponent' import './index.scss' @@ -17,7 +17,6 @@ dict: PropTypes.object, // 瀛楀吀琛� config: PropTypes.object, // 椤甸潰閰嶇疆淇℃伅 shortcuts: PropTypes.any, // 鑷畾涔夎缃� - permAction: PropTypes.object, // 鎸夐挳鏉冮檺 } state = { @@ -42,7 +41,7 @@ if (config.Template === 'CommonTable' || config.Template === 'TreePage') { this.getPageConfig() - } else if (config.Template === 'CustomPage') { + } else if (config.Template === 'CustomPage' || config.Template === 'BaseTable') { this.getCustomPageConfig() } else { notification.warning({ @@ -83,8 +82,9 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') { cell.$port = cell.verify ? cell.verify.linkUrl : '' - if (cell.verify && cell.verify.printerTypeList) { + if (cell.verify && cell.verify.printerTypeList && cell.verify.printerTypeList.length > 0) { cell.verify.printerTypeList = cell.verify.printerTypeList.map(_cell => { + _cell.uuid = _cell.uuid || _cell.key _cell.parentId = cell.uuid _cell.$port = cell.$port @@ -98,7 +98,7 @@ _comp.action.push({...cell, ...(userConfig[cell.uuid] || {})}) }) - if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { + if (item.type === 'card') { item.subcards.forEach(card => { card.elements && card.elements.forEach(cell => { if (cell.eleType !== 'button') return @@ -106,8 +106,9 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') { cell.$port = cell.verify ? cell.verify.linkUrl : '' - if (cell.verify && cell.verify.printerTypeList) { + if (cell.verify && cell.verify.printerTypeList && cell.verify.printerTypeList.length > 0) { cell.verify.printerTypeList = cell.verify.printerTypeList.map(_cell => { + _cell.uuid = _cell.uuid || _cell.key _cell.parentId = cell.uuid _cell.$port = cell.$port @@ -118,7 +119,7 @@ printbtns.push(cell) } - _comp.action.push({...cell, ...(userConfig[cell.uuid] || {})}) + _comp.action.push({...cell, $line: true, ...(userConfig[cell.uuid] || {})}) }) card.backElements && card.backElements.forEach(cell => { if (cell.eleType !== 'button') return @@ -126,8 +127,9 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') { cell.$port = cell.verify ? cell.verify.linkUrl : '' - if (cell.verify && cell.verify.printerTypeList) { + if (cell.verify && cell.verify.printerTypeList && cell.verify.printerTypeList.length > 0) { cell.verify.printerTypeList = cell.verify.printerTypeList.map(_cell => { + _cell.uuid = _cell.uuid || _cell.key _cell.parentId = cell.uuid _cell.$port = cell.$port @@ -138,10 +140,10 @@ printbtns.push(cell) } - _comp.action.push({...cell, ...(userConfig[cell.uuid] || {})}) + _comp.action.push({...cell, $line: true, ...(userConfig[cell.uuid] || {})}) }) }) - } else if (item.type === 'table' && item.subtype === 'normaltable') { + } else if (item.type === 'table') { item.cols && item.cols.forEach(col => { if (col.type !== 'action') return col.elements && col.elements.forEach(cell => { @@ -149,8 +151,9 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') { cell.$port = cell.verify ? cell.verify.linkUrl : '' - if (cell.verify && cell.verify.printerTypeList) { + if (cell.verify && cell.verify.printerTypeList && cell.verify.printerTypeList.length > 0) { cell.verify.printerTypeList = cell.verify.printerTypeList.map(_cell => { + _cell.uuid = _cell.uuid || _cell.key _cell.parentId = cell.uuid _cell.$port = cell.$port @@ -161,7 +164,7 @@ printbtns.push(cell) } - _comp.action.push({...cell, ...(userConfig[cell.uuid] || {})}) + _comp.action.push({...cell, $line: true, ...(userConfig[cell.uuid] || {})}) }) }) } @@ -179,7 +182,7 @@ } getPageConfig = () => { - const { shortcuts, permAction } = this.props + const { shortcuts } = this.props let config = fromJS(this.props.config).toJS() let userConfig = {} let components = [] @@ -197,6 +200,7 @@ printbtns.push(item) if (item.verify && item.verify.printerTypeList && item.verify.printerTypeList.length > 0) { item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { + cell.uuid = cell.uuid || cell.key cell.parentId = item.uuid cell.$port = item.$port return cell @@ -252,12 +256,12 @@ if (!subconfig || !subconfig.enabled) return - subconfig = UtilsUpdate.updateSubTable(subconfig) + subconfig = updateSubTable(subconfig) let _comp = {title: res.tab.label, uuid: res.tab.uuid, action: []} subconfig.action.forEach(item => { - if (!permAction[item.uuid]) return + if (!window.GLOB.mkActions[item.uuid]) return item.$expanded = false if (item.OpenType === 'funcbutton' && item.funcType === 'print') { @@ -265,8 +269,9 @@ item.printer = _item ? (_item.printer || '') : '' item.$port = item.verify ? item.verify.linkUrl : '' - if (item.verify && item.verify.printerTypeList) { + if (item.verify && item.verify.printerTypeList && item.verify.printerTypeList.length > 0) { item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { + cell.uuid = cell.uuid || cell.key cell.parentId = item.uuid cell.$port = item.$port cell.printer = _item && _item.printerList ? (_item.printerList[cell.Value] || '') : '' @@ -323,7 +328,7 @@ let data = '' try { data = JSON.parse(event.data) - } catch { + } catch (e) { data = '' } @@ -419,7 +424,7 @@ components.forEach(com => { com.action.forEach(item => { - if (item.shortcut && item.shortcut.length > 0) { + if (item.shortcut && item.shortcut.length > 0 && !item.$line) { _LongParam.action.push({uuid: item.uuid, parentId: com.uuid, shortcut: item.shortcut, $shortcut: item.shortcut.join('+')}) } if (item.funcType === 'print' && (item.printer || item.verify.printerTypeList)) { @@ -503,7 +508,7 @@ render() { const { components, visible } = this.state - + return ( <div className="page-setting-wrap"> {options.sysType === 'local' ? <Button @@ -526,6 +531,7 @@ ]} destroyOnClose > + <div className="tip">娉細琛岀骇鎸夐挳蹇嵎閿缃棤鏁堛��</div> {components && components.length > 0 ? components.map(item => ( <div key={item.uuid}> <p className="component-title">{item.title}</p> -- Gitblit v1.8.0