From f724c64b419f148985c0bd5a1153e3fc7d84b9e6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 12 七月 2023 17:03:27 +0800 Subject: [PATCH] Merge branch 'develop' --- src/menu/components/form/formaction/index.scss | 1 src/tabviews/custom/components/tree/antd-tree/index.jsx | 4 src/tabviews/zshare/actionList/popupbutton/index.jsx | 4 src/menu/components/card/cardcellcomponent/dragaction/action.jsx | 2 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 8 src/tabviews/custom/popview/index.jsx | 3 src/tabviews/custom/components/form/step-form/index.scss | 1 src/views/billprint/index.jsx | 2 src/menu/menushell/card.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 8 src/tabviews/custom/components/card/data-card/index.jsx | 18 src/menu/components/form/formaction/formconfig.jsx | 22 + src/tabviews/custom/components/card/cardcellList/index.jsx | 2 src/tabviews/custom/components/card/prop-card/index.jsx | 14 src/tabviews/zshare/actionList/funczip/index.jsx | 8 src/tabviews/custom/components/calendar/board/index.scss | 64 +++ src/menu/components/share/actioncomponent/formconfig.jsx | 31 + src/tabviews/custom/components/group/normal-group/index.jsx | 2 src/pc/menushell/card.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 4 src/menu/components/card/doublecardcomponent/index.jsx | 11 src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 4 src/menu/components/card/cardcomponent/index.jsx | 12 src/menu/components/card/data-card/index.jsx | 8 src/menu/components/group/groupcomponents/card.jsx | 2 src/components/breadview/index.jsx | 3 src/tabviews/custom/components/chart/antv-X6/index.jsx | 124 +++++-- src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/tabviews/custom/components/carousel/prop-card/index.jsx | 4 src/tabviews/custom/index.jsx | 2 src/menu/components/table/base-table/columns/index.jsx | 8 src/menu/components/tabs/tabcomponents/card.jsx | 2 src/tabviews/custom/components/card/tableHeader/index.jsx | 2 src/components/tabview/index.jsx | 9 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 4 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 4 src/tabviews/custom/components/table/base-table/index.jsx | 4 src/tabviews/custom/components/form/tab-form/index.scss | 1 src/tabviews/custom/components/card/double-data-card/index.jsx | 18 src/menu/components/form/formaction/actionform/index.jsx | 8 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 31 + src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 2 src/menu/components/form/simple-form/index.jsx | 2 src/tabviews/custom/components/carousel/data-card/index.jsx | 4 src/views/basedesign/index.jsx | 9 src/tabviews/custom/components/table/edit-table/index.jsx | 4 src/tabviews/custom/components/calendar/board/index.jsx | 175 ++++++++++ src/mob/components/formdragelement/index.scss | 4 src/tabviews/custom/components/calendar/index.jsx | 93 +++++ config/webpack.config.js | 20 src/tabviews/custom/components/form/simple-form/index.jsx | 5 src/mob/mobshell/card.jsx | 2 src/tabviews/custom/components/chart/custom-chart/index.jsx | 4 src/index.js | 4 src/tabviews/custom/components/form/tab-form/index.jsx | 5 src/tabviews/custom/components/card/table-card/index.jsx | 4 public/index.html | 52 +++ src/tabviews/custom/components/share/tabtransfer/index.jsx | 2 public/manifest.json | 3 src/menu/stylecontroller/index.jsx | 1 src/templates/treepageconfig/updatetable/index.jsx | 5 src/tabviews/custom/components/form/simple-form/index.scss | 1 src/mob/components/tabs/tabcomponents/card.jsx | 2 src/tabviews/zshare/actionList/printbutton/index.jsx | 4 /dev/null | 6 src/tabviews/custom/components/form/step-form/index.jsx | 5 src/tabviews/custom/components/card/balcony/index.jsx | 4 src/tabviews/zshare/actionList/popupbutton/index.scss | 15 src/utils/option.js | 16 src/menu/components/calendar/index.jsx | 11 src/views/login/index.jsx | 2 71 files changed, 728 insertions(+), 203 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index a793358..5826327 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -49,6 +49,14 @@ const cssModuleRegex = /\.module\.css$/; const sassRegex = /\.(scss|sass)$/; const sassModuleRegex = /\.module\.(scss|sass)$/; +const sign = (() => { + let uuid = [] + let options = '0123456789abcdefghigklmnopqrstuv' + for (let i = 0; i < 8; i++) { + uuid.push(options.substr(Math.floor(Math.random() * 0x20), 1)) + } + return uuid.join('') +})() // src => @ function resolves(dir) { @@ -175,14 +183,14 @@ // In development, it does not produce real files. // contenthash => hash filename: isEnvProduction - ? 'static/js/[name].[hash:8].js' + ? `static/js/[name].${sign}.js` : isEnvDevelopment && 'static/js/bundle.js', // TODO: remove this when upgrading to webpack 5 futureEmitAssets: true, // There are also additional JS chunk files if you use code splitting. // contenthash => hash chunkFilename: isEnvProduction - ? 'static/js/[name].[hash:8].chunk.js' + ? `static/js/[name].${sign}.chunk.js` : isEnvDevelopment && 'static/js/[name].chunk.js', // We inferred the "public path" (such as / or /my-project) from homepage. // We use "/" in development. @@ -354,7 +362,7 @@ loader: require.resolve('url-loader'), options: { limit: imageInlineSizeLimit, - name: 'static/media/[name].[hash:8].[ext]', + name: `static/media/[name].${sign}.[ext]`, }, }, // Process application JS with Babel. @@ -494,7 +502,7 @@ // by webpacks internal loaders. exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], options: { - name: 'static/media/[name].[hash:8].[ext]', + name: `static/media/[name].${sign}.[ext]`, }, }, // ** STOP ** Are you adding a new loader? @@ -568,8 +576,8 @@ // Options similar to the same options in webpackOptions.output // both options are optional // contenthash => hash - filename: 'static/css/[name].[hash:8].css', - chunkFilename: 'static/css/[name].[hash:8].chunk.css', + filename: `static/css/[name].${sign}.css`, + chunkFilename: `static/css/[name].${sign}.chunk.css`, }), // Generate a manifest file which contains a mapping of all asset filenames // to their corresponding output file so that tools can pick it up without diff --git a/public/index.html b/public/index.html index 2e1c8b4..3da241a 100644 --- a/public/index.html +++ b/public/index.html @@ -3,12 +3,62 @@ <head> <meta charset="utf-8" /> <meta name="renderer" content="webkit"> - <!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> --> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <link rel="shortcut icon" href="#"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <title></title> + <script> + let _href = window.location.href.split('#')[0] + let l_version = localStorage.getItem(_href + 'version') + let _ctime = parseInt(new Date().getTime() / 1000) + let _time = '' + + if (l_version) { + let vers = l_version.split('-') + l_version = vers[0] + _time = +vers[1] + } + + if (_time && _ctime - _time < 180) { + let meta1 = document.createElement('meta') + let meta2 = document.createElement('meta') + let meta3 = document.createElement('meta') + let meta4 = document.createElement('meta') + meta1.content = '0' + meta1.httpEquiv = 'Expires' + meta2.content = 'no-cache' + meta2.httpEquiv = 'Pragma' + meta3.content = 'no-cache' + meta3.httpEquiv = 'Cache-Control' + meta4.content = 'no-cache' + meta4.httpEquiv = 'Cache' + document.getElementsByTagName('head')[0].appendChild(meta1) + document.getElementsByTagName('head')[0].appendChild(meta2) + document.getElementsByTagName('head')[0].appendChild(meta3) + document.getElementsByTagName('head')[0].appendChild(meta4) + } else { + fetch('./manifest.json', { cache: 'no-cache'}) + .then(response => response.json()) + .then(res => { + if (res && res.mk_version) { + let version = res.mk_version + let nocache = false + + if (l_version && version !== l_version) { + nocache = true + localStorage.setItem(_href + 'version', version + '-' + _ctime) + } else if (!l_version) { + localStorage.setItem(_href + 'version', version + '-' + (_ctime - 360)) + } + + if (nocache) { + window.location.reload() + } + } + }) + } + </script> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> diff --git a/public/manifest.json b/public/manifest.json index 2895bc5..d3654ec 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -5,5 +5,6 @@ "start_url": ".", "display": "standalone", "theme_color": "#000000", - "background_color": "#ffffff" + "background_color": "#ffffff", + "mk_version": "20230712" } diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index 29ae6c0..15a578b 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -18,7 +18,6 @@ const TreePage = asyncComponent(() => import('@/tabviews/treepage')) const Iframe = asyncComponent(() => import('@/tabviews/iframe')) const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) -const FormTab = asyncComponent(() => import('@/tabviews/formtab')) moment.locale('zh-cn') @@ -100,8 +99,6 @@ return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param} changeTemp={this.changeTemp}/>) } else if (view.type === 'TreePage') { return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param}/>) - } else if (view.type === 'FormTab') { - return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param}/>) } else if (view.type === 'iframe') { return (<Iframe MenuID={view.MenuID} title={view.MenuName} url={view.src}/>) } else { diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index 991ce27..789e4ad 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -8,7 +8,7 @@ import 'moment/locale/zh-cn' import asyncComponent from '@/utils/asyncLoadComponent' -// import NotFount from '@/components/404' +import NotFount from '@/components/404' import options from '@/store/options.js' import MKEmitter from '@/utils/events.js' import Api from '@/api' @@ -21,8 +21,6 @@ const TreePage = asyncComponent(() => import('@/tabviews/treepage')) const Iframe = asyncComponent(() => import('@/tabviews/iframe')) const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) -const FormTab = asyncComponent(() => import('@/tabviews/formtab')) -const Calendar = asyncComponent(() => import('@/tabviews/calendar')) moment.locale('zh-cn') @@ -208,13 +206,10 @@ return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param}/>) } else if (view.type === 'RolePermission') { return (<RoleManage MenuID={view.MenuID}/>) - } else if (view.type === 'FormTab') { - return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param}/>) } else if (view.type === 'iframe') { return (<Iframe MenuID={view.MenuID} title={view.MenuName} url={view.src}/>) } else { - return (<Calendar MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} param={view.param}/>) - // return (<NotFount />) + return (<NotFount />) } } diff --git a/src/index.js b/src/index.js index 04c69e3..5a0bce2 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,6 @@ import options, { styles } from '@/store/options.js' import '@/assets/css/main.scss' import '@/assets/css/action.scss' -// import '@/assets/css/minkeicon.css' import '@/assets/css/viewstyle.scss' if (window.location.href.indexOf('#/design') > -1) { // 缂栬緫椤甸潰鍒锋柊鏃讹紝璺宠浆鑷充富椤� @@ -45,8 +44,6 @@ } sessionStorage.removeItem('isEditState') - -// 鏂扮郴缁熸枃浠剁疆浜巃dmin涓� ../options.json , { cache: 'no-cache'} fetch('../options.json') .then(response => response.json()) @@ -159,7 +156,6 @@ } let _href = window.location.href.split('#')[0] - let _systemMsg = localStorage.getItem(_href + 'system') GLOB.navBar = 'shutter' // 榛樿涓虹櫨鍙剁獥 diff --git a/src/menu/components/calendar/index.jsx b/src/menu/components/calendar/index.jsx index e4bf1fb..00a1663 100644 --- a/src/menu/components/calendar/index.jsx +++ b/src/menu/components/calendar/index.jsx @@ -175,9 +175,9 @@ res.resetContrl = card.wrap.resetContrl || 'init' if (res.colorField && res.signs) { - res.signs = res.signs.map(item => { + res.signs = res.signs.map((item, i) => { try { - let colors = item.color.match(/\d+/g) + let colors = item.background.match(/\d+/g) if ((colors[0] * 0.299 + colors[1] * 0.578 + colors[2] * 0.114) * colors[3] < 192) { item.fontColor = '#ffffff' } else { @@ -187,6 +187,13 @@ item.fontColor = '' } + item.style = {background: item.background} + if (item.fontColor) { + item.style.color = item.fontColor + } + + item.$index = i + 1 + return item }) } diff --git a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx index 9f0deab..14b00e5 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx @@ -75,6 +75,8 @@ if (card.style && card.style.clear === 'left') { _style_ = {clear: 'left'} + } else if (card.style && card.style.clear === 'right') { + _style_ = {float: 'right'} } let className = card.width || '' diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index 7435fd8..34fbe37 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -215,6 +215,8 @@ if (card.style && card.style.clear === 'left') { _style_ = {clear: 'left'} + } else if (card.style && card.style.clear === 'right') { + _style_ = {float: 'right'} } let tableHCell = false diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 0d6a97d..2e45d8c 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -157,7 +157,7 @@ const { card, side } = this.state let _style = null - let options = ['height', 'background', 'border', 'padding', 'margin', 'shadow'] + let options = ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'] if (side === 'front') { _style = card.style ? fromJS(card.style).toJS() : {} } else if (side === 'back') { @@ -378,8 +378,16 @@ tablerole = ' mk-table-header' } + let _style_ = null + + if (card.style.clear === 'left') { + _style_ = {clear: 'left'} + } else if (card.style.clear === 'right') { + _style_ = {float: 'right'} + } + return ( - <Col span={card.setting.width || 6}> + <Col span={card.setting.width || 6} style={_style_}> <div className={'card-item ' + (card.setting.btnControl || '') + checkAll + tablerole} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> <span className="circle-select"></span> <CardCellComponent cards={cards} cardCell={card} side={side} elements={elements} updateElement={this.updateCard}/> diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 3b75676..089dc95 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -313,8 +313,12 @@ } } MKEmitter.emit('changeModal', card, btn) - } else if (btn.OpenType === 'popview' && appType !== 'mob') { - MKEmitter.emit('changePopview', card, btn) + } else if (btn.OpenType === 'popview') { + if (appType === 'mob') { + message.warning('婊戝姩鎸夐挳涓嶆敮鎸佸脊绐楅〉闈紒') + } else { + MKEmitter.emit('changePopview', card, btn) + } } } diff --git a/src/menu/components/card/doublecardcomponent/index.jsx b/src/menu/components/card/doublecardcomponent/index.jsx index c5853a4..98acc31 100644 --- a/src/menu/components/card/doublecardcomponent/index.jsx +++ b/src/menu/components/card/doublecardcomponent/index.jsx @@ -127,6 +127,7 @@ if (type === 'sub') { _style = fromJS(card.backStyle).toJS() } else { + options.push('clear') _style = fromJS(card.style).toJS() } @@ -264,8 +265,16 @@ mainBox = 'flex-card ' } + let _style_ = null + + if (card.style.clear === 'left') { + _style_ = {clear: 'left'} + } else if (card.style.clear === 'right') { + _style_ = {float: 'right'} + } + return ( - <Col span={card.setting.width || 24}> + <Col span={card.setting.width || 24} style={_style_}> <div className="card-item-wrap" style={_wrapStyle}> <div className={`card-item ${card.setting.btnControl || ''} ${checkAll} mk-${card.setting.display} ${mainBox}`} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> <span className="circle-select"></span> diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index 6e9ac94..85144b8 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -51,13 +51,13 @@ let reReadonly = {} if (this.record.type === 'prev') { - shows = ['type', 'label', 'enable', 'actionType'] + shows = ['typeName', 'label', 'actionType'] } else if (this.record.type === 'next') { - shows = ['type', 'label', 'enable', 'actionType'] + shows = ['typeName', 'label', 'actionType'] } else if (this.record.type === 'close') { - shows = ['type', 'label', 'enable'] + shows = ['typeName', 'label'] } else { - shows = ['type', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'enable', 'output', 'reload'] // 閫夐」鍒楄〃 + shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload'] // 閫夐」鍒楄〃 if (this.record.intertype === 'custom') { shows.pop() diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index ace6550..65448fa 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -6,6 +6,7 @@ export function getActionForm (card, functip, tableName, usefulFields, modules, anchors) { const appType = sessionStorage.getItem('appType') + let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview let _type = '鎻愪氦' if (card.type === 'prev') { _type = '涓婁竴姝�' @@ -42,10 +43,29 @@ } } + let refresh = [] + if (viewType === 'popview') { // 寮圭獥鏍囩 + refresh.push({ + value: 'closepoptab', // 鍏抽棴寮圭獥鏍囩 + text: '鍏抽棴寮圭獥' + }) + refresh.push({ + value: 'popclose', // 鎵ц寮圭獥鍏抽棴鏃剁殑鍒锋柊 + text: '鍒锋柊婧愮粍浠�' + }) + } + return [ { type: 'tip', key: 'type', + label: '鎸夐挳绫诲瀷', + initVal: card.type, + forbid: true + }, + { + type: 'tip', + key: 'typeName', label: '鎸夐挳绫诲瀷', initVal: _type }, @@ -310,7 +330,7 @@ }, { value: 'mainline', text: '鍒锋柊涓婄骇缁勪欢 - 琛�' - }] + }, ...refresh] }, { type: (appType === 'pc' || appType === 'mob') ? 'select' : 'cascader', diff --git a/src/menu/components/form/formaction/index.scss b/src/menu/components/form/formaction/index.scss index 79055ca..b980900 100644 --- a/src/menu/components/form/formaction/index.scss +++ b/src/menu/components/form/formaction/index.scss @@ -10,6 +10,7 @@ .submit { border: none; height: auto; + border-style: solid; } .skip { color: rgba(0, 0, 0, 0.85); diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index 5c012de..9e00fe2 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -69,7 +69,7 @@ scripts: [], subcards: [{ uuid: Utils.getuuid(), - setting: {title: '绌�', align: 'left_right', enable: 'true'}, + setting: {title: '', align: 'left_right', enable: 'true'}, style: {}, fields: [], subButton: {label: '鎻愪氦', type: 'submit', intertype: 'system', reload: 'false', sqlType: 'update', sql: '', Ot: 'notRequired', execSuccess: 'never', enable: 'true', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px', paddingTop: '5px', paddingBottom: '5px'}}, diff --git a/src/menu/components/group/groupcomponents/card.jsx b/src/menu/components/group/groupcomponents/card.jsx index ca3302b..dd706fd 100644 --- a/src/menu/components/group/groupcomponents/card.jsx +++ b/src/menu/components/group/groupcomponents/card.jsx @@ -64,6 +64,8 @@ if (card.style && card.style.clear === 'left') { style.clear = 'left' + } else if (card.style && card.style.clear === 'right') { + style.float = 'right' } const getCardComponent = () => { diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 5a87254..608130d 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -388,6 +388,8 @@ shows.push('placement') } else if (this.record.display === 'drawer') { shows.push('placement') + } else if (this.record.display === 'modal') { + shows.push('popshow') } if (this.record.popClose === 'grid') { shows.push('resetPageIndex') diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 30d6719..652dc34 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -961,6 +961,22 @@ }, { type: 'radio', + key: 'popshow', + label: '寮圭獥灞曠ず', + initVal: card.popshow || 'default', + tooltip: '灏忕獥鍙e睍绀哄皢闅愯棌鏍囬鍙婂簳閮ㄦ寜閽��', + required: false, + options: [{ + value: 'default', + text: '榛樿' + }, { + value: 'miniview', + text: '灏忕獥鍙�' + }], + forbid: appType === 'mob' + }, + { + type: 'radio', key: 'maskStyle', label: '钂欏眰鏍峰紡', initVal: card.maskStyle || 'default', @@ -1939,6 +1955,21 @@ }] }, { + type: 'radio', + key: 'popshow', + label: '寮圭獥灞曠ず', + initVal: card.popshow || 'default', + tooltip: '灏忕獥鍙e睍绀哄皢闅愯棌鏍囬鍙婂簳閮ㄦ寜閽��', + required: false, + options: [{ + value: 'default', + text: '榛樿' + }, { + value: 'miniview', + text: '灏忕獥鍙�' + }] + }, + { type: 'text', key: 'preFunc', label: '鍓嶇疆鍑芥暟', diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index d1da3b4..69aacdc 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -326,7 +326,13 @@ col.label = '搴忓彿' } - _columns.splice(hoverIndex, 0, col) + let hIndex = +hoverIndex + + if (_columns.length > 0 && hIndex + 1 === _columns.length) { + _columns.push(col) + } else { + _columns.splice(hIndex, 0, col) + } this.setState({ columns: _columns diff --git a/src/menu/components/tabs/tabcomponents/card.jsx b/src/menu/components/tabs/tabcomponents/card.jsx index 248e0a7..6552008 100644 --- a/src/menu/components/tabs/tabcomponents/card.jsx +++ b/src/menu/components/tabs/tabcomponents/card.jsx @@ -67,6 +67,8 @@ if (card.style && card.style.clear === 'left') { style.clear = 'left' + } else if (card.style && card.style.clear === 'right') { + style.float = 'right' } const getCardComponent = () => { diff --git a/src/menu/menushell/card.jsx b/src/menu/menushell/card.jsx index 8333084..b56942a 100644 --- a/src/menu/menushell/card.jsx +++ b/src/menu/menushell/card.jsx @@ -70,6 +70,8 @@ if (card.style && card.style.clear === 'left') { style.clear = 'left' + } else if (card.style && card.style.clear === 'right') { + style.float = 'right' } const getCardComponent = () => { diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx index bf7ce71..163a7c6 100644 --- a/src/menu/stylecontroller/index.jsx +++ b/src/menu/stylecontroller/index.jsx @@ -953,6 +953,7 @@ <Radio.Group style={{whiteSpace: 'nowrap'}} defaultValue={card.clear || 'none'} onChange={(e) => this.changeNormalStyle(e.target.value, 'clear')}> <Radio value="none">宸︽诞鍔�</Radio> <Radio value="left">涓嶆诞鍔�</Radio> + <Radio value="right">鍙虫诞鍔�</Radio> </Radio.Group> </Form.Item> </Col> diff --git a/src/mob/components/formdragelement/index.scss b/src/mob/components/formdragelement/index.scss index 5aeda26..2798a34 100644 --- a/src/mob/components/formdragelement/index.scss +++ b/src/mob/components/formdragelement/index.scss @@ -8,8 +8,10 @@ padding-left: 0px; padding-right: 0px; } - >.ant-col:not(.ant-col-24) { + >.ant-col { padding-right: 10px; + } + >.ant-col:not(.ant-col-24) { .am-list-line .am-input-label { width: auto; padding-right: 10px; diff --git a/src/mob/components/tabs/tabcomponents/card.jsx b/src/mob/components/tabs/tabcomponents/card.jsx index 24dc025..f150bd4 100644 --- a/src/mob/components/tabs/tabcomponents/card.jsx +++ b/src/mob/components/tabs/tabcomponents/card.jsx @@ -63,6 +63,8 @@ if (card.style && card.style.clear === 'left') { style.clear = 'left' + } else if (card.style && card.style.clear === 'right') { + style.float = 'right' } const getCardComponent = () => { diff --git a/src/mob/mobshell/card.jsx b/src/mob/mobshell/card.jsx index fdca2fd..ca91322 100644 --- a/src/mob/mobshell/card.jsx +++ b/src/mob/mobshell/card.jsx @@ -70,6 +70,8 @@ if (card.style && card.style.clear === 'left') { style.clear = 'left' + } else if (card.style && card.style.clear === 'right') { + style.float = 'right' } let col = 'ant-col-' + (card.width || 24) diff --git a/src/pc/menushell/card.jsx b/src/pc/menushell/card.jsx index 7cdc671..037187a 100644 --- a/src/pc/menushell/card.jsx +++ b/src/pc/menushell/card.jsx @@ -69,6 +69,8 @@ if (card.style && card.style.clear === 'left') { style.clear = 'left' + } else if (card.style && card.style.clear === 'right') { + style.float = 'right' } let col = ' ant-col ant-col-' + (card.width || 24) diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx deleted file mode 100644 index 7ed4d3f..0000000 --- a/src/tabviews/calendar/index.jsx +++ /dev/null @@ -1,590 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { notification, Spin, Modal, Button } from 'antd' -import moment from 'moment' - -import Api from '@/api' -import options from '@/store/options.js' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' -import Utils from '@/utils/utils.js' -import asyncComponent from '@/utils/asyncComponent' -import asyncSpinComponent from '@/utils/asyncSpinComponent' -import MKEmitter from '@/utils/events.js' -import NotFount from '@/components/404' -import './index.scss' - -// 閫氱敤缁勪欢 -const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) -const CalendarComponent = asyncSpinComponent(() => import('@/tabviews/zshare/calendar')) -const SubTabTable = asyncSpinComponent(() => import('@/tabviews/subtabtable')) -const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) - -class MkCalendar extends Component { - static propTpyes = { - param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟 - MenuID: PropTypes.string, // 鑿滃崟Id - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string // 鑿滃崟鍚嶇О - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - BID: null, // 椤甸潰璺宠浆鏃舵惡甯D - loadingview: true, // 椤甸潰鍔犺浇涓� - viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 - lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 - config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� - arr_field: '', // 鏌ヨ瀛楁闆� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: null, // 鍒楄〃鏁版嵁闆� - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - visible: false, // 鏍囩椤垫帶鍒� - triggerTime: '', // 鐐瑰嚮鏃堕棿 - calendarYear: moment().format('YYYY'), // 鏃ュ巻骞翠唤 - hasReqFields: false - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - const { param } = this.props - - let _param = { - func: 'sPC_Get_LongParam', - MenuID: this.props.MenuID - } - let result = await Api.getCacheConfig(_param) - - if (result.status) { - let config = '' - let userConfig = null - let _curUserConfig = '' - - try { // 閰嶇疆淇℃伅瑙f瀽 - config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - config = '' - } - - // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 - if (result.LongParamUser && !window.GLOB.mkHS) { - try { // 閰嶇疆淇℃伅瑙f瀽 - userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) - _curUserConfig = userConfig[this.props.MenuID] - } catch (e) { - console.warn('Parse Failure') - userConfig = null - } - } - - // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� - if (!config) { - this.setState({ - loadingview: false, - viewlost: true - }) - return - } - - // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 - if (!config.enabled) { - this.setState({ - loadingview: false, - viewlost: true, - lostmsg: this.state.dict['main.view.unenabled'] - }) - return - } - - // 鏉冮檺杩囨护 - if (config.tab) { - config.tab.uuid = Utils.getuuid() - } - - if (_curUserConfig) { - config.setting = {...config.setting, ..._curUserConfig.setting} - config.easyCode = _curUserConfig.easyCode || config.easyCode || '' - } - - config.search = Utils.initSearchVal(config.search) - - // 瀛楁閫忚 - let hasReqFields = false - config.search = config.search.map(item => { - if (param && ['text', 'select', 'link'].includes(item.type) && param.$searchkey === item.field) { - item.initval = param.$searchval - } - - if (item.required) { - hasReqFields = true - } - - return item - }) - - // 鏁版嵁婧� - if (config.setting.interType === 'inner' && !config.setting.innerFunc) { - config.setting.interType = 'system' - } - - if (config.setting.interType === 'system') { - // 鏁寸悊鏁版嵁婧愯嚜瀹氫箟鑴氭湰 - let _customScript = '' - config.scripts && config.scripts.forEach(script => { - if (script.status !== 'false') { - _customScript += ` - ${script.sql} - ` - } - }) - - if (/\s/.test(config.setting.dataresource)) { - config.setting.dataresource = '(' + config.setting.dataresource + ') tb' - } - - 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, '/*') - _customScript = _customScript.replace(/@\$/ig, '*/') - } else { - config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '') - _customScript = _customScript.replace(/@\$|\$@/ig, '') - } - - let userName = sessionStorage.getItem('User_Name') || '' - let fullName = sessionStorage.getItem('Full_Name') || '' - - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } - - let regs = [ - { reg: /@userName@/ig, value: `'${userName}'` }, - { reg: /@fullName@/ig, value: `'${fullName}'` } - ] - - regs.forEach(cell => { - config.setting.dataresource = config.setting.dataresource.replace(cell.reg, cell.value) - _customScript = _customScript.replace(cell.reg, cell.value) - }) - - if (config.urlFields) { - let _param = param || {} - config.urlFields.forEach(field => { - let reg = new RegExp('@' + field + '@', 'ig') - let val = `'${_param[field] || ''}'` - config.setting.dataresource = config.setting.dataresource.replace(reg, val) - _customScript = _customScript.replace(reg, val) - }) - } - - config.setting.customScript = _customScript - } - - config.type = 'table' - config.wrap = { - show: config.setting.show || '', - float: config.setting.float || '', - advanceType: config.setting.advanceType || '', - advanceWidth: config.setting.advanceWidth || '', - drawerPlacement: config.setting.drawerPlacement || '', - searchRatio: config.setting.searchRatio || '', - searchLwidth: config.setting.searchLwidth, - borderRadius: config.setting.borderRadius, - } - - this.setState({ - hasReqFields, - BID: param && param.$BID ? param.$BID : '', - loadingview: false, - config: config, - userConfig: userConfig, - setting: config.setting, - arr_field: config.columns.map(item => item.field).join(','), - search: Utils.initMainSearch(config.search) - }, () => { - if (config.setting.onload !== 'false') { - this.loadmaindata() - } - }) - } else { - this.setState({ - loadingview: false, - viewlost: true - }) - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - } - - /** - * @description 涓昏〃鏁版嵁鍔犺浇 - */ - async loadmaindata () { - const { setting, search, BID, hasReqFields } = this.state - let param = '' - - if (hasReqFields) { - let requireFields = search.filter(item => item.required && item.value === '') - - if (requireFields.length > 0) { - return - } - } - - this.setState({ - loading: true - }) - - if (setting.interType === 'system') { - param = this.getDefaultParam() - } else { - param = this.getCustomParam() - } - - if (BID) { - param.BID = BID - } - // 鏁版嵁绠$悊鏉冮檺 - if (sessionStorage.getItem('dataM') === 'true') { - param.dataM = 'Y' - } - - let result = await Api.genericInterface(param) - if (result.status) { - this.setState({ - data: result.data.map((item, index) => { - item.key = index - return item - }), - loading: false - }) - } else { - this.setState({ - loading: false - }) - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - } - - /** - * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� - */ - getCustomParam = () => { - const { search, setting, calendarYear, config } = this.state - - let _search = Utils.formatCustomMainSearch(search) - - let param = { - ..._search - } - - if (config.calendar.refresh === 'true') { - param.calendarDate = calendarYear - } - - if (setting.interType === 'inner') { - param.func = setting.innerFunc - } else { - if (window.GLOB.mkHS) { - if (setting.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - } else { - if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - } - - if (setting.outerFunc) { - param.func = setting.outerFunc - } - } - - return param - } - - /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鐨勫弬鏁� - */ - getDefaultParam = () => { - const { arr_field, search, setting, config, calendarYear } = this.state - - let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where ' + _search : '' - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field, - custom_script: setting.customScript, - default_sql: setting.execute || 'true', - menuname: this.props.MenuName || '' - } - - let _dataresource = setting.dataresource - let regoptions = [] - let userName = sessionStorage.getItem('User_Name') || '' - let fullName = sessionStorage.getItem('Full_Name') || '' - let RoleID = sessionStorage.getItem('role_id') || '' - let departmentcode = sessionStorage.getItem('departmentcode') || '' - let organization = sessionStorage.getItem('organization') || '' - let mk_user_type = sessionStorage.getItem('mk_user_type') || '' - let nation = sessionStorage.getItem('nation') || '' - let province = sessionStorage.getItem('province') || '' - let city = sessionStorage.getItem('city') || '' - let district = sessionStorage.getItem('district') || '' - let address = sessionStorage.getItem('address') || '' - - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } - - if (setting.queryType === 'statistics' || param.custom_script) { - let allSearch = Utils.getAllSearchOptions(search) - regoptions = allSearch.map(item => { - return { - reg: new RegExp('@' + item.key + '@', 'ig'), - value: `'${item.value}'` - } - }) - regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: userName - }, { - reg: new RegExp('@fullName@', 'ig'), - value: fullName - }) - } - - if (config.calendar.refresh === 'true') { - regoptions.push({ - reg: new RegExp('@calendarDate@', 'ig'), - value: `'${calendarYear}-01-01 00:00:00.000'` - }) - regoptions.push({ - reg: new RegExp('@calendarDate1@', 'ig'), - value: `'${calendarYear}-12-31 23:59:59.999'` - }) - } - - if ((setting.queryType === 'statistics' || config.calendar.refresh === 'true') && setting.execute !== 'false') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 - regoptions.forEach(item => { - _dataresource = _dataresource.replace(item.reg, item.value) - }) - _search = '' - } - - let LText = '' - - if (setting.execute !== 'false') { - LText = `select ${arr_field} from ${_dataresource} ${_search}` - } - - if (param.custom_script) { - regoptions.forEach(item => { - param.custom_script = param.custom_script.replace(item.reg, item.value) - }) - - param.custom_script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100) - Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}' - ${param.custom_script} - ` - - if (LText) { - LText += ` - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ - ` - } else { - param.custom_script += ` - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ - ` - } - } - - // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { - param.custom_script && console.info(`${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${param.custom_script}`) - LText && console.info(LText) - } - - param.custom_script = Utils.formatOptions(param.custom_script) - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.DateCount = '' - - if (window.GLOB.probation) { - param.s_debug_type = 'Y' - } - - if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - return param - } - - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - const { setting } = this.state - - if (setting.onload === 'false') { - this.setState({ - search: searches, - setting: {...setting, onload: 'true'} - }, () => { - this.loadmaindata() - }) - } else { - this.setState({ - search: searches - }, () => { - this.loadmaindata() - }) - } - } - - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - this.setState({ loadingview: true, viewlost: false, lostmsg: '', data: null, loading: false, search: '' - }, () => { - this.loadconfig() - }) - } - - reloadMenuView = (menuId) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - this.reloadview() - } - - UNSAFE_componentWillMount () { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.loadconfig() - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - componentDidMount () { - MKEmitter.addListener('openNewTab', this.closeTab) - MKEmitter.addListener('reloadMenuView', this.reloadMenuView) - MKEmitter.addListener('refreshPopButton', this.refreshPopButton) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('openNewTab', this.closeTab) - MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) - MKEmitter.removeListener('refreshPopButton', this.refreshPopButton) - } - - refreshPopButton = (tabId) => { - const { config } = this.props - - if (!config.tab || config.tab.uuid !== tabId) return - - this.loadmaindata() - } - - triggerDate = (item) => { - const { config } = this.state - - if (!config.tab) return - - this.setState({ - visible: true, - triggerTime: item.time.substr(0, 4) + '-' + item.time.substr(4, 2) + '-' + item.time.substr(6, 2) - }) - } - - closeTab = () => { - this.setState({ - visible: false, - triggerTime: '' - }) - } - - render() { - const { BID, loadingview, viewlost, config, loading, data, triggerTime } = this.state - - return ( - <div className="calendar-page"> - {loadingview && <Spin size="large" />} - {config.search && config.search.length > 0 ? - <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null - } - {config && config.calendar ? <CalendarComponent calendar={config.calendar} loading={loading} data={data} triggerDate={this.triggerDate} changeDate={this.changeDate}/> : null} - {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} - <Modal - title={config.tab ? config.tab.label : ''} - width={'80vw'} - maskClosable={false} - visible={this.state.visible} - onCancel={this.closeTab} - footer={[ - <Button key="close" onClick={this.closeTab}>{this.state.dict['main.close']}</Button> - ]} - destroyOnClose - > - {config.tab ? <SubTabTable - BID={triggerTime} - Tab={config.tab} - MenuID={config.tab.linkTab} - SupMenuID={this.props.MenuID} - /> : null} - </Modal> - {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} - </div> - ) - } -} - -export default MkCalendar \ No newline at end of file diff --git a/src/tabviews/calendar/index.scss b/src/tabviews/calendar/index.scss deleted file mode 100644 index 23d25cf..0000000 --- a/src/tabviews/calendar/index.scss +++ /dev/null @@ -1,44 +0,0 @@ -.calendar-page { - position: relative; - min-height: calc(100vh - 94px); - padding-top: 16px; - padding-bottom: 80px; - .box404 { - padding-top: 30px; - } - >.mk-search-wrap { - padding: 0px 24px 5px; - border-bottom: 1px solid #efefef; - } - - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } - > .ant-spin { - position: absolute; - z-index: 10; - left: calc(50% - 22px); - top: calc(50vh - 70px); - } - - .common-table-copy { - position: fixed; - z-index: 2; - bottom: 65px; - right: 30px; - width: 40px; - height: 40px; - } -} - - diff --git a/src/tabviews/custom/components/calendar/board/index.jsx b/src/tabviews/custom/components/calendar/board/index.jsx index 911cc2d..77727e6 100644 --- a/src/tabviews/custom/components/calendar/board/index.jsx +++ b/src/tabviews/custom/components/calendar/board/index.jsx @@ -1,10 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Select, Radio, Row, Col } from 'antd' +import { Select, Radio, Row, Col, Popover, Badge } from 'antd' import moment from 'moment' import 'moment/locale/zh-cn' +import MKEmitter from '@/utils/events.js' import './index.scss' const { Option } = Select @@ -55,16 +56,53 @@ } UNSAFE_componentWillReceiveProps(nextProps) { - if (!is(fromJS(this.props.config.wrap), fromJS(nextProps.config.wrap))) { + const { datelist } = this.state + if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { this.setState({ - levels: nextProps.config.wrap.levels, - level: nextProps.config.wrap.levels[0] + datelist: this.mountdata(datelist, nextProps.data) }) } } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) + } + + mountdata = (datelist, data) => { + return fromJS(datelist).toJS().map(month => { + month.subData = [] + data.forEach(item => { + if (item.$startM <= month.time && item.$endM >= month.time) { + month.subData.push(item) + } + }) + + month.children = month.children.map(week => { + week.children = week.children.map(day => { + if (day.$disable) return day + + day.subData = [] + day.style = null + day.$level = 100 + data.forEach(item => { + if (item.$start <= day.time && item.$end >= day.time) { + day.subData.push(item) + + if (!day.style) { + day.style = item.$style + day.$level = item.$level + } else if (item.$level < day.$level) { + day.style = item.$style + day.$level = item.$level + } + } + }) + return day + }) + return week + }) + return month + }) } getNongLi = (nyear, nmonth, nday, week) => { @@ -307,7 +345,7 @@ let item = { day: _day, - time: times[0] + times[1] + _day, + time: +(times[0] + times[1] + _day), label: _day, subData: [], $disable: true, @@ -323,7 +361,7 @@ let item = { day: _day, - time: selectYear + month + _day, + time: +(selectYear + month + _day), label: i, subData: [], ...nl @@ -348,7 +386,7 @@ let item = { day: _day, - time: times[0] + times[1] + _day, + time: +(times[0] + times[1] + _day), label: i, subData: [], $disable: true, @@ -366,7 +404,7 @@ datelist.push({ month: month, - time: selectYear + month, + time: +(selectYear + month), label: monthName[month], children: _weeklist, subData: [] @@ -381,11 +419,19 @@ } yearChange = (value) => { + const { data } = this.props const { selectMonth } = this.state let datelist = this.getDateList(value) + + if (data.length > 0) { + datelist = this.mountdata(datelist, data) + } + let monthlist = datelist.filter(item => item.month === selectMonth)[0].children.filter(cell => !cell.children[0].$disable || !cell.children[6].$disable) this.setState({ selectYear: value, datelist, monthlist }) + + this.props.yearChange(value) } monthChange = (value) => { @@ -402,12 +448,86 @@ }) } + triggerDay = (d) => { + const { config } = this.props + + if (!config.setting.linkbtn) return + + let id = d.time + '' + id = id.substr(0, 4) + '-' + id.substr(4, 2) + '-' + id.substr(6) + + MKEmitter.emit('triggerBtnId', config.setting.linkbtn, [{$$uuid: id}]) + } + + openView = (data, e) => { + const { config } = this.props + + if (!config.wrap.click) return + + e && e.stopPropagation() + + if (config.wrap.click === 'menus') { + let menu = null + + if (config.wrap.menus && config.wrap.menus.length > 0) { + let s = data[config.wrap.menuType] + '' + config.wrap.menus.forEach(m => { + if (s !== m.sign) return + menu = m + }) + } + if (!menu) return + + let newtab = { + MenuID: menu.MenuID, + MenuName: menu.MenuName, + MenuNo: menu.MenuNo || '', + type: menu.tabType, + param: {$BID: data.$$uuid || ''} + } + + Object.keys(data).forEach(key => { + if (/^\$/.test(key)) return + newtab.param[key] = data[key] + }) + + MKEmitter.emit('modifyTabs', newtab, true) + } else if (config.wrap.click === 'menu') { + let menuId = config.wrap.MenuID || config.wrap.menu.slice(-1)[0] + let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + + if (!menu && config.wrap.MenuName && config.wrap.tabType) { + menu = { + MenuID: menuId, + MenuName: config.wrap.MenuName, + MenuNo: config.wrap.MenuNo || '', + type: config.wrap.tabType + } + } + + if (!menu) return + + let newtab = { + ...menu, + param: {$BID: data.$$uuid || ''} + } + + Object.keys(data).forEach(key => { + if (/^\$/.test(key)) return + newtab.param[key] = data[key] + }) + + MKEmitter.emit('modifyTabs', newtab, true) + } + } + render() { + const { config } = this.props const { level, selectYear, selectMonth, yearlist, levels, datelist, monthlist } = this.state const _levelName = {day: '鏃�', month: '鏈�', year: '骞�'} return ( - <div className="mk-calendar"> + <div className={'mk-calendar' + (config.setting.linkbtn ? ' open-pop' : '') + (config.wrap.click ? ' open-menu' : '')}> <div className="mk-calendar-control"> <Select value={selectYear} onChange={this.yearChange}> {yearlist.map(item => (<Option key={item} value={item}>{item}骞�</Option>))} @@ -448,8 +568,23 @@ <tr key={m}> {cell.children.map((d, i) => ( <td key={i}> - <div className={'day-wrap' + (d.$disable ? ' disabled' : '')}> - {d.label} + <div style={d.style} className={'day-wrap' + (d.$disable ? ' disabled' : '')} onClick={() => !d.$disable && this.triggerDay(d)}> + {d.subData.length > 0 ? <Popover mouseEnterDelay={0.3} overlayClassName={'calendar-day-pop' + (config.wrap.click ? ' open-menu' : '')} content={ + <div onClick={(e) => e.stopPropagation()}> + {d.subData.map((data, index) => ( + <div key={index} className="message" onClick={() => this.openView(data)}> + <Badge color={data.$color} text={ + <span> + {data.$message} + <span style={{color: 'rgba(0,0,0,.45)'}}>({data.$startTime + ' ~ ' + data.$endTime})</span> + </span>} + /> + </div> + ))} + </div> + } trigger="hover"> + {d.label} + </Popover> : d.label} </div> </td> ))} @@ -472,7 +607,7 @@ <tr key={m}> {cell.children.map((d, i) => ( <td key={i}> - <div className={'month-wrap' + (d.$disable ? ' disabled' : '')}> + <div className={'month-wrap' + (d.$disable ? ' disabled' : '')} onClick={() => !d.$disable && this.triggerDay(d)}> <div className="header"> <div className="message"> {d.label} @@ -483,7 +618,13 @@ <span className="right">{d.jr}</span> </div> </div> - <ul className="content"></ul> + <ul className="content"> + {d.subData.map((data, index) => ( + <li key={index} className="message" onClick={(e) => this.openView(data, e)}> + <Badge color={data.$color} text={data.$message} /> + </li> + ))} + </ul> </div> </td> ))} @@ -499,7 +640,13 @@ <div className="header"> {item.label} </div> - <ul className="content"></ul> + <ul className="content"> + {item.subData.map((data, index) => ( + <li key={index} className="message" onClick={() => this.openView(data)}> + <Badge color={data.$color} text={`${data.$message} (${data.$startTime} ~ ${data.$endTime})`}/> + </li> + ))} + </ul> </div> </Col> ))} diff --git a/src/tabviews/custom/components/calendar/board/index.scss b/src/tabviews/custom/components/calendar/board/index.scss index b79db1a..3957fc3 100644 --- a/src/tabviews/custom/components/calendar/board/index.scss +++ b/src/tabviews/custom/components/calendar/board/index.scss @@ -111,15 +111,28 @@ } .content { padding: 0 10px 10px; - height: 70px; + height: 55px; overflow-y: auto; position: absolute; left: 0; right: 0; .message { width: 100%; + white-space: nowrap; + overflow: hidden; + .ant-badge { + width: 100%; + } .ant-badge-status-text { - color: inherit; + font-size: 13px; + width: calc(100% - 15px); + overflow: hidden; + word-break: break-word; + white-space: nowrap; + text-overflow: ellipsis; + height: 21px; + display: inline-block; + vertical-align: top; } } } @@ -163,7 +176,6 @@ .year-wrap { width: calc(100% - 2px); box-shadow: 0px 0px 3px var(--mk-sys-color2); - cursor: pointer; transition: background 0.1s; .header { text-align: center; @@ -182,7 +194,20 @@ width: 100%; overflow: hidden; margin-bottom: 5px; - text-overflow: ellipsis; + .ant-badge { + width: 100%; + } + .ant-badge-status-text { + font-size: 13px; + width: calc(100% - 15px); + overflow: hidden; + word-break: break-word; + white-space: nowrap; + text-overflow: ellipsis; + height: 21px; + display: inline-block; + vertical-align: top; + } } } .content::-webkit-scrollbar { @@ -206,6 +231,28 @@ } } } +.mk-calendar:not(.open-pop) { + .day-wrap { + cursor: default!important; + } + .month-wrap { + cursor: default!important; + } +} +.mk-calendar.open-menu { + .month-wrap, .year-wrap { + .content { + .message { + cursor: pointer; + } + } + } +} +.calendar-day-pop.open-menu { + .message { + cursor: pointer; + } +} .calendar-day-pop { .message { .ant-badge-status-text { @@ -215,10 +262,17 @@ vertical-align: middle; } } + .ant-popover-inner { + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); + } .ant-popover-inner-content { - min-height: 100px; + padding: 0px; + min-height: 45px; max-height: 200px; overflow-y: auto; + >div { + padding: 12px 16px; + } } .ant-popover-inner-content::-webkit-scrollbar { width: 5px; diff --git a/src/tabviews/custom/components/calendar/index.jsx b/src/tabviews/custom/components/calendar/index.jsx index c9ba92b..628bfeb 100644 --- a/src/tabviews/custom/components/calendar/index.jsx +++ b/src/tabviews/custom/components/calendar/index.jsx @@ -8,12 +8,12 @@ import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import CalendarBoard from './board' import './index.scss' const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton')) -const CalendarBoard = asyncComponent(() => import('./board')) class NormalCalendar extends Component { static propTpyes = { @@ -25,7 +25,7 @@ BID: '', // 涓婄骇ID config: null, // 鍥捐〃閰嶇疆淇℃伅 loading: false, // 鏁版嵁鍔犺浇鐘舵�� - data: null, // 鏁版嵁 + data: [], // 鏁版嵁 search: '', year: new Date().getFullYear(), BData: '' @@ -55,6 +55,16 @@ _config.setting.$re_year = true } + if (_config.wrap.colorField && (!_config.wrap.signs || _config.wrap.signs.length === 0)) { + _config.wrap.colorField = '' + } + + if (_config.action[0] && _config.action[0].config && _config.action[0].config.enabled) { + _config.setting.linkbtn = _config.action[0].uuid + } else { + _config.action = [] + } + this.setState({ BID: BData ? (BData.$BID || '') : '', BData: BData, @@ -81,13 +91,19 @@ Api.getLCacheConfig(config.uuid).then(res => { if (!res || this.loaded) return - this.setState({data: res.map((item, index) => { + let data = [] + res.forEach((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' - item.$Index = index + 1 + '' - - return item - })}) + + let pass = this.resetLine(item) + + if (pass) { + data.push(item) + } + }) + + this.setState({data: data}) }) } } @@ -196,19 +212,24 @@ Api.writeCacheConfig(config.uuid, result.data || '') } - let data = result.data.map((item, index) => { + let data = [] + result.data.forEach((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' - return item + let pass = this.resetLine(item) + + if (pass) { + data.push(item) + } }) this.setState({ data: data, loading: false }) - + if (result.message) { if (result.ErrCode === 'Y') { Modal.success({ @@ -242,9 +263,57 @@ } } + resetLine = (item) => { + const { config: { wrap } } = this.state + + let startTime = item[wrap.timeField] || '' + let endTime = item[wrap.endField || wrap.timeField] || '' + + item.$message = item[wrap.remarkField] + + if (!/^(1|2)\d{3}(-|\/)\d{2}(-|\/)\d{2}/.test(startTime)) return false + if (!/^(1|2)\d{3}(-|\/)\d{2}(-|\/)\d{2}/.test(endTime)) return false + if (!item.$message) return false + + if (wrap.colorField) { + let sign = item[wrap.colorField] || '' + + wrap.signs.forEach(cell => { + if (cell.sign !== sign) return + + item.$style = cell.style + item.$color = cell.background + item.$level = cell.$index + }) + } + + let equal = endTime.substr(0, 4) === startTime.substr(0, 4) + + item.$startM = +(startTime.substr(0, 4) + startTime.substr(5, 2)) + item.$endM = +(endTime.substr(0, 4) + endTime.substr(5, 2)) + item.$start = +(startTime.substr(0, 4) + startTime.substr(5, 2) + startTime.substr(8, 2)) + item.$end = +(endTime.substr(0, 4) + endTime.substr(5, 2) + endTime.substr(8, 2)) + item.$startTime = equal ? `${startTime.substr(5, 2)}-${startTime.substr(8, 2)}` : `${startTime.substr(0, 4)}-${startTime.substr(5, 2)}-${startTime.substr(8, 2)}` + item.$endTime = equal ? `${endTime.substr(5, 2)}-${endTime.substr(8, 2)}` : `${endTime.substr(0, 4)}-${endTime.substr(5, 2)}-${endTime.substr(8, 2)}` + + return true + } + refreshbysearch = (searches) => { this.setState({ search: searches + }, () => { + this.loadData() + }) + } + + yearChange = (value) => { + const { config } = this.state + + if (!config.setting.$re_year) return + + this.setState({ + year: value }, () => { this.loadData() }) @@ -257,7 +326,7 @@ <div className="normal-calendar-box" id={'anchor' + config.uuid} style={{...config.style}}> {loading ? <div className="loading-mask"> - {data ? <div className="ant-spin-blur"></div> : null} + <div className="ant-spin-blur"></div> <Spin /> </div> : null } @@ -268,7 +337,7 @@ {config.action[0] ? <PopupButton disabled={false} BID={BID} btn={config.action[0]} BData={BData} setting={config.setting} selectedData={[]}/> : null } - <CalendarBoard config={config} /> + <CalendarBoard config={config} data={data} yearChange={this.yearChange}/> </div> ) } diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index 78d631f..7f6990c 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -247,10 +247,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鏍囩鍏抽棴鍒锋柊 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } } diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 85b86b8..1a1c2c6 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -266,6 +266,8 @@ if (card.style && card.style.clear === 'left') { _style_ = {clear: 'left'} + } else if (card.style && card.style.clear === 'right') { + _style_ = {float: 'right'} } if (card.eleType === 'sequence') { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index d83be3c..8ab93fe 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -95,6 +95,14 @@ } } + if (item.style.clear === 'left') { + item.wStyle = {clear: 'left'} + } else if (item.style.clear === 'right') { + item.wStyle = {float: 'right'} + } + + delete item.style.clear + if (item.$cardType !== 'extendCard') { _card = item } else if (!_card) { @@ -372,10 +380,6 @@ } else { this.loadData(id) } - } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) } } @@ -1042,7 +1046,7 @@ {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} <Row className={'card-row-list ' + config.wrap.layout}> {precards.map((item, index) => ( - <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}> + <Col key={'pre' + index} className="extend-card" style={item.wStyle} span={item.setting.width || 6}> {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} </TableHeader> : <CardItem card={item} cards={config} data={extendData}> @@ -1066,7 +1070,7 @@ } return ( - <Col className={className} key={index} span={card.setting.width}> + <Col className={className} key={index} style={card.wStyle} span={card.setting.width}> <CardItem card={card} cards={config} data={item} onClick={() => {this.changeCard(index, item)}}> <span className="circle-select"></span> </CardItem> @@ -1074,7 +1078,7 @@ ) })} {nextcards.map((item, index) => ( - <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}> + <Col key={'next' + index} className="extend-card" style={item.wStyle} span={item.setting.width || 6}> {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} </TableHeader> : <CardItem card={item} cards={config} data={extendData}> diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 1fe03f6..08f6dd9 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -93,6 +93,14 @@ } } + if (item.style.clear === 'left') { + item.wStyle = {clear: 'left'} + } else if (item.style.clear === 'right') { + item.wStyle = {float: 'right'} + } + + delete item.style.clear + if (item.$cardType !== 'extendCard') { _card = item } else if (!_card) { @@ -320,10 +328,6 @@ }) } else { this.loadData(id) - } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) } } @@ -1042,7 +1046,7 @@ <div className={`data-zoom ${config.wrap.wrapClass}`} style={config.wrap.minWidth ? {minWidth: config.wrap.minWidth} : null}> <Row className={'card-row-list '}> {precards.map((item, index) => ( - <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}> + <Col key={'pre' + index} className="extend-card" style={item.wStyle} span={item.setting.width || 6}> {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} </TableHeader> : <CardItem card={item} cards={config} data={extendData}> @@ -1074,7 +1078,7 @@ } return ( - <Col key={index} span={card.setting.width}> + <Col key={index} span={card.setting.width} style={card.wStyle}> <div className={className} style={wrapStyle}> <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(index, subClass)} onClick={() => {this.changeCard(index, item, subClass)}}> <span className="circle-select"></span> @@ -1091,7 +1095,7 @@ ) })} {nextcards.map((item, index) => ( - <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}> + <Col key={'next' + index} className="extend-card" style={item.wStyle} span={item.setting.width || 6}> {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} </TableHeader> : <CardItem card={item} cards={config} data={extendData}> diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index c8bc94d..837a22d 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -95,6 +95,14 @@ card.setting.click = '' } } + + if (card.style.clear === 'left') { + card.wStyle = {clear: 'left'} + } else if (card.style.clear === 'right') { + card.wStyle = {float: 'right'} + } + + delete card.style.clear }) let selected = _config.wrap.selected || 'false' @@ -322,10 +330,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } refreshLineData = (menuId, btn, uuid, count) => { @@ -536,7 +540,7 @@ } return ( - <Col className={className} key={index} span={item.setting.width || 6} offset={item.offset || 0}> + <Col className={className} key={index} style={item.wStyle} span={item.setting.width || 6} offset={item.offset || 0}> <CardItem card={item} cards={config} data={data} onClick={() => {this.changeCard(index, item)}}/> </Col> ) diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index f89d678..c23e2c7 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -211,10 +211,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } refreshLineData = (menuId, btn, uuid, count) => { diff --git a/src/tabviews/custom/components/card/tableHeader/index.jsx b/src/tabviews/custom/components/card/tableHeader/index.jsx index c3e229f..ee5030f 100644 --- a/src/tabviews/custom/components/card/tableHeader/index.jsx +++ b/src/tabviews/custom/components/card/tableHeader/index.jsx @@ -70,6 +70,8 @@ if (item.style && item.style.clear === 'left') { _style_ = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + _style_ = {float: 'right'} } let val = '' diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 45c79ef..50fdeb2 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -222,10 +222,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } resetParentParam = (MenuID, id, data) => { diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 3084bba..b5806a3 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -225,10 +225,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } resetParentParam = (MenuID, id, data) => { diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index 3090207..71aed16 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Spin, Tooltip, message, Modal, notification } from 'antd' -import { UndoOutlined, RedoOutlined, VerticalAlignTopOutlined, VerticalAlignBottomOutlined, SaveOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined, QuestionCircleOutlined } from '@ant-design/icons' +import { UndoOutlined, RedoOutlined, VerticalAlignTopOutlined, VerticalAlignBottomOutlined, SaveOutlined, ZoomInOutlined, ZoomOutOutlined, OneToOneOutlined, QuestionCircleOutlined, ClearOutlined } from '@ant-design/icons' import { Graph, Shape } from '@antv/x6' import { Stencil } from '@antv/x6-plugin-stencil' import { Transform } from '@antv/x6-plugin-transform' @@ -17,10 +17,11 @@ import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import NormalHeader from '@/tabviews/custom/components/share/normalheader' -import lanes from '@/menu/components/chart/antv-X6/lane.json' -import xflows from '@/menu/components/chart/antv-X6/xflow.json' +// import lanes from '@/menu/components/chart/antv-X6/lane.json' +// import xflows from '@/menu/components/chart/antv-X6/xflow.json' import './index.scss' +const { confirm } = Modal const NodeUpdate = asyncComponent(() => import('./nodeupdate')) const groups = { @@ -483,13 +484,14 @@ } async loadData () { - const { config, BID } = this.state + const { BID } = this.state - if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� + if (!BID) { if (!is(fromJS(this.data), fromJS([]))) { this.cells = [] this.handleData() } + this.setState({empty: true}) return } @@ -497,35 +499,27 @@ loading: true }) - if (config) { - if (config.plot.subtype === 'xflow') { - this.cells = xflows - } else { - this.cells = lanes - } - this.handleData() - - setTimeout(() => { - this.setState({ - loading: false - }) - }, 2000) - return - } - let param = { - func: '', - BID: BID + func: 's_get_works_flow_local_param_v6', + ID: BID } let result = await Api.genericInterface(param) if (result.status) { + let item = result.data && result.data[0] ? result.data[0] : null + let cells = [] + + if (item && item.long_param) { + let long_param = JSON.parse(window.decodeURIComponent(window.atob(item.long_param))) + cells = long_param.cells || [] + } + + this.cells = cells + this.handleData() + this.setState({ loading: false }) - - this.cells = result.data || [] - this.handleData() if (result.message) { if (result.ErrCode === 'Y') { @@ -1357,13 +1351,68 @@ } save = () => { - // let nodes = this.mkGraph.toJSON() - // this.mkGraph.toPNG((dataUri) => { - // Api.fileuploadbase64({ - // Base64Img: dataUri - // }).then(res => { - // }) - // }, {padding: 20}) + const { BID } = this.state + + if (!BID) { + Modal.error({ + title: '鏈幏鍙栧埌娴佺▼ID锛屼笉鍙繚瀛橈紒', + }) + return + } + + this.setState({ + loading: true + }) + + let nodes = this.mkGraph.toJSON() + this.mkGraph.toPNG((dataUri) => { + let param = { + func: 's_works_flow_param_upt_v6', + long_param: window.btoa(window.encodeURIComponent(JSON.stringify(nodes))), + flow_image: dataUri, + ID: BID, + BID: '' + } + + Api.genericInterface(param).then(res => { + if (res.status) { + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛锛�', + duration: 2 + }) + } else { + notification.error({ + top: 92, + message: res.message, + duration: 10 + }) + } + + this.setState({ + loading: false + }) + }) + }, {padding: 20}) + } + + clearNode = () => { + let cells = this.mkGraph.getCells() + const that = this + + if (cells.length === 0) return + + confirm({ + title: '纭畾娓呯┖鍏冪礌鍚�?', + content: '娓呯┖鍚庝笉鍙仮澶嶃��', + okText: '纭畾', + cancelText: '鍙栨秷', + onOk() { + that.mkGraph.removeCells(cells) + that.mkGraph.cleanHistory() + }, + onCancel() {} + }) } deleteLane = (cell, graph) => { @@ -1693,11 +1742,13 @@ if (config.plot.function === 'show') { if (config.plot.empty === 'hidden' && this.cells.length === 0) { - style.display = 'none' + style.position = 'absolute' + style.width = '100%' + style.zIndex = -1 } return ( - <div className="custom-x6-plot-box" id={'anchor' + config.uuid} style={config.style}> + <div className="custom-x6-plot-box" id={'anchor' + config.uuid} style={style}> {loading ? <div className="loading-mask"> <div className="ant-spin-blur"></div> @@ -1744,6 +1795,9 @@ <Tooltip title="鍓嶈繘"> <RedoOutlined onClick={this.setprev}/> </Tooltip> + <Tooltip title="娓呯┖"> + <ClearOutlined onClick={this.clearNode}/> + </Tooltip> <Tooltip overlayStyle={{maxWidth: 260}} title="蹇嵎閿細澶嶅埗锛坈trl+c锛夈�佸壀鍒囷紙ctrl+x锛夈�佺矘璐达紙ctrl+v锛夈�佸悗閫�锛坈trl+z锛夈�佸墠杩涳紙ctrl+shift+z锛夈�佸垹闄わ紙backspace 鎴� delete锛�"> <QuestionCircleOutlined /> </Tooltip> 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 68651c3..4f83a14 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -442,10 +442,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } reloadData = (menuId) => { diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index 405cdc5..1c96f7a 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -182,10 +182,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } reloadData = (menuId) => { diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index 6d9ee7b..2270240 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -170,10 +170,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } reloadData = (menuId) => { diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 9aa9dcb..4d1bb99 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -158,7 +158,7 @@ if (group.uuid !== menuId) return - if (position === 'mainline' && config.setting.supModule && BID) { + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { this.loadData() @@ -226,6 +226,7 @@ }, () => { this.setState({data: {$$empty: true}}) }) + MKEmitter.emit('resetSelectLine', config.uuid, '', '') return } @@ -256,6 +257,8 @@ this.setState({data: _data}) }) + MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) + if (result.message) { if (result.ErrCode === 'Y') { Modal.success({ diff --git a/src/tabviews/custom/components/form/simple-form/index.scss b/src/tabviews/custom/components/form/simple-form/index.scss index 123523e..78ba331 100644 --- a/src/tabviews/custom/components/form/simple-form/index.scss +++ b/src/tabviews/custom/components/form/simple-form/index.scss @@ -17,6 +17,7 @@ .submit { min-width: 70px; border: none; + border-style: solid; } } .mk-form-action.no-button { diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 50d09cc..3965ad6 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -205,7 +205,7 @@ if (group.uuid !== menuId) return - if (position === 'mainline' && config.setting.supModule && BID) { + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { this.loadData() @@ -285,6 +285,7 @@ }, () => { this.setState({data: {$$empty: true}}) }) + MKEmitter.emit('resetSelectLine', config.uuid, '', '') return } @@ -334,6 +335,8 @@ this.setState({group: _group}) }) + MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) + if (result.message) { if (result.ErrCode === 'Y') { Modal.success({ diff --git a/src/tabviews/custom/components/form/step-form/index.scss b/src/tabviews/custom/components/form/step-form/index.scss index 12ca54d..8a2908a 100644 --- a/src/tabviews/custom/components/form/step-form/index.scss +++ b/src/tabviews/custom/components/form/step-form/index.scss @@ -71,6 +71,7 @@ .submit { min-width: 70px; border: none; + border-style: solid; } .skip { color: rgba(0, 0, 0, 0.85); diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 4909bf9..988b04c 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -175,7 +175,7 @@ if (group.uuid !== menuId) return - if (position === 'mainline' && config.setting.supModule && BID) { + if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { MKEmitter.emit('reloadData', config.setting.supModule, BID) } else { this.loadData() @@ -242,6 +242,7 @@ }, () => { this.setState({data: {$$empty: true}}) }) + MKEmitter.emit('resetSelectLine', config.uuid, '', '') return } @@ -272,6 +273,8 @@ this.setState({data: _data}) }) + MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) + if (result.message) { if (result.ErrCode === 'Y') { Modal.success({ diff --git a/src/tabviews/custom/components/form/tab-form/index.scss b/src/tabviews/custom/components/form/tab-form/index.scss index a079e22..04a53bd 100644 --- a/src/tabviews/custom/components/form/tab-form/index.scss +++ b/src/tabviews/custom/components/form/tab-form/index.scss @@ -60,6 +60,7 @@ .submit { min-width: 70px; border: none; + border-style: solid; } } .mk-form-action.no-button { diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index 0b147bf..52a33a1 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -158,6 +158,8 @@ if (item.style && item.style.clear === 'left') { style = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + style = {float: 'right'} } if (item.type === 'card' && item.subtype === 'datacard') { diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index ec4a65c..2e26fb1 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -184,6 +184,8 @@ if (item.style && item.style.clear === 'left') { style = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + style = {float: 'right'} } if (item.type === 'card' && item.subtype === 'datacard') { diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index d5d7bf5..6b910ec 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -543,10 +543,6 @@ } else { this.reloadtable(btn, id) } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } UNSAFE_componentWillReceiveProps(nextProps) { diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index ea9d56a..cbbbbed 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -511,10 +511,6 @@ } else { this.reloadtable(btn) } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } refreshLineData = (menuId, btn, uuid, count) => { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 3d87ac8..c9a2e15 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -615,10 +615,6 @@ } else { this.reloadtable(btn, id) } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } refreshLineData = (menuId, btn, uuid, count) => { diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 3a8bb7e..2690fad 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -204,10 +204,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } refreshLineData = (menuId, btn, uuid, count) => { diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index 4bde860..e924dd2 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -218,10 +218,6 @@ } else { this.loadData() } - - if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」 - btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) - } } /** diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index be64acf..08d35b5 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -1289,6 +1289,8 @@ if (item.style && item.style.clear === 'left') { style = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + style = {float: 'right'} } if (item.type === 'card' && item.subtype === 'datacard') { diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 7c45f53..4c74eee 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -497,6 +497,7 @@ group.subButton.OpenType = 'formSubmit' group.subButton.execError = 'never' group.subButton.logLabel = item.$menuname + '-' + group.subButton.label + group.subButton.$tabId = Tab.uuid if (!group.subButton.Ot) { group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' @@ -916,6 +917,8 @@ if (item.style && item.style.clear === 'left') { style = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + style = {float: 'right'} } if (item.type === 'card' && item.subtype === 'datacard') { diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx deleted file mode 100644 index 9b97235..0000000 --- a/src/tabviews/formtab/actionList/index.jsx +++ /dev/null @@ -1,368 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import moment from 'moment' -import { Button, Modal, notification, message } from 'antd' -import Utils, { getSysDefaultSql } from '@/utils/utils.js' -import options from '@/store/options.js' -import Api from '@/api' -import './index.scss' - -const { confirm } = Modal - -class MainAction extends Component { - static propTpyes = { - MenuID: PropTypes.string, // 鑿滃崟ID - primaryId: PropTypes.string, // 涓婚敭 - actions: PropTypes.array, // 鎸夐挳缁� - dict: PropTypes.object, // 瀛楀吀椤� - data: PropTypes.any, // 鏁版嵁 - setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - getFormData: PropTypes.func, // 鑾峰彇琛ㄥ崟鍊� - refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� - } - - state = { - formdata: null, - loadingUuid: '' - } - - /** - * @description 瑙﹀彂鎸夐挳鎿嶄綔 - */ - actionTrigger = (item) => { - const { data } = this.props - let _this = this - - if (item.btnType !== 'cancel') { - this.props.getFormData().then(res => { - if (item.OpenType === 'prompt') { - confirm({ - title: this.props.dict['main.action.confirm.tip'], - onOk() { - return new Promise(resolve => { - _this.execSubmit(item, data, resolve, res) - }) - }, - onCancel() {} - }) - } else if (item.OpenType === 'exec') { - this.setState({loadingUuid: item.uuid}) - - this.execSubmit(item, data, () => { - this.setState({loadingUuid: ''}) - }, res) - } - }) - } else { - item.afterExecSuccess = 'close' - this.props.refreshdata(item, 'success', '') - } - } - - /** - * @description 鎸夐挳鎻愪氦鎵ц - */ - execSubmit = (btn, data, _resolve, formdata) => { - const { setting, primaryId } = this.props - - let _primaryId = primaryId - - if (btn.intertype === 'inner') { - let param = { // 绯荤粺瀛樺偍杩囩▼ - func: btn.innerFunc, - BID: '' - } - - param[setting.primaryKey] = primaryId - - formdata.forEach(_data => { - param[_data.key] = _data.value - }) - - if (!param[setting.primaryKey]) { - param[setting.primaryKey] = Utils.getguid() - } - - _primaryId = param[setting.primaryKey] - - Api.genericInterface(param).then((res) => { - if (res.status) { - this.execSuccess(btn, res, _primaryId, formdata) - } else { - this.execError(res, btn) - } - _resolve() - }) - } else if (btn.intertype === 'system') { - // 浣跨敤绯荤粺鎺ュ彛鏃讹紝鏁版嵁婧愪笉鍙负绌�, 浣跨敤绯荤粺鍑芥暟鏃讹紝绫诲瀷涓嶅彲涓虹┖ - if (!btn.sql || !btn.sqlType) { - this.actionSettingError() - _resolve() - return - } - - // 鍒涘缓鍑瘉鏃讹紝闇�瑕侀�夋嫨琛屾椂 - if (!data && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { - notification.warning({ - top: 92, - message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', - duration: 5 - }) - return - } - - let param = { // 绯荤粺瀛樺偍杩囩▼ - func: 'sPC_TableData_InUpDe', - exec_type: 'y', // 鍚庡彴瑙g爜 - BID: '' - } - - if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid - param.ID = Utils.getguid() - param.LText = getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - - _primaryId = param.ID - } else if (btn.sql && btn.sqlType === 'insertOrUpdate') { // 绯荤粺鍑芥暟娣诲姞鎴栦慨鏀规椂 - param.ID = primaryId || Utils.getguid() - param.LText = getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - - _primaryId = param.ID - } else if (btn.sql) { - param.ID = primaryId - param.LText = getSysDefaultSql(btn, setting, formdata, param, data, []) // 鏁版嵁婧� - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } - - if (window.GLOB.mkHS && param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - Api.genericInterface(param).then((res) => { - if (res.status) { - this.execSuccess(btn, res, _primaryId, formdata) - } else { - this.execError(res, btn) - } - _resolve() - }) - } else if (btn.intertype === 'outer') { - /** *********************璋冪敤澶栭儴鎺ュ彛************************* */ - - if (!btn.interface) { // 鎺ュ彛鍦板潃涓嶅瓨鍦ㄦ椂鎶ラ敊 - this.actionSettingError() - _resolve() - return - } - - let param = { - BID: '' - } - - param[setting.primaryKey] = primaryId - - formdata.forEach(_data => { - param[_data.key] = _data.value - }) - - if (!param[setting.primaryKey]) { - param[setting.primaryKey] = Utils.getguid() - } - _primaryId = param[setting.primaryKey] - - let _outParam = null - - new Promise(resolve => { - // 鍐呴儴璇锋眰 - if (btn.innerFunc) { - param.func = btn.innerFunc - // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞� - Api.genericInterface(param).then(res => { - if (res.status) { - delete res.ErrCode - delete res.ErrMesg - delete res.message - delete res.status - - // 浣跨敤澶勭悊鍚庣殑鏁版嵁璋冪敤澶栭儴鎺ュ彛 - resolve(res) - } else { - this.execError(res, btn) - resolve(false) - _resolve() - } - }) - } else { - resolve(param) - } - }).then(res => { - if (!res) return - // 澶栭儴璇锋眰 - _outParam = JSON.parse(JSON.stringify(res)) - - if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { - res.rduri = options.cloudServiceApi - res.userid = sessionStorage.getItem('CloudUserID') || '' - res.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } else if (btn.sysInterface !== 'true') { - res.rduri = btn.interface - } - } else { - if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { - res.rduri = window.GLOB.mainSystemApi - } else if (btn.sysInterface !== 'true') { - res.rduri = btn.interface - } - } - - if (btn.outerFunc) { - res.func = btn.outerFunc - } - - return Api.genericInterface(res) - }).then(response => { - if (!response) return - // 鍥炶皟璇锋眰 - if (btn.callbackFunc) { - // 瀛樺湪鍥炶皟鍑芥暟鏃讹紝璋冪敤 - delete response.message - delete response.status - - response.func = btn.callbackFunc - - let _callbackparam = {..._outParam, ...response} - return Api.genericInterface(_callbackparam) - } else { - if (response.status) { - this.execSuccess(btn, response, _primaryId, formdata) - _resolve() - } else { - this.execError(response, btn) - _resolve() - } - } - }).then(res => { - if (!res) return - - if (res.status) { - this.execSuccess(btn, res, _primaryId, formdata) - _resolve() - } else { - this.execError(res, btn) - _resolve() - } - }) - - } else { - this.actionSettingError() - _resolve() - return - } - } - - /** - * @description 鎿嶄綔鎴愬姛鍚庡鐞� - * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� - * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� - * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� - * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� - * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� - */ - execSuccess = (btn, res, primaryId, formdata) => { - if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 - notification.success({ - top: 92, - message: res.ErrMesg || this.props.dict['main.action.confirm.success'], - duration: 2 - }) - } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず - - } - - this.props.refreshdata(btn, 'success', primaryId, formdata) - } - - /** - * @description 鎿嶄綔澶辫触鍚庡鐞� - * 1銆佺姸鎬佺爜涓� E銆丯銆丗銆丯M 鏃讹紝鏄剧ず鐩稿簲鎻愮ず淇℃伅 - * 2銆乪xcel瀵煎嚭锛屽け璐ュ悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� - * 3銆侀�氱煡涓诲垪琛ㄥ埛鏂� - */ - execError = (res, btn) => { - if (res.ErrCode === 'E') { - Modal.error({ - title: res.message || res.ErrMesg, - }) - } else if (res.ErrCode === 'N') { - notification.error({ - top: 92, - message: res.message || res.ErrMesg, - duration: 10 - }) - } else if (res.ErrCode === 'F') { - notification.error({ - className: 'notification-custom-error', - top: 92, - message: res.message || res.ErrMesg, - duration: 10 - }) - } else if (res.ErrCode === 'NM') { - message.error(res.message || res.ErrMesg) - } - - this.props.refreshdata(btn, 'error') - } - - /** - * @description 鎸夐挳閰嶇疆淇℃伅閿欒鎻愮ず - */ - actionSettingError = () => { - notification.warning({ - top: 92, - message: '鎸夐挳璁剧疆閿欒锛�', - duration: 5 - }) - } - - - render() { - const { loadingUuid } = this.state - - return ( - <div className="button-list formtab-button"> - {this.props.actions.map((item, index) => { - if (loadingUuid === item.uuid) { - return ( - <Button - className={'mk-btn mk-' + item.class} - icon={item.icon} - key={'action' + index} - onClick={() => {this.actionTrigger(item)}} - loading - >{item.label}</Button> - ) - } else { - return ( - <Button - className={'mk-btn mk-' + item.class} - icon={item.icon} - key={'action' + index} - onClick={() => {this.actionTrigger(item)}} - >{item.label}</Button> - ) - } - })} - </div> - ) - } -} - -export default MainAction \ No newline at end of file diff --git a/src/tabviews/formtab/actionList/index.scss b/src/tabviews/formtab/actionList/index.scss deleted file mode 100644 index 3a6a441..0000000 --- a/src/tabviews/formtab/actionList/index.scss +++ /dev/null @@ -1,19 +0,0 @@ -.button-list.formtab-button { - padding: 20px 20px 10px; - background: #ffffff; - text-align: center; - button { - min-width: 70px; - margin-right: 20px; - margin-bottom: 10px; - height: 35px; - font-size: 15px; - padding: 5px 20px; - } - .ant-spin { - position: fixed; - z-index: 1010; - left: calc(50vw - 22px); - top: calc(50vh - 70px); - } -} diff --git a/src/tabviews/formtab/formgroup/index.jsx b/src/tabviews/formtab/formgroup/index.jsx deleted file mode 100644 index 53e2d67..0000000 --- a/src/tabviews/formtab/formgroup/index.jsx +++ /dev/null @@ -1,725 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification, Collapse } from 'antd' -import moment from 'moment' -import { formRule } from '@/utils/option.js' -import FileUpload from '@/tabviews/zshare/fileupload' -import './index.scss' - -const {MonthPicker} = DatePicker -const { TextArea } = Input -const { Panel } = Collapse - -class MainSearch extends Component { - static propTpyes = { - setting: PropTypes.object, // 鍩烘湰淇℃伅 - groups: PropTypes.array, // 琛ㄥ崟缁� - dict: PropTypes.object, // 瀛楀吀椤� - data: PropTypes.any, // 琛ㄦ牸鏁版嵁 - configMap: PropTypes.object, // 鎸夐挳鍙婁笅鎷夎〃鍗曢厤缃俊鎭泦 - inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 - } - - state = { - datatype: null, - readtype: null, - readin: null, - fieldlen: null, - groups: null, - formlist: [], - encrypts: [], // 鍔犲瘑瀛楁 - intercepts: [], // 鎴彇瀛楁 - record: {} - } - - UNSAFE_componentWillReceiveProps (nextProps) { - const { datatype, encrypts } = this.state - if (nextProps.data && !is(fromJS(this.props.data), fromJS(nextProps.data))) { - - let _fieldsvalue = {} - let _record = {} - Object.keys(nextProps.data).forEach(key => { - if (this.props.form.getFieldValue(key) !== undefined) { - if (datatype[key] === 'multiselect') { - let _val = nextProps.data[key] ? nextProps.data[key].split(',').filter(Boolean) : [] - _fieldsvalue[key] = _val - } else if (datatype[key] === 'date') { - let _val = nextProps.data[key] ? nextProps.data[key] : null - - if (_val) { - _val = moment(_val, 'YYYY-MM-DD') - } - - _fieldsvalue[key] = _val - } else if (datatype[key] === 'datemonth') { - let _val = nextProps.data[key] ? nextProps.data[key] : null - - if (_val) { - _val = moment(_val, 'YYYY-MM') - } - - _fieldsvalue[key] = _val - } else if (datatype[key] === 'datetime') { - let _val = nextProps.data[key] ? nextProps.data[key] : null - - if (_val) { - _val = moment(_val, 'YYYY-MM-DD HH:mm:ss') - } - - _fieldsvalue[key] = _val - } else if (datatype[key] === 'fileupload') { - let _val = nextProps.data[key] ? nextProps.data[key] : '' - - _fieldsvalue[key] = _val - } else if (datatype[key] === 'text' || datatype[key] === 'textarea') { - let _value = nextProps.data[key] - if (encrypts.includes(key)) { // 鍔犲瘑瀛楁 - try { - _value = window.btoa(window.encodeURIComponent(_value)) - } catch (e) { - console.warn(e) - } - } - - _fieldsvalue[key] = _value - } else { - _fieldsvalue[key] = nextProps.data[key] - } - } else { - let _value = nextProps.data[key] - if (encrypts.includes(key)) { // 鍔犲瘑瀛楁 - try { - _value = window.btoa(window.encodeURIComponent(_value)) - } catch (e) { - console.warn(e) - } - } - - _record[key] = _value - } - }) - - if (Object.keys(_fieldsvalue).length > 0) { - this.props.form.setFieldsValue(_fieldsvalue) - } - - this.setState({ - record: _record - }) - } - } - - UNSAFE_componentWillMount () { - const { data, groups } = this.props - - let datatype = {} - let readtype = {} - let readin = {} - let fieldlen = {} - let _formlist = [] - let encrypts = [] - let intercepts = [] - - let _groups = groups.map(group => { - group.sublist = group.sublist.map(item => { - let _readin = item.readin !== 'false' - if (item.type === 'funcvar') { - _readin = false - item.initval = '' // 鍒濆鍖栦负绌� - } - - if (item.type === 'textarea' && item.encryption === 'true') { - encrypts.push(item.field) - } - if (item.interception !== 'false') { - intercepts.push(item.field) - } - - item.initVal = item.initval ? JSON.parse(JSON.stringify(item.initval)) : '' - - let _fieldlen = item.fieldlength || 50 - if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') { - _fieldlen = item.fieldlength || 512 - } else if (item.type === 'number') { - _fieldlen = item.decimal ? item.decimal : 0 - } - - datatype[item.field] = item.type - readtype[item.field] = item.readonly === 'true' - readin[item.field] = _readin - fieldlen[item.field] = _fieldlen - - if (_readin && !/^date/.test(item.type) && data && data.hasOwnProperty(item.field)) { - let newval = data[item.field] - - if (encrypts.includes(item.field) && newval) { - try { - newval = window.decodeURIComponent(window.atob(newval)) - } catch (e) { - console.warn(e) - } - } - - item.initval = newval - } - - if (item.supvalue) { - item.supvalue = item.supvalue.split(',') - } - - _formlist.push(item) - - return item - }) - - return group - }) - - _groups = _groups.map(group => { - group.sublist = group.sublist.map(item => { - if (item.type === 'link') { - let supItem = _formlist.filter(form => form.field === item.linkField)[0] - - // 鍏宠仈鏄剧ず鍒椾腑鐨勫瓧娈靛�硷紝閫氳繃璇ュ�艰繃婊や笅鎷夐�夐」 - if (!supItem && data && data.hasOwnProperty(item.linkField)) { - supItem = {initval: data[item.linkField]} - } - - if (!supItem) { - notification.warning({ - top: 92, - message: '鏈煡璇㈠埌琛ㄥ崟銆�' + item.label + '銆嬪叧鑱斿瓧娈碉紒', - duration: 5 - }) - } else { - item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval) - } - } - return item - }) - - return group - }) - - this.setState({ - readtype: readtype, - datatype: datatype, - readin: readin, - fieldlen: fieldlen, - formlist: _formlist, - groups: _groups - }) - } - - resetform = (groups, supfields, index, fieldsvalue) => { - index++ - let subfields = [] - - supfields.forEach(supfield => { - groups = groups.map(group => { - group.sublist = group.sublist.map(item => { - if (item.type === 'link' && item.linkField === supfield.field) { - item.options = item.oriOptions.filter(option => option.ParentID === supfield.initval) - item.initval = item.options[0] ? item.options[0].Value : '' - - fieldsvalue[item.field] = item.initval - - subfields.push(item) - } - - return item - }) - return group - }) - }) - - if (subfields.length === 0 || index > 6) { - return {groups: groups, fieldsvalue: fieldsvalue} - } else { - return this.resetform(groups, subfields, index, fieldsvalue) - } - } - - selectChange = (_field, value, option) => { - const { record } = this.state - let groups = JSON.parse(JSON.stringify(this.state.groups)) - - let subfields = [] - let fieldsvalue = {} - let _record = {} - groups = groups.map(group => { - group.sublist = group.sublist.map(item => { - if (item.type === 'link' && item.linkField === _field.field) { - item.options = item.oriOptions.filter(option => option.ParentID === value) - item.initval = item.options[0] ? item.options[0].Value : '' - - fieldsvalue[item.field] = item.initval - - subfields.push(item) - } - return item - }) - return group - }) - - // 琛ㄥ崟鍒囨崲鏃讹紝鏇存柊鍏宠仈瀛楁 - if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) { - let _data = option.props.data - _field.linkSubField.forEach(subfield => { - if (this.props.form.getFieldValue(subfield) !== undefined) { - fieldsvalue[subfield] = _data[subfield] - } else { - _record[subfield] = _data[subfield] - } - }) - } - - if (subfields.length === 0) { - if (Object.keys(fieldsvalue).length > 0) { - this.props.form.setFieldsValue(fieldsvalue) - } - if (Object.keys(_record).length > 0) { - this.setState({ - record: {...record, ..._record} - }) - } - } else { - let result = this.resetform(groups, subfields, 0, fieldsvalue) - - if (Object.keys(result.fieldsvalue).length > 0) { - this.props.form.setFieldsValue(fieldsvalue) - } - - let _param = { - groups: result.groups - } - - if (Object.keys(_record).length > 0) { - _param.record = {...record, ..._record} - } - - this.setState(_param) - } - } - - getFields(formlist) { - const { getFieldDecorator } = this.props.form - - const fields = [] - let cols = 2 - if (this.props.setting && this.props.setting.cols) { - cols = parseInt(this.props.setting.cols) - if (cols > 4 || cols < 1) { - cols = 2 - } - } - - formlist.forEach((item, index) => { - if (item.hidden === 'true') return - - if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return - - if (item.type === 'text') { - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval || '', - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.input'] + item.label + '!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { // 鏁板瓧 - let min = (item.min || item.min === 0) ? item.min : -Infinity - let max = (item.max || item.max === 0) ? item.max : Infinity - let _initval = item.initval - let precision = (item.decimal || item.decimal === 0) ? item.decimal : null - - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: _initval, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + item.label + '!' - } - ] - })( - precision === null ? - <InputNumber min={min} max={max} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> : - <InputNumber min={min} max={max} precision={precision} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'select' || item.type === 'link') { // 涓嬫媺鎼滅储 - let hasSubField = false - if (item.linkSubField && item.linkSubField.length > 0) { // 瀛樺湪鍏宠仈瀛楁锛屾暟鎹瓨鍌� - hasSubField = true - } - - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={(value, option) => {this.selectChange(item, value, option)}} - disabled={item.readonly === 'true'} - > - {item.options.map(option => - <Select.Option id={option.key} data={hasSubField ? option : ''} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'multiselect') { // 澶氶�� - let _initval = item.initval ? item.initval.split(',').filter(Boolean) : [] - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: _initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <Select - showSearch - mode="multiple" - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - disabled={item.readonly === 'true'} - > - {item.options.map(option => - <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'date') { // 鏃堕棿鎼滅储 - let _initval = this.props.data ? this.props.data[item.field] : '' - if (_initval && this.state.readin[item.field]) { - _initval = moment(_initval, 'YYYY-MM-DD') - } else { - _initval = item.initval ? moment().subtract(item.initval, 'days') : null - } - - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: _initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <DatePicker disabled={item.readonly === 'true'} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'datemonth') { - let _initval = this.props.data ? this.props.data[item.field] : '' - if (_initval && this.state.readin[item.field]) { - _initval = moment(_initval, 'YYYY-MM') - } else { - _initval = item.initval ? moment().subtract(item.initval, 'month') : null - } - - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: _initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <MonthPicker disabled={item.readonly === 'true'} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'datetime') { - let _initval = this.props.data ? this.props.data[item.field] : '' - - if (_initval && this.state.readin[item.field]) { - _initval = moment(_initval, 'YYYY-MM-DD HH:mm:ss') - } else { - _initval = item.initval ? moment().subtract(item.initval, 'days') : null - } - - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: _initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <DatePicker showTime disabled={item.readonly === 'true'} /> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'fileupload') { - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: item.initval, - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.select'] + item.label + '!' - } - ] - })( - <FileUpload config={item}/> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'funcvar') { - fields.push( - <Col span={24 / cols} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.field, { - initialValue: '绯荤粺鑷姩鐢熸垚', - })(<Input placeholder="" autoComplete="off" disabled={true} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'textarea') { - let _labelcol = cols !== 3 ? 8 / cols : 3 - let _wrapcol = cols !== 3 ? 16 + (cols - 1) * 4 : 21 - let _style = {} - if (cols === 2 || cols === 4) { - _style.paddingLeft = '7px' - } - fields.push( - <Col span={24} key={index} className="textarea-row" style={{..._style}}> - <Form.Item label={item.label} labelCol={{xs: { span: 24 }, sm: { span: _labelcol }}} wrapperCol={ {xs: { span: 24 }, sm: { span: _wrapcol }} }> - {getFieldDecorator(item.field, { - initialValue: item.initval || '', - rules: [ - { - required: item.required === 'true', - message: this.props.dict['form.required.input'] + item.label + '!' - }, - { - max: formRule.textarea.max, - message: formRule.textarea.message - } - ] - })(<TextArea autoSize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)} - </Form.Item> - </Col> - ) - } - }) - - return fields - } - - handleConfirm = () => { - const { record, encrypts, intercepts } = this.state - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let search = [] - // 闅愯棌琛ㄥ崟 - this.state.formlist.forEach(item => { - if (!item.field) return - - if (item.type === 'funcvar') { - let _val = item.initval - if (values.hasOwnProperty(item.field)) { - _val = values[item.field] === '绯荤粺鑷姩鐢熸垚' ? '' : values[item.field] - } else if (record.hasOwnProperty(item.field)) { - _val = record[item.field] - } - search.push({ - type: 'funcvar', - readonly: 'true', - readin: false, - fieldlen: this.state.fieldlen[item.field], - key: item.field, - value: _val - }) - } else if (item.hidden === 'true' && item.field !== this.props.setting.primaryKey) { - let _val = item.initval - if (record.hasOwnProperty(item.field)) { - _val = record[item.field] - } - - search.push({ - type: this.state.datatype[item.field], - readonly: this.state.readtype[item.field], - readin: this.state.readin[item.field], - fieldlen: this.state.fieldlen[item.field], - key: item.field, - value: _val - }) - } else if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) { - search.push({ - type: this.state.datatype[item.field], - readonly: this.state.readtype[item.field], - readin: this.state.readin[item.field], - fieldlen: this.state.fieldlen[item.field], - key: item.field, - value: item.initVal - }) - } - }) - - Object.keys(values).forEach(key => { - if (this.state.datatype[key] === 'funcvar') return - - let _value = '' - if (this.state.datatype[key] === 'datetime') { - if (values[key]) { - _value = moment(values[key]).format('YYYY-MM-DD HH:mm:ss') - } - } else if (this.state.datatype[key] === 'datemonth') { - if (values[key]) { - _value = moment(values[key]).format('YYYY-MM') - } - } else if (this.state.datatype[key] === 'date') { - if (values[key]) { - _value = moment(values[key]).format('YYYY-MM-DD') - } - } else if (this.state.datatype[key] === 'number') { - _value = values[key] - - } else if (this.state.datatype[key] === 'multiselect') { - _value = values[key] ? values[key].join(',') : '' - - } else if (this.state.datatype[key] === 'fileupload') { - _value = values[key] - - } else if (this.state.datatype[key] === 'text' || this.state.datatype[key] === 'textarea') { - _value = values[key].replace(/\t*|\v*/g, '') // 鍘婚櫎鍒惰〃绗� - - if (intercepts.includes(key)) { // 鍘婚櫎棣栧熬绌烘牸 - _value = _value.replace(/(^\s*|\s*$)/g, '') - } - } else { - _value = values[key] - - } - - search.push({ - type: this.state.datatype[key], - readonly: this.state.readtype[key], - readin: this.state.readin[key], - fieldlen: this.state.fieldlen[key], - key: key, - value: _value - }) - }) - - if (encrypts && encrypts.length > 0) { - search = search.map(item => { - let _value = item.value - if (encrypts.includes(item.key)) { - try { - _value = window.btoa(window.encodeURIComponent(_value)) - } catch (e) { - console.warn(e) - } - } - item.value = _value - - return item - }) - } - resolve(search) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - this.props.inputSubmit() - } - - render() { - const { setting } = this.props - const { groups } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - let _width = (setting && setting.width) || 100 - - let keys = groups.map(group => group.uuid) - - return ( - <Form {...formItemLayout} className="form-tab-form-field"> - <Collapse - defaultActiveKey={keys} - expandIconPosition='right' - > - {groups.map(group => - <Panel header={group.label} key={group.uuid}> - <Row style={{margin: '0 auto', width: _width + '%'}} gutter={24}>{this.getFields(group.sublist)}</Row> - </Panel> - )} - </Collapse> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/tabviews/formtab/formgroup/index.scss b/src/tabviews/formtab/formgroup/index.scss deleted file mode 100644 index 1d63657..0000000 --- a/src/tabviews/formtab/formgroup/index.scss +++ /dev/null @@ -1,47 +0,0 @@ -.form-tab-form-field { - position: relative; - padding: 0px; - .ant-form-item { - display: flex; - } - .ant-form-item-control-wrapper { - flex: 1; - } - .ant-form-item-label { - overflow: hidden; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; - } - .textarea-row { - .ant-col-sm-3 { - width: 10.5%; - } - .ant-col-sm-21 { - width: 89.5%; - } - } - .ant-form-explain { - overflow:hidden; - text-overflow:ellipsis; - white-space:nowrap; - } - p { - color: #1890ff; - border-bottom: 1px solid #d9d9d9; - } - .ant-input-disabled { - color: rgba(0, 0, 0, 0.65)!important; - cursor: default!important; - } - .ant-input-number-input { - color: rgba(0, 0, 0, 0.65)!important; - cursor: default!important; - } - .ant-select-disabled { - color: rgba(0, 0, 0, 0.65)!important; - .ant-select-selection--multiple .ant-select-selection__choice { - color: rgba(0, 0, 0, 0.65)!important; - } - } -} \ No newline at end of file diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx deleted file mode 100644 index dcc0d1d..0000000 --- a/src/tabviews/formtab/index.jsx +++ /dev/null @@ -1,663 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { notification, Spin, Tabs} from 'antd' -import moment from 'moment' - -import Api from '@/api' -import zhCN from '@/locales/zh-CN/main.js' -import enUS from '@/locales/en-US/main.js' -import Utils from '@/utils/utils.js' -import options from '@/store/options.js' -import asyncComponent from '@/utils/asyncLoadComponent' -import MKEmitter from '@/utils/events.js' -import MkIcon from '@/components/mk-icon' -import FormGroup from './formgroup' -import FormAction from './actionList' -import NotFount from '@/components/404' -import './index.scss' - -const { TabPane } = Tabs -const SubTable = asyncComponent(() => import('@/tabviews/subtable')) -const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) - -class NormalTable extends Component { - static propTpyes = { - MenuID: PropTypes.string, // 鑿滃崟Id - param: PropTypes.any, // 涓昏〃浼犻�掑弬鏁� - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id - loadingview: true, // 椤甸潰鍔犺浇涓� - viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 - lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 - config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佽〃鍗曘�佹爣绛剧瓑 - groups: null, // 琛ㄥ崟缁� - actions: null, // 鎸夐挳闆� - arr_field: '', // 鏌ヨ瀛楁闆� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: null, // 鍒楄〃鏁版嵁闆� - BIDs: {}, // 涓婄骇琛╥d - primaryId: null, - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - const { MenuID } = this.props - - let param = { - func: 'sPC_Get_LongParam', - MenuID: MenuID - } - let result = await Api.getCacheConfig(param) - if (result.status) { - let config = '' - - try { // 閰嶇疆淇℃伅瑙f瀽 - config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - config = '' - } - - // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� - if (!config) { - this.setState({ - loadingview: false, - viewlost: true - }) - return - } - - // 椤甸潰鏈惎鐢ㄦ椂锛屾樉绀烘湭鍚敤椤甸潰 - if (!config.enabled) { - this.setState({ - loadingview: false, - viewlost: true, - lostmsg: this.state.dict['main.view.unenabled'] - }) - return - } - - // 鍏煎鏍囩 - if (!config.tabgroups) { - config.tabgroups = [{ uuid: 'tabs', sublist: [] }] - } else if (typeof(config.tabgroups[0]) === 'string') { - let _tabgroups = [] - config.tabgroups.forEach(groupId => { - let _group = { - uuid: groupId, - sublist: fromJS(config[groupId]).toJS() - } - - delete config[groupId] - - _tabgroups.push(_group) - }) - - config.tabgroups = _tabgroups - } - - config.tabgroups.forEach(group => { - group.sublist = group.sublist.map(tab => { - if (tab.supMenu === 'mainTable') { - tab.supMenu = MenuID - } - tab.ContainerId = this.state.ContainerId - return tab - }) - }) - - // 鎸夐挳绫诲瀷鍏煎 - config.action = config.action.map(item => { - if (item.intertype === 'inner' && !item.innerFunc) { - item.intertype = 'system' - } - return item - }) - - 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) { - return true - } - return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 - }) - }) - _arrField = _arrField.join(',') - - this.setState({ - config: config, - setting: config.setting, - actions: config.action, - arr_field: _arrField, - primaryId: this.props.param.primaryId || '', - data: this.props.param.data || null, - BIDs: { - [MenuID]: config.setting.onload !== 'false' ? (this.props.param.primaryId || '') : '', - [MenuID + 'data']: config.setting.onload !== 'false' ? (config.setting.datatype === 'query' ? '' : this.props.param.data) : '' - } - }, () => { - this.improveSelectOption(config.groups) - - if (config.setting.datatype === 'query' && config.setting.onload !== 'false') { - this.loadmaindata() - } else if (config.setting.datatype !== 'query' && (!this.props.param.primaryId || !this.props.param.data)) { - notification.warning({ - top: 92, - message: '鏈幏鍙栧埌涓昏〃鏁版嵁锛�', - duration: 5 - }) - } - }) - } else { - this.setState({ - loadingview: false, - viewlost: true - }) - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - } - } - - /** - * @description 琛ㄥ崟涓嬫媺閫夐」鍔犺浇 - */ - improveSelectOption = (groups) => { - let deffers = [] - groups.forEach(group => { - group.sublist = group.sublist.map(item => { - if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return item - - if (item.setAll === 'true') { - item.options.unshift({ - key: Utils.getuuid(), - Value: '', - Text: '鍏ㄩ儴' - }) - } - - if (item.resourceType === '1' && item.dataSource) { - let _option = Utils.getSelectQueryOptions(item) - let _sql = Utils.formatOptions(_option.sql) - - let param = { - func: 'sPC_Get_SelectedList', - LText: _sql, - obj_name: 'data', - arr_field: _option.field - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - - if (item.database === 'sso' && options.cloudServiceApi) { // 瀛樺湪浜戠鍦板潃鏃讹紝浣跨敤浜戠绯荤粺鍙傛暟 - param.rduri = options.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } - } else if (item.database === 'sso' && window.GLOB.mainSystemApi && window.GLOB.systemType === 'production') { - param.rduri = window.GLOB.mainSystemApi - } - - let defer = new Promise(resolve => { - Api.getSystemCacheConfig(param).then(res => { - res.search = item - resolve(res) - }) - }) - deffers.push(defer) - } else if (item.resourceType === '1' && !item.dataSource) { - notification.warning({ - top: 92, - message: item.label + ': 鏁版嵁婧愰厤缃敊璇紒', - duration: 5 - }) - } - - return item - }) - }) - - if (deffers.length === 0) { - this.setState({ - loadingview: false, - groups: groups - }) - return - } - - Promise.all(deffers).then(result => { - let _result = {} - result.forEach(res => { - if (res.status) { - let _options = res.data.map(cell => { - let _item = { - key: Utils.getuuid(), - Value: cell[res.search.valueField], - Text: cell[res.search.valueText] - } - - if (res.search.type === 'link') { - _item.ParentID = cell[res.search.linkField] - } else if (res.search.type === 'select' && res.search.linkSubField && res.search.linkSubField.length > 0) { - res.search.linkSubField.forEach(_field => { - _item[_field] = (cell[_field] || cell[_field] === 0) ? cell[_field] : '' - }) - } - - return _item - }) - - _result[res.search.uuid] = _options - } else { - notification.warning({ - top: 92, - message: res.search.label + ':' + res.message, - duration: 5 - }) - } - }) - - groups.forEach(group => { - group.sublist = group.sublist.map(item => { - if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') { - if (_result[item.uuid]) { - item.options = [...item.options, ..._result[item.uuid]] - } - item.oriOptions = JSON.parse(JSON.stringify(item.options)) - } - - return item - }) - }) - - this.setState({ - loadingview: false, - groups: groups - }) - }) - } - - /** - * @description 涓昏〃鏁版嵁鍔犺浇 - */ - async loadmaindata () { - const { setting, BIDs, config } = this.state - - if (setting.datatype !== 'query') { - notification.warning({ - top: 92, - message: '鏈缃暟鎹煡璇㈤厤缃紒', - duration: 5 - }) - return - } - - let param = null - - if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { - param = this.getCustomParam() - } else { - param = this.getDefaultParam() - } - - if (!param) return // 鏈幏鍙栧弬鏁版椂锛屼笉鍙戣姹� - - // 鏁版嵁绠$悊鏉冮檺 - if (sessionStorage.getItem('dataM') === 'true') { - param.dataM = 'Y' - } - - let result = await Api.genericInterface(param) - if (result.status) { - let _data = result.data[0] || '' - let _primaryId = '' - - if (_data) { - _primaryId = _data[setting.primaryKey] || '' - } else { - notification.warning({ - top: 92, - message: '鏈煡璇㈠埌鏁版嵁淇℃伅锛�', - duration: 5 - }) - } - - this.setState({ - data: _data, - primaryId: _primaryId, - BIDs: { ...BIDs, [this.props.MenuID]: _primaryId, [this.props.MenuID + 'data']: _data } - }) - - if (_data && (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc))) { - let keys = Object.keys(_data) - let emptys = [] - - if (!keys.includes(config.setting.primaryKey)) { - emptys.push(config.setting.primaryKey) - } - - config.groups.forEach(group => { - group.sublist.forEach(item => { - if (!keys.includes(item.field)) { - emptys.push(item.field + '(' + item.label + ')') - } - }) - }) - - if (emptys.length > 0) { - notification.warning({ - top: 92, - message: '鏈煡璇㈠埌' + emptys.join(', ') + '瀛楁淇℃伅锛�', - duration: 5 - }) - } - } - } else { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鐨勫弬鏁� - */ - getDefaultParam = () => { - const { arr_field, setting, primaryId } = this.state - - if (!arr_field) { - notification.warning({ - top: 92, - message: '鏈缃〃鍗曞瓧娈碉紒', - duration: 5 - }) - return null - } - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field, - ID: primaryId - } - - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _dataresource = _dataresource.replace(/\$@/ig, '/*') - _dataresource = _dataresource.replace(/@\$/ig, '*/') - // param.custom_script = param.custom_script.replace(/\$@/ig, '/*') - // param.custom_script = param.custom_script.replace(/@\$/ig, '*/') - } else { - _dataresource = _dataresource.replace(/@\$|\$@/ig, '') - // param.custom_script = param.custom_script.replace(/@\$|\$@/ig, '') - } - - if (!/@ID@/ig.test(_dataresource)) { - _dataresource = `${_dataresource} where ${setting.primaryKey}='${primaryId}'` - } - - let LText = `select ${arr_field} from ${_dataresource}` - - param.LText = Utils.formatOptions(LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.DateCount = '' - - if (window.GLOB.probation) { - param.s_debug_type = 'Y' - } - - if (!window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - return param - } - - /** - * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� - */ - getCustomParam = () => { - const { setting, primaryId } = this.state - - let param = {} - - if (setting.interType === 'inner') { - param.func = setting.innerFunc - } else { - if (window.GLOB.mkHS) { - if (setting.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - } else { - if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - } - - if (setting.outerFunc) { - param.func = setting.outerFunc - } - } - - param[setting.primaryKey] = primaryId - - return param - } - - /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (btn, type, primaryId, formdata) => { - const { BIDs } = this.state - - if (type === 'success' && btn.afterExecSuccess === 'notclose') { - this.setState({ - primaryId: primaryId - }, () => { - if (btn.execSuccess === 'refresh' || btn.execSuccess === 'grid') { - this.loadmaindata() - } else { - let data = {} - - if (formdata && formdata.length > 0) { - formdata.forEach(item => { - data[item.key] = item.value - }) - } - - this.setState({ - BIDs: { ...BIDs, [this.props.MenuID]: primaryId, [this.props.MenuID + 'data']: data } - }) - } - }) - } else if (type === 'success' && btn.afterExecSuccess === 'close') { - if (btn.execSuccess !== 'never') { - MKEmitter.emit('reloadData', this.props.param.parentId, 'formtab', btn) - } - - MKEmitter.emit('closeTabView', this.props.MenuID) - } else if (type === 'error' && btn.afterExecError === 'notclose') { - if (btn.execError === 'refresh') { - this.loadmaindata() - } - } else if (type === 'error' && btn.afterExecError === 'close') { - if (btn.execError !== 'never') { - MKEmitter.emit('reloadData', this.props.param.parentId, 'formtab', btn) - } - MKEmitter.emit('closeTabView', this.props.MenuID) - } - } - - /** - * @description 鑾峰彇琛ㄥ崟鍙傛暟 - */ - getFormData = () => { - return this.formGroupRef.handleConfirm() - } - - reloadview = () => { - this.setState({ - loadingview: true, - viewlost: false, - lostmsg: '', - config: {}, - groups: null, - actions: null, - setting: null, - data: null, - BIDs: {}, - primaryId: null, - }, () => { - this.loadconfig() - }) - } - - reloadMenuView = (menuId) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - this.reloadview() - } - - reloadData = (menuId) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - this.loadmaindata() - } - - changeTableLine = (ContainerId, tableId, id, data) => { - if (this.state.ContainerId !== ContainerId) return - - this.setState({ - BIDs: {...this.state.BIDs, [tableId]: id, [tableId + 'data']: data} - }) - } - - UNSAFE_componentWillMount () { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.loadconfig() - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - componentDidMount () { - MKEmitter.addListener('reloadData', this.reloadData) - MKEmitter.addListener('reloadMenuView', this.reloadMenuView) - MKEmitter.addListener('changeTableLine', this.changeTableLine) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - - MKEmitter.removeListener('reloadData', this.reloadData) - MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) - MKEmitter.removeListener('changeTableLine', this.changeTableLine) - } - - render() { - const { setting, actions, loadingview, viewlost, config, groups, data } = this.state - let hasform = false - - if (groups && (groups.length > 1 || groups[0].sublist.length > 0)) { - hasform = true - } - - return ( - <div className="formtab" id={this.state.ContainerId}> - {loadingview && <Spin size="large" />} - {hasform ? - <FormGroup - dict={this.state.dict} - data={data} - groups={groups} - setting={setting} - wrappedComponentRef={(inst) => this.formGroupRef = inst} - /> : null - } - {hasform ? - <FormAction - setting={setting} - actions={actions} - dict={this.state.dict} - data={this.state.data} - MenuID={this.props.MenuID} - primaryId={this.state.primaryId} - getFormData={this.getFormData} - refreshdata={this.refreshbyaction} - /> : null - } - {!loadingview && !viewlost && config.tabgroups.map(group => { - if (group.sublist.length === 0) return null - - return ( - <Tabs defaultActiveKey="0" key={group.uuid}> - {group.sublist.map((_tab, index) => { - return ( - <TabPane tab={ - <span> - {_tab.icon ? <MkIcon type={_tab.icon} /> : null} - {_tab.label} - </span> - } key={`${index}`}> - <SubTable - Tab={_tab} - MenuID={_tab.linkTab} - SupMenuID={this.props.MenuID} - BID={this.state.BIDs[_tab.supMenu] || ''} - BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} - /> - </TabPane> - ) - })} - </Tabs> - ) - }) - } - {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} - {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} - </div> - ) - } -} - -export default NormalTable \ No newline at end of file diff --git a/src/tabviews/formtab/index.scss b/src/tabviews/formtab/index.scss deleted file mode 100644 index b5c70bb..0000000 --- a/src/tabviews/formtab/index.scss +++ /dev/null @@ -1,112 +0,0 @@ -.formtab { - position: relative; - min-height: calc(100vh - 94px); - padding-top: 16px; - padding-bottom: 80px; - .box404 { - padding-top: 30px; - } - >.ant-form.ant-form-horizontal { - .ant-collapse { - border-radius: 0; - border: 0; - .ant-collapse-header { - cursor: default; - border-radius: 0!important; - background: #1890ff; - color: #ffffff; - padding-left: 30px; - padding-right: 20px; - .anticon { - font-size: 16px; - } - .ant-collapse-extra { - .anticon-edit { - position: absolute; - left: 5px; - top: 2px; - } - } - } - .ant-collapse-item:last-child { - border-radius: 0; - .ant-collapse-content { - border-radius: 0; - } - } - .ant-collapse-content-box { - padding: 16px 30px; - > .ant-row { - .ant-calendar-picker { - min-width: 100px!important; - width: 100%; - } - } - } - } - } - - .ant-modal-mask { - position: absolute; - } - .ant-modal-wrap { - position: absolute; - } - .action-modal .ant-modal { - top: 40px; - max-width: 95%; - .ant-modal-body { - max-height: calc(100vh - 265px); - } - } - > .ant-spin { - position: fixed; - left: calc(50vw - 22px); - top: calc(50vh - 70px); - } - > .ant-tabs { - padding: 0px 20px; - margin-bottom: 20px; - .ant-tabs-tab:not(.ant-tabs-tab-active) { - cursor: pointer; - } - } - > .ant-card { - margin: 0 20px 20px; - > .ant-card-head { - border: 0; - padding: 0; - min-height: 30px; - .ant-card-head-title { - padding: 10px 0 0; - span { - color: #1890ff; - display: inline-block; - padding: 0 10px; - font-size: 15px; - border-bottom: 1px solid #1890ff; - .anticon { - margin-right: 10px; - } - } - } - } - > .ant-card-body { - padding: 0; - } - } - .main-table-box { - position: relative; - .pickchange { - position: absolute; - right: 0px; - top: -25px; - .ant-switch { - z-index: 1; - float: right; - margin-right: 20px; - margin-bottom: 5px; - } - } - } -} diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index c25df22..b819615 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -216,6 +216,10 @@ let node = document.getElementById('tab' + id) node && node.click() } + + if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } /** @@ -257,6 +261,10 @@ } else if (btn.execError !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) } + + if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } /** diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index a31ae6b..8ccf673 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -557,6 +557,29 @@ return col }) + + if (data && data[0]) { + let errors = [] + columns.forEach(col => { + if (col.Column && data[0][col.Column] === undefined) { + errors.push(col.Text) + } + }) + + if (errors.length) { + notification.error({ + top: 92, + message: '鏁版嵁涓己灏戝瓧娈碉細' + errors.join('銆�'), + duration: 5 + }) + + this.setState({ + loading: false + }) + + return + } + } try { if (imgCol) { @@ -1143,6 +1166,10 @@ let node = document.getElementById('tab' + id) node && node.click() } + + if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } /** @@ -1184,6 +1211,10 @@ } else if (btn.execError !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', []) } + + if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } render() { diff --git a/src/tabviews/zshare/actionList/funczip/index.jsx b/src/tabviews/zshare/actionList/funczip/index.jsx index 124190f..28d6ed2 100644 --- a/src/tabviews/zshare/actionList/funczip/index.jsx +++ b/src/tabviews/zshare/actionList/funczip/index.jsx @@ -348,6 +348,10 @@ if (btn.execSuccess !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn) } + + if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } /** @@ -399,6 +403,10 @@ if (btn.execError !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) } + + if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } render() { diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index cf67e2e..ea562ed 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2148,6 +2148,10 @@ MKEmitter.emit('modifyTabs', newtab, true) } + + if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } triggerNote = (res) => { @@ -2566,6 +2570,10 @@ if (window.GLOB.breakpoint) { MKEmitter.emit('refreshDebugTable') } + + if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } handleModelConfig = (config) => { diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx index f61eadf..a472218 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.jsx +++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx @@ -186,7 +186,7 @@ if (btn.Ot === 'requiredSgl' && setting.primaryKey) { _data = data[0] - primaryId = _data[setting.primaryKey] || '' + primaryId = _data.$$uuid || _data[setting.primaryKey] || '' } this.setState({ @@ -248,7 +248,7 @@ ratio = ratio + 'vw' } return <Modal - wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview')} + wrapClassName={'popview-modal ' + (!btn.$view ? '' : 'custom-popview ') + (btn.popshow || '')} title={btn.label} width={ratio} maskClosable={btn.clickouter === 'close'} diff --git a/src/tabviews/zshare/actionList/popupbutton/index.scss b/src/tabviews/zshare/actionList/popupbutton/index.scss index 72a6a3c..5dee830 100644 --- a/src/tabviews/zshare/actionList/popupbutton/index.scss +++ b/src/tabviews/zshare/actionList/popupbutton/index.scss @@ -1,5 +1,5 @@ .custom-popview.popview-modal { - >.ant-modal-content >.ant-modal-body { + .ant-modal-content .ant-modal-body { padding: 0; .custom-page-wrap { min-height: 200px; @@ -9,6 +9,19 @@ } } } +.custom-popview.popview-modal.miniview { + .ant-modal-header { + display: none; + } + .ant-modal-footer { + display: none; + } + .ant-modal-body { + padding: 0px; + border-radius: 4px; + max-height: calc(100vh - 110px); + } +} .table-drawer-popview { .close-drawer { position: absolute; diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 4c1f0bc..ef1052c 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -1914,6 +1914,10 @@ if (btn.execSuccess !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', this.state.selines) } + + if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 + MKEmitter.emit('refreshPopButton', btn.$tabId) + } } /** diff --git a/src/tabviews/zshare/calendar/index.jsx b/src/tabviews/zshare/calendar/index.jsx deleted file mode 100644 index 19c209a..0000000 --- a/src/tabviews/zshare/calendar/index.jsx +++ /dev/null @@ -1,398 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Select, Radio, Row, Col, Popover, Badge, Spin } from 'antd' -import moment from 'moment' - -import './index.scss' - -const { Option } = Select - -class Calendar extends Component { - static propTpyes = { - data: PropTypes.any, // 浜嬩欢鏁版嵁 - calendar: PropTypes.any, - changeDate: PropTypes.func, - triggerDate: PropTypes.func, - loading: false - } - - state = { - level: 'day', - levels: null, - yearlist: null, - selectYear: moment().format('YYYY'), - selectMonth: moment().format('MM'), - datelist: null, - monthlist: null - } - - UNSAFE_componentWillMount() { - const { calendar, data } = this.props - - let yearlist = [] - let _selectYear = +this.state.selectYear - yearlist.push(`${_selectYear}`) - - for (let i = 1; i <= 50; i++) { - yearlist.unshift(`${_selectYear - i}`) - yearlist.push(`${_selectYear + i}`) - } - - let datelist = this.getDateList(this.state.selectYear) - - if (data && data.length > 0) { - datelist = this.mountdata(datelist, data) - } - - let _levels = calendar.levels - let level = _levels[0] - let monthlist = null - - if (_levels.includes('month') || _levels.includes('year')) { - monthlist = datelist.filter(item => item.month === moment().format('MM'))[0] - } - - this.setState({ - yearlist, - datelist, - monthlist, - level, - levels: _levels - }) - } - - UNSAFE_componentWillReceiveProps(nextProps) { - if (!is(fromJS(this.props.data), fromJS(nextProps.data))) { - let datelist = this.getDateList(this.state.selectYear) - let monthlist = null - - datelist = this.mountdata(datelist, nextProps.data) - - if (this.state.levels.includes('month') || this.state.levels.includes('year')) { - monthlist = datelist.filter(item => item.month === this.state.selectMonth)[0] - } - - this.setState({ - datelist: datelist, - monthlist - }) - } else if (!is(fromJS(this.props.calendar), fromJS(nextProps.calendar))) { - this.setState({ - levels: nextProps.calendar.levels - }) - } - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props.loading), fromJS(nextProps.loading)) || !is(fromJS(this.state), fromJS(nextState)) - } - - mountdata = (datelist, data) => { - const { calendar } = this.props - - let datalist = [] - let colors = { - transparent: 'rgba(0, 0, 0, 0)', - red: 'rgba(208, 2, 27, 1)', - orange: 'rgba(245, 166, 35, 1)', - yellow: 'rgba(248, 231, 28, 1)', - green: 'rgba(126, 211, 33, 1)', - cyan: 'rgba(80, 227, 194, 1)', - blue: 'rgba(24, 144, 255, 1)', - purple: 'rgba(189, 16, 224, 1)', - gray: 'rgba(155, 155, 155, 1)' - } - - data && data.forEach(item => { - let startTime = item[calendar.startfield] - let endTime = item[calendar.endfield] - let color = item[calendar.colorfield] || '#ffffff' - - if (!startTime || !/^(1|2)\d{3}(-|\/)\d{2}(-|\/)\d{2}/.test(startTime)) return - if (!endTime || !/^(1|2)\d{3}(-|\/)\d{2}(-|\/)\d{2}/.test(endTime)) return - if (!item[calendar.remarkfield]) return - - let equal = endTime.substr(0, 4) === startTime.substr(0, 4) - - datalist.push({ - color: colors[color] || color, - remark: item[calendar.remarkfield], - startMonth: startTime.substr(0, 4) + startTime.substr(5, 2), - endMonth: endTime.substr(0, 4) + endTime.substr(5, 2), - start: startTime.substr(0, 4) + startTime.substr(5, 2) + startTime.substr(8, 2), - startTime: equal ? `${startTime.substr(5, 2)}-${startTime.substr(8, 2)}` : `${startTime.substr(0, 4)}-${startTime.substr(5, 2)}-${startTime.substr(8, 2)}`, - end: endTime.substr(0, 4) + endTime.substr(5, 2) + endTime.substr(8, 2), - endTime: equal ? `${endTime.substr(5, 2)}-${endTime.substr(8, 2)}` : `${endTime.substr(0, 4)}-${endTime.substr(5, 2)}-${endTime.substr(8, 2)}` - }) - }) - - return datelist.map(month => { - month.subData = [] - datalist.forEach(item => { - if (item.startMonth <= month.time && item.endMonth >= month.time) { - month.subData.push(item) - } - }) - month.style = this.getStyle(month.subData[0]) - month.sublist = month.sublist.map(week => { - week.sublist = week.sublist.map(day => { - if (!day) return null - - day.subData = [] - datalist.forEach(item => { - if (item.start <= day.time && item.end >= day.time) { - day.subData.push(item) - } - }) - day.style = this.getStyle(day.subData[0]) - return day - }) - return week - }) - return month - }) - } - - getStyle = (item ) => { - if (!item || !item.color) return null - let style = {background: item.color} - - if (/rgb/ig.test(item.color)) { - try { - let colors = item.color.match(/\d+/g) - if ((colors[0] * 0.299 + colors[1] * 0.578 + colors[2] * 0.114) * colors[3] < 192) { - style.color = '#ffffff' - } - } catch (e) {} - } - - return style - } - - getDateList = (selectYear) => { - let datelist = [] - let months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] - let monthName = { - '01': '涓�鏈�', '02': '浜屾湀', '03': '涓夋湀', '04': '鍥涙湀', '05': '浜旀湀', '06': '鍏湀', - '07': '涓冩湀', '08': '鍏湀', '09': '涔濇湀', '10': '鍗佹湀', '11': '鍗佷竴鏈�', '12': '鍗佷簩鏈�' - } - - months.forEach(month => { - let _weeklist = [{week: 1, sublist: []}] - let _week = moment(`${selectYear}${month}01`, 'YYYYMMDD').weekday() - let end = +moment(`${selectYear}${month}`, 'YYYYMM').endOf('month').format('DD') - - for (let i = 0; i < _week; i++) { - _weeklist[0].sublist.push(null) - } - - for (let i = 1; i <= end; i++) { - let _day = i < 10 ? `0${i}` : `${i}` - - if (_weeklist[_weeklist.length - 1].sublist.length < 7) { - _weeklist[_weeklist.length - 1].sublist.push({day: _day, time: selectYear + month + _day, label: i, subData: []}) - } else { - let _week = {week: _weeklist.length + 1, sublist: [{day: _day, time: selectYear + month + _day, label: i, subData: []}]} - _weeklist.push(_week) - } - } - - let re = 7 - _weeklist.slice(-1)[0].sublist.length - for (let i = 0; i < re; i++) { - _weeklist[_weeklist.length - 1].sublist.push(null) - } - - datelist.push({ - month: month, - time: selectYear + month, - label: monthName[month], - sublist: _weeklist, - subData: [] - }) - }) - - return datelist - } - - levelChange = (e) => { - this.setState({ level: e.target.value }) - } - - yearChange = (value) => { - const { calendar, data } = this.props - const { levels, selectMonth } = this.state - let datelist = this.getDateList(value) - let monthlist = null - - if (levels.includes('month') || levels.includes('year')) { - monthlist = datelist.filter(item => item.month === selectMonth)[0] - } - - if (calendar.refresh !== 'true') { - datelist = this.mountdata(datelist, data) - - this.setState({ selectYear: value, datelist, monthlist }) - } else { - this.setState({ selectYear: value, datelist, monthlist }, () => { - this.props.changeDate(value) - }) - } - } - - monthChange = (value) => { - const { datelist, levels, selectYear } = this.state - - if (!levels.includes('month')) { - if (this.props.triggerDate) { - this.props.triggerDate({ - time: `${selectYear}${value}01` - }) - } - return - } - - this.setState({ - level: 'month', - selectMonth: value, - monthlist: datelist.filter(item => item.month === value)[0] - }) - } - - triggerDay = (item) => { - if (this.props.triggerDate) { - this.props.triggerDate(item) - } - } - - render() { - const { loading } = this.props - const { level, selectMonth, selectYear, yearlist, levels, datelist, monthlist } = this.state - const _levelName = {day: '鏃�', month: '鏈�', year: '骞�'} - - return ( - <div className="mk-calendar"> - {loading ? <div className="loading-data"><Spin /></div> : null} - <div className="mk-calendar-control"> - <Select value={selectYear} onChange={this.yearChange}> - {yearlist.map(item => (<Option key={item} value={item}>{item}骞�</Option>))} - </Select> - {level === 'month' ? <Select value={selectMonth} onChange={this.monthChange}> - <Option value="01">1鏈�</Option> - <Option value="02">2鏈�</Option> - <Option value="03">3鏈�</Option> - <Option value="04">4鏈�</Option> - <Option value="05">5鏈�</Option> - <Option value="06">6鏈�</Option> - <Option value="07">7鏈�</Option> - <Option value="08">8鏈�</Option> - <Option value="09">9鏈�</Option> - <Option value="10">10鏈�</Option> - <Option value="11">11鏈�</Option> - <Option value="12">12鏈�</Option> - </Select> : null} - {levels.length > 1 ? <Radio.Group value={level} onChange={this.levelChange}> - {levels.map(item => (<Radio.Button key={item} value={item}>{_levelName[item]}</Radio.Button>))} - </Radio.Group> : null} - </div> - <div className="mk-calendar-content"> - {level === 'day' ? <Row className="day-calendar" gutter={16}> - {datelist.map(item => ( - <Col span={4} key={item.month}> - <table> - <thead> - <tr> - <th colSpan="7">{item.label}</th> - </tr> - <tr> - <th>涓�</th><th>浜�</th><th>涓�</th><th>鍥�</th><th>浜�</th><th>鍏�</th><th>鏃�</th> - </tr> - </thead> - <tbody> - {item.sublist.map(cell => ( - <tr key={cell.week}> - {cell.sublist.map((d, i) => ( - <td key={i}> - {d ? <div className="day-wrap" style={d.style || null} onClick={() => this.triggerDay(d)}> - {d.subData.length > 0 ? <Popover mouseEnterDelay={0.3} overlayClassName="calendar-day-pop" content={ - <div> - {d.subData.map((data, index) => ( - <div key={index} className="message"> - <Badge color={data.color} text={ - <span> - {data.remark} - <span style={{color: 'rgba(0,0,0,.45)'}}>({data.startTime + ' ~ ' + data.endTime})</span> - </span>} - /> - </div> - ))} - </div> - } trigger="hover"> - {d.label} - </Popover> : d.label} - </div> : null } - </td> - ))} - </tr> - ))} - </tbody> - </table> - </Col> - ))} - </Row> : null} - {level === 'month' && monthlist ? <div className="month-calendar"> - <table> - <thead> - <tr> - <th>涓�</th><th>浜�</th><th>涓�</th><th>鍥�</th><th>浜�</th><th>鍏�</th><th>鏃�</th> - </tr> - </thead> - <tbody> - {monthlist.sublist.map(cell => ( - <tr key={cell.week}> - {cell.sublist.map((d, i) => ( - <td key={i}> - {d ? <div className="month-wrap" style={d.style || null} onClick={() => this.triggerDay(d)}> - <div className="header"> - {d.label} - </div> - <ul className="content"> - {d.subData.map((data, index) => ( - <li key={index} className="message"> - <Badge color={d.style ? (data.color === d.style.background ? '#ffffff' : data.color) : data.color} text={data.remark} /> - </li> - ))} - </ul> - </div> : null } - </td> - ))} - </tr> - ))} - </tbody> - </table> - </div>: null} - {level === 'year' && monthlist ? <Row className="year-calendar"> - {datelist.map(item => ( - <Col span={8} key={item.month}> - <div className="year-wrap" style={item.style || null} onClick={() => this.monthChange(item.month)}> - <div className="header" style={item.style ? null : {color: '#1890ff'}}> - {item.label} - </div> - <ul className="content"> - {item.subData.map((data, index) => ( - <li key={index} className="message"> - <Badge color={item.style ? (data.color === item.style.background ? '#ffffff' : data.color) : data.color} text={`${data.remark} (${data.startTime} ~ ${data.endTime})`}/> - </li> - ))} - </ul> - </div> - </Col> - ))} - </Row>: null} - </div> - </div> - ) - } -} - -export default Calendar \ No newline at end of file diff --git a/src/tabviews/zshare/calendar/index.scss b/src/tabviews/zshare/calendar/index.scss deleted file mode 100644 index 52faea5..0000000 --- a/src/tabviews/zshare/calendar/index.scss +++ /dev/null @@ -1,208 +0,0 @@ -.mk-calendar { - position: relative; - width: 100%; - padding: 20px; - - .loading-data { - position: absolute; - top: 0; - left: 20px; - right: 20px; - bottom: 0; - z-index: 2; - opacity: 0.5; - background: #ffffff; - .ant-spin-spinning { - position: absolute; - left: 50%; - top: 270px; - } - } - .mk-calendar-control { - text-align: right; - .ant-select { - width: 90px; - margin-right: 15px; - } - } - .mk-calendar-content { - margin-top: 10px; - .day-calendar .ant-col { - min-height: 235px; - table { - width: 100%; - thead { - text-align: center; - color: #1890ff; - tr { - height: 30px; - } - tr:first-child { - th { - font-weight: 600; - font-size: 16px; - } - } - } - tbody { - text-align: center; - tr { - height: 28px; - td { - .day-wrap { - cursor: pointer; - transition: background 0.1s; - span { - display: inline-block; - width: 100%; - height: 100%; - } - } - .day-wrap:hover { - background: #bae7ff; - } - } - } - } - } - } - .month-calendar { - table { - width: 100%; - thead { - text-align: center; - color: #1890ff; - font-size: 16px; - tr { - height: 35px; - } - } - tbody { - tr { - td { - position: relative; - width: 14.2%; - .month-wrap { - cursor: pointer; - height: 120px; - width: calc(100% - 2px); - transition: background 0.1s; - margin-bottom: 2px; - box-shadow: 0px 0px 3px #bae7ff; - .header { - text-align: center; - font-size: 16px; - } - .content { - padding: 0 10px 10px; - height: 90px; - overflow-y: auto; - position: absolute; - left: 0; - right: 0; - .message { - width: 100%; - .ant-badge-status-text { - color: inherit; - } - } - } - .content::-webkit-scrollbar { - width: 5px; - } - .content::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.7); - background: rgba(255, 255, 255, 0.7); - } - .content::-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); - } - } - .month-wrap:hover { - background: #e6f7ff; - } - } - } - } - } - } - .year-calendar { - .year-wrap { - width: calc(100% - 2px); - box-shadow: 0px 0px 3px #bae7ff; - cursor: pointer; - transition: background 0.1s; - .header { - text-align: center; - font-size: 16px; - } - .content { - padding: 5px 15px 10px; - height: 110px; - overflow-y: auto; - margin-bottom: 2px; - .ant-badge-status-text { - color: inherit; - } - .message { - width: 100%; - // white-space: nowrap; - overflow: hidden; - margin-bottom: 5px; - text-overflow: ellipsis; - } - } - .content::-webkit-scrollbar { - width: 5px; - } - .content::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.7); - background: rgba(255, 255, 255, 0.7); - } - .content::-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); - } - } - .year-wrap:hover { - background: #e6f7ff; - } - } - } -} -.calendar-day-pop { - .message { - .ant-badge-status-text { - display: inline-block; - min-width: 200px; - max-width: 350px; - vertical-align: middle; - } - } - .ant-popover-inner-content { - min-height: 100px; - max-height: 200px; - overflow-y: auto; - } - .ant-popover-inner-content::-webkit-scrollbar { - width: 5px; - } - .ant-popover-inner-content::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.09); - background: rgba(0, 0, 0, 0.09); - } - .ant-popover-inner-content::-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); - } -} diff --git a/src/templates/calendarconfig/calcomponent/calendarform/index.jsx b/src/templates/calendarconfig/calcomponent/calendarform/index.jsx deleted file mode 100644 index 2d1f32a..0000000 --- a/src/templates/calendarconfig/calcomponent/calendarform/index.jsx +++ /dev/null @@ -1,156 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Checkbox, Tooltip, Radio } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' -// import './index.scss' - -class MainTab extends Component { - static propTpyes = { - config: PropTypes.object, // 椤甸潰閰嶇疆 - calendar: PropTypes.any // 鏃ュ巻閰嶇疆淇℃伅 - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - render() { - const { getFieldDecorator } = this.props.form - const { calendar, config } = this.props - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 10 } - } - } - return ( - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={24}> - <Form.Item label="寮�濮嬫椂闂�"> - {getFieldDecorator('startfield', { - initialValue: calendar.startfield, - rules: [ - { - required: true, - message: '璇烽�夋嫨寮�濮嬫椂闂�!' - } - ] - })( - <Select> - {config.columns.map(option => - <Select.Option key={option.uuid} value={option.field}>{option.label}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="缁撴潫鏃堕棿"> - {getFieldDecorator('endfield', { - initialValue: calendar.endfield, - rules: [ - { - required: true, - message: '璇烽�夋嫨缁撴潫鏃堕棿!' - } - ] - })( - <Select> - {config.columns.map(option => - <Select.Option key={option.uuid} value={option.field}>{option.label}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="淇℃伅瀛楁"> - {getFieldDecorator('remarkfield', { - initialValue: calendar.remarkfield, - rules: [ - { - required: true, - message: '璇烽�夋嫨淇℃伅瀛楁!' - } - ] - })( - <Select> - {config.columns.map(option => - <Select.Option key={option.uuid} value={option.field}>{option.label}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="棰滆壊瀛楁"> - {getFieldDecorator('colorfield', { - initialValue: calendar.colorfield, - rules: [ - { - required: false, - message: '璇烽�夋嫨棰滆壊瀛楁!' - } - ] - })( - <Select> - {config.columns.map(option => - <Select.Option key={option.uuid} value={option.field}>{option.label}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鏃ュ巻绛夌骇"> - {getFieldDecorator('levels', { - initialValue: calendar.levels, - rules: [ - { - required: true, - message: '璇烽�夋嫨鏃ュ巻绛夌骇!' - } - ] - })( - <Checkbox.Group options={[{ value: 'day', label: '鏃�' }, { value: 'month', label: '鏈�' }, { value: 'year', label: '骞�' }]}/> - )} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label={ - <Tooltip placement="topLeft" title="寮�鍚悗锛屼娇鐢ㄧ郴缁熷嚱鏁版椂浼氳嚜鍔ㄦ浛鎹㈡暟鎹簮鍙婅嚜瀹氫箟鑴氭湰涓殑calendarDate涓巆alendarDate1锛屽叾鍊煎垎鍒负閫夋嫨骞翠唤鐨勫紑濮嬪拰缁撴潫鏃堕棿锛屼娇鐢ㄨ嚜瀹氫箟鍑芥暟鏃讹紝浼氬鍔燾alendarDate浼犲弬锛屽叾鍊间负閫夋嫨骞翠唤銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鏁版嵁鍒锋柊 - </Tooltip> - }> - {getFieldDecorator('refresh', { - initialValue: calendar.refresh || 'false', - })( - <Radio.Group> - <Radio key="true" value="true">寮�鍚�</Radio> - <Radio key="false" value="false">鍏抽棴</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(MainTab) \ No newline at end of file diff --git a/src/templates/calendarconfig/calcomponent/calendarform/index.scss b/src/templates/calendarconfig/calcomponent/calendarform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/templates/calendarconfig/calcomponent/calendarform/index.scss +++ /dev/null diff --git a/src/templates/calendarconfig/calcomponent/index.jsx b/src/templates/calendarconfig/calcomponent/index.jsx deleted file mode 100644 index 4a475c3..0000000 --- a/src/templates/calendarconfig/calcomponent/index.jsx +++ /dev/null @@ -1,93 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal } from 'antd' -import { EditOutlined } from '@ant-design/icons' - -import CalendarForm from './calendarform' - -import './index.scss' - -class SettingComponent extends Component { - static propTpyes = { - config: PropTypes.any, // 鏍囩 - updateConfig: PropTypes.func, - } - - state = { - calendar: null, // 鏃ュ巻璁剧疆 - visible: false, // 妯℃�佹鎺у埗 - } - - /** - * @description 淇濆瓨椤甸潰閰嶇疆淇℃伅 - */ - calendarSave = () => { - const { config } = this.props - - this.calendarRef.handleConfirm().then(res => { - this.setState({ - visible: false - }) - this.props.updateConfig({...config, calendar: res}) - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - /** - * @description 娣诲姞鎴栦慨鏀规爣绛� - */ - handleTab = (e) => { - const { config } = this.props - e.stopPropagation() - - let calendar = fromJS(config.calendar).toJS() - - this.setState({ - visible: true, - calendar - }) - } - - render() { - const { config } = this.props - const { visible, calendar } = this.state - - return ( - <div className="model-calendar-setting"> - <EditOutlined onClick={this.handleTab} /> - {/* 璁剧疆鍏ㄥ眬閰嶇疆鍙婂垪琛ㄦ暟鎹簮 */} - <Modal - wrapClassName="model-calendar-setting-modal" - title="鏃ュ巻鍏宠仈瀛楁" - visible={visible} - width={700} - maskClosable={false} - onCancel={() => { this.setState({ visible: false })}} - onOk={this.calendarSave} - destroyOnClose - > - <CalendarForm - config={config} - calendar={calendar} - wrappedComponentRef={(inst) => this.calendarRef = inst} - /> - </Modal> - </div> - ) - } -} - -export default SettingComponent \ No newline at end of file diff --git a/src/templates/calendarconfig/calcomponent/index.scss b/src/templates/calendarconfig/calcomponent/index.scss deleted file mode 100644 index 5065e8f..0000000 --- a/src/templates/calendarconfig/calcomponent/index.scss +++ /dev/null @@ -1,41 +0,0 @@ -.model-calendar-setting { - position: absolute; - right: 0; - top: 0; - z-index: 2; - >.anticon-edit { - font-size: 18px; - padding: 5px; - margin-right: 10px; - color: #1890ff; - cursor: pointer; - } -} - -.model-calendar-setting-modal { - .ant-modal { - top: 50px; - padding-bottom: 5px; - .ant-modal-body { - max-height: calc(100vh - 190px); - overflow-y: auto; - } - .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); - } - .ant-empty-normal { - margin: 5px 0px; - } - } -} \ No newline at end of file diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx deleted file mode 100644 index 34f957a..0000000 --- a/src/templates/calendarconfig/index.jsx +++ /dev/null @@ -1,842 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { DndProvider } from 'react-dnd' -import HTML5Backend from 'react-dnd-html5-backend' -import { Button, Card, Modal, Collapse, notification, Spin, Switch } from 'antd' -import { RedoOutlined } from '@ant-design/icons' -import moment from 'moment' - -import Api from '@/api' -import Utils from '@/utils/utils.js' - -import asyncComponent from '@/utils/asyncComponent' -import SearchComponent from '@/templates/sharecomponent/searchcomponent' - -import MenuForm from '@/templates/comtableconfig/menuform' -import SourceElement from '@/templates/zshare/dragsource' -import Source from './source' -import './index.scss' - -const { Panel } = Collapse -const { confirm } = Modal - -const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) -const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent')) -const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcalcomponent')) -const TabComponent = asyncComponent(() => import('./tabcomponent')) -const CalComponent = asyncComponent(() => import('./calcomponent')) -const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) -const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) -const CalendarComponent = asyncComponent(() => import('@/tabviews/zshare/calendar')) - -class SubTableConfig extends Component { - static propTpyes = { - menu: PropTypes.any, - reloadmenu: PropTypes.func, - handleView: PropTypes.func - } - - state = { - config: null, // 椤甸潰閰嶇疆 - visible: false, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪锛屾ā鎬佹鏄剧ず鎺у埗 - fields: null, // 鎼滅储鏉′欢鍙婃樉绀哄垪锛屽彲閫夊瓧娈� - formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 - menuloading: false, // 鑿滃崟淇濆瓨涓� - menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 - loading: false, // 鍔犺浇涓紝椤甸潰spin - closeVisible: false, // 鍏抽棴妯℃�佹 - originConfig: null, // 鍘熼厤缃� - tabviews: [], // 鎵�鏈夋爣绛鹃〉 - activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 - openEdition: '', // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� - mockdata: [], // 娴嬭瘯鏁版嵁 - } - - /** - * @description 鏁版嵁棰勫鐞� - * 1銆佽缃〉闈㈤厤缃俊鎭紝鏂板缓鎴栨棤閰嶇疆淇℃伅鏃讹紙鍒囨崲妯℃澘鍚庢棤閰嶇疆淇℃伅锛夛紝浣跨敤妯℃澘榛樿閰嶇疆 - * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟 - */ - UNSAFE_componentWillMount () { - const { menu } = this.props - let _LongParam = menu.LongParam - let _config = '' - - if (!_LongParam) { - _config = fromJS(Source.baseConfig).toJS() - _config.isAdd = true - } else { - _config = _LongParam - } - - if (_config.type === 'user') { - if (_config.tab) { - _config.tab.linkTab = '' - } - } - - // 椤甸潰閰嶇疆涓繚鐣欒彍鍗曚俊鎭紝鍙敤浜庢暟鎹紶閫� - _config.ParentId = menu.ParentId - _config.fstMenuId = menu.fstMenuId - _config.MenuName = menu.MenuName || '' - _config.MenuNo = menu.MenuNo || '' - _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : '' - _config.easyCode = _config.easyCode || '' - - // 鏁版嵁婧� - if (_config.setting.interType === 'inner' && !_config.setting.innerFunc) { - _config.setting.interType = 'system' - } - - this.setState({ - openEdition: menu.open_edition || '', - activeKey: menu.activeKey || '0', - config: _config, - originMenu: fromJS(_config).toJS(), - mockdata: this.getMockData(moment().format('YYYY')) - }) - } - - /** - * @description 鍔犺浇瀹屾垚鍚� - * 1銆佽幏鍙栫郴缁熷彲浣跨敤琛� - * 2銆佹牴鎹厤缃俊鎭腑宸蹭娇鐢ㄨ〃鑾峰彇鐩稿叧瀛楁淇℃伅 - */ - componentDidMount () { - this.reloadTab(false) - document.onkeydown = (event) => { - let e = event || window.event - let keyCode = e.keyCode || e.which || e.charCode - let preKey = '' - - if (e.ctrlKey) { - preKey = 'ctrl' - } - if (e.shiftKey) { - preKey = 'shift' - } else if (e.altKey) { - preKey = 'alt' - } - - if (!preKey || !keyCode) return - - let _shortcut = `${preKey}+${keyCode}` - - if (_shortcut === 'ctrl+83') { - let modals = document.querySelectorAll('.mk-pop-modal') - let msg = null - for (let i = 0; i < modals.length; i++) { - if (msg) { - break - } - - let node = modals[i].querySelector('.mk-com-name') - - if (node) { - msg = node.innerText - } - } - if (msg) { - notification.warning({ - top: 92, - message: '璇蜂繚瀛�' + msg, - duration: 5 - }) - return false - } - - let node = document.getElementById('save-config') - if (node && node.click) { - node.click() - } - return false - } - } - } - - getMockData = (year) => { - let msgs = [ - {color: 'red', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, - {color: 'orange', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, - {color: 'yellow', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, - {color: 'green', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'}, - {color: 'cyan', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'}, - {color: 'blue', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭紒'}, - {color: 'purple', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'}, - {color: 'gray', remark: '鎮ㄦ湁涓�鏉℃柊鐨勬秷鎭��'} - ] - let mockdata = [] - - for (let i = 1; i <= 12; i++) { - if (Math.random() > 0.5) { - let cell = {uuid: Utils.getuuid()} - let msg = msgs[Math.floor(Math.random() * 8)] - let day = Math.floor(Math.random() * 28 + 1) - - cell.color = msg.color - cell.remark = msg.remark - cell.start = `${year}-${i < 10 ? '0' + i : i}-${day < 10 ? '0' + day : day}` - cell.end = moment(cell.start, 'YYYY-MM-DD').add(Math.floor(Math.random() * 10), 'days').format('YYYY-MM-DD') - - mockdata.push(cell) - - if (Math.random() > 0.5) { - let _cell = {uuid: Utils.getuuid()} - let _msg = msgs[Math.floor(Math.random() * 8)] - let _day = Math.floor(Math.random() * 28 + 1) - - _cell.color = _msg.color - _cell.remark = _msg.remark - _cell.start = `${year}-${i < 10 ? '0' + i : i}-${_day < 10 ? '0' + _day : _day}` - _cell.end = moment(_cell.start, 'YYYY-MM-DD').add(Math.floor(Math.random() * 10), 'days').format('YYYY-MM-DD') - - mockdata.push(_cell) - } - } - } - - return mockdata - } - - /** - * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� - */ - reloadTab = (type) => { - this.setState({ - loading: type, - tabviews: [] - }) - Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { - if (res.status) { - let _tabviews = [] - res.UserTemp.forEach(temp => { - let item = { - uuid: temp.MenuID, - value: temp.MenuID, - text: temp.MenuName, - type: temp.Template, - MenuNo: temp.MenuNo - } - - _tabviews.push(item) - }) - - this.setState({ - loading: false, - tabviews: _tabviews - }) - - if (type) { - notification.success({ - top: 92, - message: '鍒锋柊鎴愬姛銆�', - duration: 2 - }) - } - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - document.onkeydown = () => {} - } - - // 椤甸潰杩斿洖 - handleViewBack = () => { - let param = { - editMenu: null, - editTab: null, - tabConfig: null, - subTabConfig: null, - btnTab: null, - btnTabConfig: null, - editAction: null, - subConfig: null, - tabview: '' - } - - this.props.handleView(param) - } - - getFuncNames = (data, funcNames, tableNames) => { - data.forEach(item => { - // if (item.subfuncs) { - // this.getFuncNames(item.subfuncs, funcNames, tableNames) - // return - // } - - if (item.tableName) { - tableNames.push(item.tableName) - } - if (item.innerFunc) { - funcNames.push({func: item.innerFunc, label: item.label || ''}) - } - - if (item.callbackFunc) { - funcNames.push({func: item.callbackFunc, label: item.label || ''}) - } - }) - - return { - func: funcNames, - table: tableNames - } - } - - /** - * @description 涓夌骇鑿滃崟淇濆瓨 - */ - submitConfig = () => { - const { menu } = this.props - const { openEdition } = this.state - - let _config = fromJS(this.state.config).toJS() - - // 鍩烘湰淇℃伅楠岃瘉 - if (!_config.fstMenuId || !_config.ParentId || !_config.MenuName || !_config.MenuNo) { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } - - if (_config.isAdd) { - _config.search = _config.search.filter(item => !item.origin) - } - - if (_config.type === 'user') { // 浣跨敤宸叉湁鑿滃崟鏃讹紝榛樿娣诲姞鍏宠仈鏍囩id - if (_config.tab && !_config.tab.linkTab) { - _config.tab.linkTab = Utils.getuuid() - } - } - - // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false - let vresult = this.verifyconfig(_config) - if (vresult !== true) { - _config.enabled = false - } - - _config.funcs = [] // 椤甸潰鍙婂瓙椤甸潰瀛樺偍杩囩▼闆� - - _config.funcs.push({ - type: 'view', - subtype: 'view', - uuid: menu.MenuID, - intertype: _config.setting.interType || 'system', - interface: _config.setting.interface || '', - tableName: _config.setting.tableName || '', - innerFunc: _config.setting.innerFunc || '', - outerFunc: _config.setting.outerFunc || '' - }) - - if (_config.tab) { - _config.funcs.push({ - type: 'tab', - subtype: 'tab', - uuid: _config.tab.uuid, - label: _config.tab.label, - linkTab: _config.tab.linkTab - }) - } - - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } - - new Promise(resolve => { - // if (_config.tab) { - // Api.getSystemConfig({ - // func: 'sPC_Get_LongParam', - // MenuID: _config.tab.linkTab - // }).then(result => { - // if (result.status && result.LongParam) { - // let _LongParam = '' - - // if (result.LongParam) { - // try { - // _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - // } catch (e) { - // console.warn('Parse Failure') - // _LongParam = '' - // } - // } - - // if (_LongParam) { - // _config.funcs[1].menuNo = _LongParam.tabNo || '' - // _config.funcs[1].subfuncs = _LongParam.funcs || [] - // } - // } - // resolve() - // }) - // } else { - // resolve() - // } - resolve() - }).then(() => { - // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser - delete _config.type - delete _config.isAdd - - let _LongParam = '' - - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } - - // let tabParam = { // 娣诲姞鑿滃崟tab椤� - // func: 'sPC_sMenusTab_AddUpt', - // MenuID: menu.MenuID - // } - - // if (_config.tab) { - // tabParam.LText = Utils.formatOptions(`select '${menu.MenuID}' as MenuID ,'${_config.tab.linkTab}' as Tabid,'${_config.tab.label}' as TabName ,'0' as Sort`) - // } else { - // tabParam.LText = Utils.formatOptions(`select '${menu.MenuID}' as MenuID ,'' as Tabid,'' as TabName ,'0' as Sort`) - // } - - // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - - let _vals = this.getFuncNames(_config.funcs, [], []) - let _tables = Array.from(new Set(_vals.table)) - - let param = { - func: 'sPC_TrdMenu_AddUpt', - FstID: _config.fstMenuId, - SndID: _config.ParentId, - ParentID: _config.ParentId, - MenuID: menu.MenuID, - MenuNo: _config.MenuNo, - EasyCode: _config.easyCode || '', - Template: _config.Template || '', - MenuName: _config.MenuName, - PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), - LongParam: _LongParam, - LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`), - LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`) - } - - if (menu.menuSort) { // 鑿滃崟鏂板缓鏃惰缃帓搴� - param.Sort = menu.menuSort - } - - param.LText = param.LText.join(' union all ') - param.LText = Utils.formatOptions(param.LText) - param.LTexttb = param.LTexttb.join(' union all ') - param.LTexttb = Utils.formatOptions(param.LTexttb) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - if (openEdition) { // 鐗堟湰绠$悊 - param.open_edition = openEdition - } - - // 淇濆瓨鏈湴 - let localParam = fromJS(param).toJS() - - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - config: _config, - openEdition: response.open_edition || '', - originMenu: fromJS(_config).toJS(), - menuloading: false, - menucloseloading: false - }) - - this.props.reloadmenu() - - localParam.func = 'sPC_TrdMenu_AddUpt_For_Local' - delete localParam.LongParam - delete localParam.PageParam - delete localParam.Template - delete localParam.Sort - delete localParam.EasyCode - delete localParam.open_edition - - Api.genericInterface(localParam) - - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - - if (this.state.closeVisible) { - this.handleViewBack() - } - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - } - - cancelConfig = () => { - const { config, originMenu } = this.state - let _this = this - - if (config.isAdd) { - confirm({ - content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.props.handleView() - }, - onCancel() {} - }) - } else { - if (!is(fromJS(originMenu), fromJS(config))) { - this.setState({ - closeVisible: true - }) - } else { - this.props.handleView() - } - } - } - - /** - * @description 璁剧疆鍙厤缃寜閽� - */ - setSubConfig = () => { - const { menu } = this.props - const { config, originMenu, activeKey, openEdition } = this.state - - if (config.isAdd) { // 鏂板缓鑿滃崟锛屾彁绀鸿彍鍗曞皻鏈繚瀛� - notification.warning({ - top: 92, - message: '鑿滃崟灏氭湭淇濆瓨锛岃鍏堜繚瀛樿彍鍗曢厤缃紒', - duration: 5 - }) - } else { - // 鍩烘湰淇℃伅楠岃瘉 - if (!config.fstMenuId || !config.ParentId || !config.MenuName || !config.MenuNo) { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - this.setState({activeKey: '0'}) - return - } - - if (!is(fromJS(originMenu), fromJS(config))) { // 鑿滃崟淇℃伅鍙樺寲鏃讹紝鎻愮ず淇濆瓨 - notification.warning({ - top: 92, - message: '鑿滃崟閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', - duration: 5 - }) - return - } - - let submenu = menu.fstMenuList.filter(item => item.MenuID === config.fstMenuId)[0] - let _Menu = { - ...menu, - LongParam: config, - PageParam: {...menu.PageParam, Template: config.Template, OpenType: config.OpenType}, - MenuName: config.MenuName, - MenuNo: config.MenuNo, - ParentId: config.ParentId, - fstMenuId: config.fstMenuId, - supMenuList: submenu ? submenu.options : [] - } - - // 鑿滃崟淇℃伅楠岃瘉閫氳繃鍚庯紝璺宠浆瀛愰厤缃〉闈� - _Menu.activeKey = activeKey // 淇濆瓨褰撳墠鎵撳紑椤电 - _Menu.open_edition = openEdition // 鏇存柊鐗堟湰鍙� - - let param = { - editMenu: _Menu, - editTab: fromJS(config.tab).toJS(), - tabConfig: null, - editSubTab: null, - subTabConfig: null, - btnTab: null, - btnTabConfig: null, - editAction: '', - subConfig: '', - tabview: config.tab.type - } - - // 褰撳瓙琛ㄤ娇鐢ㄤ富椤垫悳绱㈡潯浠舵椂锛屽皢涓婚〉鎼滅储鍚戜笅浼犻�� - if (param.editTab && param.editTab.searchPass === 'true') { - param.editTab.mainsearch = fromJS(config.search).toJS() - } - - this.setState({ - loading: true - }) - - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: config.tab.linkTab - }).then(res => { - if (res.status) { - this.setState({ - loading: false - }) - let _LongParam = '' - if (res.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { - param.subConfig = _LongParam - } - - if (param.editTab) { - param.editTab.open_edition = res.open_edition || '' - } - - this.props.handleView(param) - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - } - - /** - * @description 鍒囨崲鏍囩鏄惁鍚敤 - */ - onEnabledChange = () => { - const { config } = this.state - - let _enabled = !config.enabled - let result = this.verifyconfig(config) - - if (_enabled && result !== true) { - notification.warning({ - top: 92, - message: result, - duration: 5 - }) - return - } - - this.setState({ - config: {...config, enabled: _enabled} - }) - } - - /** - * @description 鏍¢獙閰嶇疆淇℃伅鐨勫悎娉曟�� - */ - verifyconfig = (config) => { - let cols = [] - config.columns.forEach(col => { - if (col.field) { - cols.push(col.field) - } - }) - - if (config.setting.interType === 'system' && config.setting.default !== 'false' && !config.setting.dataresource) { - return '鑿滃崟灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�' - } else if (config.columns.length === 0) { - return '鑿滃崟灏氭湭璁剧疆瀛楁闆嗭紝涓嶅彲鍚敤锛�' - } else if (!config.calendar.startfield) { - return '鏃ュ巻鍏宠仈瀛楁鏈缃紝涓嶅彲鍚敤锛�' - } else if (!cols.includes(config.calendar.startfield)) { - return '寮�濮嬫椂闂村瓧娈靛凡鍒犻櫎锛屼笉鍙惎鐢紒' - } else if (!cols.includes(config.calendar.endfield)) { - return '缁撴潫鏃堕棿瀛楁宸插垹闄わ紝涓嶅彲鍚敤锛�' - } else if (config.calendar.colorfield && !cols.includes(config.calendar.colorfield)) { - return '棰滆壊瀛楁宸插垹闄わ紝涓嶅彲鍚敤锛�' - } else if (!cols.includes(config.calendar.remarkfield)) { - return '淇℃伅瀛楁宸插垹闄わ紝涓嶅彲鍚敤锛�' - } else { - return true - } - } - - /** - * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽�佺矘璐淬�佹浛鎹㈢瓑 - */ - updateConfig = (res) => { - if (res.type === 'thaw') { - this.setState({ - config: res.config - }) - } else if (res.type === 'paste') { - this.setState({config: res.config}) - } - } - - /** - * @description 鏇存柊鎼滅储鏉′欢閰嶇疆淇℃伅 - */ - updatesearch = (config) => { - - this.setState({ - config: config - }) - } - - /** - * @description 鏇存柊鏄剧ず鍒楅厤缃俊鎭� - */ - updateconfig = (config) => { - this.setState({ - config: config - }) - } - - // 骞村垏鎹㈡椂閲嶆柊鐢熸垚鏁版嵁 - changeDate = (year) => { - this.setState({ - mockdata: this.getMockData(year) - }) - } - - render () { - const { menu } = this.props - const { activeKey, config, tabviews, mockdata } = this.state - - return ( - <div className="model-calendar-board"> - <DndProvider backend={HTML5Backend}> - {/* 宸ュ叿鏍� */} - <div className="tools"> - <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> - {/* 鍩烘湰淇℃伅 */} - <Panel forceRender={true} header="鍩烘湰淇℃伅" key="0" id="subtable-basedata"> - {/* 鑿滃崟淇℃伅 */} - <MenuForm - menu={menu} - config={config} - updatemenu={this.updateconfig} - /> - {config ? <UrlFieldComponent - config={config} - updateConfig={this.updateconfig} - /> : null} - {/* 琛ㄥ悕娣诲姞 */} - <TableComponent - config={config} - containerId="subtable-basedata" - updatetable={this.updateconfig} - /> - </Panel> - {/* 鎼滅储鏉′欢娣诲姞 */} - <Panel header="鎼滅储" key="1"> - <div className="search-element"> - {Source.searchItems.map((item, index) => { - return (<SourceElement key={index} content={item}/>) - })} - </div> - <FieldsComponent config={config} type="search" /> - </Panel> - </Collapse> - </div> - <div className="setting"> - <Card title={ - <div> - 鏃ュ巻椤甸潰閰嶇疆 - <RedoOutlined style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={() => this.reloadTab(true)} /> - </div> - } bordered={false} extra={ - <div> - <EditComponent type="table" options={['search', 'form']} config={this.state.config}/> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> - <Button onClick={this.cancelConfig}>鍏抽棴</Button> - </div> - } style={{ width: '100%' }}> - <SettingComponent - config={config} - MenuID={menu.MenuID} - updateConfig={this.updateconfig} - /> - <SearchComponent - menu={{MenuID: menu.MenuID, MenuName: config.MenuName}} - config={config} - updatesearch={this.updatesearch} - /> - <div className="calendar-wrap"> - <TabComponent config={config} updateConfig={this.updateconfig} tabviews={tabviews} setSubConfig={this.setSubConfig} /> - <CalComponent config={config} updateConfig={this.updateconfig} /> - <CalendarComponent calendar={{ - levels: config.calendar.levels, startfield: 'start', endfield: 'end', colorfield: 'color', remarkfield: 'remark', refresh: config.calendar.refresh - }} data={mockdata} changeDate={this.changeDate}/> - </div> - </Card> - </div> - </DndProvider> - <Modal - bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} - closable={false} - maskClosable={false} - visible={this.state.closeVisible} - onCancel={() => { this.setState({closeVisible: false}) }} - footer={[ - <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>淇濆瓨</Button>, - <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>涓嶄繚瀛�</Button>, - <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>鍙栨秷</Button> - ]} - destroyOnClose - > - 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> - {this.state.loading && <Spin size="large" />} - </div> - ) - } -} - -export default SubTableConfig diff --git a/src/templates/calendarconfig/index.scss b/src/templates/calendarconfig/index.scss deleted file mode 100644 index d40120f..0000000 --- a/src/templates/calendarconfig/index.scss +++ /dev/null @@ -1,159 +0,0 @@ -.model-calendar-board { - position: fixed; - z-index: 1; - padding-top: 48px; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - background: rgba(0, 0, 0, 0.35); - display: flex; - .tools { - flex: 1; - background: #ffffff; - border-right: 1px solid #d9d9d9; - height: 100%; - overflow-y: hidden; - padding-bottom: 30px; - .ant-collapse-borderless { - background-color: #ffffff; - } - .ant-collapse-item { - position: relative; - border: 0; - } - .ant-input-search { - margin-top: 10px; - } - .ant-collapse-item.ant-collapse-item-active { - border-bottom: 1px solid #d9d9d9; - } - .ant-collapse .ant-collapse-header { - padding: 11px 16px 10px 40px; - border-bottom: 1px solid #d9d9d9; - background: #1890ff; - color: #ffffff; - } - .ant-collapse-content-box { - .ant-form-item { - margin-bottom: 10px; - .ant-form-item-label { - text-align: left; - height: 25px; - line-height: 25px; - } - } - } - .search-element { - padding-top: 10px; - li { - padding: 0px 16px 10px; - div { - cursor: move; - } - } - } - - .config-button { - min-width: 65px; - } - } - .tools:hover { - overflow-y: auto; - } - .tools::-webkit-scrollbar { - width: 7px; - } - .tools::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0); - background: rgba(0, 0, 0, 0); - } - .tools::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0); - border-radius: 3px; - border: 1px solid rgba(0, 0, 0, 0); - background: rgba(0, 0, 0, 0); - } - .tools:hover::-webkit-scrollbar-thumb { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); - background: rgba(0, 0, 0, 0.13); - } - .tools:hover::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); - border: 1px solid rgba(0, 0, 0, 0.07); - } - .setting { - position: relative; - width: calc(100vw - 235px); - height: 100%; - background: #ffffff; - .ant-switch.big { - min-width: 60px; - height: 28px; - line-height: 28px; - margin-top: -2px; - .ant-switch-inner { - font-size: 14px; - } - } - .ant-switch.big::after { - width: 24px; - height: 24px; - } - .ant-card-head { - min-height: 44px; - } - .ant-card-head-title { - padding: 5px 0; - color: #1890ff; - } - .ant-card-extra { - padding: 5px 0; - button { - margin-left: 20px; - } - } - .ant-card-body { - position: relative; - padding: 0; - - > .anticon-setting { - position: absolute; - font-size: 18px; - right: 7px; - top: 10px; - } - .calendar-wrap { - position: relative; - padding-top: 10px; - } - } - } - .setting { - overflow-y: scroll; - } - .setting::-webkit-scrollbar { - width: 7px; - } - .setting::-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); - display: none; - } - .setting::-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); - } - .setting:hover::-webkit-scrollbar-thumb { - display: block; - } - .ant-spin { - position: absolute; - margin-left: calc(50vw - 22px); - margin-top: 30vh; - } -} diff --git a/src/templates/calendarconfig/source.jsx b/src/templates/calendarconfig/source.jsx deleted file mode 100644 index 9638d63..0000000 --- a/src/templates/calendarconfig/source.jsx +++ /dev/null @@ -1,101 +0,0 @@ -import Utils from '@/utils/utils.js' - -class CalendarBaseData { - baseConfig = { - version: '1.0', - type: 'system', - Template: 'CalendarPage', - enabled: false, - tabName: '', - tabNo: '', - Remark: '', - uuid: Utils.getuuid(), - setting: { - tableName: '', - primaryKey: '', - dataresource: '', - interType: 'system', - innerFunc: '', - interface: '', - outerFunc: '' - }, - columns: [], - scripts: [], - tables: [], - tab: null, - calendar: { - levels: ['day', 'month', 'year'], - startfield: '', - endfield: '', - colorfield: '', - remarkfield: '', - refresh: 'false' - }, - search: [] - } - - searchItems = [ - { - type: 'search', - label: '鏂囨湰', - subType: 'text', - url: '' - }, - { - type: 'search', - label: '涓嬫媺閫夋嫨', - subType: 'select', - url: '' - }, - { - type: 'search', - label: '涓嬫媺澶氶��', - subType: 'multiselect', - url: '' - }, - { - type: 'search', - label: '鑱斿姩鑿滃崟', - subType: 'link', - url: '' - }, - { - type: 'search', - label: '閫夐」鍗�', - subType: 'checkcard', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堝ぉ锛�', - subType: 'date', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堝懆锛�', - subType: 'dateweek', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堟湀锛�', - subType: 'datemonth', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堝尯闂达級', - subType: 'daterange', - url: '' - }, - { - type: 'search', - label: '鏃ユ湡锛堢粍鍚堬級', - subType: 'group', - url: '' - } - ] -} - -export default new CalendarBaseData() diff --git a/src/templates/calendarconfig/tabcomponent/index.jsx b/src/templates/calendarconfig/tabcomponent/index.jsx deleted file mode 100644 index f85bba9..0000000 --- a/src/templates/calendarconfig/tabcomponent/index.jsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { Modal } from 'antd' -import { EditOutlined, CloseOutlined, PlusOutlined } from '@ant-design/icons' - -import { getTabForm } from '@/templates/zshare/formconfig' -import TabForm from './tabform' -import './index.scss' - -const { confirm } = Modal - -class SettingComponent extends Component { - static propTpyes = { - config: PropTypes.any, // 鏍囩 - tabviews: PropTypes.array, // 鏍囩闆� - updateConfig: PropTypes.func, - setSubConfig: PropTypes.func - } - - state = { - menu: null, // 鑿滃崟淇℃伅 - formlist: null, // 琛ㄥ崟淇℃伅 - visible: false // 妯℃�佹鎺у埗 - } - - /** - * @description 淇濆瓨椤甸潰閰嶇疆淇℃伅 - */ - tabSave = () => { - const { config } = this.props - - this.tabRef.handleConfirm().then(res => { - this.setState({ - visible: false - }) - this.props.updateConfig({...config, tab: res}) - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.config.tab), fromJS(nextProps.config.tab)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - /** - * @description 娣诲姞鎴栦慨鏀规爣绛� - */ - handleTab = (e) => { - e.stopPropagation() - const { config } = this.props - - this.setState({ - visible: true, - formlist: getTabForm(config.tab || {}, '', [], '', [], config.Template) - }) - } - - closeTab = (e) => { - const { config } = this.props - const _this = this - e.stopPropagation() - - confirm({ - content: '纭畾鍒犻櫎鏍囩鍚楋紵', - onOk() { - _this.props.updateConfig({...config, tab: ''}) - }, - onCancel() {} - }) - } - - render() { - const { tabviews, config } = this.props - const { visible } = this.state - - return ( - <div className="model-calendar-tab"> - {config.tab ? <div className="tab-control"> - <span onDoubleClick={this.props.setSubConfig}>{config.tab.label}</span> - <EditOutlined onClick={this.handleTab} /> - <CloseOutlined onClick={this.closeTab} /> - </div> : <PlusOutlined title="娣诲姞鏍囩" onClick={this.handleTab} />} - {/* 璁剧疆鍏ㄥ眬閰嶇疆鍙婂垪琛ㄦ暟鎹簮 */} - <Modal - wrapClassName="model-calendar-tab-modal" - title="缂栬緫" - visible={visible} - width={700} - maskClosable={false} - onCancel={() => { this.setState({ visible: false })}} - onOk={this.tabSave} - destroyOnClose - > - <TabForm - tabs={tabviews} - inputSubmit={this.tabSave} - formlist={this.state.formlist} - wrappedComponentRef={(inst) => this.tabRef = inst} - /> - </Modal> - </div> - ) - } -} - -export default SettingComponent \ No newline at end of file diff --git a/src/templates/calendarconfig/tabcomponent/index.scss b/src/templates/calendarconfig/tabcomponent/index.scss deleted file mode 100644 index 9bb7caf..0000000 --- a/src/templates/calendarconfig/tabcomponent/index.scss +++ /dev/null @@ -1,86 +0,0 @@ -.model-calendar-tab { - position: absolute; - top: 0; - z-index: 2; - >.anticon-plus { - position: absolute; - font-size: 18px; - left: 10px; - top: 10px; - color: #26c281; - cursor: pointer; - } - .tab-control { - position: absolute; - padding: 15px 0px 0px 10px; - left: 0px; - top: 0px; - - span:not(.anticon) { - display: inline-block; - white-space: nowrap; - font-size: 16px; - cursor: pointer; - padding: 0 10px; - border-bottom: 2px solid #1890ff; - } - - .anticon-edit { - position: absolute; - font-size: 14px; - left: 10px; - top: 2px; - color: #1890ff; - cursor: pointer; - display: none; - } - .anticon-close { - position: absolute; - font-size: 14px; - left: 35px; - top: 2px; - color: #ff4d4f; - cursor: pointer; - display: none; - } - } - .tab-control:hover { - .anticon-edit { - display: inline-block; - } - .anticon-close { - display: inline-block; - } - } -} - -.model-calendar-tab-modal { - .ant-modal { - top: 50px; - padding-bottom: 5px; - .ant-modal-body { - max-height: calc(100vh - 190px); - overflow-y: auto; - // .ant-empty { - // margin: 15vh 8px; - // } - } - .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); - } - .ant-empty-normal { - margin: 5px 0px; - } - } -} \ No newline at end of file diff --git a/src/templates/calendarconfig/tabcomponent/tabform/index.jsx b/src/templates/calendarconfig/tabcomponent/tabform/index.jsx deleted file mode 100644 index 0584c22..0000000 --- a/src/templates/calendarconfig/tabcomponent/tabform/index.jsx +++ /dev/null @@ -1,230 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Tooltip, Radio } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -import { formRule } from '@/utils/option.js' -import Utils from '@/utils/utils.js' -import './index.scss' - -class MainTab extends Component { - static propTpyes = { - tabs: PropTypes.array, // 鍙叧鑱旀爣绛鹃泦 - formlist: PropTypes.any, // 琛ㄥ崟 - inputSubmit: PropTypes.any // 鍥炶溅鎻愪氦浜嬩欢 - } - - state = { - formlist: null // 琛ㄥ崟 - } - - /** - * @description 琛ㄥ崟棰勫鐞� - */ - UNSAFE_componentWillMount () { - const { formlist } = this.props - - let _tabs = this.props.tabs.filter(tab => tab.type === 'SubTable') - - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'linkTab') { - item.options = [ - { - value: '', - text: '鏂板缓' - }, - ..._tabs - ] - } - - return item - }) - }) - } - - /** - * @description 鏍囩椤电被鍨嬪垏鎹� - */ - openTypeChange = (key, value) => { - const { formlist } = this.state - - if (key === 'type') { - let _tabs = this.props.tabs.filter(tab => tab.type === value) - - this.setState({ - formlist: formlist.map(item => { - if (item.key === 'linkTab') { - item.options = [ - { - value: '', - text: '鏂板缓' - }, - ..._tabs - ] - item.initVal = '' - } - return item - }) - }, () => { - if (this.props.form.getFieldValue('linkTab') !== undefined) { - this.props.form.setFieldsValue({linkTab: ''}) - } - }) - } - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - - this.state.formlist.forEach((item, index) => { - if (item.hidden || item.forbid) return - - if (item.type === 'text') { - let rules = [] - - if (item.key === 'foreignKey') { - rules.push({ - pattern: /^[a-zA-Z_]*$/ig, - message: item.label + '瀛楁鍙厑璁稿寘鍚瓧姣嶅強涓嬪垝绾匡紒' - }) - } - fields.push( - <Col span={24} key={index}> - <Form.Item label={ - item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - }, - { - max: formRule.input.max, - message: formRule.input.message - }, - ...rules - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 - fields.push( - <Col span={24} key={index}> - <Form.Item label={item.label}> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={(value) => {this.openTypeChange(item.key, value)}} - > - {item.options.map((option, i) => - <Select.Option id={'mk' + i} title={option.text} key={'mk' + i} value={option.value}> - {option.text} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={24} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group> - { - item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - }) - } - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } - }) - - return fields - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - - if (!values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d - values.linkTab = Utils.getuuid() - } - values.type = 'SubTable' // 绫诲瀷涓哄瓙琛� - - resolve(values) - } else { - reject(err) - } - }) - }) - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 } - } - } - return ( - <Form {...formItemLayout} style={{minHeight: '180px'}}> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainTab) \ No newline at end of file diff --git a/src/templates/calendarconfig/tabcomponent/tabform/index.scss b/src/templates/calendarconfig/tabcomponent/tabform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/templates/calendarconfig/tabcomponent/tabform/index.scss +++ /dev/null diff --git a/src/templates/formtabconfig/actionform/index.jsx b/src/templates/formtabconfig/actionform/index.jsx deleted file mode 100644 index d275498..0000000 --- a/src/templates/formtabconfig/actionform/index.jsx +++ /dev/null @@ -1,442 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Radio, notification, Tooltip, InputNumber } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -import { btnIcons, btnClasses, formRule } from '@/utils/option.js' -import MkIcon from '@/components/mk-icon' -import './index.scss' - -const { TextArea } = Input - -class MainSearch extends Component { - static propTpyes = { - formlist: PropTypes.any, // 琛ㄥ崟淇℃伅 - card: PropTypes.any, // 鎸夐挳淇℃伅 - tabs: PropTypes.array, // 鎵�鏈夋爣绛鹃〉 - inputSubmit: PropTypes.any // 鍥炶溅鎻愪氦浜嬩欢 - } - - state = { - formlist: null, // 琛ㄥ崟淇℃伅 - openType: null, // 鎵撳紑鏂瑰紡 - interType: null, // 鎺ュ彛绫诲瀷锛氬唴閮ㄣ�佸閮� - insertUpdateOptions: [{ - value: 'insert', - text: '娣诲姞' - }, { - value: 'update', - text: '淇敼' - }, { - value: 'insertOrUpdate', - text: '娣诲姞鎴栦慨鏀�' - }], - returnoptions: [{ // 杩斿洖鍚�-涓嶅埛鏂般�佸埛鏂伴〉闈€�佸埛鏂拌〃鏍� - value: 'never', - text: '涓嶅埛鏂�' - }, { - value: 'grid', - text: '鍒锋柊' - }], - currentoptions: [{ // 涓嶈繑鍥炴椂-涓嶅埛鏂般�佸埛鏂� - value: 'never', - text: '涓嶅埛鏂�' - }, { - value: 'refresh', - text: '鍒锋柊' - }], - interTypeOptions: [{ - value: 'system', - text: '绯荤粺' - }, { - value: 'inner', - text: '鍐呴儴' - }, { - value: 'outer', - text: '澶栭儴' - }, { - value: 'custom', - text: '鑷畾涔�' - }] - } - - - UNSAFE_componentWillMount () { - const { card } = this.props - let _intertype = '' - - this.props.formlist.forEach(form => { - if (form.key === 'intertype') { - _intertype = form.initVal - if (card.btnType !== 'confirm') { - form.options = this.state.interTypeOptions.filter(op => op.value !== 'system') - } else { - form.options = this.state.interTypeOptions - } - } - }) - - let _options = this.getOptions(card.btnType, _intertype) - - let formlist = this.props.formlist.map(item => { - if (item.key === 'class') { - item.options = btnClasses - } else if (item.key === 'icon') { - item.options = btnIcons - } else if (item.key === 'resetPageIndex') { - item.tooltip = '椤甸潰鍏抽棴锛屼笖鎵ц鍒锋柊鏃剁敓鏁�' - } else if (item.key === 'sqlType') { - item.options = this.state.insertUpdateOptions - } else if (item.key === 'OpenType') { - item.options = [ - { - value: 'prompt', - text: '鎻愮ず妗�' - }, { - value: 'exec', - text: '鐩存帴鎵ц' - } - ] - if (card.btnType === 'cancel') { - item.readonly = true - } - } else if (item.key === 'execSuccess' && card.btnType === 'cancel') { - item.label = '鍏抽棴鍚�' - item.options[1].text = '鍒锋柊' - } else if (item.key === 'execSuccess' || item.key === 'execError') { - item.options[1].text = '鍒锋柊' - } else if (item.key === 'innerFunc' && card.btnType !== 'confirm' && _intertype === 'inner') { - item.required = true - } - - item.hidden = !_options.includes(item.key) - return item - }) - formlist.push({ - type: 'radio', - key: 'afterExecSuccess', - label: '鎴愬姛鍚�', - initVal: card.afterExecSuccess || 'close', - required: true, - options: [{ - value: 'close', - text: '鍏抽棴' - }, { - value: 'notclose', - text: '涓嶅叧闂�' - }] - }, - { - type: 'radio', - key: 'afterExecError', - label: '澶辫触鍚�', - initVal: card.afterExecError || 'notclose', - required: true, - options: [{ - value: 'close', - text: '鍏抽棴' - }, { - value: 'notclose', - text: '涓嶅叧闂�' - }] - },) - - this.setState({formlist}) - } - - componentDidMount () { - const { card } = this.props - - if (card.focus) { - try { - let _form = document.getElementById('label') - _form.select() - } catch (e) { - console.warn('琛ㄥ崟focus澶辫触锛�') - } - } - } - - getOptions = (btnType, intertype) => { - let _options = [] - - if (btnType === 'cancel') { - _options = ['label', 'OpenType', 'icon', 'class', 'execSuccess', 'resetPageIndex'] - } else if (btnType === 'confirm') { - if (intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] - } else if (intertype === 'system') { - _options = ['label', 'OpenType', 'intertype', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] - } - } else { - if (intertype === 'outer') { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'sysInterface', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] - } else { - _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'afterExecSuccess', 'afterExecError', 'resetPageIndex'] - } - } - - return _options - } - - onChange = (e, key) => { - const { card } = this.props - - let value = e.target.value - - if (key === 'intertype') { - let _options = this.getOptions(card.btnType, value) - - this.setState({ - interType: value, - formlist: this.state.formlist.map(item => { - item.hidden = !_options.includes(item.key) - - if (item.key === 'interface') { - item.readonly = false - } else if (item.key === 'sysInterface') { - item.initVal = 'false' - } else if (item.key === 'innerFunc' && value === 'inner') { - item.required = true - } else if (item.key === 'innerFunc' && value === 'outer') { - item.required = false - } - - return item - }) - }) - } else if (key === 'sysInterface') { - if (value === 'true') { - this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || '' - }) - } - this.setState({ - formlist: this.state.formlist.map(item => { - if (item.key === 'interface' && value === 'true') { - item.readonly = true - } else if (item.key === 'interface') { - item.readonly = false - } - - return item - }) - }) - } - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - getFields() { - const { getFieldDecorator } = this.props.form - const fields = [] - - this.state.formlist.forEach((item, index) => { - if (item.hidden) return - - if (item.type === 'text') { - let _rules = [] - if (item.key === 'innerFunc') { - let str = '^(' + item.fields.join('|') + ')' - let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') - _rules = [{ - pattern: _patten, - message: formRule.func.innerMessage - }, { - max: formRule.func.max, - message: formRule.func.maxMessage - }] - } else if (item.key === 'outerFunc' || item.key === 'callbackFunc') { - _rules = [{ - pattern: formRule.func.pattern, - message: formRule.func.message - }, { - max: formRule.func.max, - message: formRule.func.maxMessage - }] - } else { - _rules = [{ - max: formRule.input.max, - message: formRule.input.message - }] - } - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: item.readonly ? false : !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - }, - ..._rules - ] - })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'number') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal - })(<InputNumber min={1} max={10000} precision={0} />)} - </Form.Item> - </Col> - ) - } else if (item.type === 'select') { // 涓嬫媺鎼滅储 - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal || '', - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Select - getPopupContainer={() => document.getElementById('winter')} - disabled={!!item.readonly} - > - {item.options.map((option, index) => - <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}> - {item.key === 'icon' && option.value && <MkIcon type={option.value} />} {option.text} - </Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'radio') { - fields.push( - <Col span={12} key={index}> - <Form.Item label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> - <QuestionCircleOutlined className="mk-form-tip" /> - {item.label} - </Tooltip> : item.label - }> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: !!item.required, - message: '璇烽�夋嫨' + item.label + '!' - } - ] - })( - <Radio.Group onChange={(e) => {this.onChange(e, item.key)}}> - { - item.options.map(option => { - return ( - <Radio key={option.value} value={option.value}>{option.text}</Radio> - ) - }) - } - </Radio.Group> - )} - </Form.Item> - </Col> - ) - } else if (item.type === 'textarea') { - fields.push( - <Col span={24} key={index}> - <Form.Item label={item.label} className="textarea"> - {getFieldDecorator(item.key, { - initialValue: item.initVal, - rules: [ - { - required: item.readonly ? false : !!item.required, - message: '璇疯緭鍏�' + item.label + '!' - } - ] - })(<TextArea rows={4} readOnly={item.readonly}/>)} - </Form.Item> - </Col> - ) - } - }) - return fields - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - values.uuid = this.props.card.uuid - values.verify = this.props.card.verify || null - values.btnType = this.props.card.btnType || 'tabFormBtn' - - - if (values.innerFunc === '' && values.sql === '') { - notification.warning({ - top: 92, - message: '浣跨敤绯荤粺鍑芥暟鏃讹紝璇峰~鍐欒〃鍚嶏紝浣跨敤鑷畾涔夊嚱鏁版椂锛屽彲蹇界暐銆�', - duration: 5 - }) - } else if (values.innerFunc === '' && values.sql !== '' && values.sqlType === '') { - notification.warning({ - top: 92, - message: '浣跨敤绯荤粺鍑芥暟鏃讹紝璇烽�夋嫨鎿嶄綔绫诲瀷锛屼娇鐢ㄨ嚜瀹氫箟鍑芥暟鏃讹紝鍙拷鐣ャ��', - duration: 5 - }) - } else { - resolve(values) - } - } else { - reject(err) - } - }) - }) - } - - render() { - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 7 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 17 } - } - } - return ( - <Form {...formItemLayout} className="formtab-action-list-form" id="winter"> - <Row gutter={24}>{this.getFields()}</Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/templates/formtabconfig/actionform/index.scss b/src/templates/formtabconfig/actionform/index.scss deleted file mode 100644 index 969304f..0000000 --- a/src/templates/formtabconfig/actionform/index.scss +++ /dev/null @@ -1,33 +0,0 @@ -.formtab-action-list-form { - min-height: 190px; - .superconfig { - color: #1890ff; - cursor: pointer; - } - .textarea { - .ant-col-sm-7 { - width: 14%; - } - .ant-col-sm-17 { - width: 86%; - } - } - .with-button { - .ant-form-item-control-wrapper { - padding-right: 63px; - } - .ant-btn { - position: absolute; - right: 12px; - top: 4.5px; - } - } - .ant-input:read-only { - background: #fafafa; - resize: none; - } - .ant-input:read-only:hover, .ant-input:read-only:focus { - border-color: #d9d9d9; - box-shadow: none; - } -} \ No newline at end of file diff --git a/src/templates/formtabconfig/dragelement/card.jsx b/src/templates/formtabconfig/dragelement/card.jsx deleted file mode 100644 index feab70f..0000000 --- a/src/templates/formtabconfig/dragelement/card.jsx +++ /dev/null @@ -1,161 +0,0 @@ -import React from 'react' -import { useDrag, useDrop } from 'react-dnd' -import { Button, Select, DatePicker, Input, InputNumber, Popover } from 'antd' -import { EditOutlined, CopyOutlined, ProfileOutlined, CloseOutlined, UploadOutlined, TableOutlined } from '@ant-design/icons' -import moment from 'moment' -import ItemTypes from './itemtypes' -import './index.scss' - -const { MonthPicker } = DatePicker -const { TextArea } = Input - -const Card = ({ id, type, cols, card, moveCard, findCard, editCard, delCard, profileCard, copyCard }) => { - const originalIndex = findCard(id).index - const [{ isDragging }, drag] = useDrag({ - item: { type: ItemTypes[type], id, originalIndex }, - collect: monitor => ({ - isDragging: monitor.isDragging(), - }), - }) - const [, drop] = useDrop({ - accept: ItemTypes[type], - canDrop: () => true, - drop: (item) => { - const { id: draggedId, originalIndex } = item - - if (originalIndex === undefined) { - item.dropTargetId = id - } else if (draggedId && draggedId !== id) { - const { index: overIndex } = findCard(id) - moveCard(draggedId, overIndex) - } - } - }) - const opacity = isDragging ? 0.5 : 1 - - const edit = () => { - editCard(id) - } - - const del = () => { - delCard(id) - } - - const copy = () => { - copyCard(id) - } - - const profile = () => { - profileCard(id) - } - - let _defaultValue = '' // 涓嬫媺鎼滅储銆佹椂闂磋寖鍥寸被鍨嬶紝鍒濆鍊奸渶瑕侀澶勭悊 - - if (type === 'search' && (card.type === 'multiselect' || card.type === 'select' || card.type === 'link')) { - if (card.initval) { - let _option = card.options.filter(option => option.Value === card.initval)[0] - if (_option) { - _defaultValue = _option.Text || '' - } else { - _defaultValue = '' - } - } else if (card.setAll === 'true') { - _defaultValue = card.emptyText || '绌�' - } - } else if (type === 'search' && card.type === 'daterange') { - _defaultValue = [null, null] - if (card.initval === 'week') { - _defaultValue = [moment().startOf('week'), moment().endOf('week')] - } else if (card.initval === 'month') { - _defaultValue = [moment().startOf('month'), moment().endOf('month')] - } else if (card.initval) { - try { - let _initval = JSON.parse(card.initval) - _defaultValue = [moment().subtract(_initval[0], 'days'), moment().subtract(_initval[1], 'days')] - } catch (e) { - _defaultValue = [null, null] - } - } - } - - let labelCol = 'ant-col-sm-8' - let wrapCol = 'ant-col-sm-16' - if (card.type === 'textarea') { - if (cols === '2') { - labelCol = 'textarea-line ant-col-sm-4' - wrapCol = 'textarea-line ant-col-sm-20' - } else if (cols === '3') { - labelCol = 'textarea-line ant-col-cuslabel' - wrapCol = 'textarea-line ant-col-cuswrap' - } else if (cols === '4') { - labelCol = 'textarea-line ant-col-sm-2' - wrapCol = 'textarea-line ant-col-sm-22' - } - } - - return ( - <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ - <div className="mk-popover-control"> - <EditOutlined className="edit" title="缂栬緫" onClick={edit} /> - {type === 'search' ? <CopyOutlined className="edit copy" title="澶嶅埗" onClick={copy} /> : null} - {type === 'action' && card.btnType !== 'cancel' ? - <ProfileOutlined className="edit profile" title="鏍¢獙瑙勫垯" onClick={profile} /> : null - } - {type === 'search' || (type === 'action' && card.btnType !== 'confirm' && card.btnType !== 'cancel') ? <CloseOutlined className="edit close" title="鍒犻櫎" onClick={del} /> : null} - </div> - } trigger="hover"> - <div className="page-card" style={{ opacity: opacity}}> - <div ref={node => drag(drop(node))}> - {type === 'search' ? - <div className="ant-row ant-form-item"> - <div className={'ant-col ant-form-item-label ant-col-xs-24 ' + labelCol}> - <label title={card.label}>{card.label}</label> - </div> - <div className={'ant-col ant-form-item-control-wrapper ant-col-xs-24 ' + wrapCol}> - {card.type === 'text' ? - <Input style={{marginTop: '4px'}} value={card.initval} /> : null - } - {card.type === 'number' ? - <InputNumber value={card.initval} precision={card.decimal} /> : null - } - {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') ? - <Select value={_defaultValue}></Select> : null - } - {card.type === 'date' ? - <DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null - } - {card.type === 'datemonth' ? - <MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null - } - {card.type === 'datetime' ? - <DatePicker showTime value={card.initval ? moment().subtract(card.initval, 'days') : null} /> : null - } - {card.type === 'textarea' ? - <TextArea value={card.initval} autoSize={{ minRows: 2, maxRows: 6 }} /> : null - } - {card.type === 'funcvar' && - <Input style={{marginTop: '4px'}} value={card.linkfield} /> - } - {card.type === 'fileupload' ? - <Button> - <UploadOutlined /> 鐐瑰嚮涓婁紶 - </Button> : null - } - </div> - </div> : null - } - {type === 'action' ? - <Button - className={'mk-btn mk-' + card.class} - icon={card.icon} - key={card.uuid} - > - {card.label}{card.position === 'grid' && <TableOutlined />} - </Button> : null - } - </div> - </div> - </Popover> - ) -} -export default Card diff --git a/src/templates/formtabconfig/dragelement/index.jsx b/src/templates/formtabconfig/dragelement/index.jsx deleted file mode 100644 index 3621397..0000000 --- a/src/templates/formtabconfig/dragelement/index.jsx +++ /dev/null @@ -1,199 +0,0 @@ -import React, { useState } from 'react' -import { useDrop } from 'react-dnd' -import update from 'immutability-helper' -import { is, fromJS } from 'immutable' -import { Col } from 'antd' -import Utils from '@/utils/utils.js' -import Card from './card' -import ItemTypes from './itemtypes' -import './index.scss' - -const Container = ({list, type, groupId, setting, handleList, handleMenu, deleteMenu, profileMenu }) => { - const [cards, setCards] = useState(list) - const moveCard = (id, atIndex) => { - const { card, index } = findCard(id) - - if (!card) return - - const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) - if (type === 'action') { - handleList(type, _cards) - } else { - handleList(type, _cards, null, groupId) - } - } - - if (!is(fromJS(cards), fromJS(list))) { - setCards(list) - } - - const findCard = id => { - const card = cards.filter(c => `${c.uuid}` === id)[0] - return { - card, - index: cards.indexOf(card), - } - } - - const editCard = id => { - const { card } = findCard(id) - handleMenu(card) - } - - const copyCard = id => { - const { card } = findCard(id) - - let _card = JSON.parse(JSON.stringify(card)) - - _card.originUuid = _card.uuid - _card.uuid = Utils.getuuid() - _card.iscopy = true - _card.focus = true - - // 澶嶅埗鍒板壀鍒囨澘 - let oInput = document.createElement('input') - let val = JSON.parse(JSON.stringify(_card)) - val.copyType = 'form' - val.uuid = Utils.getuuid() - - delete val.originUuid - delete val.iscopy - - delete val.$srcId - - let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId') - if (srcid) { - val.$srcId = srcid - } - - oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val))) - document.body.appendChild(oInput) - oInput.select() - document.execCommand('Copy') - oInput.className = 'oInput' - oInput.style.display = 'none' - document.body.removeChild(oInput) - - handleMenu(_card) - } - - const profileCard = id => { - const { card } = findCard(id) - profileMenu(card) - } - - const delCard = id => { - const { card } = findCard(id) - deleteMenu({card: card, type: type}) - } - - const [, drop] = useDrop({ - accept: ItemTypes[type], - drop(item) { - if (item.hasOwnProperty('originalIndex') && groupId) { - const { card } = findCard(item.id) - - if (!card) { - handleList(type, cards, null, groupId, item.id) - } - } - - if (item.hasOwnProperty('originalIndex')) { - return - } - - let newcard = {} - newcard.uuid = Utils.getuuid() - newcard.focus = true - - if (item.type === 'search') { - let _match = 'like' - if (item.subType === 'select' || item.subType === 'link') { - _match = '=' - } else if (item.subType === 'date' || item.subType === 'datemonth') { - _match = '>=' - } else if (item.subType === 'dateweek' || item.subType === 'daterange') { - _match = 'between' - } - - newcard.label = 'label' - newcard.field = '' - newcard.initval = '' - newcard.type = item.subType - newcard.resourceType = '0' - newcard.options = [] - newcard.orderType = 'asc' - newcard.match = _match - } else if (item.type === 'action') { - newcard.label = 'button' - newcard.Ot = 'requiredSgl' - newcard.OpenType = item.subType - newcard.tabType = 'SubTable' - newcard.linkTab = '' - newcard.class = 'default' - newcard.intertype = 'inner' - newcard.position = 'toolbar' - newcard.execSuccess = 'grid' - newcard.execError = 'never' - newcard.popClose = 'never' - newcard.verify = null - } - - let targetId = '' - - if (item.dropTargetId) { - targetId = item.dropTargetId - delete item.dropTargetId - } else if (cards.length > 0) { - targetId = cards.slice(-1)[0].uuid - } - - const { index: overIndex } = findCard(`${targetId}`) - const _cards = update(cards, { $splice: [[overIndex + 1, 0, newcard]] }) - - handleList(type, _cards, newcard, groupId) - } - }) - - let _width = (setting && setting.width) || 100 - - return ( - <div ref={drop} className="ant-row" style={type === 'search' ? {margin: '0 auto', width: _width + '%'} : {}}> - {type === 'action' && cards.map(card => ( - <Card - key={card.uuid} - id={card.uuid} - type={type} - card={card} - moveCard={moveCard} - editCard={editCard} - delCard={delCard} - profileCard={profileCard} - findCard={findCard} - /> - ))} - {type === 'search' && cards.map(card => ( - <Col key={card.uuid} span={card.type !== 'textarea' ? 24 / setting.cols : 24}> - <Card - id={card.uuid} - key={card.uuid} - type={type} - card={card} - cols={setting.cols} - moveCard={moveCard} - editCard={editCard} - delCard={delCard} - copyCard={copyCard} - findCard={findCard} - /> - </Col> - ))} - {cards.length === 0 && - <div className="common-drawarea-placeholder"> - {type === 'action' ? '璇锋坊鍔犳寜閽�' : '璇锋坊鍔犺〃鍗�'} - </div> - } - </div> - ) -} -export default Container diff --git a/src/templates/formtabconfig/dragelement/index.scss b/src/templates/formtabconfig/dragelement/index.scss deleted file mode 100644 index 38776f9..0000000 --- a/src/templates/formtabconfig/dragelement/index.scss +++ /dev/null @@ -1,15 +0,0 @@ -.common-source-item { - display: block; - box-shadow: 0px 0px 2px #bcbcbc; - padding: 0.4rem 0.7rem; - background-color: white; - margin: 0px 0px 10px; - cursor: move; - border-radius: 4px; -} -.common-drawarea-placeholder { - width: 100%; - line-height: 65px; - text-align: center; - color: #bcbcbc; -} \ No newline at end of file diff --git a/src/templates/formtabconfig/dragelement/itemtypes.js b/src/templates/formtabconfig/dragelement/itemtypes.js deleted file mode 100644 index 9ea1f2c..0000000 --- a/src/templates/formtabconfig/dragelement/itemtypes.js +++ /dev/null @@ -1,8 +0,0 @@ -export default { - CARD: 'card', - form: 'form', - search: 'search', - action: 'action', - columns: 'columns', - tab: 'tab' -} diff --git a/src/templates/formtabconfig/dragelement/source.jsx b/src/templates/formtabconfig/dragelement/source.jsx deleted file mode 100644 index ab22158..0000000 --- a/src/templates/formtabconfig/dragelement/source.jsx +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react' -import { useDrag } from 'react-dnd' -import './index.scss' - -const SourceElement = ({content}) => { - const [, drag] = useDrag({ item: content }) - return ( - <div ref={drag} className="common-source-item"> - {content.label} - </div> - ) -} -export default SourceElement \ No newline at end of file diff --git a/src/templates/formtabconfig/groupform/index.jsx b/src/templates/formtabconfig/groupform/index.jsx deleted file mode 100644 index ed21eb8..0000000 --- a/src/templates/formtabconfig/groupform/index.jsx +++ /dev/null @@ -1,129 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, InputNumber } from 'antd' -import { formRule } from '@/utils/option.js' -import TransferForm from '../transferform' -// import Utils from '@/utils/utils.js' -// import './index.scss' - -class GroupForm extends Component { - static propTpyes = { - group: PropTypes.object, // 褰撳墠鍒嗙粍 - groups: PropTypes.array, // 鎵�鏈夊垎缁� - inputSubmit: PropTypes.any // 鍥炶溅鎻愪氦浜嬩欢 - } - - state = { - source: null, - selectds: null, - default: null - } - - UNSAFE_componentWillMount () { - const { groups, group } = this.props - let defaultgroup = groups.filter(item => item.isDefault)[0] - let _source = defaultgroup.sublist.filter(item => !item.origin) - let _selectds = group.sublist.map(item => item.uuid ) - - _source = [..._source, ...group.sublist] - - this.setState({ - source: _source, - selectds: _selectds, - }) - } - - handleConfirm = () => { - const { groups, group } = this.props - let defaultgroup = groups.filter(item => item.isDefault)[0] - - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - values.uuid = group.uuid - - if (group.isDefault) { - values.isDefault = true - values.sublist = group.sublist - - resolve(values) - } else { - let targetKeys = this.refs['fields-transfer'].state.targetKeys - let defaultlist = this.state.source.filter(item => !targetKeys.includes(item.uuid)) - - values.sublist = targetKeys.map(item => { - return this.state.source.filter(cell => cell.uuid === item)[0] - }) - - resolve({ - default: {...defaultgroup, sublist: defaultlist}, - target: values - }) - } - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - render() { - const { group, groups } = this.props - const { getFieldDecorator } = this.props.form - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - return ( - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={12}> - <Form.Item label="鍒嗙粍鍚嶇О"> - {getFieldDecorator('label', { - initialValue: group.label, - rules: [ - { - required: true, - message: '璇疯緭鍏ュ垎缁勫悕绉�!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鎺掑簭"> - {getFieldDecorator('sort', { - initialValue: group.hasOwnProperty('sort') ? group.sort : groups.length - })(<InputNumber min={0} max={100} precision={0} />)} - </Form.Item> - </Col> - {!group.isDefault ? <Col span={24}> - <TransferForm fields={this.state.source} ref="fields-transfer" selected={this.state.selectds}/> - </Col> : null} - </Row> - </Form> - ) - } -} - -export default Form.create()(GroupForm) \ No newline at end of file diff --git a/src/templates/formtabconfig/groupform/index.scss b/src/templates/formtabconfig/groupform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/templates/formtabconfig/groupform/index.scss +++ /dev/null diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx deleted file mode 100644 index d9b92c4..0000000 --- a/src/templates/formtabconfig/index.jsx +++ /dev/null @@ -1,1771 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { DndProvider } from 'react-dnd' -import HTML5Backend from 'react-dnd-html5-backend' -import moment from 'moment' -import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip } from 'antd' -import { QuestionCircleOutlined, RedoOutlined, SettingOutlined, PlusOutlined, DeleteOutlined, EditOutlined, SnippetsOutlined } from '@ant-design/icons' - -import Api from '@/api' -import Utils, { FuncUtils } from '@/utils/utils.js' -import { getModalForm, getActionForm } from '@/templates/zshare/formconfig' -import { queryTableSql } from '@/utils/option.js' - -import TabsComponent from '@/templates/sharecomponent/tabscomponent' - -import PasteForm from '@/templates/zshare/pasteform' -import ActionForm from './actionform' -import SettingForm from './settingform' -import DragElement from './dragelement' -import GroupForm from './groupform' - -import MenuForm from '@/templates/zshare/menuform' -import SourceElement from '@/templates/zshare/dragsource' -import asyncComponent from '@/utils/asyncComponent' -import Source from './source' -import './index.scss' - -const { Panel } = Collapse -const { confirm } = Modal -const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) -const CreateFunc = asyncComponent(() => import('@/templates/zshare/createfunc')) -const VerifyCard = asyncComponent(() => import('@/templates/zshare/verifycard')) - -class ComTableConfig extends Component { - static propTpyes = { - menu: PropTypes.any, - btnTab: PropTypes.object, - config: PropTypes.any, - handleView: PropTypes.func - } - - state = { - config: null, // 椤甸潰閰嶇疆 - modaltype: '', // 妯℃�佹绫诲瀷锛屾帶鍒舵ā鎬佹鏄剧ず - tableColumns: [], // 琛ㄦ牸鏄剧ず鍒� - fields: null, // 鎼滅储鏉′欢鍙婃樉绀哄垪锛屽彲閫夊瓧娈� - menuformlist: null, // 鍩烘湰淇℃伅琛ㄥ崟瀛楁 - formlist: null, // 鎼滅储鏉′欢銆佹寜閽�佹樉绀哄垪琛ㄥ崟瀛楁 - card: null, // 缂栬緫鍏冪礌 - menuloading: false, // 鑿滃崟淇濆瓨涓� - menucloseloading: false, // 鑿滃崟鍏抽棴鏃讹紝閫夋嫨淇濆瓨 - loading: false, // 鍔犺浇涓紝椤甸潰spin - settingVisible: false, // 鍏ㄥ眬閰嶇疆妯℃�佹 - closeVisible: false, // 鍏抽棴妯℃�佹 - tables: [], // 鍙敤琛ㄥ悕 - originMenu: null, // 鍘熷鑿滃崟 - delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 - tabviews: [], // 鎵�鏈夋爣绛鹃〉 - profileVisible: false, // 楠岃瘉淇℃伅妯℃�佹 - editgroup: null, // 褰撳墠缂栬緫缁� - groupVisible: false, // 缂栬緫缁勬ā鎬佹 - activeKey: '0', // 榛樿灞曞紑鍩烘湰淇℃伅 - pasteVisible: false, // 绮樿创妯℃�佹 - sqlVerifing: false, // sql楠岃瘉 - openEdition: '' // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� - } - - /** - * @description 鏁版嵁棰勫鐞� - * 1銆佽缃〉闈㈤厤缃俊鎭紝鏂板缓鎴栨棤閰嶇疆淇℃伅鏃讹紙鍒囨崲妯℃澘鍚庢棤閰嶇疆淇℃伅锛夛紝浣跨敤妯℃澘榛樿閰嶇疆 - * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟 - */ - UNSAFE_componentWillMount () { - const { menu, btnTab, config } = this.props - - let _config = '' - let columns = [] - - if (!config) { - _config = JSON.parse(JSON.stringify(Source.baseConfig)) - _config.isAdd = true - if (menu && menu.LongParam && menu.LongParam.setting) { - _config.setting.tableName = menu.LongParam.setting.tableName - _config.setting.primaryKey = menu.LongParam.setting.primaryKey - _config.setting.dataresource = menu.LongParam.setting.dataresource - _config.setting.interType = menu.LongParam.setting.interType - _config.setting.interface = menu.LongParam.setting.interface - _config.setting.outerFunc = menu.LongParam.setting.outerFunc - _config.setting.innerFunc = menu.LongParam.setting.innerFunc - _config.setting.sysInterface = menu.LongParam.setting.sysInterface - } - } else { - _config = config - - if (menu && menu.LongParam && menu.LongParam.setting) { - _config.setting.primaryKey = menu.LongParam.setting.primaryKey - } - } - - if (!_config.tabgroups) { - _config.tabgroups = [{ uuid: 'tabs', sublist: [] }] - } else if (typeof(_config.tabgroups[0]) === 'string') { - let _tabgroups = [] - _config.tabgroups.forEach(groupId => { - let _group = { - uuid: groupId, - sublist: fromJS(_config[groupId]).toJS() - } - - delete _config[groupId] - - _tabgroups.push(_group) - }) - - _config.tabgroups = _tabgroups - } - - if (menu && menu.LongParam && menu.LongParam.columns) { - columns = menu.LongParam.columns - } - - // 閰嶇疆榛樿鍊硷紝鍏煎 - _config.Template = 'FormTab' - _config.action = _config.action.map(item => { - if (item.intertype === 'inner' && !item.innerFunc) { - item.intertype = 'system' - } - return item - }) - - this.setState({ - config: _config, - activeKey: btnTab.activeKey || '0', - openEdition: btnTab.open_edition || '', - columns: columns, - originMenu: JSON.parse(JSON.stringify(_config)), - menuformlist: [ - { - type: 'text', - key: 'menuName', - label: '鑿滃崟鍚嶇О', - initVal: menu.MenuName, - readonly: true - }, - { - type: 'text', - key: 'actionName', - label: '鎸夐挳鍚嶇О', - initVal: btnTab.label, - readonly: true - } - ] - }) - } - - /** - * @description 鍔犺浇瀹屾垚鍚� - * 1銆佽幏鍙栫郴缁熷彲浣跨敤琛� - * 2銆佹牴鎹厤缃俊鎭腑宸蹭娇鐢ㄨ〃鑾峰彇鐩稿叧瀛楁淇℃伅 - * 3銆佽幏鍙栨墍鏈夋爣绛鹃〉淇℃伅 - */ - componentDidMount () { - let param = { - func: 'sPC_Get_SelectedList', - LText: queryTableSql, - obj_name: 'data', - arr_field: 'TbName,Remark' - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 - - Api.getSystemConfig(param).then(res => { - if (res.status) { - this.setState({ - tables: res.data - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - - Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { - if (res.status) { - this.setState({ - tabviews: res.UserTemp.map(temp => { - return { - uuid: temp.MenuID, - value: temp.MenuID, - text: temp.MenuName, - type: temp.Template, - MenuNo: temp.MenuNo - } - }) - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - /** - * @description 鍔犺浇鎴栧埛鏂版爣绛句俊鎭� - */ - reloadTab = () => { - this.setState({ - loading: true, - tabviews: [] - }) - Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { - if (res.status) { - this.setState({ - loading: false, - tabviews: res.UserTemp.map(temp => { - return { - uuid: temp.MenuID, - value: temp.MenuID, - text: temp.MenuName, - type: temp.Template, - MenuNo: temp.MenuNo - } - }) - }) - notification.success({ - top: 92, - message: '鍒锋柊鎴愬姛銆�', - duration: 2 - }) - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - - // 椤甸潰杩斿洖 - handleViewBack = () => { - const { menu } = this.props - let _tabview = menu ? menu.LongParam.Template : '' - let param = { - editMenu: menu, - editTab: null, - tabConfig: null, - editSubTab: null, - subTabConfig: null, - btnTab: null, - btnTabConfig: null, - editAction: null, - subConfig: null, - tabview: _tabview - } - - this.props.handleView(param) - } - - handleList = (type, list, card, groupId, elementId) => { - const { config } = this.state - - if (type === 'action') { - if (list.length > config.action.length) { - - this.handleAction(card) - } - - this.setState({config: {...config, action: list}}) - } else if (type === 'search') { - let _groups = null - - if (card) { - // 鍏冪礌娣诲姞 - if (config.groups.length === 1) { - _groups = config.groups.map(group => { - let _list = list.filter(item => !item.origin) - return {...group, sublist: _list} - }) - } else { - _groups = config.groups.map(group => { - if (group.uuid === groupId) { - return {...group, sublist: list} - } else { - return group - } - }) - } - this.handleSearch(card) - } else if (elementId) { - // 淇敼宸叉湁鍏冪礌鐨勫垎缁� - let element = null - _groups = config.groups.map(group => { - group.sublist = group.sublist.filter(item => { - if (item.uuid === elementId) { - element = item - return false - } else { - return true - } - }) - return group - }) - - _groups = _groups.map(group => { - if (group.uuid === groupId) { - group.sublist.push(element) - } - return group - }) - } else { - // 鍏冪礌绉诲姩 - _groups = config.groups.map(group => { - if (group.uuid === groupId) { - return {...group, sublist: list} - } else { - return group - } - }) - } - - this.setState({ - config: {...config, groups: _groups} - }) - } - } - - handleSearch = (card) => { - const { menu } = this.props - const { config } = this.state - let _inputfields = [] - let _tabfields = [] - let _linkableFields = [] - let _linksupFields = [] - let _formfields = [] - - // 璁剧疆涓嬫媺鑿滃崟鍙叧鑱斿瓧娈� - config.groups.forEach(group => { - _formfields = [..._formfields, ...group.sublist] - }) - - let uniq = new Map() - uniq.set(card.field, true) - - _formfields.forEach(item => { - if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) { - _inputfields.push({ - field: item.field, - label: item.label - }) - } - if (card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) { - _tabfields.push({ - field: item.field, - label: item.label - }) - } - - if (item.type !== 'select' && item.type !== 'link') return - if (item.field && !uniq.has(item.field)) { - uniq.set(item.field, true) - - _linkableFields.push({ - field: item.field, - label: item.label + '-琛ㄥ崟' - }) - _linksupFields.push({ - field: item.field, - label: item.label - }) - } - }) - - if (card.linkSubField && card.linkSubField.length > 0) { - let fields = _inputfields.map(item => item.field) - card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) - } - - if (menu.LongParam) { - menu.LongParam.columns.forEach(col => { - if (col.field && !uniq.has(col.field)) { - uniq.set(col.field, true) - - _linkableFields.push({ - field: col.field, - label: col.label + '-鏄剧ず鍒�' - }) - } - }) - } - - this.setState({ - modaltype: 'search', - card: card, - formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields).map(item => { - if (item.key === 'type') { - item.options = item.options.filter(option => !['switch', 'checkbox', 'radio', 'checkcard', 'hint'].includes(option.value)) - } - return item - }) - }) - } - - handleAction = (card) => { - let usefulFields = sessionStorage.getItem('permFuncField') - if (usefulFields) { - try { - usefulFields = JSON.parse(usefulFields) - } catch (e) { - usefulFields = [] - } - } else { - usefulFields = [] - } - - this.setState({ - modaltype: 'actionEdit', - card: card, - formlist: getActionForm(card, this.state.config, usefulFields) - }) - } - - - /** - * @description 鎼滅储銆佹寜閽�佹樉绀哄垪淇敼鍚庢彁浜や繚瀛� - * 1銆佹悳绱㈡潯浠朵繚瀛橈紝褰撶被鍨嬩负涓嬫媺妗嗕笖瀛樺湪鏁版嵁婧愭椂锛屽皢鏌ヨ鏉′欢鎷兼帴涓簊ql锛屽苟鐢╞ase64杞爜 - * 2銆佹寜閽寘鎷甯哥紪杈戝拰澶嶅埗锛屽鍒舵椂,鎸夐挳鍒楁湯灏炬坊鍔� - * 3銆佹坊鍔犳垨缂栬緫鍒楋紝淇濆瓨鏃讹紝濡傛寜閽綅缃缃负琛ㄦ牸锛屽垯淇敼鎿嶄綔鍒楁樉绀虹姸鎬� - */ - handleSubmit = () => { - const { config, modaltype, card } = this.state - - if (modaltype === 'search') { - this.modalFormRef.handleConfirm().then(res => { - let _config = JSON.parse(JSON.stringify(config)) - - if (_config.setting.primaryKey && _config.setting.primaryKey.toLowerCase() === res.field.toLowerCase()) { - notification.warning({ - top: 92, - message: '琛ㄥ崟涓瓧娈靛悕涓嶅彲涓庝富閿噸澶嶏紒', - duration: 5 - }) - return - } - - let _groups = null - let fieldrepet = false // 瀛楁閲嶅 - - if (card.iscopy) { - _groups = _config.groups.map(group => { - let _index = null - group.sublist.forEach((item, index) => { - if (item.uuid === card.originUuid) { - _index = index - } - - if (item.uuid !== res.uuid && item.field === res.field) { - fieldrepet = true - } - }) - - if (_index !== null) { - group.sublist.splice(_index + 1, 0, res) - } - - if (group.isDefault) { - group.sublist = group.sublist.filter(item => !item.origin) - } - return group - }) - } else { - _groups = _config.groups.map(group => { - group.sublist = group.sublist.map(item => { - if (item.uuid !== res.uuid && item.field === res.field) { - fieldrepet = true - } - - if (item.uuid === res.uuid) { - return res - } else { - return item - } - }) - if (group.isDefault) { - group.sublist = group.sublist.filter(item => !item.origin) - } - return group - }) - } - - if (fieldrepet) { - notification.warning({ - top: 92, - message: '瀛楁宸插瓨鍦紒', - duration: 5 - }) - return - } - - if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) { - this.setState({ - sqlVerifing: true - }) - - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - - if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi - } - - Api.genericInterface(param).then(result => { - if (result.status) { - this.setState({ - sqlVerifing: false, - config: {..._config, groups: _groups}, - modaltype: '' - }) - } else { - this.setState({sqlVerifing: false}) - - Modal.error({ - title: result.message - }) - } - }) - } else { - this.setState({ - config: {..._config, groups: _groups}, - modaltype: '' - }) - } - }) - } else if (modaltype === 'actionEdit') { - this.actionFormRef.handleConfirm().then(res => { - let _action = config.action.map(item => { - if (item.uuid === res.uuid) { - return res - } else { - return item - } - }) - - this.setState({ - config: {...config, action: _action}, - modaltype: '' - }) - }) - } - } - - editModalCancel = () => { - const { config, card, modaltype } = this.state - - if (card.focus) { - let _config = null - if (modaltype === 'search') { - let _groups = config.groups.map(group => { - group.sublist = group.sublist.filter(item => item.uuid !== card.uuid) - return group - }) - _config = {...config, groups: _groups} - } else if (modaltype === 'actionEdit') { - let _action = config.action.filter(item => item.uuid !== card.uuid) - _config = {...config, action: _action} - } else { - _config = config - } - - this.setState({ - card: null, - config: _config, - modaltype: '' - }) - } else { - this.setState({ - card: null, - modaltype: '' - }) - } - } - - /** - * @description 鍒涘缓鎸夐挳瀛樺偍杩囩▼ - */ - creatFunc = () => { - const { menu } = this.props - let _config = JSON.parse(JSON.stringify(this.state.config)) - - this.actionFormRef.handleConfirm().then(res => { - let btn = res // 鎸夐挳淇℃伅 - let newLText = '' // 鍒涘缓瀛樺偍杩囩▼sql - let DelText = '' // 鍒犻櫎瀛樺偍杩囩▼sql - - // 鍒涘缓瀛樺偍杩囩▼锛屽繀椤诲~鍐欏唴閮ㄥ嚱鏁板悕 - if (!btn.innerFunc) { - notification.warning({ - top: 92, - message: '璇峰~鍐欏唴閮ㄥ嚱鏁帮紒', - duration: 5 - }) - return - } - - let fields = [] - _config.groups.forEach(group => { - fields = [...fields, ...group.sublist] - }) - - let _param = { - funcName: btn.innerFunc, - name: _config.setting.tableName || '', - fields: fields, - menuNo: menu.MenuNo - } - - newLText = Utils.formatOptions(FuncUtils.getfunc(_param, btn, menu, _config)) - DelText = Utils.formatOptions(FuncUtils.dropfunc(_param.funcName)) - - this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText) - }) - } - - /** - * @description 鍒涘缓琛ㄦ牸瀛樺偍杩囩▼ - */ - tableCreatFunc = () => { - const { menu } = this.props - const { config } = this.state - - this.settingRef.handleConfirm().then(setting => { - - if (!(setting.interType === 'inner') || !setting.innerFunc) { - notification.warning({ - top: 92, - message: '鎺ュ彛绫诲瀷涓�-鍐呴儴锛屼笖瀛樺湪鍐呴儴鍑芥暟鏃讹紝鎵嶅彲浠ュ垱寤哄瓨鍌ㄨ繃绋嬶紒', - duration: 5 - }) - return - } - - if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { - let param = { - func: 's_DataSrc_Save', - LText: setting.dataresource, - MenuID: menu.MenuID - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.genericInterface(param) - } - - let _config = {...config, setting: setting} - let newLText = Utils.formatOptions(FuncUtils.getTableFunc(setting.innerFunc, menu, _config)) // 鍒涘缓瀛樺偍杩囩▼sql - let DelText = Utils.formatOptions(FuncUtils.dropfunc(setting.innerFunc)) // 鍒犻櫎瀛樺偍杩囩▼sql - - this.refs.tableCreatFunc.exec(setting.innerFunc, newLText, DelText) - }) - } - - deleteElement = (element) => { - let _this = this - confirm({ - content: `纭畾鍒犻櫎<<${element.card.label}>>鍚楋紵`, - onOk() { - let _config = JSON.parse(JSON.stringify(_this.state.config)) - let _delActions = _this.state.delActions - - if (element.type === 'search') { - _config.groups = _config.groups.map(group => { - group.sublist = group.sublist.filter(item => item.uuid !== element.card.uuid) - return group - }) - } else { - _config[element.type] = _config[element.type].filter(item => { - if (item.uuid === element.card.uuid) { - return false - } else { - return true - } - }) - _delActions.push(element.card.uuid) - } - - _this.setState({ - config: _config, - delActions: _delActions - }) - }, - onCancel() {} - }) - } - - /** - * @description 楠岃瘉淇℃伅閰嶇疆 - */ - profileAction = (element) => { - this.setState({ - profileVisible: true, - card: element - }) - } - - /** - * @description 楠岃瘉淇℃伅淇濆瓨 - */ - verifySubmit = () => { - const { card } = this.state - let config = JSON.parse(JSON.stringify(this.state.config)) - - this.verifyRef.handleConfirm().then(res => { - config.action = config.action.map(item => { - if (item.uuid === card.uuid) { - item.verify = res - } - - return item - }) - - this.setState({ - profileVisible: false, - config: config, - card: '' - }) - }) - } - - /** - * @description 鑿滃崟淇濆瓨 - */ - submitConfig = () => { - const { menu, btnTab } = this.props - const { delActions, openEdition } = this.state - - let config = JSON.parse(JSON.stringify(this.state.config)) - - this.menuformRef.handleConfirm().then(res => { - if (config.isAdd) { - if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { - config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) - } - config.tabgroups[0].sublist = config.tabgroups[0].sublist.filter(item => !item.origin) - } - - let btnNames = config.action.map(item => item.label) - btnNames = Array.from(new Set(btnNames)) - if (btnNames.length < config.action.length) { - notification.warning({ - top: 92, - message: '鎸夐挳鍚嶇О涓嶅彲鐩稿悓锛�', - duration: 5 - }) - return - } - - let _LongParam = '' - let _config = {...config} - - // 鏁版嵁鏉ユ簮涓烘煡璇笖鏈缃富閿椂锛屽惎鐢ㄤ负false - if (_config.setting.datatype === 'query' && !_config.setting.primaryKey) { - _config.enabled = false - } else if (_config.setting.datatype === 'query' && _config.setting.interType === 'inner' && !_config.setting.innerFunc && !_config.setting.dataresource) { - _config.enabled = false - } - - // 鏍囩涓嶅悎娉曟椂锛屽惎鐢ㄧ姸鎬佷负false - if (_config.tabgroups.length > 1) { - _config.tabgroups.forEach(group => { - if (group.sublist.length === 0) { - _config.enabled = false - } - }) - } - - // 瀛樺湪澶氫綑鐨勭┖琛ㄥ崟缁� - let _ismutil = _config.groups.length > 1 - let _primary = _config.setting.primaryKey ? _config.setting.primaryKey.toLowerCase() : '' - - _config.groups.forEach(group => { - if (_ismutil && group.sublist.length === 0) { - _config.enabled = false - } - let arr = group.sublist.filter(item => item.field && item.field.toLowerCase() === _primary) - - if (arr.length > 0) { - _config.enabled = false - } - }) - - _config.funcs = [] // 椤甸潰鍙婂瓙椤甸潰瀛樺偍杩囩▼闆� - - if (_config.setting.datatype === 'query') { - _config.funcs.push({ - type: 'view', - subtype: 'view', - uuid: btnTab.uuid, - intertype: _config.setting.interType || 'inner', - interface: _config.setting.interface || '', - tableName: _config.setting.tableName || '', - innerFunc: _config.setting.innerFunc || '', - outerFunc: _config.setting.outerFunc || '' - }) - } - - _config.action.forEach(item => { - if (item.btnType !== 'cancel') { - _config.funcs.push({ - type: 'button', - subtype: 'btn', - uuid: item.uuid, - label: item.label, - tableName: item.sql || '', - intertype: item.intertype, - interface: item.interface || '', - innerFunc: item.innerFunc || '', - outerFunc: item.outerFunc || '', - callbackFunc: item.callbackFunc || '' - }) - } - }) - - _config.tabgroups.forEach(group => { - group.sublist.forEach(tab => { - _config.funcs.push({ - type: 'tab', - subtype: 'tab', - uuid: tab.uuid, - label: tab.label, - linkTab: tab.linkTab - }) - }) - }) - - if (this.state.closeVisible) { // 鏄剧ず鍏抽棴瀵硅瘽妗嗘椂锛屾ā鎬佹涓繚瀛樻寜閽紝鏄剧ず淇濆瓨涓姸鎬� - this.setState({ - menucloseloading: true - }) - } else { - this.setState({ - menuloading: true - }) - } - - new Promise(resolve => { - let deffers = [] - _config.funcs.forEach(item => { - if (item.type === 'tab') { - let deffer = new Promise(resolve => { - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: item.linkTab - }).then(result => { - if (result.status && result.LongParam) { - let _LongParam = '' - - if (result.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam) { - item.menuNo = _LongParam.tabNo - item.subfuncs = _LongParam.funcs || [] - } - } - resolve() - }) - }) - - deffers.push(deffer) - } - }) - - if (deffers.length === 0) { - resolve() - } else { - Promise.all(deffers).then(() => { - resolve() - }) - } - }).then(() => { - - // 鍒犻櫎娣诲姞鏍囪瘑 - delete _config.isAdd - - try { - _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) - } catch (e) { - notification.warning({ - top: 92, - message: '缂栬瘧閿欒', - duration: 5 - }) - - this.setState({ - menucloseloading: false, - menuloading: false - }) - return - } - - let _sort = 0 // 鎸夐挳鍙婃爣绛炬帓搴� - - let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 - func: 'sPC_Button_AddUpt', - Type: 60, // 娣诲姞鎸夐挳琛ㄥ崟椤典笅鐨勬寜閽� - ParentID: btnTab.uuid, - MenuNo: menu.MenuNo, - Template: menu.PageParam.Template || '', - PageParam: '', - LongParam: '', - LText: config.action.map((item, index) => { - _sort++ - return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort` - }) - } - - btnParam.LText = btnParam.LText.join(' union all ') - btnParam.LText = Utils.formatOptions(btnParam.LText) - btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - - // let tabParam = { // 娣诲姞鑿滃崟tab椤� - // func: 'sPC_sMenusTab_AddUpt', - // MenuID: btnTab.uuid - // } - - // let _LText = [] - - // config.tabgroups.forEach(group => { - // group.sublist.forEach(item => { - // _sort++ - // _LText.push(`select '${btnTab.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_sort * 10}' as Sort`) - // }) - // }) - - // _LText = _LText.join(' union all ') - - // tabParam.LText = Utils.formatOptions(_LText) - - // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp) - - let param = { - func: 'sPC_ButtonParam_AddUpt', - ParentID: menu.MenuID, - MenuID: btnTab.uuid, - MenuNo: menu.MenuNo, - Template: 'FormTab', - MenuName: btnTab.label, - PageParam: JSON.stringify({Template: 'FormTab'}), - LongParam: _LongParam - } - - if (openEdition) { - param.open_edition = openEdition - } - - // 鏈夋寜閽垨鏍囩鍒犻櫎鏃讹紝鍏堣繘琛屽垹闄ゆ搷浣� - // 鍒犻櫎鎴愬姛鍚庯紝淇濆瓨椤甸潰閰嶇疆 - new Promise(resolve => { - if (delActions.length > 0) { - let deffers = delActions.map(item => { - let _param = { - func: 'sPC_MainMenu_Del', - MenuID: item - } - return new Promise(resolve => { - Api.getSystemConfig(_param).then(response => { - resolve(response) - }) - }) - }) - Promise.all(deffers).then(result => { - let error = null - result.forEach(response => { - if (!response.status) { - error = response - } - }) - - if (error) { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: error.message, - duration: 5 - }) - resolve(false) - } else { - this.setState({ - delActions: [] - }) - resolve(true) - } - }) - } else if (delActions.length === 0) { - resolve(true) - } - }).then(resp => { - if (resp === false) return - - Api.getSystemConfig(param).then(response => { - if (response.status) { - this.setState({ - openEdition: response.open_edition || '', - config: _config, - originMenu: _config - }) - - this.submitAction(btnParam) - } else { - this.setState({ - menuloading: false, - menucloseloading: false - }) - notification.warning({ - top: 92, - message: response.message, - duration: 5 - }) - } - }) - }) - }) - }, () => { - notification.warning({ - top: 92, - message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', - duration: 5 - }) - }) - } - - /** - * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽� - */ - submitAction = (btnParam) => { - new Promise(resolve => { - if (btnParam.LText) { - Api.getSystemConfig(btnParam).then(result => { - if (!result.status) { - notification.warning({ - top: 92, - message: result.message, - duration: 5 - }) - resolve(false) - } else { - resolve(true) - } - }) - } else { - resolve(true) - } - }).then(response => { - this.setState({ - menuloading: false, - menucloseloading: false - }) - - if (response) { - notification.success({ - top: 92, - message: '淇濆瓨鎴愬姛', - duration: 2 - }) - if (this.state.closeVisible) { - this.handleViewBack() - } - } - }) - } - - cancelConfig = () => { - const { config, originMenu } = this.state - - let _this = this - - if (config.isAdd) { - confirm({ - content: '鎸夐挳閰嶇疆灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', - onOk() { - _this.handleViewBack() - }, - onCancel() {} - }) - } else { - let _config = {...config} - - if (!is(fromJS(_config), fromJS(originMenu))) { - this.setState({ - closeVisible: true - }) - } else { - this.handleViewBack() - } - } - } - - changeSetting = () => { - this.setState({ - settingVisible: true - }) - } - - settingSave = () => { - const { menu } = this.props - const {config} = this.state - - this.settingRef.handleConfirm().then(res => { - if ( - res.interType === 'inner' && - !res.innerFunc && - /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && - config.setting.dataresource !== res.dataresource - ) { - let param = { - func: 's_DataSrc_Save', - LText: res.dataresource, - MenuID: menu.MenuID - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.genericInterface(param) - } - - if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) { - this.setState({ - sqlVerifing: true - }) - - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: res.dataresource - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - - Api.genericInterface(param).then(result => { - if (result.status) { - this.setState({ - sqlVerifing: false, - config: {...config, setting: res}, - settingVisible: false - }) - } else { - this.setState({sqlVerifing: false}) - - Modal.error({ - title: result.message - }) - } - }) - } else { - this.setState({ - config: {...config, setting: res}, - settingVisible: false - }) - } - }) - } - - /** - * @description 璁剧疆鍙厤缃爣绛� - */ - setSubConfig = (btn) => { - const {menu, btnTab} = this.props - const { config, originMenu, activeKey, openEdition } = this.state - - if (config.isAdd) { - notification.warning({ - top: 92, - message: '鑿滃崟灏氭湭淇濆瓨锛岃淇濆瓨鑿滃崟閰嶇疆锛�', - duration: 5 - }) - } else { - this.menuformRef.handleConfirm().then(res => { - let _config = {...config} - - if (!is(fromJS(originMenu), fromJS(_config))) { - notification.warning({ - top: 92, - message: '鑿滃崟閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', - duration: 5 - }) - } else { - this.setState({ - loading: true - }) - - btnTab.activeKey = activeKey // 淇濆瓨褰撳墠鎵撳紑椤电 - btnTab.open_edition = openEdition // 鏇存柊鐗堟湰鍙� - - let param = { - editMenu: menu, - editTab: btn, - tabConfig: null, - editSubTab: null, - subTabConfig: null, - btnTab: btnTab, - btnTabConfig: _config, - editAction: null, - subConfig: '', - tabview: btn.type - } - - Api.getSystemConfig({ - func: 'sPC_Get_LongParam', - MenuID: btn.linkTab - }).then(res => { - if (res.status) { - this.setState({ - loading: false - }) - let _LongParam = '' - if (res.LongParam) { - try { - _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam))) - } catch (e) { - console.warn('Parse Failure') - _LongParam = '' - } - } - - if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { - param.subConfig = _LongParam - } - - if (param.editTab) { - param.editTab.open_edition = res.open_edition || '' - } - - this.props.handleView(param) - } else { - this.setState({ - loading: false - }) - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - }, () => { - notification.warning({ - top: 92, - message: '鑿滃崟鍩烘湰淇℃伅宸蹭慨鏀癸紝璇蜂繚瀛橈紒', - duration: 5 - }) - }) - } - } - - onEnabledChange = () => { - const { config } = this.state - - let tabinvalid = true - if (config.tabgroups.length > 1) { - config.tabgroups.forEach(group => { - if (group.sublist.length === 0) { - tabinvalid = false - } - }) - } - let forminvalid = true - if (config.groups.length > 1) { - config.groups.forEach(group => { - if (group.sublist.length === 0) { - forminvalid = false - } - }) - } - - let _primary = config.setting.primaryKey ? config.setting.primaryKey.toLowerCase() : '' - let primaryrepeat = false - - config.groups.forEach(group => { - let arr = group.sublist.filter(item => item.field && item.field.toLowerCase() === _primary) - - if (arr.length > 0) { - primaryrepeat = true - } - }) - - if (config.setting.datatype === 'query' && config.setting.interType === 'inner' && !config.setting.innerFunc && !config.setting.dataresource) { - notification.warning({ - top: 92, - message: '灏氭湭璁剧疆鏁版嵁婧愶紝涓嶅彲鍚敤锛�', - duration: 5 - }) - } else if (config.setting.datatype === 'query' && !config.setting.primaryKey) { - notification.warning({ - top: 92, - message: '灏氭湭璁剧疆涓婚敭锛屼笉鍙惎鐢紒', - duration: 5 - }) - } else if (!tabinvalid) { - notification.warning({ - top: 92, - message: '瀛樺湪澶氫綑鏍囩缁勶紝涓嶅彲鍚敤锛�', - duration: 5 - }) - } else if (!forminvalid) { - notification.warning({ - top: 92, - message: '瀛樺湪澶氫綑绌鸿〃鍗曠粍锛屼笉鍙惎鐢紒', - duration: 5 - }) - } else if (primaryrepeat) { - notification.warning({ - top: 92, - message: '琛ㄥ崟瀛楁涓庝富閿噸澶嶏紝涓嶅彲鍚敤锛�', - duration: 5 - }) - } else { - this.setState({ - config: {...config, enabled: !config.enabled} - }) - } - } - - - - handleGroup = (group) => { - let editgroup = { - label: '', - sort: 0, - uuid: Utils.getuuid(), - sublist: [] - } - - if (group) { - editgroup = group - } - - this.setState({ - groupVisible: true, - editgroup: editgroup - }) - } - - closeGroup = (group) => { - const { config } = this.state - let _this = this - - confirm({ - content: `纭畾鍒犻櫎鍒嗙粍<<${group.label}>>鍚楋紵`, - onOk() { - let groups = config.groups.filter(item => !(item.uuid === group.uuid)) - groups = groups.map(item => { - if (item.isDefault) { - item.sublist = [...item.sublist, ...group.sublist] - } - - return item - }) - - _this.setState({ - config: {...config, groups: groups}, - }) - }, - onCancel() {} - }) - } - - handleGroupSave = () => { - const { editgroup, config } = this.state - let groups = config.groups.filter(item => !item.isDefault && item.uuid !== editgroup.uuid) - - this.groupRef.handleConfirm().then(res => { - if (editgroup.isDefault) { - groups.push(res) - } else { - groups.push(res.default, res.target) - } - - groups = groups.sort((a, b) => { - return a.sort - b.sort - }) - - this.setState({ - config: {...config, groups: groups}, - editgroup: '', - groupVisible: false, - }) - }) - } - - - pasteSubmit = () => { - let _config = JSON.parse(JSON.stringify(this.state.config)) - - this.pasteFormRef.handleConfirm().then(res => { - if (res.copyType === 'form') { - _config.groups.forEach(group => { - if (group.isDefault) { - group.sublist.push(res) - } - }) - - if (res.type === 'linkMain') { - notification.warning({ - top: 92, - message: '涓嶆敮鎸佹琛ㄥ崟绫诲瀷锛�', - duration: 5 - }) - return - } - - this.setState({ - config: _config, - pasteVisible: null - }, () => { - this.handleSearch(res) - }) - } else { - notification.warning({ - top: 92, - message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', - duration: 5 - }) - } - }) - } - - /** - * @description 鏇存柊鏍囩閰嶇疆淇℃伅 - */ - updatetabs = (config, delcards) => { - const { delActions } = this.state - - this.setState({ - config: config, - delActions: delcards ? [...delActions, ...delcards.map(item => item.uuid)] : delActions - }) - } - - render () { - const { config, modaltype, activeKey } = this.state - let _length = config.groups.length - - let configTabs = [] - config.tabgroups.forEach(group => { - configTabs.push(...group.sublist) - }) - - return ( - <div className="form-tab-board"> - <DndProvider backend={HTML5Backend}> - {/* 宸ュ叿鏍� */} - <div className="tools"> - <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> - {/* 鍩烘湰淇℃伅 */} - <Panel forceRender={true} header="鍩烘湰淇℃伅" key="0" id="common-basedata"> - {/* 鑿滃崟淇℃伅 */} - <MenuForm - formlist={this.state.menuformlist} - wrappedComponentRef={(inst) => this.menuformRef = inst} - /> - </Panel> - {/* 鎼滅储鏉′欢娣诲姞 */} - <Panel header="琛ㄥ崟" key="1"> - <div className="search-element"> - {Source.searchItems.map((item, index) => { - return (<SourceElement key={index} content={item}/>) - })} - </div> - </Panel> - {/* 鎸夐挳娣诲姞 */} - <Panel header="鎸夐挳" key="2"> - <div className="search-element"> - {Source.actionItems.map((item, index) => { - return (<SourceElement key={index} content={item}/>) - })} - </div> - </Panel> - {/* 娣诲姞鏍囩 */} - <Panel header="鏍囩椤�" key="4"> - <div className="search-element"> - {Source.tabItems.map((item, index) => { - return (<SourceElement key={index} content={item}/>) - })} - </div> - {configTabs.length > 0 ? - <p className="config-btn-title"> - <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫爣绛鹃厤缃俊鎭��"> - <QuestionCircleOutlined className="mk-form-tip" /> - </Tooltip> - 鏍囩閰嶇疆 - </p> : null - } - {configTabs.map((item, index) => { - return ( - <div key={index}> - <Button - className="config-button" - icon={item.icon} - style={{marginBottom: '10px'}} - onClick={() => this.setSubConfig(item, 'tab')} - >{item.label}</Button> - </div> - ) - })} - </Panel> - </Collapse> - </div> - <div className="setting"> - <Card title={ - <div> - 椤甸潰閰嶇疆 - <RedoOutlined style={{marginLeft: '10px'}} title="鍒锋柊鏍囩鍒楄〃" onClick={this.reloadTab} /> - </div> - } bordered={false} extra={ - <div> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={this.state.config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button> - <Button onClick={this.cancelConfig}>杩斿洖</Button> - </div> - } style={{ width: '100%' }}> - <SettingOutlined onClick={this.changeSetting} /> - <Collapse - activeKey={config.groups.map(group => group.uuid)} - expandIconPosition={'right'} - > - {config.groups.map((group, index) => ( - <Panel showArrow={false} header={group.label} key={group.uuid} extra={( - <span> - {index === _length - 1 ? <PlusOutlined - onClick={() => { this.handleGroup()}} - /> : null} - {_length > 1 && index !== _length - 1 ? <DeleteOutlined - onClick={() => { this.closeGroup(group) }} - /> : null} - <EditOutlined onClick={() => { this.handleGroup(group) }}/> - </span> - )}> - {group.isDefault ? <SnippetsOutlined title="绮樿创" onClick={() => {this.setState({pasteVisible: true})}} /> : null} - <DragElement - type="search" - groupId={group.uuid} - list={group.sublist} - handleList={this.handleList} - setting={config.setting} - handleMenu={this.handleSearch} - deleteMenu={this.deleteElement} - /> - </Panel> - ))} - </Collapse> - <div className="action-list"> - <DragElement - type="action" - list={this.state.config.action} - handleList={this.handleList} - handleMenu={this.handleAction} - deleteMenu={this.deleteElement} - profileMenu={this.profileAction} - /> - </div> - {/* 鏍囩缁� */} - <TabsComponent - config={config} - tabs={this.state.tabviews} - setSubConfig={(item) => this.setSubConfig(item, 'tab')} - updatetabs={this.updatetabs} - /> - </Card> - </div> - </DndProvider> - {/* 缂栬緫琛ㄥ崟 */} - <Modal - title={this.state.card && this.state.card.iscopy ? '琛ㄥ崟-澶嶅埗' : '琛ㄥ崟-缂栬緫'} - visible={modaltype === 'search'} - width={950} - maskClosable={false} - onOk={this.handleSubmit} - confirmLoading={this.state.sqlVerifing} - onCancel={this.editModalCancel} - destroyOnClose - > - <ModalForm - card={this.state.card} - formlist={this.state.formlist} - inputSubmit={this.handleSubmit} - wrappedComponentRef={(inst) => this.modalFormRef = inst} - /> - </Modal> - {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} - <Modal - title="鎸夐挳缂栬緫" - visible={modaltype === 'actionEdit'} - width={920} - maskClosable={false} - onCancel={this.editModalCancel} - footer={[ - this.state.card && this.state.card.btnType !== 'cancel' ? - <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null, - <Button key="cancel" onClick={this.editModalCancel}>鍙栨秷</Button>, - <Button key="confirm" type="primary" onClick={this.handleSubmit}>纭畾</Button> - ]} - destroyOnClose - > - <ActionForm - card={this.state.card} - tabs={this.state.tabviews} - formlist={this.state.formlist} - inputSubmit={this.handleSubmit} - wrappedComponentRef={(inst) => this.actionFormRef = inst} - /> - </Modal> - {/* 鎸夐挳浣跨敤绯荤粺瀛樺偍杩囩▼鏃讹紝楠岃瘉淇℃伅妯℃�佹 */} - <Modal - wrapClassName="mk-pop-modal" - visible={this.state.profileVisible} - width={'90vw'} - maskClosable={false} - okText="鎻愪氦" - onOk={this.verifySubmit} - onCancel={() => { - if (this.verifyRef.handleCancel) { - this.verifyRef.handleCancel().then(() => { - this.setState({ profileVisible: false }) - }) - } else { - this.setState({ profileVisible: false }) - } - }} - destroyOnClose - > - <VerifyCard - card={this.state.card} - btnTab={this.props.btnTab} - config={this.state.config} - columns={this.state.columns} - wrappedComponentRef={(inst) => this.verifyRef = inst} - /> - </Modal> - {/* 璁剧疆鍏ㄥ眬閰嶇疆鍙婂垪琛ㄦ暟鎹簮 */} - <Modal - title="缂栬緫" - visible={this.state.settingVisible} - width={700} - maskClosable={false} - onCancel={() => { // 鍙栨秷淇敼 - this.setState({ - settingVisible: false - }) - }} - footer={[ - <CreateFunc key="create" ref="tableCreatFunc" trigger={this.tableCreatFunc}/>, - <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>鍙栨秷</Button>, - <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>纭畾</Button> - ]} - destroyOnClose - > - <SettingForm - menu={this.props.menu} - config={this.state.config} - inputSubmit={this.settingSave} - wrappedComponentRef={(inst) => this.settingRef = inst} - /> - </Modal> - <Modal - bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}} - closable={false} - maskClosable={false} - visible={this.state.closeVisible} - onCancel={() => { this.setState({closeVisible: false}) }} - footer={[ - <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>淇濆瓨</Button>, - <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>涓嶄繚瀛�</Button>, - <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>鍙栨秷</Button> - ]} - destroyOnClose - > - 閰嶇疆宸蹭慨鏀癸紝鏄惁淇濆瓨閰嶇疆淇℃伅锛� - </Modal> - <Modal - title="鍒嗙粍绠$悊" - visible={this.state.groupVisible} - width={700} - maskClosable={false} - onOk={this.handleGroupSave} - onCancel={() => { this.setState({ groupVisible: false }) }} - destroyOnClose - > - <GroupForm - groups={config.groups} - group={this.state.editgroup} - inputSubmit={this.handleGroupSave} - wrappedComponentRef={(inst) => this.groupRef = inst} - /> - </Modal> - {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} - <Modal - title="绮樿创" - visible={this.state.pasteVisible} - width={600} - maskClosable={false} - onOk={this.pasteSubmit} - onCancel={() => {this.setState({pasteVisible: null})}} - destroyOnClose - > - <PasteForm - wrappedComponentRef={(inst) => this.pasteFormRef = inst} - inputSubmit={this.pasteSubmit} - /> - </Modal> - {this.state.loading && <Spin size="large" />} - </div> - ) - } -} - -export default ComTableConfig diff --git a/src/templates/formtabconfig/index.scss b/src/templates/formtabconfig/index.scss deleted file mode 100644 index cb73f81..0000000 --- a/src/templates/formtabconfig/index.scss +++ /dev/null @@ -1,394 +0,0 @@ -.form-tab-board { - position: fixed; - z-index: 1070; - padding-top: 48px; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - background: rgba(0, 0, 0, 0.35); - display: flex; - .tools { - flex: 1; - background: #ffffff; - border-right: 1px solid #d9d9d9; - height: 100%; - overflow-y: auto; - padding-bottom: 30px; - .ant-collapse-borderless { - background-color: #ffffff; - } - .ant-collapse-item { - position: relative; - border: 0; - } - .ant-input-search { - margin-top: 10px; - } - .ant-collapse-item.ant-collapse-item-active { - border-bottom: 1px solid #d9d9d9; - } - .ant-collapse .ant-collapse-header { - padding: 11px 16px 10px 40px; - border-bottom: 1px solid #d9d9d9; - background: #1890ff; - color: #ffffff; - } - .ant-collapse-content-box { - .ant-form-item { - margin-bottom: 10px; - .ant-form-item-label { - text-align: left; - height: 25px; - line-height: 25px; - } - } - } - .search-element { - padding-top: 10px; - li { - padding: 0px 16px 10px; - div { - cursor: move; - } - } - } - .config-btn-title { - margin-top: 20px; - margin-bottom: 10px; - color: #1890ff; - border-bottom: 1px solid #e8e8e8; - } - .config-button { - min-width: 65px; - } - } - .tools::-webkit-scrollbar { - width: 4px; - } - .tools::-webkit-scrollbar-thumb { - border-radius: 5px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08); - background: rgba(0, 0, 0, 0.08); - } - .tools::-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); - } - .setting { - position: relative; - width: calc(100vw - 235px); - height: 100%; - background: #ffffff; - .ant-switch.big { - min-width: 60px; - height: 28px; - line-height: 28px; - margin-top: -2px; - .ant-switch-inner { - font-size: 14px; - } - } - .ant-switch.big::after { - width: 24px; - height: 24px; - } - .ant-card-head { - min-height: 44px; - } - .ant-card-head-title { - padding: 5px 0; - color: #1890ff; - } - .ant-card-extra { - padding: 5px 0; - button { - margin-left: 20px; - } - } - .ant-card-body { - position: relative; - padding: 0 0 40px; - - > .anticon-setting { - position: absolute; - font-size: 18px; - right: 7px; - top: 10px; - padding: 10px; - z-index: 1; - } - - >.ant-collapse { - border-radius: 0; - border: 0; - margin-top: 45px; - .ant-collapse-header { - cursor: default; - border-radius: 0; - background: #1890ff; - color: #ffffff; - padding-left: 30px; - padding-right: 20px; - .anticon { - font-size: 16px; - } - .ant-collapse-extra { - .anticon-edit { - position: absolute; - left: 5px; - top: 2px; - } - } - } - .ant-collapse-item:last-child { - border-radius: 0; - .ant-collapse-content { - border-radius: 0; - } - } - .ant-collapse-content-box { - position: relative; - padding: 16px 30px; - > .ant-row { - min-height: 90px; - padding-bottom: 30px; - .page-card { - position: relative; - background: #ffffff; - border-radius: 2px; - padding-top: 15px; - .ant-form-item { - cursor: move; - display: flex; - margin-bottom: 0px; - .ant-form-item-label { - overflow: visible; - label { - width: 100%; - cursor: move; - overflow: hidden; - display: inline-block; - text-overflow: ellipsis; - white-space: nowrap; - } - } - .ant-form-item-label.ant-col-cuslabel { - width: 11%; - } - .ant-form-item-control-wrapper.ant-col-cuswrap { - width: 89%; - } - .ant-form-item-control-wrapper { - position: relative; - .ant-input-number { - margin-top: 4px; - } - .ant-select { - width: 100%; - margin-top: 4px; - } - .ant-calendar-picker { - margin-top: 4px; - } - .ant-btn { - margin-top: 4px; - } - .data-range .ant-calendar-picker-input { - padding: 4px 20px 4px 5px; - font-size: 13px; - } - } - .ant-form-item-control-wrapper::after { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - opacity: 0; - z-index: 1; - } - } - } - .ant-calendar-picker { - min-width: 100px!important; - width: 100%; - } - } - .anticon-snippets { - position: absolute; - font-size: 14px; - right: 10px; - top: 0px; - padding: 10px; - z-index: 1; - } - } - } - - .action-list { - position: relative; - padding: 0px 20px 15px; - min-height: 82px; - text-align: center; - > .ant-row { - min-height: 67px; - } - .page-card { - display: inline-block; - padding: 0px; - margin: 15px 10px 0 0; - position: relative; - div { - cursor: move; - } - - button { - cursor: move; - min-width: 70px; - margin-right: 10px; - height: 35px; - font-size: 15px; - padding: 5px 20px; - .anticon-table { - font-size: 10px; - position: absolute; - right: 1px; - bottom: 0px; - } - } - } - } - .tab-list { - position: relative; - padding: 30px 20px 0px; - .ant-switch { - position: absolute; - right: 20px; - top: 20px; - } - > .ant-row { - min-height: 47px; - .page-card { - position: relative; - padding: 0px; - > div { - padding: 12px 0px 0px; - cursor: move; - } - } - .ant-tabs-tab { - cursor: default; - } - .ant-tabs-bar { - min-height: 55px; - } - .ant-tabs-content { - .ant-tabs-tabpane img { - width: 100%; - } - } - } - > .anticon-plus { - position: absolute; - font-size: 18px; - right: 25px; - top: 50px; - z-index: 1; - color: #26C281; - cursor: pointer; - } - > .anticon-delete { - position: absolute; - font-size: 19px; - right: 25px; - top: 50px; - z-index: 1; - color: #ff4d4f; - cursor: pointer; - } - > .anticon-arrow-up { - position: absolute; - right: 55px; - font-size: 19px; - z-index: 1; - top: 50px; - color: #1890ff; - cursor: pointer; - } - > .anticon-arrow-down { - position: absolute; - right: 55px; - font-size: 19px; - z-index: 1; - top: 50px; - color: purple; - cursor: pointer; - } - > .anticon-arrow-down + .anticon-arrow-up { - right: 85px; - } - .ant-tabs-nav-container-scrolling { - margin-right: 50px; - } - } - } - } - .setting { - overflow-y: scroll; - } - .setting::-webkit-scrollbar { - width: 7px; - } - .setting::-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); - display: none; - } - .setting::-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); - } - .setting:hover::-webkit-scrollbar-thumb { - display: block; - } - .ant-spin { - position: absolute; - margin-left: calc(50vw - 22px); - margin-top: 30vh; - } -} - -.common-table-fields-modal { - .ant-modal { - top: 50px; - padding-bottom: 5px; - .ant-modal-body { - max-height: calc(100vh - 190px); - overflow-y: auto; - .ant-empty { - margin: 15vh 8px; - } - } - .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); - } - } -} diff --git a/src/templates/formtabconfig/settingform/index.jsx b/src/templates/formtabconfig/settingform/index.jsx deleted file mode 100644 index 7330244..0000000 --- a/src/templates/formtabconfig/settingform/index.jsx +++ /dev/null @@ -1,361 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Select, Tooltip, notification, InputNumber } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' - -import { formRule } from '@/utils/option.js' -import Utils from '@/utils/utils.js' -import './index.scss' - -const { TextArea } = Input - -class SettingForm extends Component { - static propTpyes = { - menu: PropTypes.object, - config: PropTypes.object, - inputSubmit: PropTypes.any // 鍥炶溅鎻愪氦浜嬩欢 - } - - state = { - interType: (this.props.config.setting && this.props.config.setting.interType) || 'inner', - columns: null, - usefulFields: [], - interReadonly: false, - } - - UNSAFE_componentWillMount() { - const { config } = this.props - - let _columns = [] - let _setting = config.setting - - try { - config.groups.forEach(group => { - let list = group.sublist.filter(item => item.field) - _columns = [..._columns, ...list] - }) - - let _colMap = new Map() - _columns = _columns.filter(item => { - if (_colMap.has(item.field)) { - return false - } else { - _colMap.set(item.field, true) - return true - } - }) - } catch (e) { - notification.warning({ - top: 92, - message: '鑿滃崟淇℃伅閿欒锛�', - duration: 5 - }) - } - - let usefulFields = sessionStorage.getItem('permFuncField') - if (usefulFields) { - try { - usefulFields = JSON.parse(usefulFields) - } catch (e) { - usefulFields = [] - } - } else { - usefulFields = [] - } - - this.setState({ - columns: _columns, - setting: _setting, - interType: _setting.interType || 'inner', - interReadonly: _setting.sysInterface === 'true', - datatype: _setting.datatype || 'maintable', - usefulFields - }) - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - let error = Utils.verifySql(values.dataresource) - - if (error) { - notification.warning({ - top: 92, - message: '鏁版嵁婧愪腑涓嶅彲浣跨敤' + error, - duration: 5 - }) - return - } - - resolve(values) - } else { - reject(err) - } - }) - }) - } - - onSysChange = (e) => { - if (e.target.value === 'true') { - this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || '' - }) - this.setState({ - interReadonly: true - }) - } else { - this.setState({ - interReadonly: false - }) - } - } - - onChange = (e) => { - this.setState({ - interType: e.target.value - }, () => { - if (e.target.value === 'inner') return - - let _type = this.props.form.getFieldValue('sysInterface') - if (_type === 'true') { - this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || '' - }) - this.setState({ - interReadonly: true - }) - } else { - this.setState({ - interReadonly: false - }) - } - }) - } - - sourceChange = (e) => { - const { interType } = this.state - - this.setState({ - datatype: e.target.value - }, () => { - if (interType === 'inner') return - - let _type = this.props.form.getFieldValue('sysInterface') - if (_type === 'true') { - this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || '' - }) - this.setState({ - interReadonly: true - }) - } else { - this.setState({ - interReadonly: false - }) - } - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - render() { - const { menu } = this.props - const { getFieldDecorator } = this.props.form - const { interType, setting, datatype, usefulFields } = this.state - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - let str = '^(' + usefulFields.join('|') + ')' - let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') - - return ( - <Form {...formItemLayout} className="ant-advanced-search-form commontable-setting-form" id="commontable-setting-form"> - <Row gutter={24}> - <Col span={12}> - <Form.Item label="琛ㄥ悕"> - {getFieldDecorator('tableName', { - initialValue: setting.tableName, - rules: [ - { - required: true, - message: '璇疯緭鍏ヨ〃鍚�!' - }, - { - max: 50, - message: '琛ㄥ悕鏈�闀夸负50涓瓧绗�!' - } - ] - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鍒楁暟"> - {getFieldDecorator('cols', { - initialValue: setting.cols || '2' - })( - <Select> - <Select.Option value="1">1鍒�</Select.Option> - <Select.Option value="2">2鍒�</Select.Option> - <Select.Option value="3">3鍒�</Select.Option> - <Select.Option value="4">4鍒�</Select.Option> - </Select> - )} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鏁版嵁鏉ユ簮"> - {getFieldDecorator('datatype', { - initialValue: setting.datatype || 'query' - })( - <Radio.Group onChange={this.sourceChange}> - <Radio value="maintable">涓昏〃</Radio> - <Radio value="query">鏌ヨ</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="涓婚敭"> - {getFieldDecorator('primaryKey', { - initialValue: setting.primaryKey - })(<Input placeholder="" autoComplete="off" disabled/>)} - </Form.Item> - </Col> - {datatype === 'query' ? <Col span={12}> - <Form.Item label="鎺ュ彛绫诲瀷"> - {getFieldDecorator('interType', { - initialValue: interType - })( - <Radio.Group onChange={this.onChange}> - <Radio value="inner">鍐呴儴</Radio> - <Radio value="outer">澶栭儴</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> : null} - {datatype === 'query' && interType === 'outer' ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="鍗曠偣鐧诲綍绯荤粺"> - <QuestionCircleOutlined className="mk-form-tip" /> - 绯荤粺鎺ュ彛 - </Tooltip> - }> - {getFieldDecorator('sysInterface', { - initialValue: setting.sysInterface || 'false' - })( - <Radio.Group onChange={this.onSysChange}> - <Radio value="true">鏄�</Radio> - <Radio value="false">鍚�</Radio> - </Radio.Group> - )} - </Form.Item> - </Col> : null} - {datatype === 'query' && interType === 'outer' ? <Col span={12}> - <Form.Item label="鎺ュ彛鍦板潃"> - {getFieldDecorator('interface', { - initialValue: setting.sysInterface === 'true' ? (window.GLOB.mainSystemApi || '') : (setting.interface || ''), - rules: [ - { - required: true, - message: '璇疯緭鍏ユ帴鍙e湴鍧�!' - }, - { - max: formRule.input.max, - message: formRule.input.message - } - ] - })(<Input placeholder="" autoComplete="off" disabled={this.state.interReadonly} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> : null} - {datatype === 'query' && interType !== 'outer' ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" overlayClassName="middle" title={`鍙嚜瀹氫箟鏁版嵁澶勭悊鍑芥暟锛屽嚱鏁板悕绉伴渶浠�${usefulFields.join(', ')}绛夊瓧绗﹀紑濮嬶紱鏈缃椂浼氳皟鐢ㄧ郴缁熷嚱鏁帮紝浣跨敤绯荤粺鍑芥暟闇�瀹屽杽鏁版嵁婧愩�俙}> - <QuestionCircleOutlined className="mk-form-tip" /> - 鍐呴儴鍑芥暟 - </Tooltip> - }> - {getFieldDecorator('innerFunc', { - initialValue: setting.innerFunc || '', - rules: [ - { - pattern: _patten, - message: formRule.func.innerMessage - }, { - max: formRule.func.max, - message: formRule.func.maxMessage - } - ] - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> : null} - {datatype === 'query' && interType !== 'outer' ? <Col span={24}> - <Form.Item help={'鏁版嵁ID锛�' + menu.MenuID} label={ - <Tooltip placement="topLeft" title="浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愶紝鑷畾涔夊嚱鏁版椂锛屽彲蹇界暐銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - 鏁版嵁婧� - </Tooltip> - } className="textarea"> - {getFieldDecorator('dataresource', { - initialValue: setting.dataresource - })(<TextArea rows={4} />)} - </Form.Item> - </Col> : null} - {datatype === 'query' && interType === 'outer' ? <Col span={12}> - <Form.Item label="澶栭儴鍑芥暟"> - {getFieldDecorator('outerFunc', { - initialValue: setting.outerFunc || '', - rules: [ - { - pattern: formRule.func.pattern, - message: formRule.func.message - }, { - max: formRule.func.max, - message: formRule.func.maxMessage - } - ] - })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> : null} - <Col span={12}> - <Form.Item label="瀹藉害"> - {getFieldDecorator('width', { - initialValue: setting.width || 100 - })(<InputNumber min={10} max={100} precision={0} />)} - </Form.Item> - </Col> - <Col span={12}> - <Form.Item label="鍒濆鍖�"> - {getFieldDecorator('onload', { - initialValue: setting.onload || 'true' - })( - <Select> - <Select.Option value="true">鍔犺浇鏁版嵁</Select.Option> - <Select.Option value="false">涓嶅姞杞芥暟鎹�</Select.Option> - </Select> - )} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/templates/formtabconfig/settingform/index.scss b/src/templates/formtabconfig/settingform/index.scss deleted file mode 100644 index bf9fa12..0000000 --- a/src/templates/formtabconfig/settingform/index.scss +++ /dev/null @@ -1,10 +0,0 @@ -.ant-advanced-search-form.commontable-setting-form { - .textarea { - .ant-form-item-label { - width: 16.3%; - } - .ant-form-item-control-wrapper { - width: 83.33333333%; - } - } -} \ No newline at end of file diff --git a/src/templates/formtabconfig/source.jsx b/src/templates/formtabconfig/source.jsx deleted file mode 100644 index 57eeafd..0000000 --- a/src/templates/formtabconfig/source.jsx +++ /dev/null @@ -1,184 +0,0 @@ -import Utils from '@/utils/utils.js' - -class CommonTableBaseData { - baseConfig = { - Template: 'FormTab', - enabled: false, - setting: { - datatype: 'query', - cols: '2', - width: 90 - }, - tables: [], - groups: [ - { - isDefault: true, - uuid: Utils.getuuid(), - label: 'label', - sort: 101, - sublist: [ - { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'text', - resourceType: '0', - options: [], - orderType: 'asc' - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'select', - resourceType: '0', - options: [], - orderType: 'asc' - }, { - origin: true, - uuid: Utils.getuuid(), - label: 'label', - field: '', - initval: '', - type: 'date', - resourceType: '0', - options: [], - orderType: 'asc' - } - ] - } - ], - action: [ - { - btnType: 'confirm', - uuid: Utils.getuuid(), - label: '纭畾', - intertype: 'system', - innerFunc: '', - interface: '', - outerFunc: '', - sql: '', - sqlType: '', - callbackFunc: '', - Ot: 'notRequired', - execSuccess: 'grid', - execError: 'never', - OpenType: 'exec', - icon: '', - class: 'border-primary', - verify: null - }, { - btnType: 'cancel', - uuid: Utils.getuuid(), - label: '鍏抽棴', - execSuccess: 'grid', - execError: 'never', - OpenType: 'exec', - pageTemplate: '', - url: '', - icon: '', - class: 'border-danger' - } - ], - tabgroups: [{ - uuid: 'tabs', - sublist: [ - { - origin: true, // 鏄惁涓虹ず渚� - uuid: Utils.getuuid(), - label: 'tab1', - type: 'SubTable', - linkTab: '', - supMenu: '' - }, - { - origin: true, - uuid: Utils.getuuid(), - label: 'tab2', - type: 'SubTable', - linkTab: '', - supMenu: '' - } - ] - }] - } - - searchItems = [ - { - type: 'search', - label: '鏂囨湰', - subType: 'text', - url: '' - }, - { - type: 'search', - label: '鏁板瓧', - subType: 'number', - url: '' - }, - { - type: 'search', - label: '涓嬫媺閫夋嫨', - subType: 'select', - url: '' - }, - { - type: 'search', - label: '鏂囦欢涓婁紶', - subType: 'fileupload', - url: '' - }, - { - type: 'search', - label: '鏃堕棿锛堝ぉ锛�', - subType: 'date', - url: '' - }, - { - type: 'search', - label: '鏃堕棿锛堟湀锛�', - subType: 'datemonth', - url: '' - }, - { - type: 'search', - label: '鏃堕棿锛堢锛�', - subType: 'datetime', - url: '' - }, - { - type: 'search', - label: '澶氳鏂囨湰', - subType: 'textarea', - url: '' - } - ] - - actionItems = [ - { - type: 'action', - label: '鎻愮ず妗�', - subType: 'prompt', - url: '' - }, - { - type: 'action', - label: '鐩存帴鎵ц', - subType: 'exec', - url: '' - } - ] - - tabItems = [ - { - type: 'tabs', - label: '瀛愯〃', - subType: 'SubTable', - } - ] -} - -export default new CommonTableBaseData() diff --git a/src/templates/formtabconfig/transferform/index.jsx b/src/templates/formtabconfig/transferform/index.jsx deleted file mode 100644 index 3ff7f65..0000000 --- a/src/templates/formtabconfig/transferform/index.jsx +++ /dev/null @@ -1,72 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Transfer } from 'antd' -import './index.scss' - -class TransferForm extends Component { - static propTypes = { - fields: PropTypes.array, - selected: PropTypes.array - } - - state = { - data: [], - targetKeys: [], - selectedKeys: [] - } - - handleChange = (nextTargetKeys, direction, moveKeys) => { - this.setState({ targetKeys: nextTargetKeys }) - } - - handleSelectChange = (sourceSelectedKeys, targetSelectedKeys) => { - this.setState({ selectedKeys: [...sourceSelectedKeys, ...targetSelectedKeys] }) - } - - UNSAFE_componentWillMount() { - let datas = new Map() - this.props.fields.forEach(item => { - if (!item.origin) { - datas.set(item.uuid, item) - } - }) - - let selecteds = [] - - this.props.selected.forEach(item => { - if (datas.has(item)) { - selecteds.push(item) - } - }) - - this.setState({ - data: [...datas.values()].map(item => { - return { - key: item.uuid, - title: item.label, - description: '' - } - }), - targetKeys: selecteds - }) - } - - render() { - const { data, targetKeys, selectedKeys } = this.state - - return ( - <div className="modal-fields-transfer"> - <Transfer - dataSource={data} - targetKeys={targetKeys} - selectedKeys={selectedKeys} - onChange={this.handleChange} - onSelectChange={this.handleSelectChange} - render={item => item.title} - /> - </div> - ) - } -} - -export default TransferForm diff --git a/src/templates/formtabconfig/transferform/index.scss b/src/templates/formtabconfig/transferform/index.scss deleted file mode 100644 index fcb7ff4..0000000 --- a/src/templates/formtabconfig/transferform/index.scss +++ /dev/null @@ -1,6 +0,0 @@ -.modal-fields-transfer { - padding-left: 18px; - .ant-transfer-list { - width: 296px; - } -} \ No newline at end of file diff --git a/src/templates/treepageconfig/updatetable/index.jsx b/src/templates/treepageconfig/updatetable/index.jsx index a0ba9f4..8cb7244 100644 --- a/src/templates/treepageconfig/updatetable/index.jsx +++ b/src/templates/treepageconfig/updatetable/index.jsx @@ -111,6 +111,7 @@ interface: config.setting.interface || '', dataresource: config.setting.dataresource || '', tableName: config.setting.tableName || '', + sysInterface: config.setting.sysInterface || 'false', order: config.setting.order || '', execute: config.setting.default || 'true', primaryKey: config.setting.valueField || '', @@ -741,7 +742,7 @@ type: 'admin', OpenType: config.OpenType, PageParam: {Template: 'CustomPage', OpenType: 'newtab', hidden: config.hidden}, - MenuType: 'CustomPage' + MenuType: 'custom' } let url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) config.tbkey = key @@ -794,7 +795,6 @@ if (res.status) { delete urlparam.type - delete urlparam.MenuType let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) @@ -807,7 +807,6 @@ onOk: () => { if (save) { delete urlparam.type - delete urlparam.MenuType let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) diff --git a/src/utils/option.js b/src/utils/option.js index 4fe5606..f001d84 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -1,6 +1,6 @@ import nortable from '@/assets/img/normaltable.jpg' // import mainsubtable from '@/assets/img/mainsubtable.jpg' -import treepage from '@/assets/img/treepage.jpg' +// import treepage from '@/assets/img/treepage.jpg' import customImg from '@/assets/img/custom.jpg' import newpage from '@/assets/img/newpage.jpg' import rolemanage from '@/assets/img/rolemanage.jpg' @@ -73,13 +73,13 @@ baseconfig: '', isSystem: true }, - { - title: '鏍戝舰椤甸潰', - type: 'TreePage', - url: treepage, - baseconfig: '', - isSystem: true - }, + // { + // title: '鏍戝舰椤甸潰', + // type: 'TreePage', + // url: treepage, + // baseconfig: '', + // isSystem: true + // }, { title: '澶栭儴椤甸潰', type: 'NewPage', diff --git a/src/views/basedesign/index.jsx b/src/views/basedesign/index.jsx index bc036a1..0adc4d0 100644 --- a/src/views/basedesign/index.jsx +++ b/src/views/basedesign/index.jsx @@ -14,7 +14,6 @@ const Header = asyncComponent(() => import('@/menu/header')) const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig')) const TreePageConfig = asyncLoadComponent(() => import('@/templates/treepageconfig')) -const FormTabConfig = asyncLoadComponent(() => import('@/templates/formtabconfig')) const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig')) const SubTable = asyncLoadComponent(() => import('@/templates/subtableconfig')) @@ -229,14 +228,6 @@ tabConfig={this.state.tabConfig} btnTab={this.state.btnTab} btnTabConfig={this.state.btnTabConfig} - config={this.state.subConfig} - handleView={this.handleView} - /> : null - } - {this.state.tabview === 'FormTab' ? - <FormTabConfig - menu={this.state.editMenu} - btnTab={this.state.btnTab} config={this.state.subConfig} handleView={this.handleView} /> : null diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index a7be0ab..3e8f53f 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -876,6 +876,8 @@ if (item.style && item.style.clear === 'left') { style = {clear: 'left'} + } else if (item.style && item.style.clear === 'right') { + style = {float: 'right'} } if (item.type === 'bar' || item.type === 'line') { diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index c160a08..6e5e8d3 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -293,7 +293,7 @@ document.getElementsByTagName('head')[0].removeChild(JSONP) },500) }) -} + } componentDidMount () { // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") -- Gitblit v1.8.0