From d441fa1e1cc80f4ea462a750a42a2b25c1f2b202 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 04 十二月 2020 15:17:51 +0800 Subject: [PATCH] 2020-12-04 --- src/components/tabview/index.jsx | 7 src/tabviews/treepage/index.jsx | 16 src/utils/utils-datamanage.js | 9 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 5 src/tabviews/formtab/index.jsx | 25 - src/components/header/index.jsx | 28 +- src/tabviews/zshare/topSearch/index.jsx | 3 src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 1 src/tabviews/zshare/normalTable/index.jsx | 23 - src/views/main/index.jsx | 31 -- src/tabviews/zshare/settingcomponent/index.jsx | 1 src/tabviews/calendar/index.jsx | 24 - src/tabviews/zshare/actionList/excelInbutton/index.jsx | 5 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 9 src/store/action.js | 23 -- src/tabviews/custom/tools/simpleSearch/index.jsx | 3 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 19 - src/views/billprint/index.jsx | 22 - src/tabviews/subtable/index.jsx | 40 -- src/tabviews/subtabtable/index.jsx | 39 -- src/tabviews/commontable/index.jsx | 49 +--- src/tabviews/zshare/actionList/normalbutton/index.jsx | 35 +-- src/tabviews/custom/components/card/data-card/index.jsx | 5 src/tabviews/custom/components/share/searchLine/index.jsx | 3 src/index.js | 2 src/tabviews/custom/components/card/table-card/index.jsx | 5 src/tabviews/custom/components/card/prop-card/index.jsx | 5 src/tabviews/custom/components/search/main-search/index.jsx | 3 src/tabviews/custom/components/share/tabtransfer/index.jsx | 38 -- src/store/reducer.js | 22 -- src/tabviews/custom/components/table/normal-table/index.jsx | 11 src/store/action-type.js | 9 src/tabviews/custom/components/chart/antv-pie/index.jsx | 5 src/tabviews/zshare/actionList/printbutton/index.jsx | 23 - src/tabviews/zshare/verifycard/index.jsx | 15 - src/tabviews/custom/index.jsx | 91 ++++---- 36 files changed, 197 insertions(+), 457 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 486af95..c9e352c 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -15,7 +15,6 @@ resetState, resetEditState, resetEditLevel, - modifyDataManager, initActionPermission, initMenuPermission, logout @@ -52,7 +51,8 @@ searchkey: '', thdMenuList: [], oriVersion: '', - newVersion: '' + newVersion: '', + debug: sessionStorage.getItem('debug') === 'true' } handleCollapse = () => { @@ -418,7 +418,8 @@ }) } else { sessionStorage.setItem('isEditState', 'true') - this.props.modifyDataManager(sessionStorage.getItem('cloudDataM') === 'true') + sessionStorage.setItem('role_id', sessionStorage.getItem('cloudRole_id')) + sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) if (window.GLOB.systemType === 'production') { this.props.resetEditLevel('HS') @@ -489,13 +490,16 @@ sessionStorage.setItem('CloudUserName', res.UserName) sessionStorage.setItem('CloudFullName', res.FullName) sessionStorage.setItem('CloudAvatar', res.icon) - sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '') - - sessionStorage.setItem('isEditState', 'true') - if (res.dataM) { - this.props.modifyDataManager(true) - } + sessionStorage.setItem('cloudDataM', res.dataM ? 'true' : '') + sessionStorage.setItem('localDataM', sessionStorage.setItem('dataM') || '') + + sessionStorage.setItem('cloudRole_id', res.role_id || '') + sessionStorage.setItem('localRole_id', sessionStorage.getItem('role_id') || '') + + sessionStorage.setItem('role_id', res.role_id || '') + sessionStorage.setItem('dataM', res.dataM ? 'true' : '') + sessionStorage.setItem('isEditState', 'true') if (window.GLOB.systemType === 'production') { this.props.resetEditLevel('HS') @@ -698,11 +702,11 @@ render () { const { mainMenu, collapse } = this.props - const { thdMenuList, searchkey, oriVersion, newVersion } = this.state + const { thdMenuList, searchkey, oriVersion, newVersion, debug } = this.state const menu = ( <Menu className="header-dropdown"> - {this.props.debug && <Menu.Item key="switch"> + {debug && <Menu.Item key="switch"> {this.state.dict['main.edit']} <Switch size="small" className="edit-switch" disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} /> </Menu.Item>} @@ -836,7 +840,6 @@ collapse: state.collapse, menuTree: state.menuTree, mainMenu: state.mainMenu, - debug: state.debug, editState: state.editState, editLevel: state.editLevel, permAction: state.permAction, @@ -854,7 +857,6 @@ resetEditLevel: (level) => dispatch(resetEditLevel(level)), initActionPermission: (permAction) => dispatch(initActionPermission(permAction)), initMenuPermission: (permMenus) => dispatch(initMenuPermission(permMenus)), - modifyDataManager: (dataManager) => dispatch(modifyDataManager(dataManager)), resetState: () => dispatch(resetState()), logout: () => dispatch(logout()) } diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index 7829c68..9f990a9 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -46,7 +46,8 @@ activeId: '', tabviews: null, // 鏍囩闆� iFrameHeight: 0, - dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS + dict: localStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS, + debug: sessionStorage.getItem('debug') === 'true' } handleTabview = (e, menu) => { @@ -224,7 +225,7 @@ render () { const { menuType } = this.props - const { tabviews, activeId } = this.state + const { tabviews, activeId, debug } = this.state return ( <section className={'flex-container content-box' + (this.props.collapse ? ' collapsed' : '')}> @@ -250,7 +251,7 @@ key={view.MenuID} > {this.selectcomponent(view)} - {options.sysType !== 'cloud' && menuType !== 'HS' && !['CommonTable', 'TreePage', 'ManageTable', 'CalendarPage', 'Home'].includes(view.type) ? + {debug && options.sysType !== 'cloud' && menuType !== 'HS' && !['CommonTable', 'TreePage', 'ManageTable', 'CalendarPage', 'Home'].includes(view.type) ? <Button icon="copy" shape="circle" diff --git a/src/index.js b/src/index.js index 4ca1c39..9da847a 100644 --- a/src/index.js +++ b/src/index.js @@ -53,6 +53,8 @@ } sessionStorage.removeItem('isEditState') sessionStorage.removeItem('loginError') +sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '') +sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '') fetch(`./options.json`) .then(response => response.json()) diff --git a/src/store/action-type.js b/src/store/action-type.js index a9386d6..5668a97 100644 --- a/src/store/action-type.js +++ b/src/store/action-type.js @@ -16,9 +16,6 @@ // 閫�鍑虹郴缁熸椂鍙傛暟閲嶇疆 export const RESET_STATE = 'RESET_STATE' -// 淇敼缂栬緫妯″紡 -export const RESET_DEBUG = 'RESET_DEBUG' - // 鍒锋柊tab椤甸潰 export const REFRESH_TABVIEW = 'REFRESH_TABVIEW' @@ -28,9 +25,6 @@ // 閲嶇疆缂栬緫绾у埆 export const RESET_EDITLEVEL = 'RESET_EDITLEVEL' -// 鍒濆鍖栬鑹叉潈闄� -export const INIT_ROLESPERMISSION = 'INIT_ROLESPERMISSION' - // 鍒濆鍖栨寜閽潈闄� export const INIT_ACTIONPERMISSION = 'INIT_ACTIONPERMISSION' @@ -39,9 +33,6 @@ // 淇敼浼氬憳绛夌骇 export const MODIFY_MEMBERLEVEL = 'MODIFY_MEMBERLEVEL' - -// 淇敼鏁版嵁鏉冮檺 -export const MODIFY_DATAMANAGER = 'MODIFY_DATAMANAGER' // 淇敼鑷畾涔夎彍鍗� export const MODIFY_CUSTOMMENU = 'MODIFY_CUSTOMMENU' diff --git a/src/store/action.js b/src/store/action.js index e37227b..7b0bcf7 100644 --- a/src/store/action.js +++ b/src/store/action.js @@ -47,13 +47,6 @@ } } -// 閫�鍑虹郴缁熸椂鍙傛暟閲嶇疆 -export const resetDebug = () => { - return { - type: user.RESET_DEBUG - } -} - // 閲嶇疆缂栬緫鐘舵�� export const resetEditState = (editState) => { return { @@ -67,14 +60,6 @@ return { type: user.RESET_EDITLEVEL, editLevel - } -} - -// 鍒濆鍖栨寜閽潈闄� -export const initRolesPermission = (permRoles) => { - return { - type: user.INIT_ROLESPERMISSION, - permRoles: permRoles } } @@ -99,14 +84,6 @@ return { type: user.MODIFY_MEMBERLEVEL, memberLevel: memberLevel - } -} - -// 鍒濆鏁版嵁鏉冮檺 -export const modifyDataManager = (dataManager) => { - return { - type: user.MODIFY_DATAMANAGER, - dataManager: dataManager } } diff --git a/src/store/reducer.js b/src/store/reducer.js index 1349b8f..19f9032 100644 --- a/src/store/reducer.js +++ b/src/store/reducer.js @@ -22,13 +22,10 @@ tabviews: [], // 瀵艰埅鏍� collapse: _collapse, // 鏄惁鏀惰捣渚ц竟鏍忓鑸� isiframe: false, // 鏄惁涓篿frame绐楀彛 - debug: false, // 鐭ュ惁鍙互澶嶅埗鑿滃崟鍙傛暟, 鏄惁鍙繘鍏ョ紪杈戞ā寮� editState: false, // 鏄惁涓虹紪杈戠姸鎬侊紝鍊间负false銆乼rue editLevel: null, // 缂栬緫鑿滃崟绾у埆锛屽�间负level1銆乴evel2銆乴evel3銆丠S - permRoles: [], // 鐢ㄦ埛瑙掕壊鍒楄〃 permAction: {}, // 鐢ㄦ埛鎸夐挳鏉冮檺 permMenus: [], // 鐢ㄦ埛涓夌骇鑿滃崟鍒楄〃 - dataManager: false, // 鏁版嵁绠$悊鍛� memberLevel: _level, // 浼氬憳绛夌骇 customMenu: null // 缂栬緫涓殑鑿滃崟锛堣嚜瀹氫箟椤甸潰锛� } @@ -77,12 +74,6 @@ isiframe: false } } - case Type.RESET_DEBUG: - // 鍒囨崲debug鐘舵�� - return { - ...state, - debug: true - } case Type.RESET_EDITSTATE: // 閲嶇疆缂栬緫鐘舵�� return { @@ -97,12 +88,6 @@ ...state, editState: true, editLevel: action.editLevel - } - case Type.INIT_ROLESPERMISSION: - // 鍒濆鍖栨寜閽潈闄� - return { - ...state, - permRoles: action.permRoles } case Type.INIT_ACTIONPERMISSION: // 鍒濆鍖栨寜閽潈闄� @@ -122,12 +107,6 @@ ...state, memberLevel: action.memberLevel } - case Type.MODIFY_DATAMANAGER: - // 淇敼鏁版嵁鏉冮檺 - return { - ...state, - dataManager: action.dataManager - } case Type.MODIFY_CUSTOMMENU: // 淇敼鑷畾涔夎彍鍗曚俊鎭� return { @@ -141,7 +120,6 @@ tabviews: [], collapse: localStorage.getItem('collapse') === 'true', isiframe: false, - debug: false, editState: false, editLevel: null, permAction: {}, diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx index 0689eea..4c964cd 100644 --- a/src/tabviews/calendar/index.jsx +++ b/src/tabviews/calendar/index.jsx @@ -50,7 +50,8 @@ visible: false, // 鏍囩椤垫帶鍒� triggerTime: '', // 鐐瑰嚮鏃堕棿 treevisible: false, // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒� - calendarYear: moment().format('YYYY') // 鏃ュ巻骞翠唤 + calendarYear: moment().format('YYYY'), // 鏃ュ巻骞翠唤 + debug: sessionStorage.getItem('debug') === 'true' } /** @@ -121,6 +122,7 @@ // 瀛楁鏉冮檺榛戝悕鍗曘�佸繀濉�佸瓧娈甸�忚 let valid = true + let roleId = sessionStorage.getItem('role_id') || '' config.search = config.search.map(item => { item.oriInitval = item.initval if (['text', 'select', 'link'].includes(item.type) && param) { @@ -138,12 +140,7 @@ } if (!item.blacklist || item.blacklist.length === 0) return item - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { item.Hide = 'true' } @@ -170,7 +167,7 @@ config.setting.dataresource = '(' + config.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') _customScript = _customScript.replace(/\$@/ig, '/*') @@ -244,7 +241,7 @@ param.BID = BID } // 鏁版嵁绠$悊鏉冮檺 - if (this.props.dataManager) { + if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' } @@ -584,7 +581,7 @@ render() { const { menuType } = this.props - const { BID, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state + const { debug, BID, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state return ( <div className="calendar-page" id={this.state.ContainerId}> @@ -595,12 +592,11 @@ dict={this.state.dict} searchlist={searchlist} menuType={menuType} - dataManager={this.props.dataManager} refreshdata={this.refreshbysearch} /> : null } {config && config.calendar ? <CalendarComponent calendar={config.calendar} loading={loading} data={data} triggerDate={this.triggerDate} changeDate={this.changeDate}/> : null} - {options.sysType !== 'cloud' && menuType !== 'HS' ? <Button + {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button icon="copy" shape="circle" className="common-table-copy" @@ -656,9 +652,7 @@ const mapStateToProps = (state) => { return { menuType: state.editLevel, - permAction: state.permAction, - permRoles: state.permRoles, - dataManager: state.dataManager + permAction: state.permAction } } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 8d087d5..038a092 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -68,7 +68,8 @@ tabActive: null, // 鏍囩椤靛睍寮�鎺у埗 chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 - statFValue: [] // 鍚堣鍊� + statFValue: [], // 鍚堣鍊� + debug: sessionStorage.getItem('debug') === 'true' } /** @@ -138,20 +139,12 @@ // 鍘婚櫎绌鸿鏍囩 config.tabgroups = config.tabgroups.filter(group => group.sublist.length > 0) + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID // 瑙嗗浘鏉冮檺 config.charts = config.charts.filter(item => { if (item.Hide === 'true') return false if (!item.blacklist || item.blacklist.length === 0) return true - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0 || item.Hide === 'true') { - return false - } else { - return true - } + return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 }) if (config.charts.length <= 1) { @@ -173,12 +166,7 @@ } if (!item.blacklist || item.blacklist.length === 0) return item - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { item.Hide = 'true' } @@ -186,13 +174,8 @@ }) config.columns = config.columns.map(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return col - - let _black = col.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (!col.field || !col.blacklist || col.blacklist.length === 0) return col + if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { col.Hide = 'true' } @@ -228,7 +211,7 @@ config.setting.dataresource = '(' + config.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') @@ -512,7 +495,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.MenuName || '' @@ -552,7 +535,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.MenuName || '' @@ -608,7 +591,7 @@ } let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.MenuName || '' @@ -930,7 +913,7 @@ render() { const { menuType, MenuName } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state + const { debug, BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state return ( <div className="commontable" id={this.state.ContainerId}> @@ -941,7 +924,6 @@ dict={this.state.dict} searchlist={searchlist} menuType={this.props.menuType} - dataManager={this.props.dataManager} refreshdata={this.refreshbysearch} /> : null } @@ -982,7 +964,6 @@ dict={this.state.dict} MenuID={this.props.MenuID} permAction={this.props.permAction} - permRoles={this.props.permRoles} userConfig={this.state.userConfig} reloadview={this.reloadview} /> : null} @@ -1079,7 +1060,7 @@ </Tabs>) ) } - {options.sysType !== 'cloud' && menuType !== 'HS' ? <Button + {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button icon="copy" shape="circle" className="common-table-copy" @@ -1116,9 +1097,7 @@ menuType: state.editLevel, tabviews: state.tabviews, permAction: state.permAction, - permMenus: state.permMenus, - permRoles: state.permRoles, - dataManager: state.dataManager + permMenus: state.permMenus } } diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index a3c9629..bc013cb 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -20,7 +20,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { @@ -128,7 +127,7 @@ } async loadData () { - const { mainSearch, BID, menuType, dataManager } = this.props + const { mainSearch, BID, menuType } = this.props const { config, arr_field, pageIndex } = this.state let searches = [] @@ -146,7 +145,7 @@ }) let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID, menuType, dataManager) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID, menuType) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 1a31450..92e6324 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -18,7 +18,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { @@ -136,7 +135,7 @@ } async loadData () { - const { mainSearch, BID, menuType, dataManager } = this.props + const { mainSearch, BID, menuType } = this.props const { config, arr_field } = this.state let searches = [] @@ -162,7 +161,7 @@ } let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID, menuType, dataManager) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID, menuType) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 6459618..2aeeb1c 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -18,7 +18,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { @@ -141,7 +140,7 @@ } async loadData () { - const { mainSearch, BID, menuType, dataManager } = this.props + const { mainSearch, BID, menuType } = this.props const { config, arr_field, pageIndex } = this.state let searches = [] @@ -159,7 +158,7 @@ }) let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID, menuType, dataManager) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID, menuType) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index dfce38e..5cd4c24 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -25,7 +25,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { @@ -263,7 +262,7 @@ } async loadData () { - const { mainSearch, BID, menuType, dataManager } = this.props + const { mainSearch, BID, menuType } = this.props const { config, arr_field, search } = this.state let searches = fromJS(search).toJS() @@ -281,7 +280,7 @@ }) let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType, dataManager) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 0e4995f..910d172 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -21,7 +21,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { @@ -137,7 +136,7 @@ } async loadData () { - const { mainSearch, menuType, dataManager } = this.props + const { mainSearch, menuType } = this.props const { config, arr_field, search, BID } = this.state let searches = fromJS(search).toJS() @@ -155,7 +154,7 @@ }) let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType, dataManager) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/search/main-search/index.jsx b/src/tabviews/custom/components/search/main-search/index.jsx index e6ab5e5..d25824b 100644 --- a/src/tabviews/custom/components/search/main-search/index.jsx +++ b/src/tabviews/custom/components/search/main-search/index.jsx @@ -20,7 +20,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 refreshdata: PropTypes.func // 鍒锋柊鏁版嵁 } @@ -71,7 +70,7 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { diff --git a/src/tabviews/custom/components/share/searchLine/index.jsx b/src/tabviews/custom/components/share/searchLine/index.jsx index 6b1fad8..03c31e6 100644 --- a/src/tabviews/custom/components/share/searchLine/index.jsx +++ b/src/tabviews/custom/components/share/searchLine/index.jsx @@ -15,7 +15,6 @@ class MainSearch extends Component { static propTpyes = { BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 menuType: PropTypes.any, // 鑿滃崟鏉冮檺锛屾槸鍚︿负HS searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 dict: PropTypes.object // 瀛楀吀椤� @@ -67,7 +66,7 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index 0938b83..3d5ce41 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -27,7 +27,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 鍏ㄥ眬鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { @@ -45,22 +44,6 @@ config.components.forEach(component => { if (component.type === 'search') { self = true - component.search = component.search.map(item => { - item.oriInitval = item.initval - - if (!item.blacklist || item.blacklist.length === 0) return item - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { - item.Hide = 'true' - } - - return item - }) - _mainSearch = Utils.initMainSearch(component.search) } }) @@ -250,7 +233,7 @@ } getComponents = () => { - const { menuType, dataManager, BID, config } = this.props + const { menuType, BID, config } = this.props const { mainSearch, data } = this.state if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) @@ -259,43 +242,43 @@ if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} key={item.uuid}> - <AntvBarAndLine data={data} config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <AntvBarAndLine data={data} config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} key={item.uuid}> - <AntvPie data={data} config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <AntvPie data={data} config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'search') { return ( <Col span={item.width} key={item.uuid}> - <MainSearch config={item} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> + <MainSearch config={item} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} /> </Col> ) } else if (item.type === 'tabs') { return ( <Col span={item.width} key={item.uuid}> - <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <AntvTabs config={item} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'table' && item.subtype === 'tablecard') { return ( <Col span={item.width} key={item.uuid}> - <TableCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <TableCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else { @@ -313,10 +296,7 @@ const mapStateToProps = (state) => { return { - menuType: state.editLevel, - permAction: state.permAction, - permRoles: state.permRoles, - dataManager: state.dataManager + menuType: state.editLevel } } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 28544c6..e073a75 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -142,7 +142,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.MenuName || '' @@ -182,7 +182,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.MenuName || '' @@ -238,7 +238,7 @@ } let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.MenuName || '' @@ -468,7 +468,6 @@ dict={this.state.dict} searchlist={searchlist} menuType={this.props.menuType} - dataManager={this.props.dataManager} refreshdata={this.refreshbysearch} /> : null } @@ -522,9 +521,7 @@ menuType: state.editLevel, tabviews: state.tabviews, permAction: state.permAction, - permMenus: state.permMenus, - permRoles: state.permRoles, - dataManager: state.dataManager + permMenus: state.permMenus } } diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index ec047e3..b6f55f1 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -16,7 +16,6 @@ config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 menuType: PropTypes.any, // 鑿滃崟绫诲瀷 - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 } state = { diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 54586f4..74a4302 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -48,6 +48,7 @@ loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� treevisible: false, // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒� + debug: sessionStorage.getItem('debug') === 'true' } /** @@ -111,10 +112,11 @@ } // 鏉冮檺杩囨护 + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID if (this.props.menuType !== 'HS') { - config.components = this.filterComponent(config.components) + config.components = this.filterComponent(config.components, roleId) } - + // 鑾峰彇涓绘悳绱㈡潯浠� let mainSearch = [] config.components.forEach(component => { @@ -130,16 +132,6 @@ } else if (param.data && param.data[item.field]) { item.initval = param.data[item.field] } - } - - if (!item.blacklist || item.blacklist.length === 0) return item - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { - item.Hide = 'true' } return item @@ -189,19 +181,18 @@ } } - filterComponent = (components) => { + filterComponent = (components, roleId) => { return components.filter(item => { if (item.type === 'tabs') { - if (item.setting.blacklist && item.setting.blacklist.length > 0) { - let _black = item.setting.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) return false + if ( + item.setting.blacklist && item.setting.blacklist.length > 0 && + item.setting.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0 + ) { + return false } item.subtabs = item.subtabs.map(tab => { - tab.components = this.filterComponent(tab.components) + tab.components = this.filterComponent(tab.components, roleId) return tab }) @@ -217,21 +208,31 @@ }) item.parentIds = supIds } else if (item.type === 'pie' || item.type === 'bar' || item.type === 'line') { - if (item.plot.blacklist && item.plot.blacklist.length > 0) { - let _black = item.plot.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) return false + if ( + item.plot.blacklist && item.plot.blacklist.length > 0 && + item.plot.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0 + ) { + return false } } else { - if (item.wrap.blacklist && item.wrap.blacklist.length > 0) { - let _black = item.wrap.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) return false + if ( + item.wrap.blacklist && item.wrap.blacklist.length > 0 && + item.wrap.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0 + ) { + return false } + } + if (item.search && item.search.length > 0) { + item.search = item.search.map(cell => { + cell.oriInitval = cell.initval + + if (!cell.blacklist || cell.blacklist.length === 0) return cell + if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + cell.Hide = 'true' + } + + return item + }) } return true }) @@ -282,7 +283,7 @@ component.setting.dataresource = '(' + component.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*') component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') _customScript = _customScript.replace(/\$@/ig, '/*') @@ -528,7 +529,7 @@ } getComponents = () => { - const { menuType, dataManager } = this.props + const { menuType } = this.props const { config, BID, data, mainSearch } = this.state if (!config || !config.components) return @@ -537,19 +538,19 @@ if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} key={item.uuid}> - <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} key={item.uuid}> - <AntvPie config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <AntvPie config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'search') { return ( <Col span={item.width} key={item.uuid}> - <MainSearch config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} refreshdata={this.resetSearch} /> + <MainSearch config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} /> </Col> ) } else if (item.type === 'tabs') { @@ -561,25 +562,25 @@ } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <DataCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <PropCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'table' && item.subtype === 'tablecard') { return ( <Col span={item.width} key={item.uuid}> - <TableCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <TableCard config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else if (item.type === 'table' && item.subtype === 'normaltable') { return ( <Col span={item.width} key={item.uuid}> - <NormalTable config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} /> + <NormalTable config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} /> </Col> ) } else { @@ -590,13 +591,13 @@ render() { const { menuType, MenuNo } = this.props - const { loadingview, viewlost, config, loading } = this.state + const { debug, loadingview, viewlost, config, loading } = this.state return ( <div className="custom-page-wrap" id={this.state.ContainerId} style={config ? config.style : null}> {(loadingview || loading) ? <Spin size="large" /> : null} <Row>{this.getComponents()}</Row> - {MenuNo && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button + {debug && MenuNo && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button icon="copy" shape="circle" className="common-table-copy" @@ -612,9 +613,7 @@ return { menuType: state.editLevel, refreshTab: state.refreshTab, - permAction: state.permAction, - permRoles: state.permRoles, - dataManager: state.dataManager + permAction: state.permAction } } diff --git a/src/tabviews/custom/tools/simpleSearch/index.jsx b/src/tabviews/custom/tools/simpleSearch/index.jsx index 6b1fad8..03c31e6 100644 --- a/src/tabviews/custom/tools/simpleSearch/index.jsx +++ b/src/tabviews/custom/tools/simpleSearch/index.jsx @@ -15,7 +15,6 @@ class MainSearch extends Component { static propTpyes = { BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 menuType: PropTypes.any, // 鑿滃崟鏉冮檺锛屾槸鍚︿负HS searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 dict: PropTypes.object // 瀛楀吀椤� @@ -67,7 +66,7 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index 89ab064..3c78b98 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -120,24 +120,15 @@ }) let _arrField = [config.setting.primaryKey] // 瀛楁闆� , 榛樿娣诲姞涓婚敭 + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID config.groups.forEach(group => { group.sublist = group.sublist.filter(item => { + item.field && _arrField.push(item.field) if (!item.blacklist || item.blacklist.length === 0) { - _arrField.push(item.field) return true } - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { - return false - } else { - _arrField.push(item.field) - return true - } + return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 }) }) _arrField = _arrField.join(',') @@ -207,7 +198,7 @@ arr_field: _option.field } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -334,7 +325,7 @@ if (!param) return // 鏈幏鍙栧弬鏁版椂锛屼笉鍙戣姹� // 鏁版嵁绠$悊鏉冮檺 - if (this.props.dataManager) { + if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' } @@ -424,7 +415,7 @@ _dataresource = '(' + _dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _dataresource = _dataresource.replace(/\$@/ig, '/*') _dataresource = _dataresource.replace(/@\$/ig, '*/') // param.custom_script = param.custom_script.replace(/\$@/ig, '/*') @@ -709,9 +700,7 @@ return { menuType: state.editLevel, tabviews: state.tabviews, - permAction: state.permAction, - dataManager: state.dataManager, - permRoles: state.permRoles + permAction: state.permAction } } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 08fb464..589ed45 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -144,30 +144,20 @@ config.action = config.action.filter(item => permAction[item.uuid]) } + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID // 瀛楁鏉冮檺榛戝悕鍗� config.search = config.search.map(item => { item.oriInitval = item.initval if (!item.blacklist || item.blacklist.length === 0) return item - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { item.Hide = 'true' } - return item }) config.columns = config.columns.map(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return col - - let _black = col.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (!col.blacklist || col.blacklist.length === 0) return col + if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { col.Hide = 'true' } @@ -178,16 +168,7 @@ config.charts = config.charts.filter(item => { if (item.Hide === 'true') return false if (!item.blacklist || item.blacklist.length === 0) return true - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0 || item.Hide === 'true') { - return false - } else { - return true - } + return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 }) if (config.charts.length <= 1) { @@ -339,7 +320,7 @@ config.setting.dataresource = '(' + config.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') @@ -428,7 +409,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType) this.handleTableId() @@ -477,7 +458,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id) + let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.Tab.label || '' @@ -551,7 +532,7 @@ } let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.Tab.label || '' @@ -770,7 +751,6 @@ dict={this.state.dict} searchlist={searchlist} menuType={this.props.menuType} - dataManager={this.props.dataManager} refreshdata={this.refreshbysearch} /> : null } @@ -883,9 +863,7 @@ tabviews: state.tabviews, menuType: state.editLevel, permAction: state.permAction, - permRoles: state.permRoles, permMenus: state.permMenus, - dataManager: state.dataManager, } } diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index f25fe28..483d8b9 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -148,30 +148,21 @@ config.action = config.action.filter(item => permAction[item.uuid]) } + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID // 瀛楁鏉冮檺榛戝悕鍗� config.search = config.search.filter(item => { item.oriInitval = item.initval if (!item.blacklist || item.blacklist.length === 0) return item - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { item.Hide = 'true' } return item }) - config.columns = config.columns.filter(col => { - if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return col - - let _black = col.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + config.columns = config.columns.map(col => { + if (!col.blacklist || col.blacklist.length === 0) return col + if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { col.Hide = 'true' } @@ -182,16 +173,7 @@ config.charts = config.charts.filter(item => { if (item.Hide === 'true') return false if (!item.blacklist || item.blacklist.length === 0) return true - - let _black = item.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0 || item.Hide === 'true') { - return false - } else { - return true - } + return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 }) if (config.charts.length <= 1) { @@ -294,7 +276,7 @@ config.setting.dataresource = '(' + config.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') @@ -368,7 +350,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.Tab.label || '' @@ -416,7 +398,7 @@ } let _orderBy = orderBy || setting.order - let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType) if (param.func === 'sPC_Get_TableData') { param.menuname = this.props.Tab.label || '' @@ -587,7 +569,6 @@ dict={this.state.dict} searchlist={searchlist} menuType={this.props.menuType} - dataManager={this.props.dataManager} refreshdata={this.refreshbysearch} /> : null } @@ -686,8 +667,6 @@ return { menuType: state.editLevel, permAction: state.permAction, - permRoles: state.permRoles, - dataManager: state.dataManager, memberLevel: state.memberLevel } } diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx index 579c736..ac11c48 100644 --- a/src/tabviews/treepage/index.jsx +++ b/src/tabviews/treepage/index.jsx @@ -54,7 +54,8 @@ settingVisible: false,// 鑷畾涔夎缃ā鎬佹 tabActive: null, // 鏍囩椤靛睍寮�鎺у埗 expandedKeys: [], // 灞曞紑鐨勬爲鑺傜偣 - selectedKeys: [] // 閫変腑鐨勬爲鑺傜偣 + selectedKeys: [], // 閫変腑鐨勬爲鑺傜偣 + debug: sessionStorage.getItem('debug') === 'true' } /** @@ -169,7 +170,7 @@ config.setting.dataresource = '(' + config.setting.dataresource + ') tb' } - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*') config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/') config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') @@ -277,7 +278,7 @@ }) let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}` - let param = UtilsDM.getQueryDataParams(setting, arr_field, [], setting.order, '', '', BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, [], setting.order, '', '', BID, this.props.menuType) let result = await Api.genericInterface(param) if (result.status) { @@ -729,7 +730,7 @@ render() { const { menuType } = this.props - const { setting, loadingview, viewlost, config, userConfig, tabActive, tabgroups, treeNodes, treedata, expandedKeys, selectedKeys } = this.state + const { debug, setting, loadingview, viewlost, config, userConfig, tabActive, tabgroups, treeNodes, treedata, expandedKeys, selectedKeys } = this.state return ( <div className="tree-page" id={this.state.ContainerId}> @@ -794,7 +795,7 @@ )} </Col> </Row> : null} - {options.sysType !== 'cloud' && menuType !== 'HS' ? <Button + {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button icon="copy" shape="circle" className="tree-page-copy" @@ -840,7 +841,6 @@ MenuID={this.props.MenuID} MenuName={this.props.MenuName} permAction={this.props.permAction} - permRoles={this.props.permRoles} config={this.state.config} userConfig={this.state.userConfig} columns={[]} @@ -858,9 +858,7 @@ return { menuType: state.editLevel, permAction: state.permAction, - permRoles: state.permRoles, - memberLevel: state.memberLevel, - dataManager: state.dataManager + memberLevel: state.memberLevel } } diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 1d59ff2..a1e7dd3 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -256,7 +256,7 @@ if (btn.intertype === 'system') { // 绯荤粺瀛樺偍杩囩▼ param.func = 'sPC_TableData_InUpDe' - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 result.sql = result.sql.replace(/\$@/ig, '/*') result.sql = result.sql.replace(/@\$/ig, '*/') result.bottom = result.bottom.replace(/\$@/ig, '/*') @@ -422,8 +422,7 @@ const mapStateToProps = (state) => { return { - menuType: state.editLevel, - dataManager: state.dataManager + menuType: state.editLevel } } diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 3a85b94..d2047ca 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -445,7 +445,7 @@ const { search } = this.state let script = btn.verify.script - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 script = script.replace(/\$@/ig, '/*') script = script.replace(/@\$/ig, '*/') } else { @@ -509,7 +509,7 @@ } // 鏁版嵁绠$悊鏉冮檺 - if (this.props.dataManager) { + if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' } @@ -545,7 +545,7 @@ } // 鏁版嵁绠$悊鏉冮檺 - if (this.props.dataManager) { + if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' } @@ -745,8 +745,7 @@ const mapStateToProps = (state) => { return { - menuType: state.editLevel, - dataManager: state.dataManager + menuType: state.editLevel } } diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 764f1b7..685d8c9 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import { Button, notification, Modal } from 'antd' @@ -48,7 +47,7 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId) => { - const { setting, btn, selectedData, dataManager } = this.props + const { setting, btn, selectedData } = this.props const _this = this if (triggerId && btn.uuid !== triggerId) return @@ -95,11 +94,11 @@ if (btn.Ot === 'required' && data && data.length > 0) { data.forEach((item, i) => { let _id = item[setting.primaryKey] || '' - let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, dataManager: dataManager }))) + let url = '#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: _id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') }))) window.open(url) }) } else { - window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, dataManager: dataManager })))) + window.open('#/billprint/' + window.btoa(window.encodeURIComponent(JSON.stringify({ id: Id, tempId: btn.printTemp, dataM: sessionStorage.getItem('dataM') })))) } } else if (btn.pageTemplate === 'billprintTemp') { let src = '#/menudesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'billPrint', MenuId: Id, MenuNo: MenuNo, MenuName: name || '鎵撳嵃', Remark: Remark }))) @@ -170,14 +169,4 @@ } } -const mapStateToProps = (state) => { - return { - dataManager: state.dataManager - } -} - -const mapDispatchToProps = () => { - return {} -} - -export default connect(mapStateToProps, mapDispatchToProps)(NewPageButton) \ No newline at end of file +export default NewPageButton \ No newline at end of file diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 6a8abe7..8c3d428 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -226,7 +226,7 @@ param.ID = primaryId param.LText = Utils.getSysDefaultSql(btn, setting, '', param, data[0], columns, this.props.Tab) // 鏁版嵁婧� - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -267,7 +267,7 @@ param.ID = primaryId || Utils.getguid() param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab) // 鏁版嵁婧� - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -286,7 +286,7 @@ param.ID = primaryId param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab) // 鏁版嵁婧� - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -358,7 +358,7 @@ param.ID = primaryId param.LText = Utils.getSysDefaultSql(btn, setting, '', param, cell, columns, this.props.Tab) // 鏁版嵁婧� - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -397,7 +397,7 @@ param.ID = _formPrimaryId || Utils.getguid() param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab) // 鏁版嵁婧� - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -416,7 +416,7 @@ param.ID = primaryId param.LText = Utils.getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab) // 鏁版嵁婧� - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 param.LText = param.LText.replace(/\$@/ig, '/*') param.LText = param.LText.replace(/@\$/ig, '*/') } else { @@ -950,6 +950,7 @@ }) this.updateStatus('over') } else { + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID if (_LongParam.groups.length > 0) { _LongParam.groups.forEach(group => { group.sublist = group.sublist.map(cell => { @@ -957,7 +958,7 @@ if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { @@ -975,12 +976,7 @@ // 瀛楁鏉冮檺榛戝悕鍗� if (!cell.blacklist || cell.blacklist.length === 0) return cell - - let _black = cell.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { cell.hidden = 'true' } @@ -993,7 +989,7 @@ if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { @@ -1007,12 +1003,7 @@ // 瀛楁鏉冮檺榛戝悕鍗� if (!cell.blacklist || cell.blacklist.length === 0) return cell - - let _black = cell.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { cell.hidden = 'true' } @@ -1222,9 +1213,7 @@ const mapStateToProps = (state) => { return { tabviews: state.tabviews, - menuType: state.editLevel, - permRoles: state.permRoles, - dataManager: state.dataManager + menuType: state.editLevel } } diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 8570727..fbaec64 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -1052,6 +1052,7 @@ }) this.updateStatus('over') } else { + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID if (_LongParam.groups.length > 0) { _LongParam.groups.forEach(group => { group.sublist = group.sublist.map(cell => { @@ -1059,7 +1060,7 @@ if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { @@ -1077,12 +1078,7 @@ // 瀛楁鏉冮檺榛戝悕鍗� if (!cell.blacklist || cell.blacklist.length === 0) return cell - - let _black = cell.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { cell.hidden = 'true' } @@ -1095,7 +1091,7 @@ if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { @@ -1109,12 +1105,7 @@ // 瀛楁鏉冮檺榛戝悕鍗� if (!cell.blacklist || cell.blacklist.length === 0) return cell - - let _black = cell.blacklist.filter(v => { - return this.props.permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { + if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { cell.hidden = 'true' } @@ -1302,9 +1293,7 @@ const mapStateToProps = (state) => { return { tabviews: state.tabviews, - menuType: state.editLevel, - permRoles: state.permRoles, - dataManager: state.dataManager + menuType: state.editLevel } } diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index e606eb0..640c6ff 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -1,9 +1,9 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import md5 from 'md5' +import { connect } from 'react-redux' import { is, fromJS } from 'immutable' -import {connect} from 'react-redux' -import { Table, message, Affix, Typography, Modal, Icon } from 'antd' +import { Table, Affix, Typography, Modal, Icon } from 'antd' import Utils from '@/utils/utils.js' import { modifyTabview } from '@/store/action' @@ -20,10 +20,6 @@ const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton')) class NormalTable extends Component { - static defaultProps = { - total: 0 - } - static propTpyes = { tableId: PropTypes.string, // 鍒楄〃Id statFValue: PropTypes.any, // 鍚堣瀛楁鏁版嵁 @@ -863,19 +859,6 @@ } } - copycontent = (e, content) => { - // 琛ㄦ牸涓唴瀹瑰鍒� - e.stopPropagation() - let oInput = document.createElement('input') - oInput.value = content - document.body.appendChild(oInput) - oInput.select() - document.execCommand('Copy') - oInput.className = 'oInput' - oInput.style.display='none' - message.success(this.props.dict['main.copy.success']) - } - /** * */ @@ -1050,7 +1033,7 @@ pageSize: this.state.pageSize, pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], showSizeChanger: true, - total: this.props.total, + total: this.props.total || 0, showTotal: (total, range) => `${range[0]}-${range[1]} ${this.props.dict['main.pagination.of']} ${total} ${this.props.dict['main.pagination.items']}` } } diff --git a/src/tabviews/zshare/settingcomponent/index.jsx b/src/tabviews/zshare/settingcomponent/index.jsx index cc01bcb..a16f49a 100644 --- a/src/tabviews/zshare/settingcomponent/index.jsx +++ b/src/tabviews/zshare/settingcomponent/index.jsx @@ -146,7 +146,6 @@ MenuID={this.props.MenuID} MenuName={this.props.MenuName} permAction={this.props.permAction} - permRoles={this.props.permRoles} config={this.props.config} userConfig={this.props.userConfig} columns={this.props.columns} diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index e1a4d13..6d848f9 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -15,7 +15,6 @@ class MainSearch extends Component { static propTpyes = { BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - dataManager: PropTypes.any, // 鏁版嵁鏉冮檺 menuType: PropTypes.any, // 鑿滃崟鏉冮檺锛屾槸鍚︿负HS searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 dict: PropTypes.object // 瀛楀吀椤� @@ -67,7 +66,7 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) - if (this.props.dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 _option.sql = _option.sql.replace(/\$@/ig, '/*') _option.sql = _option.sql.replace(/@\$/ig, '*/') } else { diff --git a/src/tabviews/zshare/verifycard/index.jsx b/src/tabviews/zshare/verifycard/index.jsx index 7fcbeee..dff26d2 100644 --- a/src/tabviews/zshare/verifycard/index.jsx +++ b/src/tabviews/zshare/verifycard/index.jsx @@ -14,7 +14,6 @@ MenuID: PropTypes.string, MenuName: PropTypes.string, permAction: PropTypes.object, - permRoles: PropTypes.array, userConfig: PropTypes.object, columns: PropTypes.array, config: PropTypes.object, // 椤甸潰閰嶇疆 @@ -28,7 +27,7 @@ } UNSAFE_componentWillMount () { - const { MenuID, MenuName, permAction, permRoles, config, userConfig, columns } = this.props + const { MenuID, MenuName, permAction, config, userConfig, columns } = this.props let menuParam = [] this.setState({ @@ -98,6 +97,7 @@ return } + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID result.forEach(res => { if (!res.LongParam) return @@ -122,16 +122,7 @@ subconfig.columns = subconfig.columns.filter(col => { if (!col.field || !col.blacklist || col.blacklist.length === 0) return true - - let _black = col.blacklist.filter(v => { - return permRoles.indexOf(v) !== -1 - }) - - if (_black.length > 0) { - return false - } else { - return true - } + return col.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 }) if (subUserConfig) { diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 0022c68..e3322cb 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -13,10 +13,9 @@ * @param {Number} pageSize 姣忛〉鏁伴噺 * @param {String} BID 涓婄骇ID * @param {String} menuType 鑿滃崟绫诲瀷锛屾櫘閫氳彍鍗曚笌HS - * @param {Boolean} dataManager 鏁版嵁鏉冮檺 * @return {Object} param */ - static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, dataManager, id) { + static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, id) { let param = null if (setting.interType === 'system' || (setting.interType === 'inner' && !setting.innerFunc)) { @@ -29,7 +28,7 @@ param.BID = BID } // 鏁版嵁绠$悊鏉冮檺 - if (dataManager) { + if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' } @@ -205,7 +204,7 @@ /** * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鍚堣鍊肩殑鍙傛暟 */ - static getStatQueryDataParams (setting, statFields, search, orderBy, BID, menuType, dataManager) { + static getStatQueryDataParams (setting, statFields, search, orderBy, BID, menuType) { let param = { func: 'sPC_Get_TableData', obj_name: 'data', @@ -305,7 +304,7 @@ } // 鏁版嵁绠$悊鏉冮檺 - if (dataManager) { + if (sessionStorage.getItem('dataM') === 'true') { param.dataM = 'Y' } diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 90cf3f7..2c5686e 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -24,7 +24,6 @@ state = { dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, loadingview: true, - dataManager: false, pages: null, BID: '', data: '', @@ -35,10 +34,11 @@ UNSAFE_componentWillMount() { try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + + sessionStorage.setItem('dataM', param.dataM || '') this.setState({ BID: param.id || '', - tempId: param.tempId, - dataManager: param.dataManager + tempId: param.tempId }, () => { this.getMenuParam() }) @@ -65,7 +65,7 @@ } getMenuParam = () => { - const { tempId, BID, dataManager } = this.state + const { tempId, BID } = this.state let _param = { func: 'sPC_Get_LongParam', @@ -178,7 +178,7 @@ component.setting.dataresource = '(' + component.setting.dataresource + ') tb' } - if (dataManager) { // 鏁版嵁鏉冮檺 + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*') component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') _customScript = _customScript.replace(/\$@/ig, '/*') @@ -198,7 +198,7 @@ _pars.push(param) } else { let arr_field = component.columns.map(col => col.field).join(',') - let param = UtilsDM.getQueryDataParams(component.setting, arr_field, [], component.setting.order || '', 1, 1000, BID, '', dataManager) + let param = UtilsDM.getQueryDataParams(component.setting, arr_field, [], component.setting.order || '', 1, 1000, BID, '') param.componentId = component.uuid @@ -511,31 +511,29 @@ } getComponents = (components) => { - const { dataManager } = this.state - return components.map(item => { if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} key={item.uuid}> - <AntvBarAndLine config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} /> + <AntvBarAndLine config={item} initdata={item.data} mainSearch={[]} menuType="" /> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} key={item.uuid}> - <AntvPie config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} /> + <AntvPie config={item} initdata={item.data} mainSearch={[]} menuType="" /> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <DataCard config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} /> + <DataCard config={item} initdata={item.data} mainSearch={[]} menuType="" /> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <PropCard config={item} initdata={item.data} mainSearch={[]} menuType="" dataManager={dataManager} /> + <PropCard config={item} initdata={item.data} mainSearch={[]} menuType="" /> </Col> ) } else { diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx index 2e3af47..dba8295 100644 --- a/src/views/main/index.jsx +++ b/src/views/main/index.jsx @@ -1,33 +1,16 @@ import React, {Component} from 'react' import { ConfigProvider } from 'antd' -import { connect } from 'react-redux' import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' import Header from '@/components/header' import Sidemenu from '@/components/sidemenu' import Tabview from '@/components/tabview' -import { resetDebug, modifyDataManager, initRolesPermission } from '@/store/action' import './index.scss' const _locale = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS class Main extends Component { - UNSAFE_componentWillMount() { - if (sessionStorage.getItem('dataM') === 'true') { - this.props.modifyDataManager(true) - } - if (sessionStorage.getItem('debug') === 'true') { - this.props.resetDebug() - } - if (sessionStorage.getItem('role_id')) { - let roles = sessionStorage.getItem('role_id') - roles = roles.split(',') - - this.props.initRolesPermission(roles) - } - } - render () { return ( <div className="flex-container"> @@ -41,16 +24,4 @@ } } -const mapStateToProps = () => { - return {} -} - -const mapDispatchToProps = (dispatch) => { - return { - resetDebug: () => dispatch(resetDebug()), - initRolesPermission: (roles) => dispatch(initRolesPermission(roles)), - modifyDataManager: (dataManager) => dispatch(modifyDataManager(dataManager)) - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(Main) \ No newline at end of file +export default Main \ No newline at end of file -- Gitblit v1.8.0