From c9967063fa42e15d9f695220c76641cfa28669f2 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 05 九月 2023 14:23:13 +0800 Subject: [PATCH] 2023-09-05 --- src/components/tabview/index.scss | 2 src/tabviews/zshare/tablenodes/index.jsx | 11 src/tabviews/zshare/automatic/index.scss | 14 - src/tabviews/basetable/index.scss | 20 + src/tabviews/zshare/settingcomponent/index.scss | 25 - src/tabviews/zshare/flowFloat/index.jsx | 225 +++++++++++++++++ src/tabviews/zshare/settingcomponent/index.jsx | 23 src/tabviews/zshare/automatic/index.jsx | 11 src/tabviews/custom/popview/index.jsx | 10 /dev/null | 35 -- src/tabviews/commontable/index.scss | 11 src/tabviews/custom/components/chart/antv-X6/index.jsx | 58 +++ src/tabviews/basetable/index.jsx | 90 +++++- src/tabviews/custom/components/module/voucher/voucherTable/index.jsx | 15 + src/api/index.js | 2 src/tabviews/custom/index.jsx | 97 ++++++ src/tabviews/custom/index.scss | 17 + src/tabviews/zshare/flowFloat/index.scss | 80 ++++++ src/tabviews/commontable/index.jsx | 2 src/tabviews/zshare/tablenodes/index.scss | 11 20 files changed, 610 insertions(+), 149 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 6440faf..3dbc996 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -876,7 +876,7 @@ let time = +sessionStorage.getItem(rduri) let c_time = Math.round(new Date().getTime() / 1000) - if (time && c_time - time <= 60) { + if (time && c_time - time <= 1800) { sessionStorage.setItem(rduri, c_time) return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 5b85043..040e6bf 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -67,7 +67,7 @@ >.ant-tabs-content { height: 100%; .ant-tabs-tabpane:first-child { - .page-setting-wrap, .page-message-wrap { + .user-tools { display: none; } } diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 4f0028e..b34b0fc 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -13,6 +13,7 @@ // 閫氱敤缁勪欢 const AntvTabs = asyncComponent(() => import('@/tabviews/custom/components/tabs/antv-tabs')) const MkBaseTable = asyncComponent(() => import('@/tabviews/custom/components/table/base-table')) +const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat')) const SettingComponent = asyncComponent(() => import('@/tabviews/zshare/settingcomponent')) const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes')) const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) @@ -35,7 +36,6 @@ lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� shortcuts: null, // 蹇嵎閿� autoMatic: null @@ -102,6 +102,48 @@ return } + if (config.process === 'true') { + let unset = true + if (result.works_flow_code && result.works_long_param) { + try { // 娴佺▼淇℃伅瑙f瀽 + let flowConfig = JSON.parse(window.decodeURIComponent(window.atob(result.works_long_param))) + flowConfig.flow_code = result.works_flow_code + flowConfig.flow_name = result.works_flow_name + config.flow_code = result.works_flow_code + config.flow_name = result.works_flow_name + unset = false + + window.GLOB.UserCacheMap.set('flow' + MenuID, flowConfig) + } catch (e) { + unset = true + console.warn('Parse Failure') + } + } + + if (unset) { + this.setState({ + config: config, + viewlost: true, + loadingview: false, + lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭璁剧疆宸ヤ綔娴侊紝璇疯仈绯荤鐞嗗憳銆�' + }) + return + } + } else if (result.works_flow_code) { + Api.getSystemConfig({ + func: 's_works_flow_param_sso_menu_upt_v6', + upt_type: 'del', + works_flow_code: '', + works_flow_name: '', + long_param: '', + flow_id: '', + menuid: config.MenuID, + menuname: config.MenuName, + username: sessionStorage.getItem('User_Name') || '', + fullName: sessionStorage.getItem('Full_Name') || '' + }) + } + // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 if (result.LongParamUser && !window.GLOB.mkHS) { try { // 閰嶇疆淇℃伅瑙f瀽 @@ -148,7 +190,7 @@ }) } - config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName) + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName, config.process === 'true') let autoMatic = null if (config.autoMatic && config.autoMatic.enable === 'true') { @@ -263,10 +305,15 @@ } } - filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName) => { + filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName, process) => { return components.filter(item => { item.$pageId = pageId item.$searchId = pageId + + if (process) { + item.$process = process + item.$flowId = 'flow' + this.props.MenuID + } item.$menuname = (MenuName || '') + '-' + (item.name || '涓昏〃') @@ -287,7 +334,7 @@ if (tab.permission !== 'true') { // 鏉冮檺鏈紑鍚笉鍋氭潈闄愭帶鍒� skip = true } - tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName) + tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName, process) return tab }) @@ -410,6 +457,11 @@ cell.$menuId = item.uuid cell.$MenuID = this.props.MenuID cell.$view = 'popview' + + if (item.$process) { + cell.$process = true + cell.$flowId = 'flow' + this.props.MenuID + } if (cell.controlField) { if (/,/ig.test(cell.controlVal)) { @@ -640,7 +692,6 @@ loadingview: true, // 椤甸潰鍔犺浇涓� viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷粍浠剁瓑 - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� shortcuts: null, }, () => { this.loadconfig() @@ -670,17 +721,30 @@ } render() { - const { loadingview, viewlost, config, loading, shortcuts, autoMatic } = this.state + const { loadingview, viewlost, config, shortcuts, autoMatic } = this.state + + if (!config || viewlost) { + return ( + <div className="custom-table-wrap"> + {loadingview ? <Spin className="view-spin" size="large" /> : null} + {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + <div className="user-tools"> + {config && config.process === 'true' ? <FlowFloat init={true} config={config}/> : null} + </div> + </div> + ) + } return ( - <div className={'custom-table-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> - {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null} + <div className="custom-table-wrap" id={this.state.ContainerId} style={config.style}> <Row className="component-wrap">{this.getComponents()}</Row> - {config && window.GLOB.breakpoint ? <DebugTable /> : null} - {!window.GLOB.mkHS && config && autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : null} - {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} - {!window.GLOB.mkHS && config ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} - {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + {window.GLOB.breakpoint ? <DebugTable /> : null} + <div className="user-tools"> + {autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : null} + {config.process === 'true' ? <FlowFloat config={config}/> : null} + <SettingComponent config={config} shortcuts={shortcuts || []}/> + <TableNodes config={config} /> + </div> </div> ) } diff --git a/src/tabviews/basetable/index.scss b/src/tabviews/basetable/index.scss index 8581886..be83043 100644 --- a/src/tabviews/basetable/index.scss +++ b/src/tabviews/basetable/index.scss @@ -43,9 +43,21 @@ .ant-btn-link:hover { opacity: 0.8; } -} -.custom-table-wrap.loading { - .ant-spin-spinning:not(.view-spin) { - display: none; + + .user-tools { + position: fixed; + z-index: 2; + bottom: 55px; + right: 20px; + .tool-wrap { + margin-top: 5px; + .ant-btn { + width: 40px; + height: 40px; + } + .anticon-forward { + font-size: 20px; + } + } } } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index ab15b41..b688628 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -1134,7 +1134,7 @@ </Tabs>)) } {setting && window.GLOB.breakpoint ? <DebugTable /> : null} - {!window.GLOB.mkHS && setting ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} + {setting ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) diff --git a/src/tabviews/commontable/index.scss b/src/tabviews/commontable/index.scss index 12b410e..1454435 100644 --- a/src/tabviews/commontable/index.scss +++ b/src/tabviews/commontable/index.scss @@ -137,4 +137,15 @@ clear: both; } } + + .tool-wrap { + position: fixed; + z-index: 2; + bottom: 55px; + right: 20px; + .ant-btn { + width: 40px; + height: 40px; + } + } } \ No newline at end of file diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index 781b43c..32267f3 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -387,6 +387,7 @@ loading: false, status: 0, flowname: '', + flowcode: '', orgs: [] } @@ -621,7 +622,8 @@ this.setState({ status: item.status || 0, - flowname: item.works_flow_name, + flowname: item.works_flow_name || '', + flowcode: item.works_flow_code || '', loading: false }) @@ -1535,7 +1537,7 @@ } save = () => { - const { BID, plot, status } = this.state + const { BID, plot, status, flowname, flowcode } = this.state if (!BID) { Modal.error({ @@ -1569,18 +1571,52 @@ ID: BID, BID: '' } + + let ssoParam = { + func: 's_works_flow_param_sso_upt_v6', + status: status, + ID: BID, + works_flow_code: flowcode, + works_flow_name: flowname, + long_param: window.btoa(window.encodeURIComponent(JSON.stringify(nodes))) + } Api.genericInterface(param).then(res => { if (res.status) { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛锛�', - duration: 2 - }) - this.setState({ - loading: false, - status: _status - }) + if (plot.subtype === 'xflow') { + Api.getSystemConfig(ssoParam).then(result => { + if (result.status) { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛锛�', + duration: 2 + }) + this.setState({ + loading: false, + status: _status + }) + } else { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + this.setState({ + loading: false + }) + } + }) + } else { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛锛�', + duration: 2 + }) + this.setState({ + loading: false, + status: _status + }) + } } else { notification.error({ top: 92, diff --git a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx index 914d039..ff923d4 100644 --- a/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx +++ b/src/tabviews/custom/components/module/voucher/voucherTable/index.jsx @@ -1136,10 +1136,23 @@ } }) + let _total = debit + if (debit === 0) { + debit = '' + } + + if (_total === '' && credit !== '') { + _total = 0 + } + + if (credit === 0) { + credit = '' + } + totalLine.debit = debit totalLine.credit = credit - totalLine.subject_voucher_text = this.changeMoneyToChinese(debit) + totalLine.subject_voucher_text = this.changeMoneyToChinese(_total) return totalLine } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 2686241..62f9b46 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -44,6 +44,7 @@ const Iframe = asyncComponent(() => import('./components/iframe')) const Calendar = asyncComponent(() => import('./components/calendar')) const DebugTable = asyncComponent(() => import('@/tabviews/debugtable')) +const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat')) const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes')) const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces')) @@ -132,6 +133,49 @@ return } + if (config.process === 'true') { + let unset = true + if (result.works_flow_code && result.works_long_param) { + try { // 娴佺▼淇℃伅瑙f瀽 + let flowConfig = JSON.parse(window.decodeURIComponent(window.atob(result.works_long_param))) + flowConfig.flow_code = result.works_flow_code + flowConfig.flow_name = result.works_flow_name + config.flow_code = result.works_flow_code + config.flow_name = result.works_flow_name + unset = false + + window.GLOB.UserCacheMap.set('flow' + MenuID, flowConfig) + } catch (e) { + unset = true + console.warn('Parse Failure') + } + } + + if (unset) { + config.interfaces = [] + this.setState({ + config: config, + viewlost: true, + loadingview: false, + lostmsg: '鎶辨瓑锛屾偍璁块棶鐨勯〉闈㈡湭璁剧疆宸ヤ綔娴侊紝璇疯仈绯荤鐞嗗憳銆�' + }) + return + } + } else if (result.works_flow_code) { + Api.getSystemConfig({ + func: 's_works_flow_param_sso_menu_upt_v6', + upt_type: 'del', + works_flow_code: '', + works_flow_name: '', + long_param: '', + flow_id: '', + menuid: config.MenuID, + menuname: config.MenuName, + username: sessionStorage.getItem('User_Name') || '', + fullName: sessionStorage.getItem('Full_Name') || '' + }) + } + // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 if (result.LongParamUser && !window.GLOB.mkHS) { try { // 閰嶇疆淇℃伅瑙f瀽 @@ -193,7 +237,7 @@ let initInters = [] config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters) - config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID) + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true') let params = [] let BID = param.$BID || '' @@ -324,12 +368,17 @@ } } - filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) => { + filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process) => { return components.filter(item => { item.$pageId = pageId item.$searchId = searchId item.$syncId = syncId + if (process) { + item.$process = process + item.$flowId = 'flow' + this.props.MenuID + } + if (cache) { item.$cache = cache item.$time = time @@ -444,7 +493,7 @@ _searchId = tab.uuid } - tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid) + tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid, process) if (_searchId === tab.uuid) { tab.components.forEach(cell => { @@ -468,7 +517,7 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) + item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process) return true } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { @@ -720,6 +769,11 @@ group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' } + if (item.$process) { + group.subButton.$process = true + group.subButton.$flowId = 'flow' + this.props.MenuID + } + if (item.$cache && item.$time) { group.$cache = item.$cache group.$time = item.$time @@ -812,6 +866,11 @@ cell.$menuId = item.uuid cell.$MenuID = this.props.MenuID cell.$view = 'popview' + + if (item.$process) { + cell.$process = true + cell.$flowId = 'flow' + this.props.MenuID + } if (cell.btnstyle) { // 鍏煎 cell.style = cell.style || {} @@ -1572,15 +1631,29 @@ render() { const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state + if (!config || viewlost) { + return ( + <div className="custom-page-wrap"> + {loadingview ? <Spin className="view-spin" size="large" /> : null} + {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + <div className="user-tools"> + {config && config.process === 'true' ? <FlowFloat init={true} config={config}/> : null} + </div> + </div> + ) + } + return ( - <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''} ${config && config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}> - {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} - <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row> - {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} - {config && window.GLOB.breakpoint ? <DebugTable /> : null} - {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} - {!window.GLOB.mkHS && config ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null} - {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + <div className={`custom-page-wrap ${config.minWidth ? 'mk-scroll' : ''} ${loading ? 'loading' : ''} ${config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config.style}> + {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null} + <Row id={'menu' + config.uuid} style={{minWidth: config.minWidth || 'unset'}} className="component-wrap">{this.getComponents()}</Row> + {config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} + {window.GLOB.breakpoint ? <DebugTable /> : null} + <div className="user-tools"> + {config.process === 'true' ? <FlowFloat config={config}/> : null} + <SettingComponent config={config} shortcuts={shortcuts || []}/> + <TableNodes config={config} /> + </div> </div> ) } diff --git a/src/tabviews/custom/index.scss b/src/tabviews/custom/index.scss index ede42fb..b2f1683 100644 --- a/src/tabviews/custom/index.scss +++ b/src/tabviews/custom/index.scss @@ -43,6 +43,23 @@ .ant-btn-link:hover { opacity: 0.8; } + + .user-tools { + position: fixed; + z-index: 2; + bottom: 55px; + right: 20px; + .tool-wrap { + margin-top: 5px; + .ant-btn { + width: 40px; + height: 40px; + } + .anticon-forward { + font-size: 20px; + } + } + } } .custom-page-wrap.loading { .ant-spin-spinning:not(.view-spin) { diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 7463f80..4555cbd 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -172,6 +172,11 @@ item.$pageId = Tab.uuid item.$searchId = searchId item.$syncId = syncId + + if (Tab.$process) { + item.$process = true + item.$flowId = Tab.$flowId + } if (item.style && item.style.boxShadow) { delete item.style.hShadow @@ -586,6 +591,11 @@ cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.uuid + if (Tab.$process) { + cell.$process = true + cell.$flowId = Tab.$flowId + } + if (cell.btnstyle) { // 鍏煎 cell.style = cell.style || {} cell.style = {...cell.style, ...cell.btnstyle} diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx index 951001a..8d3f243 100644 --- a/src/tabviews/zshare/automatic/index.jsx +++ b/src/tabviews/zshare/automatic/index.jsx @@ -4,7 +4,7 @@ import { Button, message } from 'antd' import MKEmitter from '@/utils/events.js' -import './index.scss' +// import './index.scss' class AutoMatic extends Component { static propTpyes = { @@ -223,12 +223,9 @@ const { running } = this.state return ( - <Button - icon={running ? 'pause' : 'forward'} - shape="circle" - className={'auto-matic ' + (window.GLOB.systemType === 'production' ? 'low' : '')} - onClick={this.trigger} - /> + <div className="tool-wrap"> + <Button icon={running ? 'pause' : 'forward'} shape="circle" onClick={this.trigger}/> + </div> ) } } diff --git a/src/tabviews/zshare/automatic/index.scss b/src/tabviews/zshare/automatic/index.scss index 27e2e9c..e69de29 100644 --- a/src/tabviews/zshare/automatic/index.scss +++ b/src/tabviews/zshare/automatic/index.scss @@ -1,14 +0,0 @@ -.auto-matic { - position: fixed; - z-index: 2; - bottom: 145px; - right: 20px; - width: 40px; - height: 40px; - .anticon-forward { - font-size: 20px; - } -} -.auto-matic.low { - bottom: 100px; -} diff --git a/src/tabviews/zshare/flowFloat/index.jsx b/src/tabviews/zshare/flowFloat/index.jsx new file mode 100644 index 0000000..5aab582 --- /dev/null +++ b/src/tabviews/zshare/flowFloat/index.jsx @@ -0,0 +1,225 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Button, Modal, notification, Spin, Empty } from 'antd' +import { BranchesOutlined } from '@ant-design/icons' + +import Api from '@/api' +import MKEmitter from '@/utils/events.js' +import './index.scss' + +class CustomSetting extends Component { + static propTpyes = { + config: PropTypes.object, + init: PropTypes.any + } + + state = { + debug: sessionStorage.getItem('debug') === 'true', + visible: false, + flows: null, + loading: false, + activeCode: '', + initCode: '' + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount() { + const { init } = this.props + + if (init) { + this.trigger() + } + } + + trigger = () => { + const { config } = this.props + const { debug } = this.state + + if (!debug) return null + + this.setState({ + visible: true, + loading: false, + initCode: config.flow_code || '', + activeCode: '' + }) + + let param = { + func: 's_get_works_flow_local_param_v6' + } + + Api.genericInterface(param).then(result => { + if (result.status) { + let flows = result.data || [] + let active = config.flow_code ? flows.filter(item => item.works_flow_code === config.flow_code)[0] : null + this.setState({ + flows: flows, + activeCode: active + }) + + if (config.flow_code && !active) { + Modal.error({ + title: '褰撳墠鑿滃崟宸ヤ綔娴佸凡澶辨晥锛岃閲嶆柊閫夋嫨銆�' + }) + } + } else { + if (!result.message) return + if (result.ErrCode === 'N') { + Modal.error({ + title: result.message, + }) + } else if (result.ErrCode !== '-2') { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + }) + } + + settingSubmit = () => { + const { config } = this.props + const { activeCode } = this.state + + let param = { + func: 's_works_flow_param_sso_menu_upt_v6', + upt_type: '', + works_flow_code: activeCode.works_flow_code, + works_flow_name: activeCode.works_flow_name, + long_param: activeCode.long_param, + flow_id: activeCode.id, + menuid: config.MenuID, + menuname: config.MenuName, + username: sessionStorage.getItem('User_Name') || '', + fullName: sessionStorage.getItem('Full_Name') || '' + } + + this.setState({ + loading: true + }) + + Api.getSystemConfig(param).then(result => { + if (!result.status) { + this.setState({ + loading: false + }) + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } + + Api.deleteMenuStorage(config.MenuID) + + setTimeout(() => { + this.setState({ + visible: false, + loading: false + }, () => { + window.GLOB.CacheMap = new Map() + MKEmitter.emit('reloadMenuView', config.MenuID) + }) + }, 100) + }) + } + + deleteFlow = () => { + const { config } = this.props + + let param = { + func: 's_works_flow_param_sso_menu_upt_v6', + upt_type: 'del', + works_flow_code: '', + works_flow_name: '', + long_param: '', + flow_id: '', + menuid: config.MenuID, + menuname: config.MenuName, + username: sessionStorage.getItem('User_Name') || '', + fullName: sessionStorage.getItem('Full_Name') || '' + } + + this.setState({ + deling: true + }) + + Api.getSystemConfig(param).then(result => { + if (!result.status) { + this.setState({ + deling: false + }) + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } + + Api.deleteMenuStorage(config.MenuID) + + setTimeout(() => { + this.setState({ + visible: false, + deling: false + }, () => { + window.GLOB.CacheMap = new Map() + MKEmitter.emit('reloadMenuView', config.MenuID) + }) + }, 100) + }) + } + + changeFlow = (item) => { + this.setState({ + activeCode: item + }) + } + + render() { + const { flows, visible, initCode, loading, deling, activeCode, debug } = this.state + + if (!debug) return null + + return ( + <div className="tool-wrap"> + <Button shape="circle" onClick={this.trigger}><BranchesOutlined /></Button> + <Modal + wrapClassName="flow-setting-modal" + title="宸ヤ綔娴�" + maskClosable={false} + width={1000} + visible={visible} + onCancel={() => { this.setState({ visible: false }) }} + footer={[ + initCode ? <Button key="revert" type="danger" disabled={loading} loading={deling} onClick={this.deleteFlow}>鍒犻櫎</Button> : null, + <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>鍙栨秷</Button>, + <Button key="confirm" type="primary" disabled={deling || !activeCode} loading={loading} onClick={this.settingSubmit}>鎻愪氦</Button> + ]} + destroyOnClose + > + {!flows ? <Spin size="large" /> : <> + {flows.length === 0 ? <Empty /> : <div> + {flows.map(item => (<div className={'flow-item' + (activeCode && activeCode.works_flow_code === item.works_flow_code ? ' active' : '')} key={item.works_flow_code} onClick={() => this.changeFlow(item)}> + <div className="header">{item.works_flow_name}锛坽item.works_flow_code}锛�</div> + <div className="img" style={{backgroundImage: `url(${item.flow_image})`}}></div> + </div>))} + </div>} + </>} + {flows && flows.length === 0 ? <Empty /> : null} + {!flows ? <Spin size="large" /> : null} + </Modal> + </div> + ) + } +} + +export default CustomSetting \ No newline at end of file diff --git a/src/tabviews/zshare/flowFloat/index.scss b/src/tabviews/zshare/flowFloat/index.scss new file mode 100644 index 0000000..87dcda4 --- /dev/null +++ b/src/tabviews/zshare/flowFloat/index.scss @@ -0,0 +1,80 @@ +.flow-setting-modal { + .ant-modal { + top: 50px; + padding-bottom: 5px; + .ant-modal-footer { + .ant-btn-danger:hover { + color: #ffffff!important; + } + } + .ant-modal-body { + max-height: calc(100vh - 190px); + min-height: 250px; + overflow-y: auto; + padding-top: 0px; + position: relative; + + .flow-item { + display: inline-block; + width: calc(25% - 20px); + margin: 10px; + border: 1px solid #d8d8d8; + vertical-align: top; + cursor: pointer; + + .header { + height: 50px; + padding: 5px; + word-break: break-word; + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + -webkit-line-clamp: 2; + text-align: center; + } + .img { + height: 150px; + background-size: contain; + background-position: center; + background-repeat: no-repeat; + } + } + + .flow-item.active { + border: 1px solid var(--mk-sys-color); + box-shadow: 0 0 2px var(--mk-sys-color); + } + + .ant-spin { + position: absolute; + left: calc(50% - 22px); + top: 100px; + } + .ant-empty { + margin-top: 30px; + } + + .component-title { + font-size: 16px; + display: inline-block; + margin: 20px 0px 10px 0px; + padding: 0 10px; + border-bottom: 2px solid #1890ff; + } + } + .ant-modal-body::-webkit-scrollbar { + width: 7px; + } + .ant-modal-body::-webkit-scrollbar-thumb { + border-radius: 5px; + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); + background: rgba(0, 0, 0, 0.13); + } + .ant-modal-body::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0.07); + background: rgba(0, 0, 0, 0); + } + } +} \ No newline at end of file diff --git a/src/tabviews/zshare/pageMessage/index.jsx b/src/tabviews/zshare/pageMessage/index.jsx deleted file mode 100644 index 0d283a3..0000000 --- a/src/tabviews/zshare/pageMessage/index.jsx +++ /dev/null @@ -1,351 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Button, Modal, Typography, Tree } from 'antd' - -import Api from '@/api' -import Utils from '@/utils/utils.js' - -import './index.scss' - -const { TreeNode } = Tree -const { Paragraph } = Typography - -class PageMessage extends Component { - static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - } - - state = { - debug: sessionStorage.getItem('debug') === 'true', - visible: false, - key: '', // 鏇存柊鎸囬拡 - data: [] - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - handleviewconfig = (e) => { - const { config } = this.props - let data = [] - e.stopPropagation() - - if (config.Template === 'CustomPage') { - data = this.getCusData(config) - } else { - data = this.getData(config) - } - - this.setState({ - visible: true, - data: data - }) - } - - getBtnCell = (cell, item) => { - let _cell = { uuid: cell.uuid, title: `鎸夐挳(${cell.label})锛歚 } - let _others = [] - let tablename = cell.OpenType === 'excelIn' ? (cell.sheet || '') : (cell.sql || '') - - if (cell.OpenType === 'excelOut' && cell.intertype === 'system') { - tablename = item.setting.tableName || '' - } - if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(cell.OpenType)) { - if (tablename) { - _others.push(`${tablename}(琛ㄥ悕)`) - } - if (cell.innerFunc) { - _others.push(`${cell.innerFunc}(鍐呴儴鍑芥暟)`) - } - if (cell.outerFunc) { - _others.push(`${cell.outerFunc}(澶栭儴鍑芥暟)`) - } - } else if (cell.OpenType === 'popview') { - _cell.sublist = [] - Api.getLocalCacheConfig({ - func: 'sPC_Get_LongParam', - MenuID: cell.uuid - }).then(res => { - if (res.LongParam) { - let _config - try { // 閰嶇疆淇℃伅瑙f瀽 - _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - _config = '' - } - - if (_config) { - _cell.sublist = this.getCusData(_config) - this.setState({key: cell.uuid}) - } - } - }) - } - - _cell.title = _cell.title + _others.join('銆�') - - return _cell - } - - getCusData = (config) => { - let data = [] - config.components.forEach(item => { - let _item = { uuid: item.uuid, title: item.name, sublist: [] } - if (item.type === 'tabs') { - item.subtabs.forEach(tab => { - let cell = { uuid: tab.uuid, title: tab.label } - - cell.sublist = this.getCusData(tab) - - _item.sublist.push(cell) - }) - } else if (item.type === 'group') { - _item.sublist = this.getCusData(item) - } else if (item.type === 'search' || (item.type === 'card' && item.subtype === 'propcard' && item.wrap.datatype === 'static')) { - let cell = { uuid: Utils.getuuid(), title: '鏁版嵁婧愶細(鏃�)' } - _item.sublist.push(cell) - } else if (item.setting) { - let cell = { uuid: Utils.getuuid(), title: '鏁版嵁婧愶細' } - let _others = [] - - if (item.setting.tableName) { - _others.push(`${item.setting.tableName}(琛ㄥ悕)`) - } - if (item.setting.innerFunc) { - _others.push(`${item.setting.innerFunc}(鍐呴儴鍑芥暟)`) - } - if (item.setting.outerFunc) { - _others.push(`${item.setting.outerFunc}(澶栭儴鍑芥暟)`) - } - cell.title = cell.title + _others.join('銆�') - - _item.sublist.push(cell) - } - - if (item.action) { - item.action.forEach(cell => { - let _cell = this.getBtnCell(cell, item) - _item.sublist.push(_cell) - }) - } - - if (item.type === 'card') { - item.subcards.forEach(card => { - card.elements && card.elements.forEach(cell => { - if (cell.eleType === 'button') { - let _cell = this.getBtnCell(cell, item) - _item.sublist.push(_cell) - } - }) - card.backElements && card.backElements.forEach(cell => { - if (cell.eleType === 'button') { - let _cell = this.getBtnCell(cell, item) - _item.sublist.push(_cell) - } - }) - }) - } else if (item.type === 'table') { - item.cols.forEach(col => { - if (col.type !== 'action') return - col.elements && col.elements.forEach(cell => { - let _cell = this.getBtnCell(cell, item) - _item.sublist.push(_cell) - }) - }) - } - - data.push(_item) - }) - - return data - } - - getData = (config) => { - let data = [] - let item = {uuid: Utils.getuuid(), title: '鏁版嵁婧愶細'} - let _others = [] - - if (config.Template === 'SubTable') { - if (config.tabNo) { - _others.push(`${config.tabNo}(鑿滃崟鍙傛暟)`) - } - } - - if (config.setting.tableName) { - _others.push(`${config.setting.tableName}(琛ㄥ悕)`) - } - if (config.setting.innerFunc) { - _others.push(`${config.setting.innerFunc}(鍐呴儴鍑芥暟)`) - } - if (config.setting.outerFunc) { - _others.push(`${config.setting.outerFunc}(澶栭儴鍑芥暟)`) - } - item.title = item.title + _others.join('銆�') - data.push(item) - - // 鎸夐挳 - config.action && config.action.forEach(item => { - let _item = {uuid: Utils.getuuid(), title: `鎸夐挳(${item.label})锛歚} - let _others = [] - - let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '') - - if (item.OpenType === 'excelOut' && item.intertype === 'system') { - tablename = config.setting.tableName || '' - } - - if (item.OpenType === 'popview') { - _item.sublist = [] - Api.getLocalCacheConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.linkTab - }).then(res => { - if (res.LongParam) { - let _config - try { // 閰嶇疆淇℃伅瑙f瀽 - _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - _config = '' - } - - if (_config) { - _item.sublist = this.getData(_config) - this.setState({key: item.uuid}) - } - } - }) - } else if (['pop', 'prompt', 'exec', 'excelIn', 'excelOut'].includes(item.OpenType)) { - if (tablename) { - _others.push(`${tablename}(琛ㄥ悕)`) - } - if (item.innerFunc) { - _others.push(`${item.innerFunc}(鍐呴儴鍑芥暟)`) - } - if (item.outerFunc) { - _others.push(`${item.outerFunc}(澶栭儴鍑芥暟)`) - } - } - _item.title = _item.title + _others.join('銆�') - - data.push(_item) - }) - - // 鏍囩椤� - config.tabgroups && config.tabgroups.forEach(group => { - group.sublist.forEach(tab => { - let _item = {uuid: Utils.getuuid(), title: `鏍囩(${tab.label})锛歚, sublist: []} - - Api.getLocalCacheConfig({ - func: 'sPC_Get_LongParam', - MenuID: tab.linkTab - }).then(res => { - if (res.LongParam) { - let _config - try { // 閰嶇疆淇℃伅瑙f瀽 - _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - _config = '' - } - - if (_config) { - _item.sublist = this.getData(_config) - this.setState({key: tab.uuid}) - } - } - }) - - data.push(_item) - }) - }) - - if (config.Template === 'CalendarPage' && config.tab) { - let _item = {uuid: Utils.getuuid(), title: `鏍囩(${config.tab.label})锛歚, sublist: []} - - Api.getLocalCacheConfig({ - func: 'sPC_Get_LongParam', - MenuID: config.tab.linkTab - }).then(res => { - if (res.LongParam) { - let _config - try { // 閰嶇疆淇℃伅瑙f瀽 - _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - _config = '' - } - - if (_config) { - _item.sublist = this.getData(_config) - this.setState({key: config.tab.linkTab}) - } - } - }) - - data.push(_item) - } - - return data - } - - getTreeNode = (data) => { - return data.map(item => { - if (item.sublist && item.sublist.length) { - return ( - <TreeNode title={item.title} key={item.uuid} selectable={false}> - {this.getTreeNode(item.sublist)} - </TreeNode> - ) - } - return <TreeNode key={item.uuid} title={item.title} isLeaf selectable={false} /> - }) - } - - - render() { - const { menu } = this.props - const { debug, visible, data } = this.state - - return ( - <div className={'page-message-wrap ' + (debug && window.GLOB.sysType !== 'cloud' ? 'exist' : '')}> - {debug && window.GLOB.sysType !== 'cloud' ? <Button - icon="copy" - shape="circle" - className="page-message" - onClick={this.handleviewconfig} - /> : null} - <Modal - className="menu-tree-modal" - title={'鑿滃崟淇℃伅'} - width={'850px'} - maskClosable={false} - visible={visible} - onCancel={() => this.setState({visible: false})} - footer={[ - <Button key="close" onClick={() => this.setState({visible: false})}>鍏抽棴</Button> - ]} - destroyOnClose - > - <div className="menu-header"> - <span>鑿滃崟鍚嶇О锛歿menu.MenuName}</span> - {menu.MenuNo ? <span>鑿滃崟鍙傛暟锛�<Paragraph copyable>{menu.MenuNo}</Paragraph></span> : null} - </div> - {visible ? <Tree defaultExpandAll showLine={true}> - {this.getTreeNode(data)} - </Tree> : null} - </Modal> - </div> - ) - } -} - -export default PageMessage \ No newline at end of file diff --git a/src/tabviews/zshare/pageMessage/index.scss b/src/tabviews/zshare/pageMessage/index.scss deleted file mode 100644 index 2b07659..0000000 --- a/src/tabviews/zshare/pageMessage/index.scss +++ /dev/null @@ -1,35 +0,0 @@ -.page-message-wrap { - .page-message { - position: fixed; - z-index: 2; - bottom: 55px; - right: 20px; - width: 40px; - height: 40px; - } -} -.custom-popview { - .page-message-wrap { - display: none; - } -} -.ant-modal.menu-tree-modal { - top: 60px; - .ant-modal-body { - min-height: 300px; - .menu-header { - text-align: center; - span { - font-weight: 600; - margin-right: 20px; - } - .ant-typography { - font-weight: 600; - display: inline-block; - } - } - .ant-tree li .ant-tree-node-content-wrapper { - cursor: default; - } - } -} \ No newline at end of file diff --git a/src/tabviews/zshare/settingcomponent/index.jsx b/src/tabviews/zshare/settingcomponent/index.jsx index 76f94ae..f2488e9 100644 --- a/src/tabviews/zshare/settingcomponent/index.jsx +++ b/src/tabviews/zshare/settingcomponent/index.jsx @@ -410,7 +410,9 @@ return } - Api.deleteMenuStorage(config.MenuID).then(() => { + Api.deleteMenuStorage(config.MenuID) + + setTimeout(() => { this.setState({ visible: false, revertLoading: false @@ -418,7 +420,7 @@ window.GLOB.CacheMap = new Map() MKEmitter.emit('reloadMenuView', config.MenuID) }) - }) + }, 100) }) } @@ -486,7 +488,9 @@ return } - Api.deleteMenuStorage(config.MenuID).then(() => { + Api.deleteMenuStorage(config.MenuID) + + setTimeout(() => { this.setState({ visible: false, confirmLoading: false @@ -494,7 +498,7 @@ window.GLOB.CacheMap = new Map() MKEmitter.emit('reloadMenuView', config.MenuID) }) - }) + }, 100) }) } @@ -514,14 +518,11 @@ render() { const { components, visible } = this.state + if (window.GLOB.mkHS || window.GLOB.sysType !== 'local') return null + return ( - <div className="page-setting-wrap"> - {window.GLOB.sysType === 'local' ? <Button - icon="setting" - shape="circle" - className="page-setting" - onClick={this.trigger} - /> : null} + <div className="tool-wrap"> + <Button icon="setting" shape="circle" onClick={this.trigger}/> <Modal wrapClassName="custom-setting-modal" title={'鑷畾涔夎缃�'} diff --git a/src/tabviews/zshare/settingcomponent/index.scss b/src/tabviews/zshare/settingcomponent/index.scss index b19cb86..b58b733 100644 --- a/src/tabviews/zshare/settingcomponent/index.scss +++ b/src/tabviews/zshare/settingcomponent/index.scss @@ -1,27 +1,12 @@ -.page-setting-wrap { - .page-setting { - position: fixed; - z-index: 2; - bottom: 55px; - right: 20px; - width: 40px; - height: 40px; - } -} -.custom-popview { - .page-setting-wrap { - display: none; - } -} -.page-message-wrap.exist + .page-setting-wrap { - .page-setting { - bottom: 100px; - } -} .custom-setting-modal { .ant-modal { top: 50px; padding-bottom: 5px; + .ant-modal-footer { + .ant-btn-danger:hover { + color: #ffffff!important; + } + } .ant-modal-body { max-height: calc(100vh - 190px); min-height: 250px; diff --git a/src/tabviews/zshare/tablenodes/index.jsx b/src/tabviews/zshare/tablenodes/index.jsx index 21c1919..49f6f32 100644 --- a/src/tabviews/zshare/tablenodes/index.jsx +++ b/src/tabviews/zshare/tablenodes/index.jsx @@ -473,14 +473,11 @@ const { config } = this.props const { visible, loading, empty, debug } = this.state + if (window.GLOB.mkHS || window.GLOB.systemType === 'production' || !debug || window.GLOB.sysType === 'cloud') return null + return ( - <div className={'page-message-wrap ' + (debug && window.GLOB.sysType !== 'cloud' ? 'exist' : '')}> - {debug && window.GLOB.sysType !== 'cloud' ? <Button - icon="fork" - shape="circle" - className="page-message" - onClick={this.trigger} - /> : null} + <div className="tool-wrap"> + <Button icon="fork" shape="circle" onClick={this.trigger}/> <Modal title="" wrapClassName="view-table-modal" diff --git a/src/tabviews/zshare/tablenodes/index.scss b/src/tabviews/zshare/tablenodes/index.scss index 5458306..f982f22 100644 --- a/src/tabviews/zshare/tablenodes/index.scss +++ b/src/tabviews/zshare/tablenodes/index.scss @@ -1,14 +1,3 @@ -.page-message-wrap { - .page-message { - position: fixed; - z-index: 2; - bottom: 55px; - right: 20px; - width: 40px; - height: 40px; - } -} - .view-table-modal { .ant-modal { top: 30px; -- Gitblit v1.8.0