From bdfec44c9f3a37dbbe05bf14a252ffec04132a86 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 06 九月 2022 21:24:28 +0800 Subject: [PATCH] Merge branch 'develop' --- src/templates/zshare/modalform/index.jsx | 4 src/tabviews/formtab/index.jsx | 2 src/menu/components/timeline/normal-timeline/index.jsx | 42 src/tabviews/custom/components/editor/braft-editor/index.jsx | 15 src/menu/components/card/balcony/options.jsx | 16 src/templates/zshare/verifycard/customscript/index.jsx | 2 src/menu/components/chart/antv-scatter/index.jsx | 12 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 4 src/tabviews/zshare/mutilform/mkInput/index.jsx | 8 src/menu/datasource/verifycard/index.jsx | 10 src/menu/components/table/edit-table/index.scss | 27 src/menu/components/card/table-card/index.scss | 7 src/components/header/index.scss | 18 src/menu/components/card/cardcellcomponent/index.jsx | 12 src/menu/components/form/dragtitle/index.scss | 1 src/store/reducer.js | 5 src/menu/components/form/tab-form/index.jsx | 34 src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx | 31 src/menu/components/carousel/prop-card/index.jsx | 50 src/menu/components/card/cardcomponent/index.jsx | 13 src/menu/components/chart/antv-pie/index.jsx | 12 src/views/pay/index.jsx | 4 src/views/menudesign/index.scss | 34 src/menu/components/card/prop-card/index.jsx | 80 src/menu/components/table/edit-table/columns/index.jsx | 25 src/components/encrypts/index.jsx | 53 src/menu/datasource/verifycard/utils.jsx | 34 src/menu/tableshell/index.scss | 21 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 31 src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 27 src/views/login/loginform.jsx | 2 src/tabviews/zshare/topSearch/index.jsx | 39 src/templates/comtableconfig/index.jsx | 2 src/menu/components/chart/chart-custom/index.jsx | 12 src/menu/components/form/simple-form/index.jsx | 34 src/views/basedesign/index.jsx | 11 src/tabviews/custom/components/table/edit-table/index.jsx | 18 src/views/printTemplate/print.js | 14 src/api/index.js | 140 src/templates/treepageconfig/index.scss | 32 src/templates/formtabconfig/index.scss | 35 src/mob/components/search/single-search/index.jsx | 15 src/menu/components/table/base-table/columns/index.scss | 146 src/menu/components/table/base-table/columns/editColumn/index.jsx | 398 + src/views/pcdesign/index.jsx | 3 src/menu/datasource/verifycard/settingform/index.jsx | 26 src/mob/components/formdragelement/index.jsx | 9 src/menu/components/share/actioncomponent/index.jsx | 12 src/menu/components/card/cardsimplecomponent/index.jsx | 12 src/tabviews/custom/components/form/step-form/index.jsx | 22 src/templates/modalconfig/source.jsx | 10 src/views/systemfunc/sidemenu/config.jsx | 120 src/tabviews/formtab/actionList/index.jsx | 2 src/mob/components/tabs/antv-tabs/index.jsx | 40 src/tabviews/custom/components/tree/antd-tree/index.jsx | 27 src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 43 src/tabviews/zshare/normalTable/index.jsx | 131 src/menu/components/share/searchcomponent/index.jsx | 2 src/templates/treepageconfig/index.jsx | 4 src/views/menudesign/menuform/index.jsx | 5 src/menu/components/module/voucher/index.jsx | 17 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 4 src/menu/components/table/base-table/index.scss | 92 src/menu/components/form/formaction/index.jsx | 20 src/menu/components/tree/antd-tree/index.jsx | 15 src/views/billprint/index.jsx | 6 src/tabviews/subtabtable/index.jsx | 13 src/views/imdesign/index.scss | 30 src/menu/tableshell/card.jsx | 56 src/tabviews/zshare/actionList/normalbutton/index.jsx | 233 src/views/tabledesign/index.scss | 211 src/views/menudesign/index.jsx | 2 src/tabviews/custom/components/card/data-card/index.jsx | 75 src/templates/calendarconfig/index.scss | 31 src/tabviews/custom/components/module/voucher/index.jsx | 15 src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 20 src/templates/calendarconfig/index.jsx | 2 src/router/index.js | 54 src/menu/components/card/data-card/index.jsx | 87 src/menu/components/chart/antv-dashboard/index.jsx | 12 src/menu/components/share/clockcomponent/settingform/index.jsx | 29 src/mob/components/menubar/common-menubar/index.jsx | 15 src/views/appmanage/index.jsx | 2 src/views/design/header/versions/index.jsx | 10 src/menu/components/tabs/antv-tabs/index.jsx | 12 src/templates/sharecomponent/searchcomponent/index.scss | 2 src/views/design/index.jsx | 33 src/views/printTemplate/option.js | 76 src/components/header/index.jsx | 371 - src/views/pcdesign/menuform/index.jsx | 8 src/templates/formtabconfig/index.jsx | 327 - src/templates/zshare/verifycard/callbackcustomscript/index.jsx | 2 src/tabviews/custom/components/card/cardItem/index.jsx | 5 src/tabviews/calendar/index.jsx | 4 src/views/appmanage/scriptform/index.jsx | 9 src/tabviews/custom/components/carousel/data-card/index.jsx | 19 src/menu/components/code/sandbox/index.jsx | 15 src/tabviews/zshare/mutilform/mkSelect/index.jsx | 1 src/views/tabledesign/menuform/index.jsx | 338 + src/menu/components/table/normal-table/index.scss | 20 src/templates/zshare/verifycard/customform/index.jsx | 2 src/menu/sysinterface/settingform/utils.jsx | 2 src/tabviews/custom/components/chart/custom-chart/index.jsx | 31 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 37 src/menu/components/card/balcony/index.jsx | 49 src/tabviews/zshare/actionList/tabbutton/index.jsx | 5 src/templates/modalconfig/index.scss | 35 src/menu/stylecontroller/index.jsx | 20 src/menu/components/table/base-table/options.jsx | 274 + src/templates/zshare/verifycard/index.jsx | 2 src/tabviews/zshare/actionList/printbutton/index.jsx | 91 src/menu/components/card/cardcellcomponent/formconfig.jsx | 28 src/templates/comtableconfig/index.scss | 31 src/templates/sharecomponent/actioncomponent/index.jsx | 6 src/menu/components/editor/braft-editor/index.jsx | 20 src/tabviews/zshare/topSearch/dategroup/index.scss | 3 src/menu/components/share/markcomponent/markform/index.jsx | 10 src/mob/searchconfig/index.jsx | 2 src/menu/components/share/markcomponent/index.jsx | 3 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 10 src/menu/components/share/actioncomponent/dragaction/index.jsx | 2 src/templates/modalconfig/index.jsx | 2 src/views/systemfunc/index.jsx | 5 src/templates/sharecomponent/tablecomponent/index.jsx | 10 src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 2 src/views/design/sidemenu/index.jsx | 18 src/mob/modalconfig/index.jsx | 2 src/mob/modalconfig/index.scss | 35 src/tabviews/commontable/index.jsx | 13 src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx | 26 src/views/tabledesign/menuform/index.scss | 8 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx | 9 src/menu/components/form/formaction/formconfig.jsx | 4 src/tabviews/custom/components/card/cardcellList/index.jsx | 1214 ++-- src/tabviews/custom/components/card/prop-card/index.jsx | 31 src/menu/tableshell/index.jsx | 132 src/menu/components/card/data-card/options.jsx | 7 src/mob/components/menubar/normal-menubar/index.jsx | 15 src/tabviews/custom/components/table/normal-table/index.jsx | 19 src/templates/sharecomponent/treesettingcomponent/settingform/datasource/index.jsx | 8 src/templates/sharecomponent/actioncomponent/verifyexcelout/columnform/index.jsx | 5 src/tabviews/custom/components/chart/antv-pie/index.jsx | 27 src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 65 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 35 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 2 src/components/breadview/index.jsx | 5 src/components/video/index.scss | 30 src/tabviews/zshare/mutilform/index.jsx | 80 src/menu/components/share/actioncomponent/actionform/index.jsx | 23 src/tabviews/custom/index.jsx | 183 src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx | 4 src/menu/components/table/normal-table/columns/index.jsx | 16 src/pc/components/navbar/normal-navbar/index.jsx | 28 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 31 src/views/design/header/index.jsx | 157 src/components/video/index.jsx | 2 src/menu/components/card/cardcellcomponent/dragaction/index.jsx | 2 src/menu/components/table/base-table/columns/editColumn/formconfig.jsx | 414 + src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 79 src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 4 src/menu/components/chart/antv-bar/index.jsx | 12 src/views/tabledesign/index.jsx | 905 ++++ src/views/mainparams/index.jsx | 48 src/tabviews/custom/components/form/simple-form/index.jsx | 22 src/tabviews/subtable/index.jsx | 13 src/menu/components/table/edit-table/index.jsx | 52 src/menu/components/carousel/data-card/index.jsx | 43 src/tabviews/custom/components/card/table-card/index.jsx | 68 src/menu/components/search/main-search/dategroup/index.scss | 1 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 23 src/mob/components/menubar/normal-menubar/menucomponent/index.jsx | 13 src/views/popdesign/index.scss | 30 src/menu/components/form/step-form/index.jsx | 34 src/menu/components/share/normalheader/index.jsx | 17 src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx | 4 src/templates/subtableconfig/index.scss | 31 src/menu/components/search/main-search/index.jsx | 14 src/mob/components/topbar/normal-navbar/index.jsx | 38 src/templates/sharecomponent/actioncomponent/dragaction/index.jsx | 4 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx | 4 src/components/sidemenu/index.jsx | 4 src/views/login/index.jsx | 8 src/mob/components/navbar/normal-navbar/index.jsx | 15 src/utils/utils-datamanage.js | 23 src/menu/picturecontroller/index.jsx | 2 src/menu/sysinterface/settingform/simplescript/index.jsx | 2 src/tabviews/custom/components/code/sand-box/index.jsx | 17 src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx | 2 src/menu/components/card/table-card/index.jsx | 50 src/templates/zshare/verifycard/baseform/index.scss | 27 src/components/encrypts/index.scss | 12 src/views/main/index.jsx | 13 src/menu/picturecontroller/index.scss | 2 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 2 public/options.json | 10 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 4 src/tabviews/basetable/index.jsx | 1287 +++++ src/menu/components/card/data-card/index.scss | 7 src/views/pcdesign/index.scss | 30 src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 12 src/templates/modalconfig/dragelement/card.jsx | 4 src/views/design/sidemenu/editthdmenu/index.jsx | 5 src/views/mobdesign/index.jsx | 3 src/menu/components/share/actioncomponent/formconfig.jsx | 15 src/tabviews/basetable/index.scss | 140 src/tabviews/custom/components/group/normal-group/index.jsx | 72 src/templates/sharecomponent/columncomponent/index.scss | 2 src/templates/sharecomponent/tablecomponent/index.scss | 28 src/tabviews/custom/components/carousel/prop-card/index.jsx | 19 src/templates/zshare/createinterface/index.jsx | 4 src/menu/components/table/base-table/columns/index.jsx | 618 ++ src/menu/components/table/normal-table/index.jsx | 50 src/views/design/sidemenu/thdmenuplus/index.jsx | 31 src/menu/components/group/normal-group/index.jsx | 12 src/tabviews/zshare/normalTable/index.scss | 21 src/components/tabview/index.jsx | 13 src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx | 41 src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx | 4 src/views/appcheck/index.jsx | 6 src/views/mobdesign/menuform/index.jsx | 21 src/views/mainparams/index.scss | 7 src/mob/searchconfig/index.scss | 58 src/templates/sharecomponent/searchcomponent/index.jsx | 24 src/templates/sharecomponent/columncomponent/index.jsx | 17 src/views/mobdesign/index.scss | 32 src/tabviews/custom/components/share/normalTable/index.jsx | 62 src/templates/modalconfig/dragelement/index.jsx | 9 src/tabviews/custom/components/card/data-card/index.scss | 12 src/utils/utils.js | 10 src/tabviews/custom/components/card/table-card/index.scss | 12 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 43 src/index.js | 5 src/tabviews/custom/components/form/tab-form/index.jsx | 22 src/templates/zshare/createfunc/index.jsx | 6 src/views/appmanage/scriptform/index.scss | 4 src/tabviews/custom/components/share/tabtransfer/index.jsx | 75 src/templates/sharecomponent/searchcomponent/dategroup/index.scss | 1 src/tabviews/rolemanage/index.jsx | 4 src/templates/zshare/formconfig.jsx | 149 src/mob/components/formdragelement/card.jsx | 4 src/pc/components/login/normal-login/index.jsx | 15 /dev/null | 0 src/menu/modalconfig/index.scss | 35 src/menu/modalconfig/index.jsx | 2 src/tabviews/custom/components/card/balcony/index.jsx | 35 src/menu/components/table/base-table/columns/editColumn/index.scss | 17 src/menu/components/table/base-table/index.jsx | 554 ++ src/templates/zshare/verifycard/baseform/index.jsx | 100 src/utils/option.js | 7 src/templates/sharecomponent/columncomponent/columnform/index.jsx | 3 250 files changed, 9,405 insertions(+), 3,641 deletions(-) diff --git a/public/options.json b/public/options.json index 523da64..fbdb8bf 100644 --- a/public/options.json +++ b/public/options.json @@ -1,12 +1,12 @@ { - "appId": "201912040924165801464FF1788654BC5AC73", - "appkey": "20191106103859640976D6E924E464D029CF0", + "appId": "202108312122504607B107A83F55B40C98CCF", + "appkey": "20210831212235413F287EC3BF489424496C8", "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", "systemType": "", "externalDatabase": "false", "lineColor": "", "filter": "false", - "defaultApp": "mk", + "defaultApp": "mkindustry", "defaultLang": "zh-CN", "WXAppID": "", "WXminiAppID": "", @@ -15,6 +15,6 @@ "probation": "", "keepPassword": "true", "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], - "host": "http://qingqiumarket.cn", - "service": "MKWMS/" + "host": "http://demo.mk9h.cn", + "service": "erp_new/" } \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index 39c477c..1311362 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -42,11 +42,6 @@ const setCurrentUrl = (res) => { if (!!(window.history && window.history.pushState)) { - if (window.location.href.indexOf('paramsmain') > -1) { - let _href = window.location.href.split('#') - localStorage.setItem(_href[0] + 'paramsmain', _href[1]) - } - sessionStorage.clear() sessionStorage.setItem('loginError', JSON.stringify({url: res.config ? res.config.url : '', request: res.config ? res.config.data : '', response: JSON.stringify(res.data)})) window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') @@ -571,33 +566,7 @@ } /** - * @description 鑾峰彇鎴栦慨鏀规湰鍦伴厤缃紝澧炲姞appkey - */ - getLocalConfig (param) { - param.userid = param.userid || sessionStorage.getItem('UserID') || '' - param.lang = param.lang || sessionStorage.getItem('lang') || '' - param.SessionUid = localStorage.getItem('SessionUid') || '' - param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' - param.appkey = window.GLOB.appkey || '' - - let url = '/webapi/dostars' - if (param.rduri) { - url = param.rduri - delete param.rduri - } - - param = this.encryptParam(param) - - return axios({ - url: `${url}${param.func ? '/' + param.func : ''}`, - method: 'post', - data: param - }) - } - - /** * @description 鑾峰彇绯荤粺閰嶇疆锛屽彇鍊间紭鍏堢瓑绾ebsql銆佺紦瀛樸�佹湇鍔″櫒 - * @param {Object} param 璇锋眰鍙傛暟 */ getCacheConfig (param) { param.userid = sessionStorage.getItem('UserID') || '' @@ -692,11 +661,10 @@ /** * @description 鑾峰彇鏈湴绯荤粺閰嶇疆 - * @param {Object} param 璇锋眰鍙傛暟 */ getLocalCacheConfig (param) { param.userid = sessionStorage.getItem('UserID') || '' - param.lang = param.lang || sessionStorage.getItem('lang') || '' + param.lang = sessionStorage.getItem('lang') || '' param.SessionUid = localStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' @@ -797,21 +765,17 @@ /** * @description 鑾峰彇涓氬姟閫氱敤鎺ュ彛 + * 璁块棶 'https://sso.mk9h.cn/webapi/dostars'鎴栦簯绔椂锛屼紶鍏serid銆丩oginUID */ genericInterface (param) { - param.userid = sessionStorage.getItem('UserID') || '' - param.lang = sessionStorage.getItem('lang') || '' + param.userid = param.userid || sessionStorage.getItem('UserID') || '' + param.lang = param.lang || sessionStorage.getItem('lang') || '' param.SessionUid = localStorage.getItem('SessionUid') || '' - param.LoginUID = sessionStorage.getItem('LoginUID') || '' + param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' - if (options.cloudServiceApi && param.rduri === options.cloudServiceApi) { // HS涓嬭彍鍗� - param.userid = sessionStorage.getItem('CloudUserID') || param.userid || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || param.LoginUID || '' - } - let url = '/webapi/dostars' - if (param.rduri && /\/dostars/.test(param.rduri)) { + if (param.rduri && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { // 鍒囨崲鐢ㄦ埛闇�瑕侀�氳繃鏈湴 url = param.rduri delete param.rduri } @@ -826,55 +790,55 @@ } /** - * @description 瀵煎嚭Excel + * @description 瀵煎嚭Excel锛屽悗鍙扮敓鎴愭枃浠� */ - getExcelOut (param, name) { - param.userid = sessionStorage.getItem('UserID') - param.lang = sessionStorage.getItem('lang') || '' - param.SessionUid = localStorage.getItem('SessionUid') || '' - param.LoginUID = sessionStorage.getItem('LoginUID') || '' - param.appkey = window.GLOB.appkey || '' + // getExcelOut (param, name) { + // param.userid = sessionStorage.getItem('UserID') + // param.lang = sessionStorage.getItem('lang') || '' + // param.SessionUid = localStorage.getItem('SessionUid') || '' + // param.LoginUID = sessionStorage.getItem('LoginUID') || '' + // param.appkey = window.GLOB.appkey || '' - return new Promise(resolve => { - axios({ - url: '/webapi/doexcel', - responseType: 'blob', - method: 'post', - data: param - }).then(res => { - try { - const blob = new Blob([res]) + // return new Promise(resolve => { + // axios({ + // url: '/webapi/doexcel', + // responseType: 'blob', + // method: 'post', + // data: param + // }).then(res => { + // try { + // const blob = new Blob([res]) - if (res.type === 'application/json') { - const reader = new FileReader() - reader.onload = e => resolve(JSON.parse(e.target.result)) - reader.readAsText(blob) - } else { - if ('download' in document.createElement('a')) { // 闈濱E涓嬭浇 - const elink = document.createElement('a') - elink.download = name - elink.style.display = 'none' - elink.href = URL.createObjectURL(blob) - document.body.appendChild(elink) - elink.click() - URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 - document.body.removeChild(elink) - } else { // IE10+涓嬭浇 - navigator.msSaveBlob(blob, name) - } - resolve() - } - } catch (e) { - resolve({ - ErrCode: 'E', - ErrMesg: '鏂囦欢瑙f瀽閿欒', - message: '', - status: false - }) - } - }) - }) - } + // if (res.type === 'application/json') { + // const reader = new FileReader() + // reader.onload = e => resolve(JSON.parse(e.target.result)) + // reader.readAsText(blob) + // } else { + // if ('download' in document.createElement('a')) { // 闈濱E涓嬭浇 + // const elink = document.createElement('a') + // elink.download = name + // elink.style.display = 'none' + // elink.href = URL.createObjectURL(blob) + // document.body.appendChild(elink) + // elink.click() + // URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + // document.body.removeChild(elink) + // } else { // IE10+涓嬭浇 + // navigator.msSaveBlob(blob, name) + // } + // resolve() + // } + // } catch (e) { + // resolve({ + // ErrCode: 'E', + // ErrMesg: '鏂囦欢瑙f瀽閿欒', + // message: '', + // status: false + // }) + // } + // }) + // }) + // } /** * @description 涓婁紶base64 diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index 9f1a97d..bd3d3cd 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -16,6 +16,7 @@ const Home = asyncComponent(() => import('@/tabviews/home')) const CustomPage = asyncComponent(() => import('@/tabviews/custom')) const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) +// const BaseTable = asyncComponent(() => import('@/tabviews/basetable')) const CalendarPage = asyncComponent(() => import('@/tabviews/calendar')) const TreePage = asyncComponent(() => import('@/tabviews/treepage')) const Iframe = asyncComponent(() => import('@/tabviews/iframe')) @@ -92,8 +93,10 @@ // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠� if (view.type === 'Home') { return (<Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) - } else if (view.type === 'CommonTable' || view.type === 'ManageTable') { + } else if (view.type === 'CommonTable') { return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) + // } else if (view.type === 'BaseTable') { + // return (<BaseTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'CustomPage') { return (<CustomPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'TreePage') { diff --git a/src/components/encrypts/index.jsx b/src/components/encrypts/index.jsx new file mode 100644 index 0000000..8d6617d --- /dev/null +++ b/src/components/encrypts/index.jsx @@ -0,0 +1,53 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' + +import './index.scss' + +class Encryption extends Component { + static propTpyes = { + value: PropTypes.any + } + + state = { + eye: false + } + + getValue = () => { + const { value } = this.props + + let len = value.length + let val = '' + + if (len === 1) { + val = '*' + } else if (len === 2) { + val = value.substr(0, 1) + '*' + } else if (len <= 6) { + val = value.substr(0, 1) + Array(len - 1).join('*') + value.substr(-1) + } else if (len <= 10) { + val = value.substr(0, 2) + Array(len - 3).join('*') + value.substr(-2) + } else if (len === 11) { + val = value.substr(0, 3) + '****' + value.substr(-4) + } else { + let l = Math.floor(len * 0.2) + val = value.substr(0, l) + Array(len - 1 - 2 * l).join('*') + value.substr(-l) + } + + return val + } + + render() { + const { value } = this.props + const { eye } = this.state + + return ( + <> + {eye ? value : this.getValue()} + {eye ? <EyeOutlined className="mk-open-eye" onClick={() => this.setState({eye: false})}/> : <EyeInvisibleOutlined className="mk-close-eye" onClick={() => this.setState({eye: true})}/>} + </> + ) + } +} + +export default Encryption \ No newline at end of file diff --git a/src/components/encrypts/index.scss b/src/components/encrypts/index.scss new file mode 100644 index 0000000..201b3b5 --- /dev/null +++ b/src/components/encrypts/index.scss @@ -0,0 +1,12 @@ +.mk-open-eye { + color: var(--mk-sys-color); + cursor: pointer; + margin-left: 3px!important; + margin-right: 2px!important; +} +.mk-close-eye { + color: rgba(0, 0, 0, 0.65); + cursor: pointer; + margin-left: 3px!important; + margin-right: 2px!important; +} \ No newline at end of file diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index afbac7f..6ecc8a9 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -143,117 +143,92 @@ } getRolesMenu () { - // 鑾峰彇瑙掕壊鏉冮檺 - let roledefer = new Promise(resolve => { - // edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A' - setTimeout(() => { - Api.getSystemConfig({ - func: 's_Get_TrdMenu_Role', - edition_type: 'A', - pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '' - }).then(result => { - let _permAction = {loaded: true} // 鎸夐挳鏉冮檺 - - if (result && result.status) { - if (result.UserRoles_Menu) { - result.UserRoles_Menu.forEach(menu => { - if (!menu.MenuID) return - _permAction[menu.MenuID] = true - }) - } - } else if (result) { - notification.error({ - top: 92, - message: result.message, - duration: 10 + // 鑾峰彇涓昏彍鍗曞弬鏁� + let _param = {func: 's_get_pc_menus', systemType: options.sysType} + _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' + + Api.getSystemConfig(_param).then(result => { + if (!result.status) { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + return + } + + const { menulist, thdMenuList } = this.getMenulist(result) + + let systems = [] + if ((options.sysType === 'local' || options.sysType === 'SSO') && result.sys_list) { + systems = result.sys_list + + if (options.sysType === 'local' && window.GLOB.systemType !== 'production' && systems.length > 10) { + systems.length = 10 + } + } + + this.setState({ + menulist, + thdMenuList, + systems: systems + }) + + let mainMenu = menulist[0] || '' + let _menu = null + + if (sessionStorage.getItem('ThirdMenu')) { // 鏄惁涓烘墦寮�鏂伴〉闈� + let ThirdMenuId = sessionStorage.getItem('ThirdMenu') + _menu = thdMenuList.filter(item => item.MenuID === ThirdMenuId)[0] // 閫氳繃url涓璵enuid绛涢�夊嚭閫変腑鐨勪富鑿滃崟 + + sessionStorage.removeItem('ThirdMenu') + } + + this.props.modifyMainMenu(mainMenu) + this.props.initMenuPermission([...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]) + + if (_menu) { // 寤舵椂鎵撳紑锛岄槻姝㈡爣绛剧粍鏈畬鎴愬姞杞� + setTimeout(() => { + if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { + MKEmitter.emit('modifyTabs', _menu, 'replace') + } else { + MKEmitter.emit('modifyTabs', _menu, 'plus') + } + }, 200) + } + }) + + // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A' + setTimeout(() => { + Api.getSystemConfig({ + func: 's_Get_TrdMenu_Role', + edition_type: 'A', + pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '' + }).then(result => { + let _permAction = {loaded: true} // 鎸夐挳鏉冮檺 + + if (result && result.status) { + if (result.UserRoles_Menu) { + result.UserRoles_Menu.forEach(menu => { + if (!menu.MenuID) return + _permAction[menu.MenuID] = true }) } - - this.props.initActionPermission(_permAction) - resolve() - }) - }, 50) - }) - - // 鑾峰彇涓昏彍鍗曞弬鏁� - let menudefer = new Promise(resolve => { - let _param = {func: 's_get_pc_menus', systemType: options.sysType} - _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' - - Api.getSystemConfig(_param).then(result => { - if (!result.status) { + } else if (result) { notification.error({ top: 92, message: result.message, duration: 10 }) - return } - const { menulist, thdMenuList } = this.getMenulist(result) - - let systems = [] - if ((options.sysType === 'local' || options.sysType === 'SSO') && result.sys_list) { - systems = result.sys_list - - if (options.sysType === 'local' && window.GLOB.systemType !== 'production' && systems.length > 10) { - systems.length = 10 - } - } - - this.setState({ - menulist, - thdMenuList, - systems: systems - }) - - let mainMenu = menulist[0] || '' - let _menu = null - - if (mainMenu === '') { // 鏄惁鏄剧ず渚ц竟鏍忔帶鍒� - let _url = window.location.href.split('#')[0] - localStorage.setItem(_url + '-sideHidden', 'true') - } else { - let _url = window.location.href.split('#')[0] - localStorage.removeItem(_url + '-sideHidden') - } - - if (sessionStorage.getItem('ThirdMenu')) { // 鏄惁涓烘墦寮�鏂伴〉闈� - let ThirdMenuId = sessionStorage.getItem('ThirdMenu') - _menu = thdMenuList.filter(item => item.MenuID === ThirdMenuId)[0] // 閫氳繃url涓璵enuid绛涢�夊嚭閫変腑鐨勪富鑿滃崟 - - if (_menu) { - mainMenu = menulist.filter(item => item.MenuID === _menu.FstId)[0] - mainMenu = fromJS(mainMenu).toJS() - mainMenu.openId = _menu.ParentId - } - - sessionStorage.removeItem('ThirdMenu') - } - - this.props.modifyMainMenu(mainMenu) - this.props.initMenuPermission([...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}]) - - resolve(_menu) + this.props.initActionPermission(_permAction) }) - }) - - Promise.all([roledefer, menudefer]).then(response => { - if (response[1]) { - let menu = fromJS(response[1]).toJS() - - if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') { - MKEmitter.emit('modifyTabs', menu, 'replace') - } else { - MKEmitter.emit('modifyTabs', menu, 'plus') - } - } - }) + }, 50) } getMenulist = (result) => { let thdMenuList = [] - let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] let menulist = [] result.fst_menu && result.fst_menu.forEach(fst => { let fstItem = { @@ -264,14 +239,13 @@ } if (fst.PageParam) { try { - fstItem.PageParam = JSON.parse(fst.PageParam) - } catch (e) { - fstItem.PageParam = null - } - if (fstItem.PageParam && fstItem.PageParam.OpenType === 'outpage' && fstItem.PageParam.linkUrl) { - fstItem.OpenType = 'outpage' - fstItem.linkUrl = fstItem.PageParam.linkUrl - } + let PageParam = JSON.parse(fst.PageParam) + + if (PageParam.OpenType === 'outpage' && PageParam.linkUrl) { + fstItem.OpenType = 'outpage' + fstItem.linkUrl = PageParam.linkUrl + } + } catch (e) {} } if (fst.snd_menu) { @@ -280,31 +254,16 @@ ParentId: fst.MenuID, MenuID: snd.MenuID, MenuName: snd.MenuName, - PageParam: {Icon: 'folder'}, + Icon: 'folder', children: [] } if (snd.PageParam) { try { - sndItem.PageParam = JSON.parse(snd.PageParam) - } catch (e) { - sndItem.PageParam = {Icon: 'folder'} - } - } + let PageParam = JSON.parse(snd.PageParam) - let msg = { - UserID: sessionStorage.getItem('UserID'), - LoginUID: sessionStorage.getItem('LoginUID'), - User_Name: sessionStorage.getItem('User_Name'), - Full_Name: sessionStorage.getItem('Full_Name'), - Member_Level: sessionStorage.getItem('Member_Level'), - dataM: sessionStorage.getItem('dataM'), - avatar: sessionStorage.getItem('avatar'), - debug: sessionStorage.getItem('debug'), - role_id: sessionStorage.getItem('role_id'), - mainlogo: window.GLOB.mainlogo, - navBar: window.GLOB.navBar || '', - mstyle: window.GLOB.style + sndItem.Icon = PageParam.Icon || 'folder' + } catch (e) {} } if (snd.trd_menu) { @@ -321,45 +280,23 @@ OpenType: 'newtab', hidden: 'false' } - - if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { - trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') - } else { + + if (trd.PageParam) { try { - trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} - } catch (e) { - trdItem.PageParam = {OpenType: 'newtab'} - } + let PageParam = JSON.parse(trd.PageParam) - trdItem.type = trdItem.PageParam.Template || trdItem.type - trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType - trdItem.hidden = trdItem.PageParam.hidden || trdItem.hidden + trdItem.type = PageParam.Template || trdItem.type + trdItem.OpenType = PageParam.OpenType || trdItem.OpenType + trdItem.hidden = PageParam.hidden || trdItem.hidden - if (trdItem.type === 'NewPage') { - trdItem.src = trdItem.PageParam.url || '' - - if (trdItem.src.indexOf('paramsmain/') > -1) { - try { - let _url = trdItem.src.split('paramsmain/')[0] + 'paramsmain/' - let _param = JSON.parse(window.decodeURIComponent(window.atob(trdItem.src.split('paramsmain/')[1]))) - _param.UserID = sessionStorage.getItem('UserID') - _param.LoginUID = sessionStorage.getItem('LoginUID') - _param.User_Name = sessionStorage.getItem('User_Name') - _param.Full_Name = sessionStorage.getItem('Full_Name') - - trdItem.src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } + if (trdItem.type === 'NewPage') { + trdItem.src = PageParam.url || '' } - } else { - // 鎵撳紑鏂伴〉闈㈤摼鎺� - trdItem.src = '#/paramsmain/' + window.btoa(window.encodeURIComponent(JSON.stringify({ - ...msg, - ThirdMenu: trd.MenuID - }))) - } + } catch (e) {} + } + + if (trdItem.type !== 'NewPage') { + trdItem.src = '#/tab/' + trd.MenuID } thdMenuList.push(trdItem) @@ -444,7 +381,6 @@ localStorage.setItem(_url, window.btoa(window.encodeURIComponent(JSON.stringify({time: new Date().getTime(), username: param.username, password: param.password})))) } - this.setSystemFuncs() this.props.modifyMainMenu(null) this.props.history.replace('/design') } else { @@ -462,106 +398,6 @@ }) } }) - }) - } - - setSystemFuncs = () => { - if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { - return - } - this.getfuncTime().then(res => { - Api.getSystemFuncs(res.createDate).then(result => { - if (!result.status) { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } else if (result.func_detail && result.func_detail.length > 0) { - this.writeFuncs(result.func_detail) - } - }) - }) - } - - writeFuncs = (funcs) => { - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - - let sys_datetime = sessionStorage.getItem('sys_datetime') - let app_datetime = sessionStorage.getItem('app_datetime') - if (sys_datetime && app_datetime) { - let seconds = Math.floor((new Date().getTime() - app_datetime) / 1000) - timestamp = moment(sys_datetime, 'YYYY-MM-DD HH:mm:ss').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss') - } - - if (window.GLOB.WebSql) { - window.GLOB.WebSql.transaction(tx => { - tx.executeSql('DELETE FROM FUNCS') - - funcs.forEach(item => { - if (!item.key_sql) return - tx.executeSql('INSERT INTO FUNCS (func_code, key_sql) VALUES (?, ?)', [item.func_code, item.key_sql]) - }) - tx.executeSql(`UPDATE VERSIONS SET createDate='${timestamp}' where CDefine1='funcs'`) - }) - } else { - let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') - - objectStore.clear() - - funcs.forEach(item => { - if (!item.key_sql) return - item.id = item.func_code - objectStore.add(item) - }) - - let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) - } - } - - getfuncTime = () => { - return new Promise((resolve, reject) => { - if (window.GLOB.WebSql) { - window.GLOB.WebSql.transaction(tx => { - tx.executeSql("SELECT * FROM VERSIONS where CDefine1='funcs'", [], (tx, results) => { - let rows = results.rows - if (rows.length === 0) { - tx.executeSql('DELETE FROM FUNCS') - tx.executeSql('INSERT INTO VERSIONS (version, createDate, CDefine1) VALUES (?, ?, ?)', ['1.0', '1970-01-01 14:59:09.000', 'funcs']) - resolve({createDate: '1970-01-01 14:59:09.000'}) - } else { - resolve(rows[0]) - } - }, (tx, results) => { - reject() - console.warn(results) - }) - }) - } else { - let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - let request = objectStore.get('funcs') - - request.onerror = (event) => { - console.warn(event) - reject() - } - - request.onsuccess = () => { - if (request.result) { - resolve(request.result) - } else { - let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - - add.onerror = () => { - reject() - } - add.onsuccess = () => { - resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - } - } - } - } }) } @@ -653,6 +489,13 @@ // search_type: '' // }).then(res => { // }) + + // sessionStorage 璺ㄩ〉闈㈠叡浜� + window.addEventListener('storage', (e) => { + if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { + localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) + } + }) } shouldComponentUpdate (nextProps, nextState) { @@ -738,6 +581,12 @@ }) } + changeToHome = () => { + if (!['linkage', 'menu_board'].includes(window.GLOB.navBar)) return + + MKEmitter.emit('modifyTabs', {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}, 'replace') + } + render () { const { mainMenu, collapse } = this.props const { thdMenuList, searchkey, debug, menulist, navBar, menuType, appVersion } = this.state @@ -767,7 +616,7 @@ return ( <header className="header-container ant-menu-dark" id="main-header-container"> - <div className={'header-logo ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}><img src={this.state.logourl} alt=""/></div> + <div className={'header-logo ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')} onClick={this.changeToHome}><img src={this.state.logourl} alt=""/></div> <div className={'header-collapse ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}> {navBar !== 'topmenu' ? (collapse ? <MenuUnfoldOutlined onClick={this.handleCollapse}/> : <MenuFoldOutlined onClick={this.handleCollapse}/>) : null} </div> diff --git a/src/components/header/index.scss b/src/components/header/index.scss index 27850ef..ee1530d 100644 --- a/src/components/header/index.scss +++ b/src/components/header/index.scss @@ -196,7 +196,7 @@ border-radius: 4px; box-shadow: 0 0 3px #959595; position: relative; - left: 11.8%; + // left: 11.8%; .menu-wrap { .title { color: #1890ff; @@ -205,21 +205,23 @@ } .menu-detail { max-width: 60vw; - padding: 5px 0 10px 15px; + padding: 5px 0 5px 15px; div { - float: left; - margin-bottom: 5px; + // float: left; + display: inline-block; + vertical-align: top; + margin-bottom: 8px; width: 120px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; + // overflow: hidden; + // white-space: nowrap; + // text-overflow: ellipsis; cursor: pointer; } div:hover { color: #40a9ff; } div:not(:last-child) { - margin-right: 20px; + margin-right: 15px; } } .menu-detail::after { diff --git a/src/components/sidemenu/index.jsx b/src/components/sidemenu/index.jsx index 4df598a..69fb3c8 100644 --- a/src/components/sidemenu/index.jsx +++ b/src/components/sidemenu/index.jsx @@ -36,7 +36,7 @@ let openKey = '' if (menu.children[0]) { - openKey = menu.openId || menu.children[0].MenuID + openKey = menu.children[0].MenuID } this.setState({ @@ -103,7 +103,7 @@ key={item.MenuID} title={ <span> - <MkIcon type={item.PageParam.Icon} /> + <MkIcon type={item.Icon} /> <span>{item.MenuName}</span> </span> } diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index d5320f5..ad4fec5 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -18,10 +18,9 @@ const Home = asyncComponent(() => import('@/tabviews/home')) const CustomPage = asyncComponent(() => import('@/tabviews/custom')) const CommonTable = asyncComponent(() => import('@/tabviews/commontable')) +// const BaseTable = asyncComponent(() => import('@/tabviews/basetable')) const CalendarPage = asyncComponent(() => import('@/tabviews/calendar')) const TreePage = asyncComponent(() => import('@/tabviews/treepage')) -const VerupTable = asyncComponent(() => import('@/tabviews/verupmanage')) -const ScriptTable = asyncComponent(() => import('@/tabviews/scriptmanage')) const TabManage = asyncComponent(() => import('@/tabviews/tabmanage')) const Iframe = asyncComponent(() => import('@/tabviews/iframe')) const RoleManage = asyncComponent(() => import('@/tabviews/rolemanage')) @@ -199,23 +198,19 @@ // 鏍规嵁tab椤典腑鑿滃崟淇℃伅锛岄�夋嫨鎵�闇�鐨勭粍浠� if (view.type === 'Home') { return (<Home MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) - } else if (view.type === 'CommonTable' || view.type === 'ManageTable') { + } else if (view.type === 'CommonTable') { return (<CommonTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) + // } else if (view.type === 'BaseTable') { + // return (<BaseTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'CustomPage') { return (<CustomPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'TreePage') { return (<TreePage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) } else if (view.type === 'CalendarPage') { return (<CalendarPage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) - } else if (view.type === 'VerupTable') { - return (<VerupTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) - } else if (view.type === 'ScriptTable') { - return (<ScriptTable MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'TabManage') { return (<TabManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'RolePermission') { - return (<RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) - } else if (view.type === 'appRolePermission') { return (<RoleManage MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID}/>) } else if (view.type === 'FormTab') { return (<FormTab MenuNo={view.MenuNo} MenuID={view.MenuID} MenuName={view.MenuName} key={view.MenuID} param={view.param}/>) diff --git a/src/components/video/index.jsx b/src/components/video/index.jsx index 960bbbf..5b09f94 100644 --- a/src/components/video/index.jsx +++ b/src/components/video/index.jsx @@ -33,7 +33,7 @@ <source src={value} /> <BigPlayButton position="center" /> <ControlBar> - <VolumeMenuButton /> + <VolumeMenuButton vertical /> <CurrentTimeDisplay /> <TimeDivider /> <PlaybackRateMenuButton rates={[5, 2, 1, 0.5, 0.1]} order={7.1} /> diff --git a/src/components/video/index.scss b/src/components/video/index.scss index 1c11bbc..7fad5d4 100644 --- a/src/components/video/index.scss +++ b/src/components/video/index.scss @@ -25,7 +25,7 @@ .video-react .video-react-volume-menu-button, .video-react .video-react-play-control, .video-react .video-react-play-progress, .video-react .video-react-big-play-button { /* use !important to prevent issues with browser extensions that change fonts */ font-family: "video-react" !important; - speak: none; + // speak: none; font-style: normal; font-weight: normal; font-variant: normal; @@ -703,8 +703,7 @@ ginormous. If you'd like to enable the current time tooltip all the time, this should be disabled to avoid a weird hitch when you roll off the hover. */ .video-react .video-react-progress-control:hover .video-react-time-tooltip, -.video-react .video-react-progress-control:hover .video-react-mouse-display:after, -.video-react .video-react-progress-control:hover .video-react-play-progress:after { +.video-react .video-react-progress-control:hover .video-react-mouse-display:after { visibility: visible; font-size: 0.6em; } @@ -728,14 +727,13 @@ } .video-react .video-react-play-progress:before { position: absolute; - top: -0.3333333333em; + top: -4px; right: -0.5em; font-size: 0.9em; } .video-react .video-react-time-tooltip, -.video-react .video-react-mouse-display:after, -.video-react .video-react-play-progress:after { +.video-react .video-react-mouse-display:after { visibility: hidden; pointer-events: none; position: absolute; @@ -753,8 +751,7 @@ } .video-react .video-react-time-tooltip, -.video-react .video-react-play-progress:before, -.video-react .video-react-play-progress:after { +.video-react .video-react-play-progress:before { z-index: 1; } @@ -930,13 +927,13 @@ } .video-react .video-react-slider-vertical .video-react-volume-level:before { top: -0.5em; - left: -0.3em; + left: -4px; } .video-react .video-react-slider-horizontal .video-react-volume-level { height: 0.3em; } .video-react .video-react-slider-horizontal .video-react-volume-level:before { - top: -0.3em; + top: -4px; right: -0.5em; } .video-react .video-react-menu-button-popup.video-react-volume-menu-button .video-react-menu { @@ -1046,4 +1043,17 @@ .video-react video::-webkit-media-text-track-container { -webkit-transform: translateY(-30px); transform: translateY(-30px); +} + +.video-react .video-react-play-progress:after { + display: none; +} + +.video-react .video-react-current-time { + padding-left: 0px; + padding-right: 4px; +} +.video-react .video-react-duration { + padding-left: 4px; + padding-right: 10px; } \ No newline at end of file diff --git a/src/index.js b/src/index.js index 215706f..34031a7 100644 --- a/src/index.js +++ b/src/index.js @@ -118,6 +118,10 @@ GLOB.debugger = options.sysType === 'local' && GLOB.systemType !== 'production' + if (/#\/hs$/.test(window.location.href)) { // hs涓嬩笉鎵撳嵃鑴氭湰 + GLOB.debugger = false + } + if (options.sysType !== 'cloud') { if (config.appkey === options.cakey) { document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">涓嶅彲浣跨敤浜戠appkey锛岃鑱旂郴绠$悊鍛橈紒</div>' @@ -271,6 +275,7 @@ window.GLOB.CacheMap = new Map() // 缂撳瓨閰嶇疆淇℃伅 window.GLOB.UserCacheMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夎缃� + window.GLOB.CacheData = new Map() // 瀛樺偍閫変腑鏁版嵁 render(Route) }) diff --git a/src/menu/components/card/balcony/index.jsx b/src/menu/components/card/balcony/index.jsx index d5d1458..263b648 100644 --- a/src/menu/components/card/balcony/index.jsx +++ b/src/menu/components/card/balcony/index.jsx @@ -81,10 +81,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -96,7 +92,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -119,19 +114,19 @@ card.errors = [] if (card.wrap.datatype === 'static') { - let supModule = card.wrap.linkType === 'static' ? '' : 'has' + // let supModule = card.wrap.linkType === 'static' ? '' : 'has' card.elements.forEach(cell => { if (cell.eleType === 'button') { if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else if (!supModule) { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain') { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } - }) + // } else if (!supModule) { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain') { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } + // }) } } } else if (cell.datatype === 'dynamic' && cell.field) { @@ -139,10 +134,10 @@ } }) } else { - let supModule = card.wrap.linkType === 'static' ? '' : 'has' + // let supModule = card.wrap.linkType === 'static' ? '' : 'has' let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -159,14 +154,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && card.wrap.linkType !== 'sync' && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && card.wrap.linkType !== 'sync' && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { @@ -193,15 +188,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx index 2beceb4..aab6ad8 100644 --- a/src/menu/components/card/balcony/options.jsx +++ b/src/menu/components/card/balcony/options.jsx @@ -51,6 +51,9 @@ options: [ {value: 'dynamic', label: '鍔ㄦ��'}, {value: 'static', label: '闈欐��'}, + ], + controlFields: [ + {field: 'empty', values: ['dynamic']} ] }, { @@ -210,6 +213,19 @@ }, { type: 'radio', + field: 'empty', + label: '绌哄�奸殣钘�', + initval: wrap.empty || 'show', + tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', + required: false, + skip: true, + options: [ + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, + ], + }, + { + type: 'radio', field: 'permission', label: '鏉冮檺楠岃瘉', initval: wrap.permission || 'false', diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index bc181b0..b5f393b 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -135,7 +135,7 @@ } else if (card.eleType === 'splitline') { let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth return ( - <div style={{paddingTop: '1px'}}> + <div style={{paddingTop: _borderWidth ? '1px' : '10px'}}> <div className="ant-mk-splitline" style={{borderColor: card.color, borderWidth: _borderWidth}}></div> </div> ) @@ -203,7 +203,7 @@ <CopyOutlined className="copy" title="澶嶅埗" onClick={() => copyCard(id)} /> <CloseOutlined className="close" title="鍒犻櫎" onClick={() => delCard(id)} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => changeStyle(id)}/> - {['text', 'number', 'slider', 'sequence', 'formula'].includes(card.eleType) ? <MarkColumn columns={fields} type={card.eleType} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } + {['text', 'number', 'slider', 'sequence', 'formula'].includes(card.eleType) ? <MarkColumn field={card.field || ''} columns={fields} type={card.eleType} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } </div> } trigger="hover"> <div ref={node => drag(drop(node))} className={'ant-col card-cell ant-col-' + card.width}> diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx index bba223b..f6cdeac 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx @@ -48,8 +48,6 @@ let _val = fromJS(copycard).toJS() if (_val.control) { - _val.control = '' - delete _val.controlField delete _val.controlVal } diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 2e2b905..8964a75 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -16,7 +16,7 @@ const cardTypeOptions = { sequence: ['eleType', 'width'], text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable'], - number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'], + number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle'], picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'], video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'], icon: ['eleType', 'icon', 'datatype', 'width'], @@ -66,7 +66,7 @@ item.options = [] config.columns.forEach(col => { let label = col.label - if (label !== col.field) { + if (label.toLowerCase() !== col.field.toLowerCase()) { label = col.field + ' ' + col.label } if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) { @@ -112,7 +112,7 @@ if (datatype === 'dynamic') { _options.push('field') if (eleType === 'number') { - _options.push('decimal') + _options.push('decimal', 'format') } } else if (eleType === 'picture' || eleType === 'video') { _options.push('url') @@ -175,7 +175,7 @@ item.options = [] config.columns.forEach(col => { let label = col.label - if (label !== col.field) { + if (label.toLowerCase() !== col.field.toLowerCase()) { label = col.field + ' ' + col.label } @@ -229,8 +229,6 @@ }, () => { if (value === 'slider') { this.props.form.setFieldsValue({width: 24, color: '#1890ff'}) - } else if (value === 'splitline') { - this.props.form.setFieldsValue({width: 24, color: '#e8e8e8'}) } else if (value === 'qrcode') { this.props.form.setFieldsValue({color: '#000000'}) } else if (value === 'text' || value === 'number') { diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 2e65cfb..1529d90 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -90,7 +90,7 @@ min: 0, label: '鍐呭', initVal: card.value || '', - tooltip: '鏂囨湰绫诲瀷锛屼細鏇挎崲鍐呭涓殑@username@銆丂fullName@銆丂mk_city@銆丂appname@銆�', + tooltip: '鏂囨湰绫诲瀷锛屼細鏇挎崲鍐呭涓殑@username@銆丂fullName@銆丂mk_city@銆丂appname@銆丂bid@銆�', required: true }, { @@ -161,6 +161,16 @@ required: true }, { + type: 'number', + key: 'decimal', + min: 0, + max: 18, + decimal: 0, + label: '灏忔暟浣�', + initVal: card.decimal === undefined ? '' : card.decimal, + required: false + }, + { type: 'select', key: 'format', label: '鏍煎紡鍖�', @@ -172,6 +182,7 @@ { value: 'percent', text: '鐧惧垎鏁�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' }, { value: 'abs', text: '缁濆鍊�' }, + { value: 'encryption', text: '鍔犲瘑'}, { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }, { value: 'YYYY-MM-DD HH:mm', text: 'YYYY-MM-DD HH:mm' }, { value: 'YYYY-MM-DD HH:mm:ss', text: 'YYYY-MM-DD HH:mm:ss' }, @@ -197,16 +208,6 @@ { value: 'YYYY-MM-DD HH:mm', text: 'YYYY-MM-DD HH:mm' }, { value: 'YYYY-MM-DD HH:mm:ss', text: 'YYYY-MM-DD HH:mm:ss' }, ] - }, - { - type: 'number', - key: 'decimal', - min: 0, - max: 18, - decimal: 0, - label: '灏忔暟浣�', - initVal: card.decimal === undefined ? '' : card.decimal, - required: false }, { type: 'text', @@ -346,7 +347,7 @@ max: 10, label: '楂樺害(琛�)', initVal: card.height !== undefined ? card.height : 1, - tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲锛屾敞锛氳嚜閫傚簲楂樺害浠呭湪璁剧疆鍗$墖楂樺害鍚庢湁鏁堛��', + tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲銆�', required: false }, { @@ -413,7 +414,8 @@ min: 0, max: 50, label: '绾垮', - initVal: card.borderWidth || 1, + initVal: card.borderWidth === undefined ? 1 : card.borderWidth, + tooltip: '绾垮涓�0鏃讹紝涓烘柟渚垮湪寮�鍙戞椂閫変腑榛樿楂樺害涓�10px锛岃娉ㄦ剰璋冩暣鍐呭杈硅窛銆�', required: true }, { diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index cd73458..146bf94 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -66,7 +66,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitModal', this.handleSave) MKEmitter.addListener('cardAddElement', this.cardAddElement) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) @@ -95,7 +94,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitModal', this.handleSave) MKEmitter.removeListener('cardAddElement', this.cardAddElement) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) @@ -141,8 +139,6 @@ } handleStyle = (element) => { - const { cards, cardCell } = this.props - let _style = element.style ? fromJS(element.style).toJS() : {} let options = ['font', 'border', 'padding', 'margin', 'background'] @@ -169,14 +165,11 @@ card: element }) - MKEmitter.emit('changeStyle', [cards.uuid, cardCell.uuid, element.uuid], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } - getStyle = (comIds, style) => { - const { cards, cardCell } = this.props + getStyle = (style) => { const { card, elements } = this.state - - if (comIds.length !== 3 || comIds[0] !== cards.uuid || comIds[1] !== cardCell.uuid || !card) return // if (card.eleType === 'button') { // if ((style.paddingLeft || style.paddingRight) && !style.width) { @@ -430,6 +423,7 @@ res.eleType = cell.eleType || null res.style = cell.style || null res.modal = cell.modal || null + res.wrapStyle = cell.wrapStyle || null // res = {...cell, ...res} // if (!res.control) { diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 5554b8f..624eb32 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -47,10 +47,6 @@ }) } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { const { cards } = this.props @@ -64,14 +60,10 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } - getStyle = (comIds, style) => { - const { cards } = this.props + getStyle = (style) => { const { card, side } = this.state - - if (comIds.length !== 2 || comIds[0] !== cards.uuid || comIds[1] !== card.uuid) return let _card = fromJS(card).toJS() if (side === 'back') { @@ -155,7 +147,6 @@ } changeStyle = () => { - const { cards } = this.props const { card, side } = this.state let _style = null @@ -167,7 +158,7 @@ options = ['background', 'padding'] } - MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } getSettingForms = () => { diff --git a/src/menu/components/card/cardsimplecomponent/index.jsx b/src/menu/components/card/cardsimplecomponent/index.jsx index eea36ff..54f44b0 100644 --- a/src/menu/components/card/cardsimplecomponent/index.jsx +++ b/src/menu/components/card/cardsimplecomponent/index.jsx @@ -43,10 +43,6 @@ }) } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props.cards), fromJS(nextProps.cards)) || !is(fromJS(this.state), fromJS(nextState)) } @@ -58,14 +54,10 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } - getStyle = (comIds, style) => { - const { cards } = this.props + getStyle = (style) => { const { card } = this.state - - if (comIds.length !== 2 || comIds[0] !== cards.uuid || comIds[1] !== card.uuid) return let _card = fromJS(card).toJS() _card.style = style @@ -134,7 +126,7 @@ options = ['background', 'border', 'padding', 'margin', 'shadow'] } - MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } getSettingForms = () => { diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index bcdde15..c3dfe4e 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Popover, Modal, Pagination } from 'antd' -import { PlusOutlined, PlusCircleOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' +import { PlusOutlined, PlusCircleOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, DownOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -145,7 +145,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitModal', this.handleSave) // MKEmitter.addListener('logButton', this.logButton) } @@ -161,7 +160,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitModal', this.handleSave) // MKEmitter.removeListener('logButton', this.logButton) } @@ -198,7 +196,7 @@ card.errors = [] let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -212,30 +210,30 @@ card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) } - let supModule = '' - if (card.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢 - if (card.supNodes && card.supNodes[0]) { - supModule = card.supNodes[0].componentId - } - } else if (card.setting.supModule) { - supModule = card.setting.supModule[card.setting.supModule.length - 1] || '' - if (supModule === 'empty') { - supModule = '' - } - } + // let supModule = '' + // if (card.wrap.supType === 'multi') { // 鏁版嵁鍗″涓婄骇缁勪欢 + // if (card.supNodes && card.supNodes[0]) { + // supModule = card.supNodes[0].componentId + // } + // } else if (card.setting.supModule) { + // supModule = card.setting.supModule[card.setting.supModule.length - 1] || '' + // if (supModule === 'empty') { + // supModule = '' + // } + // } card.action.forEach(cell => { if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } // $check@鏈夋晥鎬ф娴� @@ -257,14 +255,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -281,14 +279,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -375,15 +373,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'height', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'height', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } @@ -799,6 +793,7 @@ <div style={{clear: 'both'}}></div> {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType !== 'mob' ? <Pagination total={85} size="small" showTotal={total => `鍏� ${total} 鏉} pageSize={20} defaultCurrent={1}/> : null} {card.wrap.pagestyle === 'page' && card.setting.laypage === 'true' && appType === 'mob' ? <MobPagination /> : null} + {card.wrap.pagestyle === 'more' && card.setting.laypage === 'true' ? <div className="mk-more">鏌ョ湅鏇村<DownOutlined/></div> : null} <div className="component-name"> <div className="center"> <div className="title">{card.name}</div> diff --git a/src/menu/components/card/data-card/index.scss b/src/menu/components/card/data-card/index.scss index ed54cb3..baf9613 100644 --- a/src/menu/components/card/data-card/index.scss +++ b/src/menu/components/card/data-card/index.scss @@ -118,6 +118,13 @@ border-bottom: 2px solid transparent!important; } } + .mk-more { + text-align: center; + line-height: 40px; + .anticon-down { + margin-left: 2px; + } + } } .menu-data-card-edit-box::-webkit-scrollbar { diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index ba3b1f6..7db4e04 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -114,18 +114,19 @@ field: 'pagestyle', label: '鍒嗛〉椋庢牸', initval: wrap.pagestyle || 'page', - tooltip: '鏁版嵁婧愰�夋嫨鍒嗛〉鏃舵湁鏁堛�傛敞锛氭粦鍔ㄥ姞杞藉彧鏈夌涓�涓湁鏁�', + tooltip: '鏁版嵁婧愰�夋嫨鍒嗛〉鏃舵湁鏁堛�傛敞锛氬脊鎬у竷灞�鏃跺浐瀹氫负椤电爜銆�', required: false, disabled: !laypage, options: [ {value: 'page', label: '椤电爜'}, - {value: 'switch', label: '宸﹀彸鍒囨崲', forbid: appType === 'mob'}, + {value: 'switch', label: '宸﹀彸鍒囨崲', forbid: appType === 'mob' || subtype === 'tablecard'}, {value: 'slide', label: '婊戝姩鍔犺浇', forbid: appType !== 'mob'}, + {value: 'more', label: '鏌ョ湅鏇村'}, ], controlFields: [ {field: 'slidetip', values: ['slide']}, ], - forbid: !(subtype === 'datacard' || (subtype === 'tablecard' && appType === 'mob')) + forbid: subtype === 'propcard' }, { type: 'radio', diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index 3dc9f8d..daf0cb9 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -109,7 +109,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) // MKEmitter.addListener('logButton', this.logButton) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -125,7 +124,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) // MKEmitter.removeListener('logButton', this.logButton) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -185,7 +183,7 @@ } if (card.wrap.datatype === 'static') { - let supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : '' + // let supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : '' card.subcards.forEach((item, i) => { let linkbtn = item.setting.linkbtn || '' @@ -194,12 +192,12 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else if (!supModule) { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain') { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } - }) + // } else if (!supModule) { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain') { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -216,12 +214,12 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else if (!supModule) { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain') { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } - }) + // } else if (!supModule) { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain') { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -238,12 +236,12 @@ } }) } else { - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -264,14 +262,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -288,14 +286,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -379,15 +377,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 919af41..1c498ad 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Popover, Modal, Pagination } from 'antd' -import { PlusOutlined, PlusCircleOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' +import { PlusOutlined, PlusCircleOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined, DownOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' import asyncIconComponent from '@/utils/asyncIconComponent' @@ -136,11 +136,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - // MKEmitter.addListener('logButton', this.logButton) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -152,8 +147,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) - // MKEmitter.removeListener('logButton', this.logButton) } // logButton = (id, item) => { @@ -186,12 +179,12 @@ card.errors = [] - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.subcards.length === 0) { card.errors.push({ level: 0, detail: '鍗$墖涓嶅彲涓虹┖锛�'}) @@ -216,14 +209,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (linkbtn && linkbtn === cell.uuid) { @@ -300,15 +293,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } @@ -611,8 +600,9 @@ <div style={{minHeight: 'calc(100% - 90px)'}}> {card.subcards.map(subcard => (<CardSimpleComponent key={subcard.uuid} cards={card} card={subcard} updateElement={this.updateCard} move={this.move} deleteElement={this.deleteCard}/>))} </div> - {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' && appType !== 'mob' ? <Pagination size="small" total={50} /> : null} - {card.setting.laypage === 'true' && card.wrap.pagestyle !== 'slide' && appType === 'mob' ? <MobPagination /> : null} + {card.setting.laypage === 'true' && card.wrap.pagestyle === 'page' && appType !== 'mob' ? <Pagination size="small" total={50} /> : null} + {card.setting.laypage === 'true' && card.wrap.pagestyle === 'page' && appType === 'mob' ? <MobPagination /> : null} + {card.setting.laypage === 'true' && card.wrap.pagestyle === 'more' ? <div className="mk-more">鏌ョ湅鏇村<DownOutlined/></div> : null} <div className="component-name"> <div className="center"> <div className="title">{card.name}</div> diff --git a/src/menu/components/card/table-card/index.scss b/src/menu/components/card/table-card/index.scss index 03e950e..c03d640 100644 --- a/src/menu/components/card/table-card/index.scss +++ b/src/menu/components/card/table-card/index.scss @@ -84,6 +84,13 @@ .ant-pagination { text-align: right; } + .mk-more { + text-align: center; + line-height: 40px; + .anticon-down { + margin-left: 2px; + } + } } .menu-table-card-edit-box::after { display: block; diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx index 50d3068..4440080 100644 --- a/src/menu/components/carousel/data-card/index.jsx +++ b/src/menu/components/carousel/data-card/index.jsx @@ -95,11 +95,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - // MKEmitter.addListener('logButton', this.logButton) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -111,8 +106,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) - // MKEmitter.removeListener('logButton', this.logButton) } // logButton = (id, item) => { @@ -145,13 +138,13 @@ card.errors = [] - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -171,14 +164,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { @@ -248,15 +241,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx index fa64530..641330c 100644 --- a/src/menu/components/carousel/prop-card/index.jsx +++ b/src/menu/components/carousel/prop-card/index.jsx @@ -95,7 +95,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) // MKEmitter.addListener('logButton', this.logButton) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -111,7 +110,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) // MKEmitter.removeListener('logButton', this.logButton) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -174,12 +172,12 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain') { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain') { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } + // }) } } } else if (cell.datatype === 'dynamic' && cell.field) { @@ -188,12 +186,12 @@ }) }) } else { - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -213,14 +211,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { @@ -291,15 +289,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index c7f587b..90c340e 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -124,7 +124,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('plusSearch', this.plusSearch) MKEmitter.addListener('tabsChange', this.handleTabsChange) setTimeout(() => { @@ -143,7 +142,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('plusSearch', this.plusSearch) MKEmitter.removeListener('tabsChange', this.handleTabsChange) } @@ -1338,15 +1336,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx index a950a8f..6434bd4 100644 --- a/src/menu/components/chart/antv-dashboard/index.jsx +++ b/src/menu/components/chart/antv-dashboard/index.jsx @@ -158,7 +158,6 @@ componentDidMount () { MKEmitter.addListener('tabsChange', this.handleTabsChange) - MKEmitter.addListener('submitStyle', this.getStyle) setTimeout(() => { this.viewrender() @@ -177,7 +176,6 @@ return } MKEmitter.removeListener('tabsChange', this.handleTabsChange) - MKEmitter.removeListener('submitStyle', this.getStyle) } handleTabsChange = (parentId) => { @@ -512,15 +510,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 793dfd6..1fdd69b 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -116,7 +116,6 @@ componentDidMount () { MKEmitter.addListener('tabsChange', this.handleTabsChange) - MKEmitter.addListener('submitStyle', this.getStyle) setTimeout(() => { this.viewrender() @@ -135,7 +134,6 @@ return } MKEmitter.removeListener('tabsChange', this.handleTabsChange) - MKEmitter.removeListener('submitStyle', this.getStyle) } handleTabsChange = (parentId) => { @@ -670,15 +668,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx index 334f7ca..5b5d93a 100644 --- a/src/menu/components/chart/antv-scatter/index.jsx +++ b/src/menu/components/chart/antv-scatter/index.jsx @@ -112,7 +112,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('plusSearch', this.plusSearch) MKEmitter.addListener('tabsChange', this.handleTabsChange) setTimeout(() => { @@ -131,7 +130,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('plusSearch', this.plusSearch) MKEmitter.removeListener('tabsChange', this.handleTabsChange) } @@ -356,15 +354,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/chart/chart-custom/index.jsx b/src/menu/components/chart/chart-custom/index.jsx index d82d9bf..8de9dd0 100644 --- a/src/menu/components/chart/chart-custom/index.jsx +++ b/src/menu/components/chart/chart-custom/index.jsx @@ -100,7 +100,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('tabsChange', this.handleTabsChange) setTimeout(() => { this.viewrender() @@ -118,7 +117,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('tabsChange', this.handleTabsChange) } @@ -236,15 +234,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length > 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/code/sandbox/index.jsx b/src/menu/components/code/sandbox/index.jsx index 3c13f57..4e713af 100644 --- a/src/menu/components/code/sandbox/index.jsx +++ b/src/menu/components/code/sandbox/index.jsx @@ -83,10 +83,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -98,7 +94,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -136,15 +131,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length !== 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx index 479ad2a..6d7e1d7 100644 --- a/src/menu/components/editor/braft-editor/index.jsx +++ b/src/menu/components/editor/braft-editor/index.jsx @@ -78,10 +78,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -93,7 +89,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -131,20 +126,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid) return - - let _card = {} - if (comIds.length === 1) { - _card = {...card, style} - } else { - return - } + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/form/dragtitle/index.scss b/src/menu/components/form/dragtitle/index.scss index f4413f1..9921c52 100644 --- a/src/menu/components/form/dragtitle/index.scss +++ b/src/menu/components/form/dragtitle/index.scss @@ -6,6 +6,7 @@ position: relative; flex: 1; text-align: center; + background: transparent; cursor: move; .form-sort { background: #d8d8d8; diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index 7f54c4d..73b27d1 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -101,7 +101,7 @@ type: 'radio', key: 'sqlType', label: Formdict['header.form.action.type'], - initVal: card.sqlType || 'update', + initVal: card.sqlType || '', required: true, options: [{ value: 'insert', @@ -317,7 +317,7 @@ key: 'syncComponent', label: '鍚屾鍒锋柊', initVal: card.syncComponent, - tooltip: '鎵ц鎴愬姛鍚庨渶瑕佸埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堛��', + tooltip: '鎵ц鎴愬姛鍚庨渶瑕佸埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��', required: false, options: modules }, diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx index 2227f2a..10b6797 100644 --- a/src/menu/components/form/formaction/index.jsx +++ b/src/menu/components/form/formaction/index.jsx @@ -32,10 +32,6 @@ profVisible: false, // 楠岃瘉淇℃伅缂栬緫 } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props.group), fromJS(nextProps.group)) || !is(fromJS(this.state), fromJS(nextState)) } @@ -47,12 +43,9 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } handleStyle = (element) => { - const { group } = this.props - let _style = element.style ? fromJS(element.style).toJS() : {} let options = ['font', 'border', 'padding', 'margin', 'backgroundColor', 'width'] @@ -60,19 +53,18 @@ card: element }) - MKEmitter.emit('changeStyle', [group.uuid, element.type], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } - getStyle = (comIds, style) => { + getStyle = (style) => { + const { card } = this.state let group = fromJS(this.props.group).toJS() - if (comIds.length !== 2 || comIds[0] !== group.uuid) return - - if (comIds[1] === 'prev') { + if (card.type === 'prev') { group.prevButton.style = style - } else if (comIds[1] === 'submit') { + } else if (card.type === 'submit') { group.subButton.style = style - } else if (comIds[1] === 'next') { + } else if (card.type === 'next') { group.nextButton.style = style } diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index 00d14c6..7aa4c24 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -112,7 +112,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -127,7 +126,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -162,7 +160,7 @@ supModule = '' } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -180,8 +178,8 @@ item.fields.forEach(m => { if (m.type === 'linkMain' && !supModule) { card.errors.push({ level: 1, detail: `鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) } }) }) @@ -221,29 +219,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] === 'form') { - let Index = card.subcards[0].fields.findIndex(n => n.uuid === comIds[1]) - - if (Index === -1) return - - let _card = fromJS(card).toJS() - - _card.subcards[0].fields[Index].style = style - - this.updateComponent(_card) - - return - } - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } @@ -534,7 +514,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index fb8ea12..4ccf43c 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -119,7 +119,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -134,7 +133,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -169,7 +167,7 @@ supModule = '' } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -187,8 +185,8 @@ item.fields.forEach(m => { if (m.type === 'linkMain' && !supModule) { card.errors.push({ level: 1, detail: `鍒嗙粍鈥�${item.setting.title}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鍒嗙粍鈥�${item.setting.title}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鍒嗙粍鈥�${item.setting.title}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) } }) }) @@ -228,29 +226,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card, group } = this.state - - if (comIds[0] === 'form') { - let Index = group.fields.findIndex(n => n.uuid === comIds[1]) - - if (Index === -1) return - - let _group = fromJS(group).toJS() - - _group.fields[Index].style = style - - this.updateGroup(_group) - - return - } - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } @@ -635,7 +615,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index 2d8f7c6..711552c 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -131,7 +131,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -146,7 +145,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -181,7 +179,7 @@ supModule = '' } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -199,8 +197,8 @@ item.fields.forEach(m => { if (m.type === 'linkMain' && !supModule) { card.errors.push({ level: 1, detail: `鍒嗙粍鈥�${item.setting.title}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鍒嗙粍鈥�${item.setting.title}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鍒嗙粍鈥�${item.setting.title}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) } }) }) @@ -240,29 +238,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card, group } = this.state - - if (comIds[0] === 'form') { - let Index = group.fields.findIndex(n => n.uuid === comIds[1]) - - if (Index === -1) return - - let _group = fromJS(group).toJS() - - _group.fields[Index].style = style - - this.updateGroup(_group) - - return - } - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } @@ -641,7 +621,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx index 509829e..08229ed 100644 --- a/src/menu/components/group/normal-group/index.jsx +++ b/src/menu/components/group/normal-group/index.jsx @@ -60,7 +60,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('tabsChange', this.handleTabsChange) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -72,7 +71,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('tabsChange', this.handleTabsChange) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -99,15 +97,11 @@ changeStyle = () => { const { group } = this.state - MKEmitter.emit('changeStyle', [group.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], group.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], group.style, this.getStyle) } - getStyle = (comIds, style) => { - const { group } = this.state - - if (comIds.length !== 1 || comIds[0] !== group.uuid) return - - let _card = {...group, style} + getStyle = (style) => { + let _card = {...this.state.group, style} this.setState({ group: _card diff --git a/src/menu/components/module/voucher/index.jsx b/src/menu/components/module/voucher/index.jsx index 30d250f..ccc29e7 100644 --- a/src/menu/components/module/voucher/index.jsx +++ b/src/menu/components/module/voucher/index.jsx @@ -42,7 +42,7 @@ width: card.width || 12, name: '鍑瘉', subtype: card.subtype, - // setting: { interType: 'system' }, + setting: { interType: 'system' }, wrap: { name: '鍑瘉', title: '', width: card.width || 12, type: 'edit' }, style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, headerStyle: {}, @@ -58,10 +58,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -73,7 +69,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -93,15 +88,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length !== 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/search/main-search/dategroup/index.scss b/src/menu/components/search/main-search/dategroup/index.scss index 3e0369e..57adcd0 100644 --- a/src/menu/components/search/main-search/dategroup/index.scss +++ b/src/menu/components/search/main-search/dategroup/index.scss @@ -13,6 +13,7 @@ } .ant-tag-checkable-checked { border-color: #1890ff; + background: #1890ff; } } diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 0010681..379f56b 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -76,7 +76,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('plusSearch', this.plusSearch) } @@ -87,7 +86,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('plusSearch', this.plusSearch) } @@ -95,12 +93,8 @@ return !is(fromJS(this.state), fromJS(nextState)) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.setState({ card: _card @@ -112,7 +106,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } /** @@ -292,7 +286,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ card: card, diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index a92b985..a6125a5 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -178,7 +178,7 @@ reReadonly.interface = false reRequired.interface = true } else if (intertype === 'outer') { - shows.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType', 'output') + shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType', 'output') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { @@ -194,6 +194,8 @@ if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -241,7 +243,7 @@ reOptions.intertype = this.state.interTypeOptions.filter(item => item.value !== 'custom') if (intertype === 'outer') { - shows.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType') + shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { @@ -257,6 +259,8 @@ if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -288,13 +292,15 @@ reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -310,12 +316,14 @@ reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') reRequired.innerFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -370,13 +378,15 @@ if (_funcType === 'print') { shows.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -419,6 +429,9 @@ } else if (_funcType === 'pay') { shows.push('payType', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) + } else if (_funcType === 'refund') { + shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') + reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) } } diff --git a/src/menu/components/share/actioncomponent/dragaction/index.jsx b/src/menu/components/share/actioncomponent/dragaction/index.jsx index 13bbd48..77e72fe 100644 --- a/src/menu/components/share/actioncomponent/dragaction/index.jsx +++ b/src/menu/components/share/actioncomponent/dragaction/index.jsx @@ -64,8 +64,6 @@ let _val = fromJS(copycard).toJS() if (_val.control) { - _val.control = '' - delete _val.controlField delete _val.controlVal } diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 25baad2..789803c 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -91,15 +91,16 @@ let pageTemps = [ { value: 'billprint', text: '鍗曟嵁鎵撳嵃' }, - { value: 'pay', text: Formdict['model.pay'] }, - { value: 'custom', text: Formdict['header.form.custom'] } + { value: 'pay', text: '鏀粯' }, + { value: 'custom', text: '鑷畾涔�' } ] const isApp = ['pc', 'mob'].includes(appType) let funTypes = [ - { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, { value: 'print', text: '鏍囩鎵撳嵃' }, + { value: 'refund', text: '閫�娆�' }, { value: 'closetab', text: '鏍囩鍏抽棴' }, + { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, { value: 'megvii', text: '鏃疯闈㈡澘鏈�' }, { value: 'filezip', text: '鏂囦欢鍘嬬缉鍖�' }, ] @@ -121,6 +122,7 @@ funTypes = [ { value: 'scan', text: '鎵爜' }, { value: 'pay', text: '鏀粯' }, + { value: 'refund', text: '閫�娆�' }, { value: 'resetPwd', text: '淇敼瀵嗙爜'}, { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' }, { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' }, @@ -137,6 +139,7 @@ } else if (appType === 'pc') { opentypes = opentypes.filter(item => item.value !== 'tab') funTypes = [ + { value: 'refund', text: '閫�娆�' }, { value: 'changeuser', text: '鍒囨崲鐢ㄦ埛' }, ] pageTemps = [ @@ -282,7 +285,7 @@ type: 'radio', key: 'procMode', label: '鍙傛暟澶勭悊', - initVal: card.procMode || 'system', + initVal: card.procMode || (card.innerFunc ? 'inner' : 'system'), required: true, options: [{ value: 'system', @@ -430,7 +433,7 @@ type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', - initVal: card.callbackType || 'script', + initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��', required: true, options: [{ @@ -690,7 +693,7 @@ key: 'syncComponent', label: '鍒锋柊缁勪欢', initVal: card.syncComponent || [], - tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堛��', + tooltip: '鎵ц鎴愬姛鍚庯紙鎴栧脊绐楁爣绛惧叧闂椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑缁勪欢銆傛敞锛氶�夋嫨褰撳墠缁勪欢鐨勪笂绾х粍浠舵棤鏁堬紝鍒锋柊涓婄骇缁勪欢璇烽�夋嫨鎴愬姛鍚庘�滃埛鏂颁笂绾х粍浠� - 琛屸�濄��', required: false, options: modules }, diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index f7e1175..f64746e 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -65,7 +65,6 @@ componentDidMount () { MKEmitter.addListener('addButton', this.addButton) - MKEmitter.addListener('submitStyle', this.getStyle) } /** @@ -90,14 +89,11 @@ return } MKEmitter.removeListener('addButton', this.addButton) - MKEmitter.removeListener('submitStyle', this.getStyle) } - getStyle = (comIds, style) => { + getStyle = (style) => { const { config } = this.props const { card, actionlist } = this.state - - if (comIds[0] !== config.uuid || comIds[1] !== 'actionlist') return let _card = fromJS(card).toJS() _card.style = style @@ -115,8 +111,6 @@ } changeBtnStyle = (element) => { - const { config } = this.props - let _style = element.style ? fromJS(element.style).toJS() : {} let options = ['font', 'border', 'background', 'margin', 'padding'] @@ -124,7 +118,7 @@ card: element }) - MKEmitter.emit('changeStyle', [config.uuid, 'actionlist', element.uuid], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } addButton = (cardId, element) => { @@ -517,7 +511,7 @@ const { actionlist, visible, appType, card, dict, profVisible, record } = this.state return ( - <div className={'model-menu-action-list'}> + <div className={'model-menu-action-list length' + actionlist.length}> <DragElement list={actionlist} type={appType === 'mob' ? (type || '') : ''} diff --git a/src/menu/components/share/clockcomponent/settingform/index.jsx b/src/menu/components/share/clockcomponent/settingform/index.jsx index 3e60007..67b168c 100644 --- a/src/menu/components/share/clockcomponent/settingform/index.jsx +++ b/src/menu/components/share/clockcomponent/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Tooltip, Input, InputNumber } from 'antd' +import { Form, Row, Col, Select, Tooltip, Input, InputNumber, notification } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import './index.scss' @@ -21,6 +21,15 @@ return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + if (values.timer === '2s') { + if (!values.timerRepeats) { + notification.warning({ top: 92, message: '璇疯缃�2s瀹氭椂鍣ㄦ墽琛屾鏁般��', duration: 3 }) + return + } else if (values.timerRepeats > 3) { + notification.warning({ top: 92, message: '2s瀹氭椂鍣ㄦ墽琛屾鏁颁笉鍙秴杩�3娆°��', duration: 3 }) + return + } + } resolve(values) } else { reject(err) @@ -50,12 +59,22 @@ <Form {...formItemLayout}> <Row gutter={24}> <Col span={22}> - <Form.Item label="瀹氭椂鍣�"> + <Form.Item label={ + <Tooltip placement="topLeft" title="2s瀹氭椂鍣ㄦ渶澶氬彧鑳芥墽琛屼笁娆★紝瀹氭椂鍣ㄦ墽琛�3娆′互涓婇渶瑕佸湪鍗曠偣绯荤粺璁剧疆鏉冮檺銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 瀹氭椂鍣� + </Tooltip> + }> {getFieldDecorator('timer', { initialValue: config.timer || '' })( - <Select onChange={(val) => this.setState({timer: val})}> + <Select onChange={(val) => this.setState({timer: val}, () => { + if (val === '2s') { + this.props.form.setFieldsValue({timerRepeats: 1}) + } + })}> <Select.Option value=""> 鏃� </Select.Option> + <Select.Option value="2s"> 2绉� </Select.Option> <Select.Option value="5s"> 5绉� </Select.Option> <Select.Option value="15s"> 15绉� </Select.Option> <Select.Option value="30s"> 30绉� </Select.Option> @@ -81,7 +100,7 @@ })(<InputNumber min={0} max={500} precision={0} />)} </Form.Item> </Col> : null} - {(config.subtype === 'balcony' || config.subtype === 'propcard') && timer ? <Col span={22}> + {(config.subtype === 'balcony' || config.subtype === 'propcard') && timer && timer !== '2s' ? <Col span={22}> <Form.Item label={ <Tooltip placement="topLeft" title="鍙互鎸囧畾瀛楁鐢ㄤ簬鎺у埗瀹氭椂鍣ㄧ殑鍏抽棴銆�"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -97,7 +116,7 @@ )} </Form.Item> </Col> : null} - {(config.subtype === 'balcony' || config.subtype === 'propcard') && clearField && timer ? <Col span={22}> + {(config.subtype === 'balcony' || config.subtype === 'propcard') && clearField && timer && timer !== '2s' ? <Col span={22}> <Form.Item label={ <Tooltip placement="topLeft" title="褰撳瓧娈靛�间笌鍏抽棴鍊肩浉绛夋椂锛屽叧闂畾鏃跺櫒锛屽涓�煎彲鐢ㄩ�楀彿鍒嗛殧銆�"> <QuestionCircleOutlined className="mk-form-tip" /> diff --git a/src/menu/components/share/markcomponent/index.jsx b/src/menu/components/share/markcomponent/index.jsx index 1da2ecd..7945663 100644 --- a/src/menu/components/share/markcomponent/index.jsx +++ b/src/menu/components/share/markcomponent/index.jsx @@ -19,6 +19,7 @@ class MarkColumn extends Component { static propTpyes = { + field: PropTypes.any, columns: PropTypes.array, // 鏄剧ず鍒� marks: PropTypes.object, onSubmit: PropTypes.func @@ -341,7 +342,7 @@ onCancel={() => { this.setState({ visible: false }) }} destroyOnClose > - <MarkForm dict={dict} signs={signs} columns={options} markChange={this.markChange}/> + <MarkForm field={this.props.field} dict={dict} signs={signs} columns={options} markChange={this.markChange}/> <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細浠庝笂鍒颁笅锛屽尮閰嶇涓�涓鍚堟潯浠剁殑鏍囪銆�</Col> <EditTable actions={['edit', 'move', 'del']} data={marks} columns={markColumns} onChange={(marks) => this.setState({marks})}/> </Modal> diff --git a/src/menu/components/share/markcomponent/markform/index.jsx b/src/menu/components/share/markcomponent/markform/index.jsx index 560f22d..2809114 100644 --- a/src/menu/components/share/markcomponent/markform/index.jsx +++ b/src/menu/components/share/markcomponent/markform/index.jsx @@ -9,6 +9,7 @@ class UniqueForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� + field: PropTypes.any, columns: PropTypes.array, // 鍒楀悕闆嗗悎 signs: PropTypes.array, // 鏍囪绫诲瀷 markChange: PropTypes.func // 淇敼鍑芥暟 @@ -24,7 +25,7 @@ } render() { - const { columns, signs } = this.props + const { columns, signs, field } = this.props const { getFieldDecorator } = this.props.form const formItemLayout = { labelCol: { @@ -37,13 +38,18 @@ } } + let initVal = [] + if (field) { + initVal = [field, 'static'] + } + return ( <Form {...formItemLayout} className="normal-table-mark-form"> <Row gutter={24}> <Col span={6}> <Form.Item label={'瀵规瘮瀛楁'}> {getFieldDecorator('field', { - initialValue: [], + initialValue: initVal, rules: [ { required: true, diff --git a/src/menu/components/share/normalheader/index.jsx b/src/menu/components/share/normalheader/index.jsx index e5345f5..2f552fd 100644 --- a/src/menu/components/share/normalheader/index.jsx +++ b/src/menu/components/share/normalheader/index.jsx @@ -22,10 +22,6 @@ appType: sessionStorage.getItem('appType') } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props.config), fromJS(nextProps.config)) } @@ -37,15 +33,14 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } - getStyle = (comIds, style) => { - const { config } = this.props + getStyle = (style) => { + if (!style.borderBottomWidth) { + style.borderBottomWidth = '0px' + } - if (comIds[0] !== config.uuid || comIds[1] !== 'header') return - - let _config = {...config, headerStyle: style} + let _config = {...this.props.config, headerStyle: style} this.props.updateComponent(_config) } @@ -58,7 +53,7 @@ options.push('padding') } - MKEmitter.emit('changeStyle', [config.uuid, 'header'], options, config.headerStyle) + MKEmitter.emit('changeStyle', options, config.headerStyle, this.getStyle) } render() { diff --git a/src/menu/components/share/searchcomponent/index.jsx b/src/menu/components/share/searchcomponent/index.jsx index dc49dc5..e03d2e9 100644 --- a/src/menu/components/share/searchcomponent/index.jsx +++ b/src/menu/components/share/searchcomponent/index.jsx @@ -233,7 +233,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx new file mode 100644 index 0000000..547c1c6 --- /dev/null +++ b/src/menu/components/table/base-table/columns/editColumn/formconfig.jsx @@ -0,0 +1,414 @@ +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' + +const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS + +/** + * @description 鑾峰彇鏄剧ず鍒楄〃鍗曢厤缃俊鎭� + * @param {object} card // 鎼滅储鏉′欢瀵硅薄 + */ +export function getColumnForm (card, fields = []) { + let appType = sessionStorage.getItem('appType') + let roleList = sessionStorage.getItem('sysRoles') + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch (e) { + roleList = [] + } + } else { + roleList = [] + } + + let menulist = [] + + if (appType === 'pc') { + menulist = sessionStorage.getItem('appMenus') + } else if (!appType) { + menulist = sessionStorage.getItem('fstMenuList') + } + + if (menulist) { + try { + menulist = JSON.parse(menulist) + } catch (e) { + menulist = [] + } + } else { + menulist = [] + } + + let options = [{ + value: 'text', + text: Formdict['model.form.text'] + }, { + value: 'number', + text: Formdict['model.form.number'] + }, { + value: 'picture', + text: Formdict['model.form.picture'] + }, { + value: 'link', + text: Formdict['model.form.href'] + }, { + value: 'textarea', + text: Formdict['model.form.textarea'] + }, { + value: 'custom', + text: '鑷畾涔夊垪' + }, { + value: 'colspan', + text: '鍚堝苟鍒�' + }, { + value: 'formula', + text: '鍏紡' + }, { + value: 'index', + text: '搴忓彿' + }] + + if (!card.isSub) { + options.push({ + value: 'action', + text: '鎿嶄綔' + }) + } + + if (!card.linkurl && (!card.linkmenu || card.linkmenu.length === 0)) { + card.perspective = '' + } + + return [ + { + type: 'text', + key: 'label', + label: '鍒楀ご鏂囧瓧', + initVal: card.label, + required: true + }, + { + type: 'select', + key: 'type', + label: Formdict['model.form.type'], + initVal: card.type, + required: true, + options: options + }, + { + type: 'select', + key: 'field', + label: Formdict['model.form.field'], + initVal: card.field, + required: true, + options: fields + }, + { + type: 'select', + key: 'nameField', + label: Formdict['model.name'] + Formdict['model.form.field'], + initVal: card.nameField || '', + required: false, + options: [{uuid: 'empty', field: '', label: '绌�'}, ...fields] + }, + { + type: 'number', + key: 'Width', + min: 20, + max: 1000, + decimal: 0, + label: Formdict['model.form.columnWidth'], + initVal: card.Width || 120, + required: true + }, + { + type: 'radio', + key: 'joint', + label: Formdict['model.form.paramJoint'], + initVal: card.joint || 'true', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Hide', + label: Formdict['model.hidden'], + initVal: card.Hide || 'false', + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'IsSort', + label: Formdict['model.sort'], + initVal: card.IsSort || (card.isSub ? 'false' : 'true'), + required: true, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'Align', + label: Formdict['model.form.align'], + initVal: card.Align || 'left', + required: true, + options: [{ + value: 'left', + text: Formdict['model.form.alignLeft'] + }, { + value: 'center', + text: Formdict['model.form.alignCenter'] + }, { + value: 'right', + text: Formdict['model.form.alignRight'] + }] + }, + { + type: 'radio', + key: 'rowspan', + label: '琛屽悎骞�', + initVal: card.rowspan || 'false', + tooltip: '鐩搁偦琛屼俊鎭浉鍚屾椂锛屽崟鍏冩牸鍚堝苟銆�', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'sum', + label: '鏄剧ず鍚堣', + initVal: card.sum || 'false', + tooltip: '鍚堣淇℃伅鍙湪浣跨敤绯荤粺鏁版嵁婧愭椂鏈夋晥銆�', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'number', + key: 'decimal', + min: 0, + max: 18, + decimal: 0, + label: Formdict['header.form.decimal'], + initVal: card.decimal || 0, + required: true + }, + { + type: 'select', + key: 'format', + label: Formdict['header.form.format'], + initVal: card.format || 'none', + options: [{ + value: 'none', + text: '鏃�' + }, { + value: 'thdSeparator', + text: '鍗冨垎浣�' + }, { + value: 'percent', + text: '鐧惧垎姣�' + }, { + value: 'abs', + text: '缁濆鍊�' + }], + required: false + }, + { + type: 'select', + key: 'textFormat', + label: Formdict['header.form.format'], + initVal: card.textFormat || 'none', + options: [{ + value: 'none', + text: '鏃�' + }, { + value: 'encryption', + text: '鍔犲瘑' + }, { + value: 'YYYY-MM-DD', + text: 'YYYY-MM-DD' + }, { + value: 'YYYY-MM-DD HH:mm:ss', + text: 'YYYY-MM-DD HH:mm:ss' + }], + required: false + }, + { + type: 'text', + key: 'prefix', + label: Formdict['header.form.prefix'], + initVal: card.prefix || '', + required: false, + readonly: false + }, + { + type: 'text', + key: 'postfix', + label: Formdict['header.form.postfix'], + initVal: card.postfix || '', + required: false, + readonly: false + }, + { + type: 'number', + key: 'span', + min: 1, + max: 24, + precision: 0, + label: '鍥剧墖瀹藉害', + initVal: card.span || 24, + tooltip: '鏍呮牸甯冨眬锛岀瓑鍒嗕负24浠姐��', + required: true + }, + { + type: 'select', + key: 'lenWidRadio', + label: '闀垮姣�', + initVal: card.lenWidRadio || '1:1', + required: true, + options: [ + { value: '1:1', text: '1:1' }, + { value: '4:3', text: '4:3' }, + { value: '3:2', text: '3:2' }, + { value: '16:9', text: '16:9' }, + { value: '2:1', text: '2:1' }, + { value: '3:1', text: '3:1' }, + { value: '4:1', text: '4:1' }, + { value: '5:1', text: '5:1' }, + { value: '6:1', text: '6:1' }, + { value: '7:1', text: '7:1' }, + { value: '8:1', text: '8:1' }, + { value: '9:1', text: '9:1' }, + { value: '10:1', text: '10:1' }, + { value: '3:4', text: '3:4' }, + { value: '2:3', text: '2:3' }, + { value: '9:16', text: '9:16' }, + ] + }, + { + type: 'radio', + key: 'scale', + label: '鐐瑰嚮缂╂斁', + initVal: card.scale || 'true', + required: false, + options: [{ + value: 'true', + text: Formdict['model.true'] + }, { + value: 'false', + text: Formdict['model.false'] + }] + }, + { + type: 'radio', + key: 'perspective', + label: '瀛楁閫忚', + initVal: card.perspective || '', + options: [{ + value: '', + text: '鏃�' + }, { + value: 'linkmenu', + text: '鑿滃崟' + }, { + value: 'linkurl', + text: '閾炬帴' + }], + forbidden: appType === 'mob' + }, + { + type: appType === 'pc' ? 'select' : 'cascader', + key: 'linkmenu', + label: Formdict['model.menu'], + initVal: card.linkmenu || (appType === 'pc' ? '' : []), + required: true, + options: menulist, + forbidden: appType === 'mob' + }, + { + type: 'textarea', + key: 'linkurl', + label: '閾炬帴鍦板潃', + initVal: card.linkurl || '', + required: true, + forbidden: appType === 'mob' + }, + { + type: 'multiselect', + key: 'linkfields', + label: '鍏宠仈瀛楁', + initVal: card.linkfields || [], + required: false, + options: fields, + forbidden: appType === 'mob' + }, + { + type: 'radio', + key: 'open', + label: '鎵撳紑鏂瑰紡', + initVal: card.open || 'blank', + required: false, + forbid: appType !== 'pc', + options: [ + { value: 'blank', text: '鏂扮獥鍙�' }, + { value: 'self', text: '褰撳墠绐楀彛' } + ] + }, + { + type: 'radio', + key: 'eval', + label: '瑙f瀽', + initVal: card.eval || 'true', + tooltip: '褰撳叕寮忓唴瀹规秹鍙婅绠楁椂璇烽�夋嫨鈥滄槸鈥濓紝褰撳叕寮忓唴瀹逛负瀛楁鎷兼帴鏃惰閫夋嫨鈥滃惁鈥濄��', + required: false, + options: [ + { value: 'true', text: '鏄�' }, + { value: 'false', text: '鍚�' } + ] + }, + { + type: 'textarea', + key: 'formula', + label: '鍏紡', + initVal: card.formula || '', + tooltip: '鎵ц鏃朵細浣跨敤鏌ヨ鍒扮殑鏁版嵁鏇挎崲鐩稿簲鐨勫瓧娈碉紝灞曠ず鑾峰緱鐨勭粨鏋滐紝鍦ㄤ笉浣跨敤瑙f瀽鏃舵崲琛岀鎴栫┖鏍间細鏇挎崲涓洪〉闈㈠厓绱犮�傚彲浣跨敤JS鐨勪竴浜涜娉曪紝濡傦細涓夊厓琛ㄨ揪寮� @field1@ > @field2@ ? 0 : 1锛汳ath瀵硅薄锛屽彇缁濆鍊� Math.abs(@field@)銆佸洓鑸嶄簲鍏� Math.round(@field@)绛�', + placeholder: '渚嬪锛欯price@ * @number@', + required: true + }, + { + type: 'multiselect', + key: 'blacklist', + label: Formdict['header.form.blacklist'], + initVal: card.blacklist || [], + required: false, + options: roleList, + forbidden: appType === 'mob' + } + ] +} diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx new file mode 100644 index 0000000..907ebb2 --- /dev/null +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -0,0 +1,398 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' + +import { getColumnForm } from './formconfig' +import { formRule } from '@/utils/option.js' +import './index.scss' + +const { TextArea } = Input +const columnTypeOptions = { + text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'blacklist', 'perspective', 'rowspan'], + number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], + link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'], + textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'span'], + colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], + custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], + action: ['label', 'type', 'Align', 'Width'], + formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], + index: ['label', 'type', 'Align', 'Width'] +} + +class NormalTableColumn extends Component { + static propTpyes = { + dict: PropTypes.object, // 瀛楀吀椤� + visible: PropTypes.bool, + column: PropTypes.object, + fields: PropTypes.array, + submitCol: PropTypes.func, // 鎻愪氦浜嬩欢 + cancelCol: PropTypes.func // 鍙栨秷鏃跺垹闄や簨浠� + } + + state = { + visible: false, + formlist: null + } + + UNSAFE_componentWillReceiveProps (nextProps) { + if (nextProps.column && !is(fromJS(this.props.column), fromJS(nextProps.column))) { + this.editColumn(nextProps.column) + } + } + + editColumn = (column) => { + let fields = fromJS(this.props.fields).toJS().map(item => { + if (item.label.toLowerCase() !== item.field.toLowerCase()) { + item.text = item.label + '锛�' + item.field + '锛�' + } + return item + }) + + let formlist = getColumnForm(column, fields) + let _options = fromJS(columnTypeOptions[column.type]).toJS() + if (column.type === 'text' || column.type === 'number') { + if (column.perspective === 'linkmenu') { + _options.push('linkmenu', 'linkfields', 'open') + } else if (column.perspective === 'linkurl') { + _options.push('linkurl', 'linkfields', 'open') + } + } + + this.setState({ + visible: true, + type: column.type, + formlist: formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }) + if (column.focus) { + setTimeout(() => { + try { + let _form = document.getElementById('label') + _form && _form.select() + } catch (e) { + console.warn('琛ㄥ崟focus澶辫触锛�') + } + }, 200) + } + } + + typeChange = (key, value, option) => { + if (key === 'type') { + let _options = fromJS(columnTypeOptions[value]).toJS() + + this.setState({ + type: value, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }, () => { + if (value === 'link' || value === 'textarea' || value === 'picture') { + this.props.form.setFieldsValue({IsSort: 'false'}) + } else if (value === 'text' || value === 'number') { + this.props.form.setFieldsValue({perspective: ''}) + } else if (value === 'action' || value === 'colspan') { + this.props.form.setFieldsValue({Align: 'center'}) + } + }) + } else if (key === 'field') { + let values = {label: option.props.label || option.props.children} + if (/Decimal|int/ig.test(option.props.datatype)) { + let decimal = 0 + if (/Decimal/ig.test(option.props.datatype)) { + decimal = +option.props.datatype.replace(/Decimal\(18,/ig, '').replace(')', '') + } + values.type = 'number' + values.decimal = decimal + } else { + values.type = 'text' + } + + if (values.type !== this.state.type) { + values.perspective = '' + let _options = fromJS(columnTypeOptions[values.type]).toJS() + + this.setState({ + type: values.type, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }, () => { + this.props.form.setFieldsValue(values) + }) + } else { + this.props.form.setFieldsValue(values) + } + } else if (key === 'format' && value === 'percent') { + this.props.form.setFieldsValue({postfix: '%'}) + } + } + + changeRadio = (key, value) => { + if (key === 'perspective') { + let _options = fromJS(columnTypeOptions[this.state.type]).toJS() + + if (value === 'linkmenu') { + _options.push('linkmenu', 'linkfields', 'open') + } else if (value === 'linkurl') { + _options.push('linkurl', 'linkfields', 'open') + } + + this.setState({ + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + + return item + }) + }) + } + } + + getFields() { + const { getFieldDecorator } = this.props.form + const { formlist } = this.state + const fields = [] + + if (!formlist) return null + + formlist.forEach((item, index) => { + if (item.hidden || item.forbidden) return + + if (item.type === 'text') { + let rules = [] + if (item.key !== 'linkurl') { + rules = [{ + max: formRule.input.max, + message: formRule.input.message + }] + } + 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: this.props.dict['form.required.input'] + 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" title={item.tooltip}> + <QuestionCircleOutlined className="mk-form-tip" /> + {item.label} + </Tooltip> : item.label + }> + {getFieldDecorator(item.key, { + initialValue: item.initVal, + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.input'] + item.label + '!' + } + ] + })(item.unlimit ? <InputNumber onPressEnter={this.handleSubmit}/> : + <InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.handleSubmit}/>)} + </Form.Item> + </Col> + ) + } else if (item.type === 'select') { + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || '', + rules: [ + { + required: !!item.required, + 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.typeChange(item.key, value, option)}} + getPopupContainer={() => document.getElementById('columnwinter')} + > + {item.options.map((option, index) => + <Select.Option key={index} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}> + {(option.text || option.label || option.MenuName)} + </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: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( + <Radio.Group onChange={(e) => {this.changeRadio(item.key, e.target.value)}}> + { + item.options.map(option => { + return ( + <Radio key={option.value} value={option.value}>{option.text}</Radio> + ) + }) + } + </Radio.Group> + )} + </Form.Item> + </Col> + ) + } else if (item.type === 'multiselect') { // 澶氶�� + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || [] + })( + <Select + showSearch + mode="multiple" + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > + {item.options.map((option, i) => + <Select.Option id={i} key={i} value={option.value || option.field}>{option.text || option.label}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + ) + } else if (item.type === 'cascader') { // 澶氶�� + fields.push( + <Col span={12} key={index}> + <Form.Item label={item.label}> + {getFieldDecorator(item.key, { + initialValue: item.initVal || [], + rules: [ + { + required: !!item.required, + message: this.props.dict['form.required.select'] + item.label + '!' + } + ] + })( + <Cascader + options={item.options} + placeholder="" + getPopupContainer={() => document.getElementById('columnwinter')} + /> + )} + </Form.Item> + </Col> + ) + } else if (item.type === 'textarea') { + fields.push( + <Col span={24} key={index} className="textarea"> + <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: this.props.dict['form.required.input'] + item.label + '!' + } + ] + })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)} + </Form.Item> + </Col> + ) + } + }) + return fields + } + + handleSubmit = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + this.setState({visible: false, formlist: null}) + this.props.submitCol(values) + } + }) + } + + editModalCancel = () => { + this.setState({visible: false, formlist: null}) + + this.props.cancelCol() + } + + render() { + const { visible } = this.state + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 } + } + } + + return ( + <div style={{display: 'inline-block'}}> + <Modal + title="鏄剧ず鍒楃紪杈�" + visible={visible} + width={850} + maskClosable={false} + onOk={this.handleSubmit} + onCancel={this.editModalCancel} + destroyOnClose + > + <Form {...formItemLayout} className="commontable-column-form" id="columnwinter"> + <Row gutter={24}>{this.getFields()}</Row> + </Form> + </Modal> + </div> + ) + } +} + +export default Form.create()(NormalTableColumn) \ No newline at end of file diff --git a/src/menu/components/table/base-table/columns/editColumn/index.scss b/src/menu/components/table/base-table/columns/editColumn/index.scss new file mode 100644 index 0000000..9885df8 --- /dev/null +++ b/src/menu/components/table/base-table/columns/editColumn/index.scss @@ -0,0 +1,17 @@ +.commontable-column-form { + min-height: 190px; + .ant-cascader-menus { + padding: 5px 0px; + .ant-cascader-menu:last-child { + padding-right: 3px; + } + } + .textarea { + .ant-form-item-label { + width: 12%; + } + .ant-form-item-control-wrapper { + width: 88%; + } + } +} diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx new file mode 100644 index 0000000..44be56a --- /dev/null +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -0,0 +1,618 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { DndProvider, DragSource, DropTarget } from 'react-dnd' +import { Table, Popover, Modal, message } from 'antd' +import { PlusOutlined, FileSyncOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons' + +import asyncComponent from '@/utils/asyncComponent' +import asyncIconComponent from '@/utils/asyncIconComponent' +import Utils from '@/utils/utils.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +import MKEmitter from '@/utils/events.js' +import './index.scss' + +const { confirm } = Modal +const EditColumn = asyncIconComponent(() => import('./editColumn')) +const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent')) +const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) +const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination')) +const PasteComponent = asyncIconComponent(() => import('@/components/paste')) + +class HeaderCol extends Component { + deleteCol = () => { + const _this = this + + confirm({ + content: '纭畾鍒犻櫎鏄剧ず鍒楀悧锛�', + onOk() { + _this.props.deleteCol(_this.props.column) + }, + onCancel() {} + }) + } + + updateMarks = (vals) => { + const { column } = this.props + this.props.updateCol({...column, marks: vals}) + } + + shouldComponentUpdate (nextProps, nextState) { + + if (this.props.rowSpan !== nextProps.rowSpan || this.props.colSpan !== nextProps.colSpan) { + return true + } + + if (!nextProps.column) return false + + return !is(fromJS(this.props.column), fromJS(nextProps.column)) || + !is(fromJS(this.props.fields), fromJS(nextProps.fields)) || + this.props.index !== nextProps.index + } + + render() { + const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, pasteCell, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props + + if (index !== undefined) { + return connectDragSource( + connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => column && this.props.editColumn(column)}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> + {column && ['custom', 'colspan', 'action'].includes(column.type) ? + <PlusOutlined className="plus" title="娣诲姞" onClick={() => this.props.addElement(column)} /> : null + } + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> + {column && column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + {column && column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} + <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> + {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + </div> + } trigger="hover"> + {children} + </Popover> + </th>), + ) + } else if (column) { + return ( + <th {...restProps} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> + {column && ['custom', 'colspan'].includes(column.type) ? + <PlusOutlined className="plus" title="娣诲姞" onClick={() => this.props.addElement(column)} /> : null + } + <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> + {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> + {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + </div> + } trigger="hover"> + {children} + </Popover> + </th> + ) + } else { + return (<th {...restProps}>{children}</th>) + } + } +} + +const rowSource = { + beginDrag(props) { + return { + index: props.index, + } + } +} + +const ColTarget = { + drop(props, monitor) { + const dragIndex = monitor.getItem().index + const hoverIndex = props.index + + if (dragIndex === undefined || hoverIndex === undefined || dragIndex === hoverIndex) { + return + } + + props.moveCol(dragIndex, hoverIndex) + monitor.getItem().index = hoverIndex + }, +} + +const DragableHeaderCol = DropTarget('col', ColTarget, connect => ({ + connectDropTarget: connect.dropTarget() +}))( + DragSource('col', rowSource, connect => ({ + connectDragSource: connect.dragSource(), + }))(HeaderCol), +) + +class EditableColumnCell extends Component { + updateCard = (vals, btn) => { + const { column } = this.props + this.props.upComponent({...column, elements: vals}, btn) + } + + shouldComponentUpdate (nextProps, nextState) { + const { config, column } = this.props + + if (!nextProps.column) return true + + return !is(fromJS(column), fromJS(nextProps.column)) || + !is(fromJS(config.columns), fromJS(nextProps.config.columns)) || + !is(fromJS(config.action), fromJS(nextProps.config.action)) || + !is(fromJS(config.search), fromJS(nextProps.config.search)) + } + + render() { + const { column, config, children, className, style } = this.props + + if (column && column.type === 'custom') { + return ( + <td style={{padding: 0, minWidth: column.Width || 100, ...(column.style || {})}} className={className}> + <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> + </td> + ) + } else if (column && column.type === 'action') { + return ( + <td style={{padding: '0 5px', textAlign: column.Align, minWidth: column.Width || 100}} className={'action-column ' + className}> + <CardCellComponent cards={config} cardCell={column} elements={column.elements} updateElement={this.updateCard}/> + </td> + ) + } else if (column) { + let val = column.field || '' + if (column.type === 'index') { + val = '$Index' + } else if (column.type === 'formula') { + val = column.formula + if (column.eval === 'false') { + val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + val = <span style={{fontWeight: 'inherit'}} dangerouslySetInnerHTML={{__html: val}}></span> + } + } + return ( + <td style={{...style, minWidth: column.Width || 100}} className={className}> + {val} + {column.Hide === 'true' ? <CloseCircleOutlined style={{marginLeft: '5px', color: 'orange', fontSize: '12px'}}/> : null} + {column.marks && column.marks.length ? <AntDesignOutlined className="profile"/> : null} + </td> + ) + } else { + return ( + <td style={style} className={className}> + {children} + </td> + ) + } + } +} + +class NormalTableColumns extends Component { + static propTpyes = { + config: PropTypes.object, // 閰嶇疆淇℃伅 + updatecolumn: PropTypes.func // 鏁版嵁鍙樺寲 + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + appType: sessionStorage.getItem('appType'), + tableId: '', + data: [{uuid: Utils.getuuid()}], + refresh: false, // 寮哄埗鍒锋柊 + columns: [], + fields: [], + editStyleCard: null, + lineMarks: [] + } + + UNSAFE_componentWillMount () { + const { config } = this.props + + let tableId = (() => { + let uuid = [] + let _options = 'abcdefghigklmnopqrstuv' + for (let i = 0; i < 19; i++) { + uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) + } + return uuid.join('') + }) () + + this.setState({ + tableId, + columns: fromJS(config.cols).toJS(), + fields: fromJS(config.columns).toJS(), + lineMarks: config.lineMarks ? fromJS(config.lineMarks).toJS() : [] + }, () => { + const element = document.getElementById(tableId) + element && element.style.setProperty('--mk-table-border-color', config.wrap.borderColor || '#e8e8e8') + element && element.style.setProperty('--mk-table-color', config.wrap.color || 'rgba(0, 0, 0, 0.65)') + element && element.style.setProperty('--mk-table-font-size', config.wrap.fontSize || '14px') + element && element.style.setProperty('--mk-table-font-weight', config.wrap.fontWeight || 'normal') + }) + } + + UNSAFE_componentWillReceiveProps (nextProps) { + if (!is(fromJS(this.state.columns), fromJS(nextProps.config.cols))) { + let _columns = fromJS(nextProps.config.cols).toJS() + this.setState({columns: _columns}) + let lastcol = _columns.slice(-1)[0] + if (lastcol && lastcol.focus) { + this.editColumn(lastcol) + } + } else if (!is(fromJS(this.state.fields), fromJS(nextProps.config.columns))) { + this.setState({fields: fromJS(nextProps.config.columns).toJS()}) + } else if (!is(fromJS(this.props.config.wrap), fromJS(nextProps.config.wrap))) { + const element = document.getElementById(this.state.tableId) + element && element.style.setProperty('--mk-table-border-color', nextProps.config.wrap.borderColor || '#e8e8e8') + element && element.style.setProperty('--mk-table-color', nextProps.config.wrap.color || 'rgba(0, 0, 0, 0.65)') + element && element.style.setProperty('--mk-table-font-size', nextProps.config.wrap.fontSize || '14px') + element && element.style.setProperty('--mk-table-font-weight', nextProps.config.wrap.fontWeight || 'normal') + } + } + + shouldComponentUpdate (nextProps, nextState) { + const { config } = this.props + + return !is(fromJS(this.state), fromJS(nextState)) || + !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) || + !is(fromJS(config.search), fromJS(nextProps.config.search)) || + !is(fromJS(config.action), fromJS(nextProps.config.action)) || + config.setting.laypage !== nextProps.config.setting.laypage + } + + moveCol = (dragIndex, hoverIndex) => { + let _columns = fromJS(this.state.columns).toJS() + + _columns.splice(hoverIndex, 0, ..._columns.splice(dragIndex, 1)) + + this.setState({ + columns: _columns + }, () => { + this.props.updatecolumn({...this.props.config, cols: _columns}) + }) + } + + loopCol = (columns, col) => { + return columns.map(column => { + if (column.type === 'colspan') { + column.subcols = this.loopCol(column.subcols, col) + } + if (column.uuid === col.uuid) { + return col + } + return column + }) + } + + updateCol = (col, btn) => { + let _columns = fromJS(this.state.columns).toJS() + _columns = this.loopCol(_columns, col) + + this.setState({ + columns: _columns, + }, () => { + let config = {...this.props.config, cols: _columns} + if (btn) { + config.action = config.action.filter(item => item.uuid !== btn.uuid) + } + + this.props.updatecolumn(config) + }) + } + + editColumn = (col) => { + this.setState({ + card: fromJS(col).toJS() + }) + } + + pasteCell = (col, cell, resolve) => { + resolve({status: true}) + + delete cell.copyType + cell.uuid = Utils.getuuid() + cell.focus = true + + MKEmitter.emit('cardAddElement', [this.props.config.uuid, col.uuid], cell) + } + + addElement = (col) => { + const { config } = this.props + let column = fromJS(col).toJS() + + if (column.type === 'colspan') { + column.subcols = column.subcols || [] + let subcol = { isSub: true, focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text' } + column.subcols.push(subcol) + + this.setState({ + card: subcol + }) + this.updateCol(column) + } else if (column.type === 'custom') { + let newcard = {uuid: Utils.getuuid(), focus: true, width: 24, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}} + + // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 + MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + } else if (column.type === 'action') { + let newcard = { + uuid: Utils.getuuid(), + focus: true, + eleType: 'button', + label: 'button', + OpenType: 'prompt', + class: 'primary', + intertype: 'system', + execSuccess: 'grid', + execError: 'never', + show: 'link' + } + + // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 + MKEmitter.emit('cardAddElement', [config.uuid, column.uuid], newcard) + } + } + + submitCol = (col) => { + const { card } = this.state + + col.uuid = card.uuid + col.isSub = card.isSub === true + col.marks = card.marks || [] + + if (col.type === 'colspan') { + col.subcols = card.subcols || [] + } else if (col.type === 'custom') { + col.elements = card.type === 'custom' ? (card.elements || []) : [] + } else if (col.type === 'action') { + col.elements = card.type === 'action' ? (card.elements || []) : [] + } + + this.setState({card: null}) + this.updateCol(col) + } + + changeStyle = (col) => { + this.setState({ + editStyleCard: fromJS(col).toJS() + }) + + MKEmitter.emit('changeStyle', ['font', 'padding'], col.style || {}, this.getStyle) + } + + getStyle = (style) => { + const { editStyleCard } = this.state + + let _card = {...editStyleCard, style} + + this.updateCol(_card) + } + + cancelCol = () => { + const { card } = this.state + + if (card.focus) { + this.deleteCol(card) + } + + this.setState({card: null}) + } + + loopDelCol = (columns, col) => { + return columns.filter(column => { + if (column.type === 'colspan') { + column.subcols = this.loopDelCol(column.subcols, col) + } + return column.uuid !== col.uuid + }) + } + + deleteCol = (col) => { + const { appType } = this.state + let _columns = fromJS(this.state.columns).toJS() + + _columns = this.loopDelCol(_columns, col) + + this.setState({ + columns: _columns + }, () => { + this.props.updatecolumn({...this.props.config, cols: _columns}) + }) + + if (col.type !== 'action' || appType === 'mob') return + + let uuids = [] + col.elements && col.elements.forEach(c => { + if (appType === 'pc' && c.OpenType !== 'popview') return + + uuids.push(c.uuid) + }) + + if (uuids.length === 0) return + + MKEmitter.emit('delButtons', uuids) + } + + updateLineMarks = (vals) => { + this.setState({ + lineMarks: vals + }, () => { + this.props.updatecolumn({...this.props.config, lineMarks: vals}) + }) + } + + /** + * @description 鏄剧ず鍒楀鍒� + */ + copycolumn = () => { + const { columns } = this.state + + let oInput = document.createElement('input') + let val = { + copyType: 'cols', + cols: columns.filter(col => !col.origin) + } + + 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' + + message.success('澶嶅埗鎴愬姛銆�') + + document.body.removeChild(oInput) + } + + handlecolumns = (columns, fields, config, isSub) => { + return columns.map((col, index) => { + return { + title: col.label, + dataIndex: col.uuid, + align: col.Align, + // sorter: !isSub && col.IsSort === 'true', + sorter: col.IsSort === 'true', + onCell: () => ({ + column: col, + width: col.Width, + config: config, + upComponent: this.updateCol + }), + onHeaderCell: () => ({ + index: isSub ? undefined : index, + column: col, + fields: fields, + align: col.Align, + moveCol: this.moveCol, + updateCol: this.updateCol, + addElement: this.addElement, + editColumn: this.editColumn, + pasteCell: this.pasteCell, + changeStyle: this.changeStyle, + deleteCol: this.deleteCol, + }), + children: col.subcols && col.subcols.length ? this.handlecolumns(col.subcols, fields, config, true) : null, + } + }) + } + + syncfield = () => { + const { fields } = this.state + let columns = fromJS(this.state.columns).toJS() + + columns = columns.filter(c => !c.origin) + + let keys = columns.map(col => col.field) + + fields.forEach(item => { + if (keys.includes(item.field)) return + + let cell = { uuid: Utils.getuuid(), label: item.label, field: item.field, Align: 'left', Hide: 'false', IsSort: 'true', Width: 120, blacklist: [], postfix: '', prefix: '', linkmenu: [], marks: [], perspective: 'linkmenu' } + + if (/Nvarchar|date/ig.test(item.datatype)) { + cell.type = 'text' + cell.rowspan = 'false' + cell.textFormat = 'none' + } else { + cell.type = 'number' + cell.format = 'none' + cell.sum = 'false' + cell.decimal = item.decimal || 0 + cell.Width = 80 + } + + columns.push(cell) + }) + + const _this = this + + confirm({ + content: '纭畾鍚屾瀛楁闆嗗悧锛�', + onOk() { + _this.setState({columns}, () => { + _this.props.updatecolumn({..._this.props.config, cols: columns}) + }) + }, + onCancel() {} + }) + } + + clear = () => { + const _this = this + + confirm({ + content: '纭畾娓呯┖鏄剧ず鍒楀悧锛�', + onOk() { + _this.setState({columns: []}, () => { + _this.props.updatecolumn({..._this.props.config, cols: []}) + }) + }, + onCancel() {} + }) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + } + + render() { + const { config } = this.props + const { fields, card, lineMarks, dict, tableId, appType } = this.state + const components = { + header: { + cell: DragableHeaderCol + }, + body: { + cell: EditableColumnCell + } + } + + const columns = this.handlecolumns(this.state.columns, fields, config) + + return ( + <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''}`} id={tableId}> + <div className="col-control"> + <CopyOutlined title="澶嶅埗鏄剧ず鍒�" onClick={this.copycolumn} /> + <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> + <FileSyncOutlined title="鍚屾瀛楁闆�" onClick={this.syncfield} /> + <DeleteOutlined title="娓呯┖鏄剧ず鍒�" onClick={this.clear}/> + </div> + <DndProvider> + <Table + rowKey="uuid" + size={config.wrap.size || 'middle'} + rowClassName="editable-row" + bordered={config.wrap.bordered !== 'false'} + components={components} + dataSource={this.state.data} + rowSelection={config.wrap.tableType ? { type: 'radio' } : null} + columns={columns} + pagination={appType !== 'mob' ? { + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '25', '50', '100', '500', '1000'], + showSizeChanger: true, + total: 58, + showTotal: (total, range) => `${range[0]}-${range[1]} 鍏� ${total} 鏉 + } : false} + /> + {appType === 'mob' && config.setting.laypage !== 'fasle' ? <MobPagination /> : null} + </DndProvider> + <EditColumn column={card} dict={dict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> + </div> + ) + } +} + +export default NormalTableColumns \ No newline at end of file diff --git a/src/menu/components/table/base-table/columns/index.scss b/src/menu/components/table/base-table/columns/index.scss new file mode 100644 index 0000000..3d4835c --- /dev/null +++ b/src/menu/components/table/base-table/columns/index.scss @@ -0,0 +1,146 @@ +.normal-table-columns { + position: relative; + --mk-table-border-color: #e8e8e8; + --mk-table-color: rgba(0, 0, 0, 0.65); + --mk-table-font-size: 14px; + --mk-table-font-weight: normal; + + .ant-table { + color: inherit; + font-size: inherit; + font-weight: inherit; + } + .ant-table-body { + overflow-x: auto; + tr { + td { + background: #ffffff; + } + td:not(.ant-table-selection-column) { + position: relative; + padding: 12px 8px; + >.profile { + position: absolute; + top: 2px; + right: 2px; + color: purple; + font-size: 12px; + } + } + } + .action-column { + .card-detail-row:empty { + min-height: 40px; + } + } + tr:hover td { + background: #ffffff!important; + } + } + + .ant-table-thead { + th { + position: relative; + .ant-table-column-sorter::before { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + content: ''; + } + } + > tr > th { + padding: 12px 8px; + .ant-table-column-sorter .ant-table-column-sorter-inner { + .ant-table-column-sorter-up.on, .ant-table-column-sorter-down.on { + color: unset; + } + } + } + } + .col-control { + position: absolute; + z-index: 2; + right: 0; + top: -25px; + >.anticon, >div > .anticon { + font-size: 16px; + margin-right: 10px; + cursor: pointer; + } + >.anticon-copy { + color: #26C281; + } + >.anticon-delete { + color: #ff4d4f; + } + >.anticon-file-sync { + color: #1890ff; + } + >div >.profile { + color: purple; + } + } + .ant-table-small > .ant-table-content > .ant-table-body { + margin: 0; + } + + table, tr, th, td { + border-color: var(--mk-table-border-color)!important; + } + table tr { + th .ant-table-column-title { + // color: var(--mk-table-color)!important; + font-size: var(--mk-table-font-size)!important; + font-weight: var(--mk-table-font-weight)!important; + } + td { + color: var(--mk-table-color)!important; + font-size: var(--mk-table-font-size)!important; + font-weight: var(--mk-table-font-weight)!important; + } + } +} +.normal-table-columns.false { + .ant-pagination { + display: none; + } +} +.normal-table-columns.checkbox { + .ant-radio-inner { + border-radius: 0; + } + .ant-radio-inner::after { + border-radius: 0; + } + .ant-radio-checked::after { + border-radius: 0; + } +} + +.normal-table-columns.ghost { + .ant-table-thead > tr { + > th { + color: inherit; + background: transparent; + .ant-table-column-sorter .ant-table-column-sorter-inner { + color: inherit; + } + } + > th:hover { + background: transparent; + } + } + .ant-table-body { + overflow-x: auto; + tr { + td { + background: transparent; + } + } + tr:hover td { + background: transparent!important; + } + } +} diff --git a/src/menu/components/table/base-table/index.jsx b/src/menu/components/table/base-table/index.jsx new file mode 100644 index 0000000..480a7db --- /dev/null +++ b/src/menu/components/table/base-table/index.jsx @@ -0,0 +1,554 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Popover } from 'antd' +import { PlusOutlined, PlusCircleOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' + +import asyncComponent from '@/utils/asyncComponent' +import asyncIconComponent from '@/utils/asyncIconComponent' +import { resetStyle } from '@/utils/utils-custom.js' +import MKEmitter from '@/utils/events.js' +import getWrapForm from './options' +import Utils from '@/utils/utils.js' + +import './index.scss' + +const SettingComponent = asyncIconComponent(() => import('@/menu/datasource')) +const NormalForm = asyncIconComponent(() => import('@/components/normalform')) +const SearchComponent = asyncComponent(() => import('@/templates/sharecomponent/searchcomponent')) +const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) +const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) +const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) +const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) +const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) +// const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) +const ColumnComponent = asyncComponent(() => import('./columns')) + +class TableCardEditComponent extends Component { + static propTpyes = { + card: PropTypes.object, + deletecomponent: PropTypes.func, + updateConfig: PropTypes.func, + } + + state = { + appType: sessionStorage.getItem('appType'), + card: null, + back: false + } + + UNSAFE_componentWillMount () { + const { card } = this.props + const { appType } = this.state + + if (card.isNew) { + let _card = { + uuid: card.uuid, + type: card.type, + tabId: card.tabId || '', + parentId: card.parentId || '', + format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 + pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� + switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� + dataName: card.dataName || '', + width: card.width || 24, + search: [ + { origin: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text', match: 'like' }, + { origin: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'select', match: 'equal' } + ], + action: [ + { origin: true, uuid: Utils.getuuid(), label: '娣诲姞', intertype: 'system', OpenType: 'pop', execSuccess: 'grid', icon: 'plus', class: 'green', style: {color: 'rgb(255, 255, 255)', background: 'rgb(38, 194, 129)', marginRight: '15px'} }, + { origin: true, uuid: Utils.getuuid(), label: '淇敼', intertype: 'system', OpenType: 'pop', execSuccess: 'grid', icon: 'form', class: 'purple', style: {color: 'rgb(255, 255, 255)', background: 'rgb(142, 68, 173)', marginRight: '15px'} }, + { origin: true, uuid: Utils.getuuid(), label: '鍒犻櫎', intertype: 'system', OpenType: 'prompt', execSuccess: 'grid', Ot: 'required', icon: 'delete', class: 'danger', style: {color: 'rgb(255, 255, 255)', background: 'rgb(255, 77, 79)', marginRight: '15px'} } + ], + name: card.name, + subtype: card.subtype, + setting: { interType: 'system' }, + wrap: { name: card.name, width: card.width || 24, bordered: 'true', tableType: 'checkbox', show: 'true' }, + style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' }, + headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, + columns: [], + cols: [ + { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label1', field: '', Hide: 'false', type: 'text', Width: 120 }, + { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label2', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, + { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, + ], + scripts: [], + btnlog: [], + isNew: true + } + + if (card.config) { + let config = fromJS(card.config).toJS() + + _card.wrap = config.wrap + _card.wrap.name = card.name + _card.style = config.style + _card.headerStyle = config.headerStyle + + _card.setting = config.setting + _card.columns = config.columns + _card.scripts = config.scripts + + let oriUids = {} + _card.action = config.action.map(item => { + let _uuid = Utils.getuuid() + oriUids[item.uuid] = _uuid + item.uuid = _uuid + return item + }) + _card.search = config.search.map(item => { + item.uuid = Utils.getuuid() + return item + }) + _card.cols = config.cols.map(col => { + col.uuid = Utils.getuuid() + if (col.type === 'colspan' && col.subcols) { + col = this.loopCol(col) + } else if (col.type === 'custom' && col.elements) { + col.elements = col.elements.map(cell => { + cell.uuid = Utils.getuuid() + return cell + }) + } else if (col.type === 'action' && col.elements) { + col.elements = col.elements.map(cell => { + cell.uuid = Utils.getuuid() + return cell + }) + } + return col + }) + + if (_card.wrap.doubleClick) { + _card.wrap.doubleClick = oriUids[_card.wrap.doubleClick] || '' + } + } + + if (appType === 'mob') { + _card.search = [] + _card.action = _card.action.filter(a => !a.origin) + } + + this.updateComponent(_card) + } else { + let _card = fromJS(card).toJS() + if (appType === 'mob') { + _card.search = [] + } + + this.setState({ + card: _card + }) + } + } + + componentDidMount () { + MKEmitter.addListener('submitModal', this.handleSave) + // MKEmitter.addListener('logButton', this.logButton) + MKEmitter.addListener('completeSave', this.completeSave) + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('submitModal', this.handleSave) + // MKEmitter.removeListener('logButton', this.logButton) + MKEmitter.removeListener('completeSave', this.completeSave) + } + + completeSave = () => { + const { card } = this.state + + if (card.isNew) { + let item = fromJS(card).toJS() + item.search = item.search.filter(a => !a.origin) + item.action = item.action.filter(a => !a.origin) + item.cols = item.cols.filter(a => !a.origin) + + delete item.isNew + + this.setState({card: item}, () => { MKEmitter.emit('revert') }) + } + } + + loopCol = (col) => { + col.subcols = col.subcols.map(c => { + c.uuid = Utils.getuuid() + if (c.type === 'colspan' && c.subcols) { + c = this.loopCol(c) + } else if (c.type === 'custom' && c.elements) { + c.elements = c.elements.map(cell => { + cell.uuid = Utils.getuuid() + return cell + }) + } + return c + }) + + return col + } + + /** + * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級 + */ + updateComponent = (card) => { + card.width = card.wrap.width + card.name = card.wrap.name + + if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� + card.errors = [] + + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } + let doubleClick = card.wrap.doubleClick || '' + + let columns = card.columns.map(c => c.field) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) + + if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { + card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) + } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) { + card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'}) + } else if (!card.setting.primaryKey) { + card.errors.push({ level: 0, detail: '鏈缃富閿紒'}) + } else if (!columns.includes(card.setting.primaryKey)) { + card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'}) + } else if (!card.setting.supModule) { + card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'}) + } + + card.action.forEach(cell => { + if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { + if (!cell.modal || cell.modal.fields.length === 0) { + card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) + } + } + if (doubleClick === cell.uuid) { + doubleClick = '' + } + }) + + card.cols.forEach(col => { + if (col.type === 'action') { + col.elements.forEach(cell => { + if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { + if (!cell.modal || cell.modal.fields.length === 0) { + card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) + } + } + if (doubleClick === cell.uuid) { + doubleClick = '' + } + }) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { + card.errors.push({ level: 1, detail: `鏄剧ず鍒椻��${col.label}鈥濅腑鍔ㄦ�佸瓧娈碘��${cell.field}鈥濇棤鏁坄}) + } + }) + } else if (col.field && !columns.includes(col.field)) { + card.errors.push({ level: 1, detail: `鏄剧ず鍒椻��${col.label}鈥濅腑瀛楁鈥�${col.field}鈥濇棤鏁坄}) + } + }) + + if (doubleClick) { + card.errors.push({ level: 1, detail: `缁戝畾鐨勫弻鍑绘寜閽凡鍒犻櫎`}) + } + } + + this.setState({ + card: card + }) + + let _card = card.isNew ? fromJS(card).toJS() : card + if (_card.isNew) { + _card.cols = _card.cols.filter(a => !a.origin) + _card.search = _card.search.filter(a => !a.origin) + _card.action = _card.action.filter(a => !a.origin) + + delete _card.isNew + } + + this.props.updateConfig(_card) + } + + // logButton = (id, item) => { + // const { card } = this.state + + // if (id !== card.uuid) return + + // let btnlog = card.btnlog || [] + // btnlog.push(item) + + // this.updateComponent({...card, btnlog}) + // } + + changeStyle = () => { + const { card } = this.state + + let style = {...card.style} + style.color = card.wrap.color || 'rgba(0, 0, 0, 0.65)' + style.fontSize = card.wrap.fontSize || 14 + style.fontWeight = card.wrap.fontWeight || 'normal' + + MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow'], style, this.getStyle) + } + + getStyle = (style) => { + const { card } = this.state + + let _card = fromJS(card).toJS() + let _style = fromJS(style).toJS() + + let color = style.color + let fontSize = style.fontSize + let fontWeight = style.fontWeight + + delete _style.color + delete _style.fontSize + delete _style.fontWeight + + _card.style = _style + _card.wrap.color = color + _card.wrap.fontSize = fontSize + _card.wrap.fontWeight = fontWeight + + this.updateComponent(_card) + } + + addColumns = () => { + let card = fromJS(this.state.card).toJS() + + card.cols.push({ focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text' }) + + this.setState({card}) + } + + addSearch = () => { + const { card } = this.state + + MKEmitter.emit('plusSearch', card.uuid, {uuid: Utils.getuuid(), focus: true, label: 'label', type: 'text', match: '='}, 'simple') + } + + addButton = () => { + const { card } = this.state + + let newcard = {} + newcard.uuid = Utils.getuuid() + newcard.focus = true + + newcard.label = 'label' + newcard.sqlType = '' + newcard.Ot = 'requiredSgl' + newcard.OpenType = 'pop' + newcard.icon = '' + newcard.class = 'green' + newcard.intertype = card.setting.interType || 'system' + newcard.innerFunc = card.setting.innerFunc || '' + newcard.sysInterface = card.setting.sysInterface || '' + newcard.outerFunc = card.setting.outerFunc || '' + newcard.interface = card.setting.interface || '' + newcard.execSuccess = 'grid' + newcard.execError = 'never' + newcard.verify = null + newcard.show = 'button' + newcard.style = {marginRight: '15px'} + + // 娉ㄥ唽浜嬩欢-娣诲姞鎸夐挳 + MKEmitter.emit('addButton', card.uuid, newcard) + } + + setSubConfig = (item) => { + const { card, appType } = this.state + let btn = fromJS(item).toJS() + + if (btn.OpenType === 'pop' || btn.execMode === 'pop') { + if (!btn.modal) { + btn.modal = { + setting: { title: btn.label, width: appType === 'mob' ? 100 : 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' }, + tables: [], + groups: [], + fields: [] + } + } + MKEmitter.emit('changeModal', card, btn) + } else if (btn.OpenType === 'popview') { + MKEmitter.emit('changePopview', card, btn) + } + } + + handleSave = (_cards, btn, modal) => { + let card = fromJS(this.state.card).toJS() + + if (card.uuid !== _cards.uuid) return + + let _index = card.action.findIndex(cell => cell.uuid === btn.uuid) + + if (_index === -1) return + + card.action = card.action.map(cell => { + if (cell.uuid === btn.uuid) { + cell.modal = modal + } + + return cell + }) + + this.updateComponent(card) + } + + // handleLog = (type, logs, item) => { + // let card = fromJS(this.state.card).toJS() + + // if (type === 'revert') { + // let done = false + // if (item.$parentId) { + // card.cols.forEach(col => { + // if (col.type !== 'action') return + // if (item.$parentId === col.uuid) { + // col.elements = col.elements ? [...col.elements, item] : [item] + // done = true + // } + // }) + // } + + // if (!done) { + // card.action = card.action ? [...card.action, item] : [item] + // } + + // card.btnlog = logs + + // this.updateComponent(card) + // notification.success({ + // top: 92, + // message: '鎭㈠鎴愬姛锛�', + // duration: 2 + // }) + // } else { + // card.btnlog = logs + // this.updateComponent(card) + // notification.success({ + // top: 92, + // message: '娓呴櫎鎴愬姛锛�', + // duration: 2 + // }) + // } + // } + + getWrapForms = () => { + const { wrap, action, columns, cols } = this.state.card + + let _actions = [...action] + + cols.forEach(col => { + if (col.type !== 'action') return + _actions.push(...col.elements) + }) + + return getWrapForm(wrap, _actions, columns) + } + + updateWrap = (res) => { + const { card } = this.state + + res.color = card.wrap.color + res.fontSize = card.wrap.fontSize + res.fontWeight = card.wrap.fontWeight + + res.show = card.wrap.show || 'true' + res.advanceType = card.wrap.advanceType || 'modal' + res.advanceWidth = card.wrap.advanceWidth || 1000 + res.drawerPlacement = card.wrap.drawerPlacement || 'right' + res.searchRatio = card.wrap.searchRatio || 6 + res.searchLwidth = card.wrap.searchLwidth !== undefined ? card.wrap.searchLwidth : 33.3 + + this.updateComponent({...card, wrap: res}) + } + + clickComponent = (e) => { + if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { + e.stopPropagation() + MKEmitter.emit('clickComponent', this.state.card) + } + } + + render() { + const { card, appType } = this.state + let options = ['action', 'search', 'form', 'cols'] + let _style = resetStyle(card.style) + + if (appType === 'mob') { + options = ['action', 'cols'] + } + + return ( + <div className="menu-normal-table-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> + <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/> + <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ + <div className="mk-popover-control"> + <PlusOutlined className="plus" title="娣诲姞鍒�" onClick={this.addColumns}/> + {appType !== 'mob' ? <PlusCircleOutlined className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch}/> : null} + <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={this.addButton}/> + <NormalForm title="琛ㄦ牸璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}> + <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> + </NormalForm> + <CopyComponent type="normaltable" card={card}/> + <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> + <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> + {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} + <UserComponent config={card}/> + <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> + <SettingComponent config={card} updateConfig={this.updateComponent} /> + </div> + } trigger="hover"> + <ToolOutlined /> + </Popover> + <SearchComponent config={card} updatesearch={this.updateComponent}/> + <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/> + <ColumnComponent config={card} updatecolumn={this.updateComponent}/> + <div className="component-name"> + <div className="center"> + <div className="title">{card.name}</div> + <div className="content"> + {card.errors && card.errors.map((err, index) => { + if (err.level === 0) { + return <span key={index} className="error">{err.detail}</span> + } else { + return <span key={index} className="waring">{err.detail}锛�</span> + } + })} + </div> + </div> + </div> + </div> + ) + } +} + +export default TableCardEditComponent \ No newline at end of file diff --git a/src/menu/components/table/base-table/index.scss b/src/menu/components/table/base-table/index.scss new file mode 100644 index 0000000..b558c2a --- /dev/null +++ b/src/menu/components/table/base-table/index.scss @@ -0,0 +1,92 @@ +.menu-normal-table-edit-box { + position: relative; + box-sizing: border-box; + background: #ffffff; + background-position: center center; + background-repeat: no-repeat; + background-size: cover; + min-height: 100px; + + .model-table-search-list { + padding: 10px 0px 15px; + min-height: 65px; + border-bottom: 1px solid #f0f0f0; + .page-card { + background: transparent; + } + .quickly-add { + display: inline-block; + position: absolute; + z-index: 3; + right: 70px; + bottom: 5px; + .ant-btn-block { + background-color: transparent; + color: #1890ff; + border: none; + box-shadow: none !important; + height: 18px; + padding: 0 10px; + } + } + } + .model-table-search-list.length0 { + min-height: 10px; + border-bottom: 0; + >.quickly-add { + right: unset; + left: -8px; + bottom: 0; + } + >.ant-row { + display: none; + } + >.ant-switch { + display: none; + } + } + .model-table-search-list.length0 + .length0 { + margin-top: -25px; + } + .anticon-tool { + position: absolute; + z-index: 2; + font-size: 16px; + right: 1px; + top: 1px; + cursor: pointer; + padding: 5px; + background: rgba(255, 255, 255, 0.55); + } + .model-menu-action-list { + line-height: 55px; + padding: 0px; + min-height: 55px; + >.ant-row { + min-height: 30px; + } + } + .card-add-button { + text-align: right; + clear: left; + .anticon-plus { + font-size: 20px; + color: #26C281; + padding: 5px; + margin-right: 10px; + } + } + + .ant-btn.mk-link { + padding: 0; + } +} +.menu-normal-table-edit-box::after { + display: block; + content: ' '; + clear: both; +} +.menu-normal-table-edit-box:hover { + z-index: 1; + box-shadow: 0px 0px 4px #1890ff; +} diff --git a/src/menu/components/table/base-table/options.jsx b/src/menu/components/table/base-table/options.jsx new file mode 100644 index 0000000..c6caecc --- /dev/null +++ b/src/menu/components/table/base-table/options.jsx @@ -0,0 +1,274 @@ +/** + * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 + */ +export default function (wrap, action = [], columns = []) { + let roleList = sessionStorage.getItem('sysRoles') + let appType = sessionStorage.getItem('appType') + + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch (e) { + roleList = [] + } + } else { + roleList = [] + } + + const wrapForm = [ + { + type: 'text', + field: 'title', + label: '鏍囬', + initval: wrap.title || '', + required: false + }, + { + type: 'text', + field: 'name', + label: '缁勪欢鍚嶇О', + initval: wrap.name || '', + tooltip: '鐢ㄤ簬缁勪欢闂寸殑鍖哄垎銆�', + required: true + }, + { + type: 'number', + field: 'width', + label: '瀹藉害', + initval: wrap.width || 24, + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + min: 1, + max: 24, + precision: 0, + required: true + }, + { + type: 'number', + field: 'height', + label: '楂樺害', + initval: wrap.height || '', + tooltip: '琛ㄦ牸楂樺害锛岀┖鍊兼椂楂樺害鑷�傚簲銆�', + min: 10, + max: 3000, + precision: 0, + required: false, + forbid: appType === 'mob' + }, + { + type: 'radio', + field: 'tableType', + label: '琛ㄦ牸灞炴��', + initval: wrap.tableType || '', + required: false, + options: [ + {value: '', label: '涓嶅彲閫�'}, + {value: 'radio', label: '鍗曢��'}, + {value: 'checkbox', label: '澶氶��'}, + ], + controlFields: [ + {field: 'selected', values: ['radio', 'checkbox']}, + ] + }, + { + type: 'radio', + field: 'bordered', + label: '杈规', + initval: wrap.bordered || 'true', + required: false, + options: [ + {value: 'true', label: '鏈�'}, + {value: 'false', label: '鏃�'}, + ] + }, + { + type: 'radio', + field: 'tableHeader', + label: '琛ㄥご', + initval: wrap.tableHeader || 'show', + required: false, + options: [ + {value: 'show', label: '鏄剧ず'}, + {value: 'hidden', label: '闅愯棌'}, + ] + }, + { + type: 'radio', + field: 'collapse', + label: '鍙敹璧�', + initval: wrap.collapse || 'false', + required: false, + options: [ + {value: 'true', label: '鏄�'}, + {value: 'false', label: '鍚�'}, + ], + forbid: appType === 'mob' || appType === 'pc' + }, + { + type: 'radio', + field: 'size', + label: '琛ㄦ牸澶у皬', + initval: wrap.size || 'middle', + tooltip: '琛ㄦ牸鐨勫唴杈硅窛锛屼粠澶у埌灏忎緷娆¢�掑噺銆�', + required: false, + options: [ + {value: 'default', label: '澶�'}, + {value: 'middle', label: '涓�'}, + {value: 'small', label: '灏�'}, + {value: 'mini', label: '杩蜂綘'}, + ] + }, + { + type: 'radio', + field: 'mode', + label: '妯″紡', + initval: wrap.mode || 'default', + required: false, + options: [ + {value: 'default', label: '甯歌'}, + {value: 'ghost', label: '閫忔槑'}, + ] + }, + { + type: 'radio', + field: 'selected', + label: '棣栬閫変腑', + initval: wrap.selected || 'false', + tooltip: '褰撴寜閽墽琛屽畬鎴愬苟杩斿洖涓婚敭鍊兼椂锛岄粯璁ら�変腑涓婚敭鍊煎搴旇銆�', + required: false, + options: [ + {value: 'false', label: '鏃�'}, + {value: 'init', label: '鍒濆鍖�'}, + {value: 'always', label: '鏁版嵁鍔犺浇'}, + ] + }, + // { + // type: 'radio', + // field: 'show', + // label: '鎼滅储鎸夐挳', + // initval: wrap.show || 'true', + // tooltip: '鎼滅储鏉′欢瀛樺湪鏃讹紝鍙�夋嫨鏄惁鏄剧ず鎼滅储鎸夐挳銆�', + // required: false, + // options: [ + // {value: 'true', label: '鏄剧ず'}, + // {value: 'false', label: '闅愯棌'}, + // ] + // }, + { + type: 'color', + field: 'borderColor', + label: '杈规棰滆壊', + initval: wrap.borderColor || '#e8e8e8', + tooltip: '榛樿鍊� #e8e8e8銆�', + required: false + }, + // { + // type: 'color', + // field: 'color', + // label: '瀛椾綋棰滆壊', + // initval: wrap.color || 'rgba(0, 0, 0, 0.65)', + // tooltip: '榛樿鍊� rgba(0, 0, 0, 0.65)銆�', + // required: false + // }, + // { + // type: 'number', + // field: 'fontSize', + // label: '瀛椾綋澶у皬', + // initval: wrap.fontSize || 14, + // min: 12, + // max: 30, + // precision: 0, + // required: false + // }, + // { + // type: 'number', + // field: 'advanceWidth', + // label: '楂樼骇鎼滅储', + // initval: wrap.advanceWidth || 1000, + // tooltip: '楂樼骇鎼滅储寮圭獥鐨勫搴︼紝娉細褰撳搴﹀�煎皬浜�100鏃惰〃绀哄崰绐楀彛鐨勭櫨鍒嗘瘮锛屽ぇ浜�100鏃惰〃绀哄搴︾殑缁濆鍊笺��', + // min: 10, + // max: 3000, + // precision: 0, + // required: false, + // forbid: appType === 'mob' + // }, + { + type: 'select', + field: 'doubleClick', + label: '鍙屽嚮浜嬩欢', + initval: wrap.doubleClick || '', + tooltip: '鍙屽嚮琛ㄦ牸涓锛岃Е鍙戠殑鎸夐挳銆�', + required: false, + allowClear: true, + options: action.map(item => ({value: item.uuid, label: item.label})), + forbid: appType === 'mob' + }, + { + type: 'select', + field: 'controlField', + label: '绂佺敤瀛楁', + initval: wrap.controlField || '', + tooltip: '鐢ㄤ簬鎺у埗琛屾暟鎹槸鍚﹀彲閫夋嫨銆�', + required: false, + allowClear: true, + options: columns, + controlFields: [ + {field: 'controlVal', notNull: true}, + ] + }, + { + type: 'text', + field: 'controlVal', + label: '绂佺敤鍊�', + initval: wrap.controlVal || '', + tooltip: '褰撳瓧娈靛�间笌绂佺敤鍊肩浉绛夋椂锛岃鏁版嵁浼氱鐢紝澶氫釜鍊肩敤閫楀彿鍒嗛殧銆�', + required: false + }, + { + type: 'radio', + field: 'empty', + label: '绌哄�奸殣钘�', + initval: wrap.empty || 'show', + tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', + required: false, + options: [ + {value: 'show', label: '鍚�'}, + {value: 'hidden', label: '鏄�'}, + ], + }, + { + type: 'radio', + field: 'supKey', + label: '涓婄骇涓婚敭', + initval: wrap.supKey || 'true', + tooltip: '褰撹缃笂绾х粍浠舵椂锛屼笂绾т富閿�间负绌烘槸鍚﹁繘琛屾暟鎹煡璇€��', + required: false, + options: [ + {value: 'true', label: '楠岃瘉'}, + {value: 'false', label: '蹇界暐'}, + ], + }, + { + type: 'radio', + field: 'permission', + label: '鏉冮檺楠岃瘉', + initval: wrap.permission || 'false', + required: false, + options: [ + {value: 'true', label: '鍚敤'}, + {value: 'false', label: '绂佺敤'}, + ], + forbid: !appType + }, + { + type: 'multiselect', + field: 'blacklist', + label: '榛戝悕鍗�', + initval: wrap.blacklist || [], + required: false, + options: roleList, + forbid: !!appType + }, + ] + + return wrapForm +} \ No newline at end of file diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx index adbb88b..06fefad 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx @@ -384,7 +384,7 @@ precision: 0, label: Formdict['header.form.decimal'], initVal: card.decimal || 0, - required: true + required: false }, { type: 'number', @@ -409,7 +409,7 @@ initVal: card.format || 'none', options: [{ value: 'none', - text: Formdict['model.empty'] + text: '鏃�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' @@ -429,7 +429,10 @@ initVal: card.textFormat || 'none', options: [{ value: 'none', - text: Formdict['model.empty'] + text: '鏃�' + }, { + value: 'encryption', + text: '鍔犲瘑' }, { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 67057c7..870e23a 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -69,9 +69,10 @@ } <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + {column.type === 'action' ? <PasteComponent options={['action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } </div> } trigger="hover"> {children} @@ -340,27 +341,25 @@ editStyleCard: fromJS(col).toJS() }) - MKEmitter.emit('changeStyle', [col.uuid], ['font', 'padding'], col.style || {}) + MKEmitter.emit('changeStyle', ['font', 'padding'], col.style || {}, this.getStyle) } changeSubmitStyle = () => { const { config } = this.props - MKEmitter.emit('changeStyle', [config.uuid, 'submit'], ['font', 'background', 'border', 'margin', 'padding'], config.submit.style || {}) + MKEmitter.emit('changeStyle', ['font', 'background', 'border', 'margin', 'padding'], config.submit.style || {}, this.getSubmitStyle) } - getStyle = (comIds, style) => { + getSubmitStyle = (style) => { const { config } = this.props + + let submit = {...config.submit, style} + + this.props.updatecolumn({...config, submit: submit}) + } + + getStyle = (style) => { const { editStyleCard } = this.state - - if (comIds.length === 2 && comIds[0] === config.uuid && comIds[1] === 'submit') { - let submit = {...config.submit, style} - - this.props.updatecolumn({...config, submit: submit}) - - return - } - if (comIds.length !== 1 || !editStyleCard || comIds[0] !== editStyleCard.uuid) return let _card = {...editStyleCard, style} diff --git a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx index 03bcb2d..0d6e3ec 100644 --- a/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx +++ b/src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx @@ -37,7 +37,7 @@ fields.push('jskey') let _sql = `Declare @${btn.sheet} table (${usefulfields.map(item => item.field + ' ' + item.type).join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50)) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) + Declare @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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='' ` @@ -172,7 +172,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx index 6b858aa..26803be 100644 --- a/src/menu/components/table/edit-table/index.jsx +++ b/src/menu/components/table/edit-table/index.jsx @@ -126,7 +126,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitModal', this.handleSave) MKEmitter.addListener('completeSave', this.completeSave) } @@ -142,7 +141,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitModal', this.handleSave) MKEmitter.removeListener('completeSave', this.completeSave) } @@ -170,13 +168,13 @@ if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� card.errors = [] - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -194,14 +192,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } }) @@ -212,14 +210,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } }) @@ -257,13 +255,11 @@ style.fontSize = card.wrap.fontSize || 14 style.fontWeight = card.wrap.fontWeight || 'normal' - MKEmitter.emit('changeStyle', [card.uuid], ['font1', 'background', 'border', 'padding', 'margin', 'shadow'], style) + MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow'], style, this.getStyle) } - getStyle = (comIds, style) => { + getStyle = (style) => { const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length !== 1) return let _card = fromJS(card).toJS() let _style = fromJS(style).toJS() @@ -406,7 +402,7 @@ let _style = resetStyle(card.style) return ( - <div className="menu-normal-table-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> + <div className="menu-editable-table-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> diff --git a/src/menu/components/table/edit-table/index.scss b/src/menu/components/table/edit-table/index.scss index f933a19..0991fb4 100644 --- a/src/menu/components/table/edit-table/index.scss +++ b/src/menu/components/table/edit-table/index.scss @@ -1,4 +1,4 @@ -.menu-normal-table-edit-box { +.menu-editable-table-edit-box { position: relative; box-sizing: border-box; background: #ffffff; @@ -11,9 +11,6 @@ padding: 10px 0px 15px; min-height: 65px; border-bottom: 1px solid #f0f0f0; - >.anticon-question-circle { - display: none; - } .page-card { background: transparent; } @@ -34,7 +31,22 @@ } } .model-table-search-list.length0 { - display: none; + min-height: 10px; + border-bottom: 0; + >.quickly-add { + right: unset; + left: -8px; + bottom: 0; + } + >.ant-row { + display: none; + } + >.ant-switch { + display: none; + } + } + .model-table-search-list.length0 + .length0 { + margin-top: -25px; } .anticon-tool { position: absolute; @@ -49,7 +61,6 @@ .model-menu-action-list { line-height: 55px; padding: 0px; - min-height: 55px; >.ant-row { min-height: 30px; } @@ -69,12 +80,12 @@ padding: 0; } } -.menu-normal-table-edit-box::after { +.menu-editable-table-edit-box::after { display: block; content: ' '; clear: both; } -.menu-normal-table-edit-box:hover { +.menu-editable-table-edit-box:hover { z-index: 1; box-shadow: 0px 0px 4px #1890ff; } diff --git a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx index 0c76b5f..937165d 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/formconfig.jsx @@ -217,7 +217,7 @@ decimal: 0, label: Formdict['header.form.decimal'], initVal: card.decimal || 0, - required: true + required: false }, { type: 'select', @@ -226,7 +226,7 @@ initVal: card.format || 'none', options: [{ value: 'none', - text: Formdict['model.empty'] + text: '鏃�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' @@ -246,7 +246,10 @@ initVal: card.textFormat || 'none', options: [{ value: 'none', - text: Formdict['model.empty'] + text: '鏃�' + }, { + value: 'encryption', + text: '鍔犲瘑' }, { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' @@ -273,6 +276,17 @@ readonly: false }, { + type: 'number', + key: 'span', + min: 1, + max: 24, + precision: 0, + label: '鍥剧墖瀹藉害', + initVal: card.span || 24, + tooltip: '鏍呮牸甯冨眬锛岀瓑鍒嗕负24浠姐��', + required: true + }, + { type: 'select', key: 'lenWidRadio', label: '闀垮姣�', @@ -296,27 +310,6 @@ { value: '2:3', text: '2:3' }, { value: '9:16', text: '9:16' }, ] - }, - { - type: 'radio', - key: 'picSort', - label: '鍥剧墖鎺掑垪', - initVal: card.picSort || '1', - tooltip: '鍚屼竴鍗曞厓鏍煎唴锛屽惈鏈夊寮犲浘鐗囨椂鐨勫垪鏁般��', - required: false, - options: [{ - value: '1', - text: '1' - }, { - value: '2', - text: '2' - }, { - value: '3', - text: '3' - }, { - value: '4', - text: '4' - }] }, { type: 'radio', diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index 5a41606..907ebb2 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -14,7 +14,7 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'picSort'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'span'], colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], action: ['label', 'type', 'Align', 'Width'], @@ -380,7 +380,7 @@ <Modal title="鏄剧ず鍒楃紪杈�" visible={visible} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index d22150a..e4c9a64 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -64,9 +64,10 @@ } <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> {column && column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} + {column && column.type === 'action' ? <PasteComponent options={['action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} {column && column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null} <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } </div> } trigger="hover"> {children} @@ -84,7 +85,7 @@ <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} /> {column.type === 'custom' ? <PasteComponent options={['customCardElement']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null} <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} /> - {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn field={column.field || ''} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } </div> } trigger="hover"> {children} @@ -377,13 +378,11 @@ editStyleCard: fromJS(col).toJS() }) - MKEmitter.emit('changeStyle', [col.uuid], ['font', 'padding'], col.style || {}) + MKEmitter.emit('changeStyle', ['font', 'padding'], col.style || {}, this.getStyle) } - getStyle = (comIds, style) => { + getStyle = (style) => { const { editStyleCard } = this.state - - if (!editStyleCard || comIds[0] !== editStyleCard.uuid || comIds.length !== 1) return let _card = {...editStyleCard, style} @@ -559,10 +558,6 @@ }) } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ @@ -570,7 +565,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } render() { diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index 0ba1305..480a7db 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -143,7 +143,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitModal', this.handleSave) // MKEmitter.addListener('logButton', this.logButton) MKEmitter.addListener('completeSave', this.completeSave) @@ -160,7 +159,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitModal', this.handleSave) // MKEmitter.removeListener('logButton', this.logButton) MKEmitter.removeListener('completeSave', this.completeSave) @@ -208,14 +206,14 @@ if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� card.errors = [] - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let doubleClick = card.wrap.doubleClick || '' let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -233,14 +231,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (doubleClick === cell.uuid) { @@ -254,14 +252,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } if (doubleClick === cell.uuid) { @@ -319,13 +317,11 @@ style.fontSize = card.wrap.fontSize || 14 style.fontWeight = card.wrap.fontWeight || 'normal' - MKEmitter.emit('changeStyle', [card.uuid], ['font1', 'background', 'border', 'padding', 'margin', 'shadow'], style) + MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow'], style, this.getStyle) } - getStyle = (comIds, style) => { + getStyle = (style) => { const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length !== 1) return let _card = fromJS(card).toJS() let _style = fromJS(style).toJS() diff --git a/src/menu/components/table/normal-table/index.scss b/src/menu/components/table/normal-table/index.scss index f933a19..b558c2a 100644 --- a/src/menu/components/table/normal-table/index.scss +++ b/src/menu/components/table/normal-table/index.scss @@ -11,9 +11,6 @@ padding: 10px 0px 15px; min-height: 65px; border-bottom: 1px solid #f0f0f0; - >.anticon-question-circle { - display: none; - } .page-card { background: transparent; } @@ -34,7 +31,22 @@ } } .model-table-search-list.length0 { - display: none; + min-height: 10px; + border-bottom: 0; + >.quickly-add { + right: unset; + left: -8px; + bottom: 0; + } + >.ant-row { + display: none; + } + >.ant-switch { + display: none; + } + } + .model-table-search-list.length0 + .length0 { + margin-top: -25px; } .anticon-tool { position: absolute; diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index fbcfe24..a272815 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -75,7 +75,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitSearch', this.getSearch) MKEmitter.addListener('tabsChange', this.handleTabsChange) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) @@ -88,7 +87,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitSearch', this.getSearch) MKEmitter.removeListener('tabsChange', this.handleTabsChange) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) @@ -130,15 +128,11 @@ changeStyle = () => { const { tabs } = this.state - MKEmitter.emit('changeStyle', [tabs.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style, this.getStyle) } - getStyle = (comIds, style) => { - const { tabs } = this.state - - if (comIds.length !== 1 || comIds[0] !== tabs.uuid) return - - let _card = {...tabs, style} + getStyle = (style) => { + let _card = {...this.state.tabs, style} this.setState({ tabs: _card diff --git a/src/menu/components/timeline/normal-timeline/index.jsx b/src/menu/components/timeline/normal-timeline/index.jsx index d11aa93..87c2fe4 100644 --- a/src/menu/components/timeline/normal-timeline/index.jsx +++ b/src/menu/components/timeline/normal-timeline/index.jsx @@ -50,6 +50,7 @@ setting: { interType: 'system' }, wrap: { title: '', name: card.name, direction: 'vertical', width: card.width || 24, color: '#1890ff', mode: 'left' }, style: { marginLeft: '0px', marginRight: '0px', marginTop: '0px', marginBottom: '0px' }, + headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' }, subcards: [{ uuid: Utils.getuuid(), setting: { width: 24, type: 'simple'}, @@ -91,10 +92,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -106,7 +103,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -118,12 +114,12 @@ if (!window.GLOB.styling || !card.errors) { // 鏍峰紡淇敼鏃朵笉鍋氱瓫鏌� card.errors = [] - let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' - if (supModule === 'empty') { - supModule = '' - } + // let supModule = card.setting.supModule ? card.setting.supModule[card.setting.supModule.length - 1] || '' : '' + // if (supModule === 'empty') { + // supModule = '' + // } let columns = card.columns.map(c => c.field) - let lowcols = card.columns.map(c => c.field.toLowerCase()) + // let lowcols = card.columns.map(c => c.field.toLowerCase()) if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) { card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'}) @@ -143,14 +139,14 @@ if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) { if (!cell.modal || cell.modal.fields.length === 0) { card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`}) - } else { - cell.modal.fields.forEach(m => { - if (m.type === 'linkMain' && !supModule) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) - } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { - card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) - } - }) + // } else { + // cell.modal.fields.forEach(m => { + // if (m.type === 'linkMain' && !supModule) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑鍏宠仈涓昏〃琛ㄥ崟鈥�${m.label}鈥濇棤鏁坄}) + // } else if (m.field && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) { + // card.errors.push({ level: 1, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟鈥�${m.label}鈥濆ぇ灏忓啓涓庡瓧娈甸泦涓嶄竴鑷碻}) + // } + // }) } } } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) { @@ -181,15 +177,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/components/tree/antd-tree/index.jsx b/src/menu/components/tree/antd-tree/index.jsx index 0619ac9..0c5d16e 100644 --- a/src/menu/components/tree/antd-tree/index.jsx +++ b/src/menu/components/tree/antd-tree/index.jsx @@ -78,10 +78,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -93,7 +89,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -133,15 +128,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid || comIds.length !== 1) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index e692605..df624b3 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -588,14 +588,12 @@ let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, timestamp) - if (r.error) { + if (r.errors) { notification.warning({ top: 92, - message: r.error, + message: r.errors, duration: 5 }) - reject() - return } let param = { @@ -619,10 +617,10 @@ sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { if (sumParam) { - Api.getLocalConfig(sumParam).then(res => { + Api.genericInterface(sumParam).then(res => { if (res.status) { resolve() } else { diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 9f89d35..cc9c58e 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -27,6 +27,7 @@ modules: [], usefulFields: [], useMSearch: this.props.setting.useMSearch || 'false', + sysInterface: this.props.setting.sysInterface || 'false', supModule: this.props.setting.supModule || [], appType: sessionStorage.getItem('appType') } @@ -141,10 +142,13 @@ }) } } - + onSysInter = (e) => { let value = e.target.value - + + this.setState({ + sysInterface: value + }) if (value === 'true') { this.props.form.setFieldsValue({interface: window.GLOB.mainSystemApi}) } @@ -157,7 +161,7 @@ render() { const { setting, columns, config } = this.props const { getFieldDecorator } = this.props.form - const { interType, modules, useMSearch, laypage, supModule, usefulFields, appType } = this.state + const { interType, modules, useMSearch, laypage, supModule, usefulFields, appType, sysInterface } = this.state const formItemLayout = { labelCol: { @@ -226,7 +230,13 @@ {interType === 'outer' ? <Col span={8}> <Form.Item label="绯荤粺鎺ュ彛"> {getFieldDecorator('sysInterface', { - initialValue: setting.sysInterface || 'false' + initialValue: sysInterface, + rules: [ + { + required: true, + message: '璇烽�夋嫨鏄惁浣跨敤绯荤粺鎺ュ彛!' + } + ] })( <Radio.Group onChange={this.onSysInter}> <Radio value="true">鏄�</Radio> @@ -256,17 +266,17 @@ {interType === 'outer' ? <Col className="outer-interface" span={24}> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { - initialValue: setting.interface || '', + initialValue: setting.interface || (sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), rules: [ { - required: true, + required: sysInterface !== 'true' ? true : false, message: this.props.dict['form.required.input'] + '鎺ュ彛鍦板潃!' } ] - })(<TextArea rows={2}/>)} + })(<TextArea rows={2} readOnly={sysInterface === 'true'}/>)} </Form.Item> </Col> : null} - {interType === 'outer' ? <Col className="outer-interface" span={24}> + {interType === 'outer' && sysInterface !== 'true' ? <Col className="outer-interface" span={24}> <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃"> <QuestionCircleOutlined className="mk-form-tip" /> 姝e紡鍦板潃 diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index 7dc431d..38cfddf 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -40,8 +40,8 @@ // error = '绯荤粺鍑芥暟' + _customScript.match(/\$ex@.{1,50}@ex\$/g)[0].replace(/\$ex@|@ex\$/g, '') + '鏈畾涔�' // } - _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) - _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) + _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`) + _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') @@ -54,7 +54,7 @@ _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } @@ -170,11 +170,11 @@ ${_sql} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' ` } else { sumSql = `/* sql sum楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_sql}` } } @@ -198,16 +198,34 @@ ${_dataresource} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' ` } else { sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_dataresource}` } sql = sql.replace(/\n\s{8}/ig, '\n') console.info(sql) + + let errors = [] + + if (/@[0-9a-zA-Z_]+@/ig.test(sql)) { + let arr = sql.match(/@[0-9a-zA-Z_]+@/ig) + + arr.forEach(item => { + let reg = new RegExp(item, 'ig') + if (reg.test(_dataresource)) { + errors.push(`鏁版嵁婧愪腑瀛樺湪鏈浛鎹㈠��${item}`) + } + scripts && scripts.forEach(script => { + if (reg.test(script.sql)) { + errors.push(`鑷畾涔夎剼鏈�(${script.$index})瀛樺湪鏈浛鎹㈠��${item}`) + } + }) + }) + } if (sumSql) { sumSql = sumSql.replace(/\n\s{10}/ig, '\n') @@ -215,6 +233,6 @@ console.info(sumSql) } - return { error, sql, sumSql } + return { error, sql, sumSql, errors: errors.join('锛�') } } } \ No newline at end of file diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 89d315a..abc8389 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -288,7 +288,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/menu/modalconfig/index.scss b/src/menu/modalconfig/index.scss index 814f0fc..e0dcc61 100644 --- a/src/menu/modalconfig/index.scss +++ b/src/menu/modalconfig/index.scss @@ -55,41 +55,6 @@ } } } - .tables { - .ant-select-selection-selected-value { - opacity: 0.4!important; - } - } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } } .tools::-webkit-scrollbar { width: 4px; diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index 9f41000..ec99c44 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -247,7 +247,7 @@ <div style={{display: 'inline-block'}}> <Button className="mk-border-purple" onClick={this.trigger}><PictureOutlined /> 璧勬簮绠$悊</Button> <Modal - title="绮樿创" + title="璧勬簮绠$悊" wrapClassName="picture-control-model" visible={visible} width={1200} diff --git a/src/menu/picturecontroller/index.scss b/src/menu/picturecontroller/index.scss index c059029..5cf5400 100644 --- a/src/menu/picturecontroller/index.scss +++ b/src/menu/picturecontroller/index.scss @@ -4,7 +4,7 @@ .ant-modal-body { max-height: calc(100vh - 120px); min-height: 510px; - padding-top: 5px; + padding: 10px 5px 24px; } } .ant-tabs-tabpane { diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx index a98c24b..b2bb476 100644 --- a/src/menu/stylecontroller/index.jsx +++ b/src/menu/stylecontroller/index.jsx @@ -51,11 +51,12 @@ state = { card: null, fonts: null, - comIds: [], backgroundImage: '', options: [], borposition: 'outer' } + + callback = null shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) @@ -75,7 +76,7 @@ MKEmitter.removeListener('changeStyle', this.initStyle) } - initStyle = (comIds, options, style = {}) => { + initStyle = (options, style = {}, callback) => { let backgroundImage = '' if (style.backgroundImage && /^url/ig.test(style.backgroundImage)) { backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '') @@ -95,10 +96,11 @@ } } + this.callback = callback + this.setState({ visible: true, fonts: fonts, - comIds: comIds, card: fromJS(style).toJS(), options: options, borposition: 'outer', @@ -134,21 +136,21 @@ } if (check) { - MKEmitter.emit('submitStyle', this.state.comIds, card) + this.callback && this.callback(card) } this.setState({ visible: false, - comIds: [], card: null, options: [], backgroundImage: '' }) window.GLOB.styling = false + this.callback = null } updateStyle = (style) => { - const { comIds, card } = this.state + const { card } = this.state let _style = { ...card, @@ -159,7 +161,7 @@ card: _style, }) - MKEmitter.emit('submitStyle', comIds, _style) + this.callback && this.callback(_style) } /** @@ -262,7 +264,7 @@ } changeBackground = (val) => { - const { comIds, card } = this.state + const { card } = this.state let _style = { ...card } @@ -280,7 +282,7 @@ }) if (!val || /(^linear-gradient|^radial-gradient)\(.*\)$/.test(val)) { - MKEmitter.emit('submitStyle', comIds, _style) + this.callback && this.callback(_style) } } diff --git a/src/menu/sysinterface/settingform/simplescript/index.jsx b/src/menu/sysinterface/settingform/simplescript/index.jsx index 5392bbd..9f13e66 100644 --- a/src/menu/sysinterface/settingform/simplescript/index.jsx +++ b/src/menu/sysinterface/settingform/simplescript/index.jsx @@ -259,7 +259,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ loading: false, diff --git a/src/menu/sysinterface/settingform/utils.jsx b/src/menu/sysinterface/settingform/utils.jsx index 60d5574..c532c3f 100644 --- a/src/menu/sysinterface/settingform/utils.jsx +++ b/src/menu/sysinterface/settingform/utils.jsx @@ -17,7 +17,7 @@ }) if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } diff --git a/src/menu/tableshell/card.jsx b/src/menu/tableshell/card.jsx new file mode 100644 index 0000000..aa6116e --- /dev/null +++ b/src/menu/tableshell/card.jsx @@ -0,0 +1,56 @@ +import React from 'react' +import { useDrag, useDrop } from 'react-dnd' + +import asyncComponent from '@/utils/asyncComponent' +import './index.scss' + +const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs')) +const BaseTable = asyncComponent(() => import('@/menu/components/table/base-table')) + +const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { + const originalIndex = findCard(id).index + const [{ isDragging }, drag] = useDrag({ + item: { type: 'menu', id, originalIndex }, + collect: monitor => ({ + isDragging: monitor.isDragging(), + }), + }) + const [, drop] = useDrop({ + accept: 'menu', + canDrop: () => true, + drop: (item) => { + const { id: draggedId, originalIndex } = item + if (originalIndex === undefined) { + item.dropTargetId = id + } else if (draggedId) { + if (draggedId === id) return + const { index: originIndex } = findCard(draggedId) + + if (originIndex === -1) return + + const { index: overIndex } = findCard(id) + + moveCard(draggedId, overIndex) + } + } + }) + + let style = { opacity: 1} + if (isDragging) { + style = { opacity: 0.3} + } + + const getCardComponent = () => { + if (card.type === 'table') { + return (<BaseTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } else if (card.type === 'tabs') { + return (<AntvTabs tabs={card} updateConfig={updateConfig} deletecomponent={delCard}/>) + } + } + return ( + <div className={'ant-col mk-component-card ant-col-' + (card.width || 24)} ref={node => drag(drop(node))} style={style}> + {getCardComponent()} + </div> + ) +} +export default Card diff --git a/src/menu/tableshell/index.jsx b/src/menu/tableshell/index.jsx new file mode 100644 index 0000000..0346d43 --- /dev/null +++ b/src/menu/tableshell/index.jsx @@ -0,0 +1,132 @@ +import React, { useState } from 'react' +import { useDrop } from 'react-dnd' +import update from 'immutability-helper' +import { Modal } from 'antd' + +import Utils from '@/utils/utils.js' +import Card from './card' +import './index.scss' + +const { confirm } = Modal + +const Container = ({menu, handleList }) => { + const [cards, setCards] = useState(menu.components) + const moveCard = (id, atIndex) => { + const { card, index } = findCard(id) + const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] }) + handleList({...menu, components: _cards}) + setCards(_cards) + } + + if (menu.components.length > cards.length) { + setCards(menu.components) + } + + const findCard = id => { + const card = cards.filter(c => `${c.uuid}` === id)[0] + return { + card, + index: cards.indexOf(card), + } + } + + const updateConfig = (element) => { + const _cards = cards.map(item => item.uuid === element.uuid ? element : item) + handleList({...menu, components: _cards}) + setCards(_cards) + } + + const deleteCard = (id) => { + const { card } = findCard(id) + + let hasComponent = false + if (card.type === 'tabs') { + card.subtabs.forEach(tab => { + if (tab.components.length > 0) { + hasComponent = true + } + }) + } + + confirm({ + title: `纭畾鍒犻櫎銆�${card.name}銆嬪悧锛焋, + content: hasComponent ? '褰撳墠缁勪欢涓惈鏈夊瓙缁勪欢锛�' : '', + onOk() { + const _cards = cards.filter(item => item.uuid !== card.uuid) + handleList({...menu, components: _cards}) + setCards(_cards) + }, + onCancel() {} + }) + } + + const [, drop] = useDrop({ + accept: 'menu', + drop(item) { + if (item.hasOwnProperty('originalIndex') || item.added) { + delete item.added // 鍒犻櫎缁勪欢娣诲姞鏍囪 + return + } + + let name = '' + let names = { + tabs: '鏍囩缁�' + } + let i = 1 + + while (!name && names[item.component]) { + let _name = names[item.component] + i + if (menu.components.filter(com => com.name === _name).length === 0) { + name = _name + } + i++ + } + + let newcard = { + uuid: Utils.getuuid(), + type: item.component, + subtype: item.subtype, + config: item.config, + width: item.width || 24, + dataName: Utils.getdataName(), + name: name, + floor: 1, // 缁勪欢鐨勫眰绾� + isNew: true // 鏂版坊鍔犳爣蹇楋紝鐢ㄤ簬鍒濆鍖� + } + + 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({...menu, components: _cards}) + setCards(_cards) + } + }) + + return ( + <div ref={drop} className="table-shell-inner" style={menu.style}> + <div className="ant-row"> + {cards.map(card => ( + <Card + id={card.uuid} + key={card.uuid} + card={card} + moveCard={moveCard} + delCard={deleteCard} + findCard={findCard} + updateConfig={updateConfig} + /> + ))} + </div> + </div> + ) +} +export default Container diff --git a/src/menu/tableshell/index.scss b/src/menu/tableshell/index.scss new file mode 100644 index 0000000..700e55d --- /dev/null +++ b/src/menu/tableshell/index.scss @@ -0,0 +1,21 @@ +.table-shell-inner { + min-height: calc(100vh - 100px); + width: auto!important; + overflow-x: hidden; + background-size: 100%; + + .anticon { + cursor: unset; + } + + .mk-component-card { + position: relative; + } + + .anticon-tool { + color: rgba(0, 0, 0, 0.55); + } + .anticon-tool:hover { + color: #1890ff; + } +} \ No newline at end of file diff --git a/src/mob/components/formdragelement/card.jsx b/src/mob/components/formdragelement/card.jsx index d248a84..2fc4c8f 100644 --- a/src/mob/components/formdragelement/card.jsx +++ b/src/mob/components/formdragelement/card.jsx @@ -12,7 +12,7 @@ const CheckCard = asyncComponent(() => import('@/templates/modalconfig/checkCard')) -const Card = ({ id, card, moveCard, findCard, editCard, closeCard, copyCard, showField }) => { +const Card = ({ id, card, moveCard, findCard, editCard, closeCard, copyCard, showField, setStyle }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: 'form', id, originalIndex }, @@ -59,7 +59,7 @@ style.marginBottom = card.marginBottom } - MKEmitter.emit('changeStyle', ['form', card.uuid], options, style) + MKEmitter.emit('changeStyle', options, style, (s) => {setStyle(s, id)}) } let selectval = '' diff --git a/src/mob/components/formdragelement/index.jsx b/src/mob/components/formdragelement/index.jsx index 7ff6d39..2494505 100644 --- a/src/mob/components/formdragelement/index.jsx +++ b/src/mob/components/formdragelement/index.jsx @@ -42,6 +42,14 @@ closeForm(card) } + const setStyle = (style, id) => { + const { card, index } = findCard(id) + + const _cards = update(cards, { $splice: [[index, 1, {...card, style}]] }) + + handleList(_cards) + } + const copyCard = id => { const { card, index: overIndex } = findCard(id) @@ -138,6 +146,7 @@ showField={showField} moveCard={moveCard} editCard={editCard} + setStyle={setStyle} closeCard={closeCard} copyCard={copyCard} findCard={findCard} diff --git a/src/mob/components/menubar/common-menubar/index.jsx b/src/mob/components/menubar/common-menubar/index.jsx index d3db159..0c8e7d0 100644 --- a/src/mob/components/menubar/common-menubar/index.jsx +++ b/src/mob/components/menubar/common-menubar/index.jsx @@ -71,10 +71,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -86,7 +82,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -106,15 +101,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.setState({ card: _card diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx index 53d4e1f..796d173 100644 --- a/src/mob/components/menubar/normal-menubar/index.jsx +++ b/src/mob/components/menubar/normal-menubar/index.jsx @@ -88,10 +88,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -103,7 +99,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -170,15 +165,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.setState({ card: _card diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx index 3c28d9f..53aa073 100644 --- a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx +++ b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx @@ -36,10 +36,6 @@ }) } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -51,14 +47,10 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } - getStyle = (comIds, style) => { - const { cards } = this.props + getStyle = (style) => { const { card } = this.state - - if (comIds.length !== 2 || comIds[0] !== cards.uuid || comIds[1] !== card.uuid) return let _card = fromJS(card).toJS() _card.style = style @@ -71,13 +63,12 @@ } changeStyle = () => { - const { cards } = this.props const { card } = this.state let _style = card.style ? fromJS(card.style).toJS() : {} let options = ['font', 'border', 'padding', 'margin', 'background'] - MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) + MKEmitter.emit('changeStyle', options, _style, this.getStyle) } getSettingForms = () => { diff --git a/src/mob/components/navbar/normal-navbar/index.jsx b/src/mob/components/navbar/normal-navbar/index.jsx index 8244a70..ab69d33 100644 --- a/src/mob/components/navbar/normal-navbar/index.jsx +++ b/src/mob/components/navbar/normal-navbar/index.jsx @@ -65,10 +65,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -80,7 +76,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -96,12 +91,8 @@ this.props.updateConfig(component) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.setState({ card: _card @@ -113,7 +104,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'border', 'padding', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['font', 'background', 'border', 'padding', 'shadow'], card.style, this.getStyle) } getWrapForms = () => { diff --git a/src/mob/components/search/single-search/index.jsx b/src/mob/components/search/single-search/index.jsx index bccac3f..11a0f10 100644 --- a/src/mob/components/search/single-search/index.jsx +++ b/src/mob/components/search/single-search/index.jsx @@ -61,10 +61,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -72,19 +68,14 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.setState({ card: _card @@ -96,7 +87,7 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle) } /** diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx index 1ddf66c..3800c62 100644 --- a/src/mob/components/tabs/antv-tabs/index.jsx +++ b/src/mob/components/tabs/antv-tabs/index.jsx @@ -80,7 +80,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitSearch', this.getSearch) MKEmitter.addListener('tabsChange', this.handleTabsChange) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) @@ -93,7 +92,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitSearch', this.getSearch) MKEmitter.removeListener('tabsChange', this.handleTabsChange) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) @@ -135,37 +133,33 @@ changeStyle = () => { const { tabs } = this.state - MKEmitter.emit('changeStyle', [tabs.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style) + MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow'], tabs.style, this.getStyle) } changeTabStyle = () => { const { tabs } = this.state - MKEmitter.emit('changeStyle', [tabs.uuid, 'tab'], ['font', 'padding'], tabs.tabStyle || {}) + MKEmitter.emit('changeStyle', ['font', 'padding'], tabs.tabStyle || {}, this.getTabStyle) } - getStyle = (comIds, style) => { - const { tabs } = this.state + getStyle = (style) => { + let _card = {...this.state.tabs, style} - if (comIds[0] !== tabs.uuid) return + this.setState({ + tabs: _card + }) + + this.props.updateConfig(_card) + } - if (comIds.length === 1) { - let _card = {...tabs, style} + getTabStyle = (style) => { + let _card = {...this.state.tabs, tabStyle: style} - this.setState({ - tabs: _card - }) - - this.props.updateConfig(_card) - } else if (comIds[1] === 'tab') { - let _card = {...tabs, tabStyle: style} - - this.setState({ - tabs: _card - }) - - this.props.updateConfig(_card) - } + this.setState({ + tabs: _card + }) + + this.props.updateConfig(_card) } handleTabsChange = (parentId) => { diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index 9579b7e..123fa23 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -64,7 +64,6 @@ } componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) MKEmitter.addListener('submitSearch', this.getSearch) } @@ -79,7 +78,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) MKEmitter.removeListener('submitSearch', this.getSearch) } @@ -94,20 +92,28 @@ this.props.updateConfig(component) } - getStyle = (comIds, style) => { - const { card } = this.state + getStyle = (style) => { + let _card = {...this.state.card, style} - if (comIds[0] !== card.uuid) return + this.setState({ + card: _card + }) + + this.props.updateConfig(_card) + } - let _card = fromJS(card).toJS() + getSearchStyle = (style) => { + let _card = {...this.state.card, searchStyle: style} - if (comIds[1] === 'search') { - _card.searchStyle = style - } else if (comIds[1] === 'title') { - _card.titleStyle = style - } else { - _card.style = style - } + this.setState({ + card: _card + }) + + this.props.updateConfig(_card) + } + + getTitleStyle = (style) => { + let _card = {...this.state.card, titleStyle: style} this.setState({ card: _card @@ -119,19 +125,19 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'border', 'padding', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['font', 'background', 'border', 'padding', 'shadow'], card.style, this.getStyle) } changeTitleStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid, 'title'], ['font'], card.titleStyle || {}) + MKEmitter.emit('changeStyle', ['font'], card.titleStyle || {}, this.getTitleStyle) } changeSearchStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid, 'search'], ['font', 'background', 'border'], card.searchStyle || {}) + MKEmitter.emit('changeStyle', ['font', 'background', 'border'], card.searchStyle || {}, this.getSearchStyle) } clickComponent = (e) => { diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx index 2bc3d6c..2476590 100644 --- a/src/mob/modalconfig/index.jsx +++ b/src/mob/modalconfig/index.jsx @@ -287,7 +287,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/mob/modalconfig/index.scss b/src/mob/modalconfig/index.scss index d9c2725..d4fbaa9 100644 --- a/src/mob/modalconfig/index.scss +++ b/src/mob/modalconfig/index.scss @@ -57,41 +57,6 @@ } } } - .tables { - .ant-select-selection-selected-value { - opacity: 0.4!important; - } - } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } } .tools::-webkit-scrollbar { width: 4px; diff --git a/src/mob/searchconfig/index.jsx b/src/mob/searchconfig/index.jsx index a240a6c..ff9ea70 100644 --- a/src/mob/searchconfig/index.jsx +++ b/src/mob/searchconfig/index.jsx @@ -248,7 +248,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/mob/searchconfig/index.scss b/src/mob/searchconfig/index.scss index 9eb6275..de9d1a3 100644 --- a/src/mob/searchconfig/index.scss +++ b/src/mob/searchconfig/index.scss @@ -20,12 +20,7 @@ .ant-collapse-borderless { background-color: #ffffff; } - .ant-collapse-item { - border: 0; - } - .ant-input-search { - margin-top: 10px; - } + .ant-collapse-item.ant-collapse-item-active { border-bottom: 1px solid #d9d9d9; } @@ -57,56 +52,8 @@ } } } - .tables { - .ant-select-selection-selected-value { - opacity: 0.4!important; - } - } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } } - .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); - } + .modal-control { position: absolute; right: 0; @@ -343,7 +290,6 @@ background: rgba(0, 0, 0, 0); } } - .modal-fields { .ant-modal { diff --git a/src/pc/components/login/normal-login/index.jsx b/src/pc/components/login/normal-login/index.jsx index 226531c..cbcc124 100644 --- a/src/pc/components/login/normal-login/index.jsx +++ b/src/pc/components/login/normal-login/index.jsx @@ -81,10 +81,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -96,7 +92,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -122,15 +117,11 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['width', 'background', 'border', 'padding', 'margin'], card.style) + MKEmitter.emit('changeStyle', ['width', 'background', 'border', 'padding', 'margin'], card.style, this.getStyle) } - getStyle = (comIds, style) => { - const { card } = this.state - - if (comIds.length !== 1 || comIds[0] !== card.uuid) return - - let _card = {...card, style} + getStyle = (style) => { + let _card = {...this.state.card, style} this.updateComponent(_card) } diff --git a/src/pc/components/navbar/normal-navbar/index.jsx b/src/pc/components/navbar/normal-navbar/index.jsx index 7a3868e..18f8e48 100644 --- a/src/pc/components/navbar/normal-navbar/index.jsx +++ b/src/pc/components/navbar/normal-navbar/index.jsx @@ -63,10 +63,6 @@ } } - componentDidMount () { - MKEmitter.addListener('submitStyle', this.getStyle) - } - shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) } @@ -78,7 +74,6 @@ this.setState = () => { return } - MKEmitter.removeListener('submitStyle', this.getStyle) } /** @@ -94,17 +89,18 @@ this.props.updateConfig(component) } - getStyle = (comIds, style) => { - const { card } = this.state + getStyle = (style) => { + let _card = {...this.state.card, style} - if (comIds[0] !== card.uuid) return + this.setState({ + card: _card + }) + + this.props.updateConfig(_card) + } - let _card = {...card} - if (comIds.length === 1) { - _card = {...card, style} - } else if (comIds[1] === 'logo') { - _card = {...card, logoStyle: style} - } + getLogoStyle = (style) => { + let _card = {...this.state.card, logoStyle: style} this.setState({ card: _card @@ -116,13 +112,13 @@ changeStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid], ['font', 'background', 'shadow'], card.style) + MKEmitter.emit('changeStyle', ['font', 'background', 'shadow'], card.style, this.getStyle) } changeLogoStyle = () => { const { card } = this.state - MKEmitter.emit('changeStyle', [card.uuid, 'logo'], ['width', 'margin'], card.logoStyle) + MKEmitter.emit('changeStyle', ['width', 'margin'], card.logoStyle, this.getLogoStyle) } clickComponent = (e) => { diff --git a/src/router/index.js b/src/router/index.js index 2f4d669..d923557 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,15 +2,15 @@ import {HashRouter, Switch, Route, Redirect} from 'react-router-dom' import md5 from 'md5' import moment from 'moment' -import { styles } from '@/store/options.js' import asyncComponent from '@/utils/asyncComponent' import asyncLoadComponent from '@/utils/asyncLoadComponent' -const Pay = asyncLoadComponent(() => import('@/views/pay')) -const Sso = asyncLoadComponent(() => import('@/views/sso')) -const Main = asyncLoadComponent(() => import('@/views/main')) -const Design = asyncLoadComponent(() => import('@/views/design')) const Login = asyncLoadComponent(() => import('@/views/login')) +const Main = asyncLoadComponent(() => import('@/views/main')) +const Sso = asyncLoadComponent(() => import('@/views/sso')) +const Pay = asyncLoadComponent(() => import('@/views/pay')) +const MainParams = asyncLoadComponent(() => import('@/views/mainparams')) +const Design = asyncLoadComponent(() => import('@/views/design')) const NotFound = asyncComponent(() => import('@/views/404')) const AppManage = asyncLoadComponent(() => import('@/views/appmanage')) const AppCheck = asyncLoadComponent(() => import('@/views/appcheck')) @@ -20,6 +20,7 @@ const ImDesign = asyncLoadComponent(() => import('@/views/imdesign')) const MenuDesign = asyncLoadComponent(() => import('@/views/menudesign')) const BaseDesign = asyncLoadComponent(() => import('@/views/basedesign')) +const TableDesign = asyncLoadComponent(() => import('@/views/tabledesign')) const BillPrint = asyncLoadComponent(() => import('@/views/billprint')) const PrintT = asyncLoadComponent(() => import('@/views/printTemplate')) const Interface = asyncLoadComponent(() => import('@/views/interface')) @@ -28,10 +29,10 @@ const routers = [ {path: '/login', name: 'login', component: Login, auth: false}, + {path: '/main', name: 'main', component: Main, auth: true}, {path: '/pay/:param', name: 'pay', component: Pay, auth: false}, {path: '/print/:param', name: 'print', component: PrintT, auth: false}, {path: '/ssologin/:param', name: 'ssologin', component: Sso, auth: false}, - {path: '/main', name: 'main', component: Main, auth: true}, {path: '/design', name: 'design', component: Design, auth: true}, {path: '/appmanage', name: 'appmanage', component: AppManage, auth: true}, {path: '/appcheck', name: 'appcheck', component: AppCheck, auth: true}, @@ -40,11 +41,12 @@ {path: '/imdesign/:param', name: 'imdesign', component: ImDesign, auth: true}, {path: '/menudesign/:param', name: 'menudesign', component: MenuDesign, auth: true}, {path: '/basedesign/:param', name: 'basedesign', component: BaseDesign, auth: true}, + {path: '/tabledesign/:param', name: 'tabledesign', component: TableDesign, auth: true}, {path: '/popdesign/:param', name: 'popdesign', component: PopDesign, auth: true}, {path: '/billprint/:param', name: 'billprint', component: BillPrint, auth: true}, {path: '/docprint/:menuId', name: 'docprint', component: BillPrint, auth: false}, {path: '/docprint/:menuId/:id', name: 'docprint', component: BillPrint, auth: false}, - {path: '/paramsmain/:param', name: 'pmain', component: Main, auth: true}, + {path: '/tab/:menuId', name: 'tab', component: MainParams, auth: false}, {path: '/role/:param', name: 'role', component: RoleManage, auth: true}, {path: '/hs', name: 'hs', component: SystemFunc, auth: true}, {path: '/interface', name: 'interface', component: Interface, auth: true} @@ -52,44 +54,11 @@ export default class RouteConfig extends Component { controlRoute (item, props) { - if (!item.auth) { // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆 - return (<item.component {...props}/>) - } - - if (item.name === 'pmain') { // 鏂扮獥鍙f墦寮�锛屽彇url鍙傛暟鏀惧叆sessionStorage - try { - let _param = JSON.parse(window.decodeURIComponent(window.atob(props.match.params.param))) - - if (typeof(_param) === 'object') { - _param.UserID && sessionStorage.setItem('UserID', _param.UserID) - _param.LoginUID && sessionStorage.setItem('LoginUID', _param.LoginUID) - _param.User_Name && sessionStorage.setItem('User_Name', _param.User_Name) - _param.Full_Name && sessionStorage.setItem('Full_Name', _param.Full_Name) - _param.debug && sessionStorage.setItem('debug', _param.debug) - _param.dataM && sessionStorage.setItem('dataM', _param.dataM) - _param.dataM && sessionStorage.setItem('localDataM', _param.dataM) - _param.avatar && sessionStorage.setItem('avatar', _param.avatar) - _param.role_id && sessionStorage.setItem('role_id', _param.role_id) - _param.dataM && sessionStorage.setItem('localRole_id', _param.dataM) - _param.Member_Level && sessionStorage.setItem('Member_Level', _param.Member_Level) - _param.ThirdMenu && sessionStorage.setItem('ThirdMenu', _param.ThirdMenu) - - window.GLOB.mainlogo = _param.mainlogo || '' - window.GLOB.navBar = _param.navBar || '' - - if (_param.mstyle && styles[_param.mstyle]) { - document.body.className = styles[_param.mstyle] - } - } - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } - + if (!item.auth) { // 涓嶉渶瑕佹巿鏉冿紝鐩存帴璺宠浆 return (<item.component {...props}/>) } - let userId = sessionStorage.getItem('UserID') // 鍒ゆ柇鏄惁瀛樺湪userid - + let userId = sessionStorage.getItem('UserID') // 鍒ゆ柇鐧诲綍淇℃伅鏄惁瀛樺湪锛屾敞鐢ㄦ埛鍙兘淇濆瓨涓婚〉閾炬帴 let authCode = localStorage.getItem(window.location.href.split('#')[0] + 'AuthCode') // 鍒ゆ柇绯荤粺鏄惁鍦ㄦ巿鏉冩湡闄愬唴 let _s = md5('mksoft' + moment().format('YYYYMMDD')) let isauth = authCode && authCode.includes(_s) @@ -103,7 +72,6 @@ if (userId && isauth) { return (<item.component {...props}/>) } else { - // return (<Redirect to={{ pathname: '/login', state: {from: props.location}}}/>) return (<Redirect to={{ pathname: '/login'}}/>) } } diff --git a/src/store/reducer.js b/src/store/reducer.js index 15db885..4729c77 100644 --- a/src/store/reducer.js +++ b/src/store/reducer.js @@ -1,12 +1,7 @@ import * as Type from './action-type' let _mainMenu = null -let _url = window.location.href.split('#')[0] let _collapse = localStorage.getItem('collapse') === 'true' - -if (localStorage.getItem(_url + '-sideHidden') === 'true') { - _mainMenu = '' -} let defaultState = { menuTree: null, // 鑿滃崟缁撴瀯鏍� diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx new file mode 100644 index 0000000..14f6e16 --- /dev/null +++ b/src/tabviews/basetable/index.jsx @@ -0,0 +1,1287 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import {connect} from 'react-redux' +import { is, fromJS } from 'immutable' +import { notification, Spin, Tabs, Switch, Row, Col } from 'antd' + +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 UtilsDM from '@/utils/utils-datamanage.js' +import { updateCommonTable } from '@/utils/utils-update.js' +import asyncComponent from '@/utils/asyncComponent' +import asyncSpinComponent from '@/utils/asyncSpinComponent' +import MkIcon from '@/components/mk-icon' +import MKEmitter from '@/utils/events.js' +import NotFount from '@/components/404' +import './index.scss' + +// 閫氱敤缁勪欢 +const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) +const MainAction = asyncSpinComponent(() => import('@/tabviews/zshare/actionList')) +const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) +const SettingComponent = asyncComponent(() => import('@/tabviews/zshare/settingcomponent')) +const SubTable = asyncSpinComponent(() => import('@/tabviews/subtable')) +const CardComponent = asyncSpinComponent(() => import('@/tabviews/zshare/cardcomponent')) +const ChartComponent = asyncSpinComponent(() => import('@/tabviews/zshare/chartcomponent')) +const PagemsgComponent = asyncComponent(() => import('@/tabviews/zshare/pageMessage')) +const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic')) + +const { TabPane } = Tabs + +class NormalTable 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, + ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id + BID: null, // 椤甸潰璺宠浆鏃舵惡甯D + loadingview: true, // 椤甸潰鍔犺浇涓� + viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 + lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 + config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 + shortcuts: null, // 蹇嵎閿� + searchlist: null, // 鎼滅储鏉′欢 + actions: null, // 鎸夐挳闆� + columns: null, // 鏄剧ず鍒� + arr_field: '', // 鏌ヨ瀛楁闆� + setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 + data: [], // 鍒楄〃鏁版嵁闆� + selectedData: [], // 宸查�夎〃鏍兼暟鎹� + total: 0, // 鎬绘暟 + loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� + pageIndex: 1, // 椤电爜 + pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 + orderBy: '', // 鎺掑簭 + search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� + BIDs: {}, // 涓婄骇琛╥d + pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + chartId: '', // 灞曞紑鍥捐〃ID + statFields: [], // 鍚堣瀛楁 + statFValue: [], // 鍚堣鍊� + absFields: [], // 缁濆鍊煎瓧娈� + loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 + hasReqFields: false, + autoMatic: null + } + + /** + * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 + */ + async loadconfig () { + const { permAction, permMenus, param, MenuName, MenuID } = this.props + + let _param = { + func: 'sPC_Get_LongParam', + MenuID: MenuID + } + let result = await Api.getCacheConfig(_param) + + if (result.status) { + let config = '' + let shortcuts = [] + + try { // 閰嶇疆淇℃伅瑙f瀽 + config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + config.MenuID = MenuID + config.MenuName = MenuName + config.setting.MenuName = MenuName + config.setting.$name = MenuName + } catch (e) { + console.warn('Parse Failure') + config = '' + } + + // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 + if (result.LongParamUser && !window.GLOB.mkHS) { + try { // 閰嶇疆淇℃伅瑙f瀽 + let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) + if (userConfig && !userConfig.version) { + Object.keys(userConfig).forEach(key => { + let component = userConfig[key] + + if (!component.action) return + + Object.keys(component.action).forEach(uuid => { + let item = {uuid: uuid, parentId: key, shortcut: component.action[uuid].shortcut} + let printer = component.action[uuid].printer + + if (item.shortcut) { + item.$shortcut = item.shortcut.join('+') + shortcuts.push(item) + } + if (printer) { + item.printer = printer.defaultPrinter || '' + item.printerList = printer.printerList || '' + window.GLOB.UserCacheMap.set(key + uuid, item) + } + }) + }) + } else if (userConfig) { + shortcuts = userConfig.action + userConfig.printers.forEach(item => { + window.GLOB.UserCacheMap.set(item.parentId + item.uuid, item) + }) + } + } catch (e) { + console.warn('Parse Failure') + } + } + + // 椤甸潰閰嶇疆瑙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 + } + + // 鐗堟湰鍏煎 + config = updateCommonTable(config) + + // 鏉冮檺杩囨护 + if (!window.GLOB.mkHS) { + config.action = config.action.filter(item => item.hidden !== 'true' && permAction[item.uuid]) + config.tabgroups.forEach(group => { + group.sublist = group.sublist.filter(tab => { + if (tab.supMenu === 'mainTable') { + tab.supMenu = MenuID + } + return permAction[tab.linkTab] + }) + }) + } else { + config.action = config.action.filter(item => item.hidden !== 'true') + config.tabgroups.forEach(group => { + group.sublist = group.sublist.map(tab => { + if (tab.supMenu === 'mainTable') { + tab.supMenu = MenuID + } + return tab + }) + }) + } + // 鍘婚櫎绌鸿鏍囩 + config.tabgroups = config.tabgroups.filter(group => group.sublist.length > 0) + + let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID + + let chartId = '' + + if (config.charts) { + // 瑙嗗浘鏉冮檺 + config.charts = config.charts.filter(item => { + if (item.Hide === 'true') return false + if (!item.blacklist || item.blacklist.length === 0) return true + return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0 + }) + + if (config.charts.length <= 1) { + config.expand = true + } + chartId = config.charts[0] ? config.charts[0].uuid : '' + } + + config.search = Utils.initSearchVal(config.search) + + // 瀛楁閫忚鍙婂繀濉爣蹇� + let hasReqFields = false + config.search = config.search.map(item => { + if (['text', 'select', 'link'].includes(item.type) && param && param.$searchkey === item.field) { + item.initval = param.$searchval + } + + if (item.required) { + hasReqFields = true + } + + return item + }) + + config.columns = config.columns.map(col => { + if (!col.field || !col.blacklist || col.blacklist.length === 0) return col + if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + col.Hide = 'true' + } + + return col + }) + + // 鏍囪涓婚〉闈紝鐢ㄤ簬鎸夐挳鍥哄畾鍙婅〃鍗曟寕杞借缃� + config.setting.tabType = 'main' + + // 鏁版嵁婧愪俊鎭澶勭悊 + config.setting.laypage = config.setting.laypage !== 'false' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 + config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 + config.setting.customScript = '' // 鑷畾涔夎剼鏈� + config.setting.dataresource = config.setting.dataresource || '' + + if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { + if (config.setting.scripts && config.setting.scripts.length > 0) { + let _customScript = '' + config.setting.scripts.forEach(item => { + if (item.status === 'false') return + _customScript += ` + ${item.sql} + ` + }) + config.setting.customScript = _customScript + } + + if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ + config.setting.dataresource = '' + } else 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, '*/') + config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*') + config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/') + } else { + config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '') + config.setting.customScript = config.setting.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) + config.setting.customScript = config.setting.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) + config.setting.customScript = config.setting.customScript.replace(reg, val) + }) + } + } + + let _arrField = [] // 瀛楁闆� + let _columns = [] // 鏄剧ず鍒� + let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� + let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 + let statFields = [] // 鍚堣瀛楁淇℃伅 + let absFields = [] // 缁濆鍊煎瓧娈� + + let _actions = [] // 宸ュ叿鏍忔寜閽� + let _operations = [] // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級 + + config.action.forEach(item => { + item.logLabel = MenuName + '-' + item.label // 鐢ㄤ簬sPC_TableData_InUpDe璁板綍鎿嶄綔鎸夐挳 + item.$menuId = this.props.MenuID + + if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify) { // 鎵撳嵃鏈鸿缃� + let _item = window.GLOB.UserCacheMap.get(this.props.MenuID + item.uuid) + + if (_item) { + item.printer = _item.printer || '' + item.verify.defaultPrinter = _item.printer || '' + if (item.verify.printerTypeList && _item.printerList) { + item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { + cell.printer = _item.printerList[cell.Value] || '' + + return cell + }) + } + } + } + + if (item.position === 'toolbar') { + item.$toolbtn = true + _actions.push(item) + } else if (item.position === 'grid') { + _operations.push(item) + } + }) + + // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid + config.columns.forEach(col => { + if (col.field) { + _arrField.push(col.field) + + if (col.linkmenu && col.linkmenu.length > 0) { + let menu_id = col.linkmenu.slice(-1)[0] + col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || '' + } else { + col.linkThdMenu = '' + } + + col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� + if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { + statFields.push(col) + } + if (col.format === 'abs') { + absFields.push(col.field) + } + } + if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 + _hideCol = _hideCol.concat(col.sublist) + } + colMap.set(col.uuid, col) + }) + + // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� + config.columns.forEach((col, index) => { + if (_hideCol.includes(col.uuid)) return + + col.sort = index + + if (col.type === 'colspan') { + if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 + col.type = 'old_colspan' + } + + let _col = fromJS(col).toJS() + let subcols = [] + _col.sublist && _col.sublist.forEach(sub => { + if (colMap.has(sub)) { + subcols.push(colMap.get(sub)) + } + }) + if (subcols.length > 0) { + _col.subcols = subcols + _columns.push(_col) + } + } else { + _columns.push(col) + } + }) + + if (config.gridBtn && config.gridBtn.display && _operations.length > 0) { + config.gridBtn.operations = _operations + _columns.push(config.gridBtn) + } + + if (config.setting.selected !== 'init' && config.setting.selected !== 'always') { + config.setting.selected = 'false' + } else if (config.setting.selected === 'init' && config.setting.onload === 'false') { + config.setting.selected = 'false' + } else { + config.setting.orisel = true + } + + let autoMatic = null + if (config.autoMatic && config.autoMatic.enable === 'true') { + _actions.forEach(item => { + if (item.uuid === config.autoMatic.action && (['pop', 'prompt', 'exec'].includes(item.OpenType) || (item.OpenType === 'funcbutton' && item.funcType === 'print'))) { + autoMatic = config.autoMatic + autoMatic.OpenType = item.execMode || item.OpenType + config.setting.selected = 'false' + item.autoMatic = true + } + }) + } + + if (config.setting.controlField) { + if (config.setting.controlVal) { + config.setting.controlVal = config.setting.controlVal.split(',') + } else { + config.setting.controlVal = [''] + } + } + + this.setState({ + pageSize: config.setting.pageSize || 10, + loadingview: false, + absFields, + autoMatic, + chartId, + config, + statFields, + shortcuts, + setting: config.setting, + searchlist: config.search, + actions: _actions, + columns: _columns, + arr_field: _arrField.join(','), + BID: param && param.$BID ? param.$BID : '', + search: Utils.initMainSearch(config.search), + hasReqFields + }, () => { + if (config.setting.onload !== 'false') { // 鍒濆鍖栧彲鍔犺浇 + this.loadData() + } + this.setShortcut() + }) + } else { + this.setState({ + loadingview: false, + viewlost: true + }) + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + } + + setShortcut = () => { + const { shortcuts } = this.state + + if (!shortcuts || shortcuts.length === 0) { + document.onkeydown = () => {} + return + } + + document.onkeydown = (event) => { + let e = event || window.event + let keyCode = e.keyCode || e.which || e.charCode + let preKey = '' + + if (e.ctrlKey) { + preKey = 'ctrl' + } else if (e.shiftKey) { + preKey = 'shift' + } else if (e.altKey) { + preKey = 'alt' + } + + if (!preKey || !keyCode) return + + let _shortcut = `${preKey}+${keyCode}` + + shortcuts.some(item => { + if (item.$shortcut === _shortcut) { + MKEmitter.emit('triggerBtnId', item.uuid) + + let element = item.parentId && item.parentId !== this.props.MenuID ? document.getElementById(item.parentId) : '' // 鏍囩鍒囨崲 + if (element && element.click) { + element.click() + } + + return true + } + return false + }) + } + } + + loadData = (id) => { + const { MenuID } = this.props + const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state + + this.setState({ + selectedData: [] + }) + MKEmitter.emit('changeTableLine', ContainerId, MenuID, '', '') + + if (hasReqFields) { + let requireFields = search.filter(item => item.required && item.value === '') + + if (requireFields.length > 0) { + this.setState({ + loading: false + }) + return + } + } + + if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { + notification.warning({ + top: 92, + message: '鏈缃寮忕郴缁熷湴鍧�!', + duration: 3 + }) + return + } + + if (setting.interType === 'custom' && loadCustomApi) { + if (setting.execTime === 'once') { + this.setState({loadCustomApi: false}) + } + + this.loadOutResource() + if (setting.execType === 'async') { + this.loadmaindata(id) + } + } else { + this.loadmaindata(id) + } + } + + loadOutResource = () => { + const { setting, search, BID } = this.state + + let param = UtilsDM.getPrevQueryParams(setting, search, BID) + + if (setting.execType === 'sync') { + this.setState({ + loading: true + }) + } + + Api.genericInterface(param).then(res => { + if (res.status) { + if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { + this.loadmaindata() + } else { + this.customOuterRequest(res) + } + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: res.message, + duration: 10 + }) + } + }, () => { + this.setState({ + loading: false + }) + }) + } + + customOuterRequest = (result) => { + const { setting } = this.state + let url = '' + + if (window.GLOB.systemType === 'production') { + url = setting.proInterface + } else { + url = setting.interface + } + + let mkey = result.mk_api_key || '' + + delete result.mk_ex_invoke // 鏄惁缁х画鎵ц + delete result.status + delete result.message + delete result.ErrCode + delete result.ErrMesg + delete result.mk_api_key // 褰撳墠璇锋眰鐨刱ey鍊硷紝鐢ㄤ簬鍥炶皟 + + let param = {} + + Object.keys(result).forEach(key => { + key = key.replace(/^mk_/ig, '') + param[key] = result[key] + }) + + Api.directRequest(url, setting.method, param, setting.cross).then(res => { + if (typeof(res) !== 'object') { + let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒' + + if (typeof(res) === 'string') { + error = res.replace(/'/ig, '"') + } + + let _result = { + mk_api_key: mkey, + $ErrCode: 'E', + $ErrMesg: error + } + + this.customCallbackRequest(_result) + } else { + if (Array.isArray(res)) { + res = { data: res } + } + res.mk_api_key = mkey + this.customCallbackRequest(res) + } + }, (e) => { + let _result = { + mk_api_key: mkey, + $ErrCode: 'E', + $ErrMesg: e && e.statusText ? e.statusText : '' + } + + this.customCallbackRequest(_result) + }) + } + + customCallbackRequest = (result) => { + const { setting, BID } = this.state + let errSql = '' + if (result.$ErrCode === 'E') { + errSql = ` + set @ErrorCode='E' + set @retmsg='${result.$ErrMesg}' + ` + delete result.$ErrCode + delete result.$ErrMesg + } + + let lines = UtilsDM.getCallBackSql(setting, result) + let param = {} + + if (setting.callbackType === 'script') { // 浣跨敤鑷畾涔夎剼鏈� + let sql = lines.map(item => (` + ${item.insert} + ${item.selects.join(` union all + `)} + `)) + sql = sql.join('') + + param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, BID) + } else { + param.func = 's_ex_result_back' + param.s_ex_result = lines.map((item, index) => ({ + MenuID: this.state.config.MenuID, + MenuName: this.state.config.MenuName, + TableName: item.table, + LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), + Sort: index + 1 + })) + + if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { + let sql = lines.map(item => (` + ${item.insert} + ${item.selects.join(` union all + `)} + `)) + sql = sql.join('') + console.info(sql.replace(/\n\s{10}/ig, '\n')) + } + } + + Api.genericInterface(param).then(res => { + if (res.status) { + this.loadmaindata() + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: res.message, + duration: 10 + }) + } + }, () => { + this.setState({ + loading: false + }) + }) + } + + /** + * @description 涓昏〃鏁版嵁鍔犺浇 + */ + async loadmaindata (id) { + const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields, autoMatic } = this.state + + this.setState({ + loading: true + }) + + let _orderBy = orderBy || setting.order + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID) + + let result = await Api.genericInterface(param) + + this.getStatFieldsValue() + + if (result.status) { + let start = 1 + if (setting.laypage) { + start = pageSize * (pageIndex - 1) + 1 + } + + if (setting.selected !== 'false' || (setting.orisel && id)) { + setTimeout(() => { + MKEmitter.emit('mkTableCheckTopLine', this.props.MenuID, id) + }, 200) + if (setting.selected === 'init') { + this.setState({setting: {...setting, selected: 'false'}}) + } + } + + this.setState({ + data: result.data.map((item, index) => { + if (absFields.length) { + absFields.forEach(field => { + if (!item[field]) return + if (isNaN(Math.abs(item[field]))) return + + item[field] = Math.abs(item[field]) + }) + } + + item.key = index + item.$$uuid = item[setting.primaryKey] || '' + item.$$key = '' + item.key + item.$$uuid + item.$$BID = BID || '' + item.$Index = start + index + '' + + if (setting.controlField) { + if (setting.controlVal.includes(item[setting.controlField])) { + item.$disabled = true + } + } + + return item + }), + total: result.total, + loading: false, + pickup: false + }) + + if (autoMatic) { + if (result.data && result.data.length > 0) { + MKEmitter.emit('autoGetData', this.props.MenuID) + } else { + MKEmitter.emit('autoMaticOver', this.props.MenuID) + } + } + } else { + this.setState({ + loading: false + }) + if (autoMatic) { + MKEmitter.emit('autoMaticError', this.props.MenuID) + } + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + /** + * @description 鑾峰彇鍗曡鏁版嵁 + */ + async loadmainLinedata (id) { + const { setting, arr_field, search, orderBy, BID, pageIndex, pageSize, absFields } = this.state + + this.setState({ + loading: true + }) + + let _orderBy = orderBy || setting.order + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, id) + + let result = await Api.genericInterface(param) + if (result.status) { + let data = fromJS(this.state.data).toJS() + let selectedData = fromJS(this.state.selectedData).toJS() + if (result.data && result.data[0]) { + let _data = result.data[0] || {} + + if (absFields.length) { + absFields.forEach(field => { + if (!_data[field]) return + if (isNaN(Math.abs(_data[field]))) return + + _data[field] = Math.abs(_data[field]) + }) + } + _data.$$uuid = _data[setting.primaryKey] || '' + _data.$$BID = BID || '' + + try { + data = data.map(item => { + if (item.$$uuid === _data.$$uuid) { + _data.key = item.key + _data.$$key = '' + item.key + item.$$uuid + _data.$Index = item.$Index + return _data + } else { + return item + } + }) + selectedData = selectedData.map(item => { + if (_data.$$uuid === item.$$uuid) { + return _data + } + return item + }) + } catch (e) { + console.warn('鏁版嵁鏌ヨ閿欒') + } + } + + this.setState({ + data, + selectedData, + loading: false + }) + } else { + this.setState({ + loading: false + }) + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } + + /** + * @description 鑾峰彇鍚堣瀛楁鍊� + */ + getStatFieldsValue = () => { + const { setting, search, BID, orderBy, statFields } = this.state + + if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return + + let _orderBy = orderBy || setting.order + let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID) + + Api.genericInterface(param).then(res => { + if (res.status) { + let _data = res.data[0] + let values = [] + + if (_data) { + statFields.forEach(item => { + if (_data[item.field] || _data[item.field] === 0) { + let val = +_data[item.field] + if (isNaN(val)) { + val = 0 + } + val = val.toFixed(item.decimal) + values.push({label: item.label, value: val}) + } + }) + } + this.setState({ + statFValue: values + }) + } else { + this.setState({ + statFValue: [] + }) + notification.error({ + top: 92, + message: res.message, + duration: 10 + }) + } + }) + } + + /** + * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 + * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� + */ + refreshbysearch = (searches) => { + const { setting } = this.state + + if (setting.onload === 'false') { + this.setState({ + pageIndex: 1, + search: searches, + setting: {...setting, onload: 'true'} + }, () => { + this.loadData() + }) + } else { + MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 + this.setState({ + pageIndex: 1, + search: searches + }, () => { + this.loadData() + }) + } + } + + /** + * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 + */ + refreshbytable = (pagination, filters, sorter) => { + if (!sorter) { + this.setState({ + pageIndex: pagination.pageIndex + }, () => { + this.loadData() + }) + return + } + + if (sorter.order) { + let _chg = { + ascend: 'asc', + descend: 'desc' + } + sorter.order = _chg[sorter.order] + } + + this.setState({ + pageIndex: pagination.current, + pageSize: pagination.pageSize, + orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' + }, () => { + this.loadData() + }) + } + + /** + * @description 琛ㄦ牸鍒锋柊 + */ + reloadtable = (btn, id = '') => { + if (!btn || btn.resetPageIndex !== 'false') { + MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 + this.setState({ + pageIndex: 1 + }, () => { + this.loadData(id) + }) + } else { + MKEmitter.emit('resetTable', this.props.MenuID, 'false') // 鍒楄〃閲嶇疆 + this.loadData(id) + } + } + + /** + * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� + */ + reloadview = () => { + this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, + data: null, total: 0, loading: false, pageIndex: 1, shortcuts: null, + pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false, searchlist: null + }, () => { + this.loadconfig() + }) + } + + /** + * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� + */ + queryModuleParam = (menuId, callback) => { + const { MenuName, MenuID } = this.props + const { arr_field, orderBy, search, setting} = this.state + + if (MenuID !== menuId) return + + callback({ + arr_field: arr_field, + orderBy: orderBy || setting.order, + search: search, + menuName: MenuName + }) + } + + /** + * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� + */ + changeSelectedData = (selectedData) => { + this.setState({selectedData}) + } + + /** + * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 + */ + pickupChange = () => { + const { pickup } = this.state + this.setState({ + pickup: !pickup + }) + } + + /** + * @description 鍥捐〃瑙嗗浘鍒囨崲 + */ + changeChart = (uuid) => { + this.setState({chartId: uuid}) + } + + reloadData = (menuId, id, btn) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + + if (id === 'formtab') { // 琛ㄥ崟鏍囩椤靛埛鏂� + this.reloadtable(btn) + return + } + + if (!id) { + this.reloadtable() + } else { + this.loadmainLinedata(id) + } + } + + reloadMenuView = (menuId, position) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + + if (position === 'table') { + this.reloadtable() + } else { + this.reloadview() + } + } + + resetActiveMenu = (menuId) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + + this.setShortcut() + } + + changeTableLine = (ContainerId, tableId, id, data) => { + if (this.state.ContainerId !== ContainerId) return + + this.setState({ + BIDs: {...this.state.BIDs, [tableId]: id, [tableId + 'data']: data} + }) + } + + /** + * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� + * @param {*} menuId // 鑿滃崟Id + * @param {*} position // 鍒锋柊浣嶇疆 + * @param {*} btn // 鎵ц鐨勬寜閽� + */ + refreshByButtonResult = (menuId, position, btn, id, lines) => { + const { MenuID } = this.props + + if (MenuID !== menuId) return + + if (position === 'line' && lines && lines.length === 1) { + this.loadmainLinedata(lines[0].$$uuid) + } else { + this.reloadtable(btn, id) + } + } + + 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) + MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) + MKEmitter.addListener('queryModuleParam', this.queryModuleParam) + MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 + */ + componentWillUnmount () { + this.setState = () => { + return + } + document.onkeydown = () => {} + MKEmitter.removeListener('reloadData', this.reloadData) + MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) + MKEmitter.removeListener('changeTableLine', this.changeTableLine) + MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) + MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) + MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + } + + render() { + const { MenuID } = this.props + const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state + + return ( + <div className="commontable" id={this.state.ContainerId}> + {loadingview ? <Spin size="large" /> : null} + {searchlist && searchlist.length ? + <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null + } + {setting && config.charts ? <Row className="chart-view" gutter={16}> + {/* 瑙嗗浘缁� */} + {!config.expand ? <Tabs activeKey={chartId} onChange={this.changeChart}> + {config.charts.map(item => ( + <TabPane tab={<MkIcon type={item.icon} />} key={item.uuid}></TabPane> + ))} + </Tabs> : null} + {config.charts.map(item => { + if (!config.expand && chartId !== item.uuid) return null + + if (item.chartType === 'table') { + return ( + <Col span={item.width || 24} key={item.uuid}> + {config.charts.length > 1 && item.title ? <p className="chart-table chart-title">{item.title}</p> : null} + <div className="commontable-main-action"> + <MainAction + BID={BID} + setting={setting} + actions={actions} + columns={columns} + dict={this.state.dict} + MenuID={MenuID} + selectedData={selectedData} + ContainerId={this.state.ContainerId} + /> + </div> + <div className="main-table-box"> + {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? + <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null + } + <MainTable + MenuID={MenuID} + tableId={MenuID} + pickup={pickup} + setting={setting} + columns={columns} + pageSize={pageSize} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + loading={this.state.loading} + statFValue={this.state.statFValue} + ContainerId={this.state.ContainerId} + refreshdata={this.refreshbytable} + chgSelectData={this.changeSelectedData} + /> + </div> + </Col> + ) + } else if (item.chartType === 'card') { + return ( + <Col className="card-view" span={item.width} key={item.uuid}> + <CardComponent + BID={BID} + plot={item} + MenuID={MenuID} + config={config} + tableId={MenuID} + columns={columns} + data={this.state.data} + loading={this.state.loading} + ContainerId={this.state.ContainerId} + /> + </Col> + ) + } else { + return ( + <Col span={item.width} key={item.uuid}> + <ChartComponent + BID={BID} + plot={item} + config={config} + data={this.state.data} + loading={this.state.loading} + /> + </Col> + ) + } + })} + </Row> : null } + {setting && !config.charts ? <div className="chart-view"> + <div className="commontable-main-action"> + <MainAction + BID={BID} + setting={setting} + actions={actions} + columns={columns} + dict={this.state.dict} + MenuID={MenuID} + selectedData={selectedData} + ContainerId={this.state.ContainerId} + /> + </div> + <div className="main-table-box"> + {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? + <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null + } + <MainTable + MenuID={MenuID} + tableId={MenuID} + pickup={pickup} + setting={setting} + columns={columns} + pageSize={pageSize} + dict={this.state.dict} + data={this.state.data} + total={this.state.total} + loading={this.state.loading} + statFValue={this.state.statFValue} + ContainerId={this.state.ContainerId} + refreshdata={this.refreshbytable} + chgSelectData={this.changeSelectedData} + /> + </div> + </div> : null } + {setting && config.tabgroups.map(group => ( + <Tabs key={group.uuid}> + {group.sublist.map(_tab => { + return ( + <TabPane tab={ + <span id={_tab.uuid}> + {_tab.icon ? <MkIcon type={_tab.icon} /> : null} + {_tab.label} + </span> + } key={_tab.uuid}> + <SubTable + Tab={_tab} + SupMenuID={MenuID} + MenuID={_tab.linkTab} + mainSearch={_tab.searchPass === 'true' ? search : null} + ContainerId={this.state.ContainerId} + BID={this.state.BIDs[_tab.supMenu] || ''} + BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} + /> + </TabPane> + ) + })} + </Tabs>)) + } + {!window.GLOB.mkHS && autoMatic ? <AutoMatic autoMatic={autoMatic} config={config} /> : 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} + {!window.GLOB.mkHS && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts} permAction={this.props.permAction}/> : null} + {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} + </div> + ) + } +} + +const mapStateToProps = (state) => { + return { + permAction: state.permAction, + permMenus: state.permMenus + } +} + +const mapDispatchToProps = () => { + return {} +} + +export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file diff --git a/src/tabviews/basetable/index.scss b/src/tabviews/basetable/index.scss new file mode 100644 index 0000000..242cdf2 --- /dev/null +++ b/src/tabviews/basetable/index.scss @@ -0,0 +1,140 @@ +.commontable { + position: relative; + min-height: calc(100vh - 94px); + padding-top: 16px; + padding-bottom: 0px; + .box404 { + padding-top: 30px; + } + >.top-search { + padding: 0px 24px 5px; + border-bottom: 1px solid #efefef; + } + .commontable-main-action { + min-height: 25px; + .button-list { + padding-right: 60px; + } + } + .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); + } + > .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; + .main-pickup { + position: absolute; + right: 0px; + top: -22px; + z-index: 1; + } + >.async-spin { + line-height: 150px!important; + } + } + > .ant-tabs { + width: 100%; + padding: 0px 20px; + margin-bottom: 20px; + .ant-tabs-tab:not(.ant-tabs-tab-active) { + cursor: pointer; + } + .ant-tabs-tab.ant-tabs-tab-active { + cursor: default; + } + } + .ant-table-fixed-left, .ant-table-fixed-right { + z-index: 1; + } + > .chart-view { + position: relative; + padding: 0 20px; + >.ant-tabs { + .ant-tabs-bar { + position: relative; + z-index: 1; + margin: 0; + border: 0; + .ant-tabs-nav-scroll { + text-align: right; + padding-right: 20px; + .ant-tabs-ink-bar { + display: none!important; + } + .ant-tabs-tab { + padding: 6px 5px; + margin-right: 5px; + } + } + } + } + >.ant-col { + min-height: 100px; + } + >.card-view.ant-col-24 { + padding: 0!important; + .card-row-box { + padding: 0; + } + } + .chart-title { + position: relative; + color: rgba(0, 0, 0, 0.65); + font-weight: 400; + font-size: 16px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin: 0px; + padding: 5px 10px; + float: left; + max-width: 50%; + } + .chart-table.chart-title { + position: absolute; + top: 0px; + } + .canvas { + clear: both; + } + } +} \ No newline at end of file diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx index 735d55a..c7485e1 100644 --- a/src/tabviews/calendar/index.jsx +++ b/src/tabviews/calendar/index.jsx @@ -301,6 +301,8 @@ 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 } @@ -403,7 +405,7 @@ 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(50),@mk_organization nvarchar(50),@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) + 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} ` diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 99900ea..b861521 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -341,6 +341,15 @@ col.linkThdMenu = '' } + if (col.type === 'number') { + col.decimal = col.decimal || 0 + col.round = Math.pow(10, col.decimal) + + if (col.format === 'percent') { + col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 + } + } + col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { statFields.push(col) @@ -980,13 +989,13 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { MenuName, MenuID } = this.props const { arr_field, orderBy, search, setting} = this.state if (MenuID !== menuId) return - MKEmitter.emit('returnModuleParam', MenuID, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: search, diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index 43ec2d1..8429861 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -15,7 +15,6 @@ class BalconyComponent extends Component { static propTpyes = { - BID: PropTypes.any, data: PropTypes.array, config: PropTypes.object, } @@ -34,13 +33,25 @@ } UNSAFE_componentWillMount () { - const { data, BID, initdata } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _data = { $$empty: true } let _sync = false + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } - if (_config.setting && _config.wrap.datatype !== 'static') { + if (_config.wrap.datatype !== 'static') { _sync = _config.setting.sync === 'true' if (_sync && data) { @@ -164,11 +175,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -190,7 +210,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) @@ -282,12 +301,12 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { config } = this.state if (config.uuid !== menuId) return - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: '', orderBy: '', search: [], @@ -375,6 +394,8 @@ render() { const { config, loading, data, show, syncConfig, syncData, checked } = this.state + if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null + return ( <div className={'custom-balcony-box' + (!show ? ' hidden' : '')} style={config.style}> {loading ? diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx index 6ba7e42..cc3c5e1 100644 --- a/src/tabviews/custom/components/card/cardItem/index.jsx +++ b/src/tabviews/custom/components/card/cardItem/index.jsx @@ -85,11 +85,12 @@ let menu = null if (card.setting.MenuID) { + let _menu = this.props.permMenus.filter(m => m.MenuID === card.setting.MenuID)[0] || '' menu = { MenuID: card.setting.MenuID, - MenuName: card.setting.MenuName, + MenuName: _menu ? _menu.MenuName : card.setting.MenuName, MenuNo: card.setting.MenuNo, - type: card.setting.tabType + type: _menu ? _menu.type : card.setting.tabType } } else if (card.setting.menu && card.setting.menu.length > 0) { let menu_id = card.setting.menu.slice(-1)[0] diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 00b8a4e..9c9e2c4 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -11,6 +11,7 @@ import MkIcon from '@/components/mk-icon' import MKEmitter from '@/utils/events.js' import LostPng from '@/assets/img/lost.png' +import Encrypts from '@/components/encrypts' import './index.scss' const { Paragraph } = Typography @@ -43,21 +44,7 @@ elements: PropTypes.array, // 鍏冪礌闆� } - state = { - card: null, // 缂栬緫涓厓绱� - elements: null, // 鎸夐挳缁� - } - - /** - * @description 鎼滅储鏉′欢鍒濆鍖� - */ - UNSAFE_componentWillMount () { - const { elements } = this.props - - this.setState({ - elements: fromJS(elements).toJS() - }) - } + state = {} shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps)) @@ -236,624 +223,562 @@ return color } - getContent = (card) => { - const { data, cards } = this.props + getContent = () => { + const { data, cards, elements } = this.props - if (card.eleType === 'sequence') { - let _style = {} - if (card.marks) { - _style.width = card.innerHeight - _style.height = card.innerHeight - _style.lineHeight = card.innerHeight + 'px' + let contents = [] - let mark = getMark(card.marks, data, _style) - - _style = mark.style - } - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <div className="ant-mk-text"><span className="sequence-wrap" style={_style}>{data.$Index || ''}</span></div> - </div> - </Col> - ) - } else if (card.eleType === 'text') { - let val = '' - let _style = card.style ? {...card.style} : {} - - if (card.datatype === 'static') { - val = card.value || '' - if (/@username@|@fullName@|@mk_city@/ig.test(val)) { - let userName = sessionStorage.getItem('User_Name') || '' - let fullName = sessionStorage.getItem('Full_Name') || '' - let city = sessionStorage.getItem('city') || '' - val = val.replace(/@username@/ig, userName).replace(/@fullName@/ig, fullName).replace(/@mk_city@/ig, city) + elements.forEach(card => { + if (card.eleType === 'sequence') { + let _style = {} + if (card.marks) { + _style.width = card.innerHeight + _style.height = card.innerHeight + _style.lineHeight = card.innerHeight + 'px' + + let mark = getMark(card.marks, data, _style) + + _style = mark.style } - } else if (data.hasOwnProperty(card.field)) { - val = data[card.field] - } - - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - if (val !== '' && card.format) { - let _val = null - - if (card.format === 'calendar1') { - _val = moment(val).calendar(null, { - sameDay: '[浠婂ぉ] ahh:mm', - nextDay: '[鏄庡ぉ] ahh:mm', - nextWeek: 'MM鏈圖D鏃� ahh:mm', - lastDay: '[鏄ㄥぉ] ahh:mm', - lastWeek: 'dddd ahh:mm', - sameElse: 'MM鏈圖D鏃� ahh:mm' - }) - } else if (card.format === 'calendar2') { - let time = new Date(val).getTime() - if (!isNaN(time)) { - time = parseInt(time / 60000) // 鏃堕棿鍊� - let now = parseInt(new Date().getTime() / 60000) // 褰撳墠鏃堕棿鍊� - let start = new Date(new Date().toDateString()).getTime() / 60000 // 浠婂ぉ闆剁偣鏃堕棿鍊� - let split = now - time - - if (split < 0) { // 鏃堕棿鍊煎湪褰撳墠鏃堕棿涔嬪悗 - _val = moment(val).format('MM鏈圖D鏃� HH:mm') - } else if (split < 3) { - _val = '鍒氬垰' - } else if (split < 5) { - _val = '3鍒嗛挓鍓�' - } else if (split < 10) { - _val = '5鍒嗛挓鍓�' - } else if (split < 20) { - _val = '10鍒嗛挓鍓�' - } else if (split < 30) { - _val = '20鍒嗛挓鍓�' - } else if (split < 60) { - _val = '30鍒嗛挓鍓�' - } else if (split < 420 || time > start) { // 7灏忔椂鍐呮垨鏃堕棿鍊煎湪浠婂ぉ闆剁偣鍚� - _val = parseInt(split / 60) + '灏忔椂鍓�' - } else { // 鏃堕棿鍊煎湪浠婂ぉ闆剁偣涔嬪墠 - let _day = parseInt((start - time) / (24 * 60)) + 1 - if (_day === 1) { - _val = '鏄ㄥぉ' - } else if (_day <= 30) { - _val = _day + '澶╁墠' - } else { + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={card.style}> + <div className="ant-mk-text"><span className="sequence-wrap" style={_style}>{data.$Index || ''}</span></div> + </div> + </Col> + ) + } else if (card.eleType === 'text') { + let val = '' + let _style = card.style ? {...card.style} : {} + + if (card.datatype === 'static') { + val = card.value || '' + if (/@username@|@fullName@|@mk_city@|@bid@/ig.test(val)) { + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + let city = sessionStorage.getItem('city') || '' + let bid = data.$$BID || '' + val = val.replace(/@username@/ig, userName).replace(/@fullName@/ig, fullName).replace(/@mk_city@/ig, city).replace(/@bid@/ig, bid) + } + } else if (data.hasOwnProperty(card.field)) { + val = data[card.field] + } + + if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } + + if (val !== '' && card.format) { + let _val = null + + if (card.format === 'calendar1') { + _val = moment(val).calendar(null, { + sameDay: '[浠婂ぉ] ahh:mm', + nextDay: '[鏄庡ぉ] ahh:mm', + nextWeek: 'MM鏈圖D鏃� ahh:mm', + lastDay: '[鏄ㄥぉ] ahh:mm', + lastWeek: 'dddd ahh:mm', + sameElse: 'MM鏈圖D鏃� ahh:mm' + }) + } else if (card.format === 'calendar2') { + let time = new Date(val).getTime() + if (!isNaN(time)) { + time = parseInt(time / 60000) // 鏃堕棿鍊� + let now = parseInt(new Date().getTime() / 60000) // 褰撳墠鏃堕棿鍊� + let start = new Date(new Date().toDateString()).getTime() / 60000 // 浠婂ぉ闆剁偣鏃堕棿鍊� + let split = now - time + + if (split < 0) { // 鏃堕棿鍊煎湪褰撳墠鏃堕棿涔嬪悗 _val = moment(val).format('MM鏈圖D鏃� HH:mm') + } else if (split < 3) { + _val = '鍒氬垰' + } else if (split < 5) { + _val = '3鍒嗛挓鍓�' + } else if (split < 10) { + _val = '5鍒嗛挓鍓�' + } else if (split < 20) { + _val = '10鍒嗛挓鍓�' + } else if (split < 30) { + _val = '20鍒嗛挓鍓�' + } else if (split < 60) { + _val = '30鍒嗛挓鍓�' + } else if (split < 420 || time > start) { // 7灏忔椂鍐呮垨鏃堕棿鍊煎湪浠婂ぉ闆剁偣鍚� + _val = parseInt(split / 60) + '灏忔椂鍓�' + } else { // 鏃堕棿鍊煎湪浠婂ぉ闆剁偣涔嬪墠 + let _day = parseInt((start - time) / (24 * 60)) + 1 + if (_day === 1) { + _val = '鏄ㄥぉ' + } else if (_day <= 30) { + _val = _day + '澶╁墠' + } else { + _val = moment(val).format('MM鏈圖D鏃� HH:mm') + } } } - } - } else { - _val = moment(val).format(card.format) - } - - // if (card.format === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(val)) { - // val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)}` - // } - if (_val && _val !== 'Invalid date') { - val = _val - } - } - - if (val !== '') { - let orival = val - if (card.fixStyle === 'alone') { - let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} - val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> - } else { - val = `${card.prefix || ''}${val}${card.postfix || ''}` - } - if (card.copyable === 'true') { - val = <Paragraph copyable={{ text: orival }}>{val}</Paragraph> - } - } - - if (card.marks) { - let mark = getMark(card.marks, data, _style) - - _style = mark.style - - if (mark.icon) { - if (mark.position === 'front') { - val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> } else { - val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> - } - } - } - - if (card.link || (card.anchors && card.anchors.length > 0)) { - _style.cursor = 'pointer' - } - - if (card.bgImage && data[card.bgImage]) { - _style.backgroundImage = `url('${data[card.bgImage]}')` - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> - <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> - </div> - </Col> - ) - } else if (card.eleType === 'number') { - let val = '' - let _style = card.style ? {...card.style} : {} - - if (card.datatype === 'static') { - val = card.value - } else if (data.hasOwnProperty(card.field)) { - val = data[card.field] - } - - if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - if (typeof(val) === 'number') { - if (card.format === 'percent') { - val = val * 100 - } else if (card.format === 'abs') { - val = Math.abs(val) - } - - if (typeof(card.decimal) === 'number') { - let decimal = card.decimal - - if (card.format === 'percent') { - decimal = decimal - 2 - } - if (decimal < 0) { - decimal = 0 + _val = moment(val).format(card.format) } - val = val.toFixed(decimal) - } else { - val = '' + val + // if (card.format === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(val)) { + // val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)}` + // } + if (_val && _val !== 'Invalid date') { + val = _val + } + } + + if (val !== '') { + let orival = val + if (card.format === 'encryption') { + val = <Encrypts value={val} /> + } + if (card.fixStyle === 'alone') { + let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} + val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> + } else { + val = <span>{card.prefix || ''}{val}{card.postfix || ''}</span> + } + if (card.copyable === 'true') { + val = <Paragraph copyable={{ text: orival }}>{val}</Paragraph> + } + } + + if (card.marks) { + let mark = getMark(card.marks, data, _style) + + _style = mark.style + + if (mark.icon) { + if (mark.position === 'front') { + val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> + } else { + val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> + } + } + } + + if (card.link || (card.anchors && card.anchors.length > 0)) { + _style.cursor = 'pointer' + } + + if (card.bgImage && data[card.bgImage]) { + _style.backgroundImage = `url('${data[card.bgImage]}')` + } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> + <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> + </div> + </Col> + ) + } else if (card.eleType === 'number') { + let val = '' + let _style = card.style ? {...card.style} : {} + + if (card.datatype === 'static') { + val = card.value + } else if (data.hasOwnProperty(card.field)) { + val = data[card.field] + } + + if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } + + if (typeof(val) === 'number') { + if (card.round) { + val = Math.round(val * card.round) / card.round + } + if (card.format === 'percent') { + val = val * 100 + } else if (card.format === 'abs') { + val = Math.abs(val) + } + + if (card.round) { + val = val.toFixed(card.decimal) + } else { + val = '' + val + } + + if (card.format === 'percent' && (!card.postfix || card.postfix.indexOf('%') === -1)) { + val = val + '%' + } else if (card.format === 'thdSeparator') { + val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') + } + } + + if (val !== '') { + if (card.fixStyle === 'alone') { + let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} + val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> + } else { + val = `${card.prefix || ''}${val}${card.postfix || ''}` + } } - if (card.format === 'percent' && (!card.postfix || card.postfix.indexOf('%') === -1)) { - val = val + '%' - } else if (card.format === 'thdSeparator') { - val = val.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') + if (card.marks) { + let mark = getMark(card.marks, data, _style) + + _style = mark.style + + if (mark.icon) { + if (mark.position === 'front') { + val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> + } else { + val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> + } + } } - } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={_style}> + <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> + </div> + </Col> + ) + } else if (card.eleType === 'icon') { + let val = '' + + if (card.datatype === 'static') { + val = card.tooltip + } else if (data.hasOwnProperty(card.field)) { + val = data[card.field] + } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={card.style}> + {val ? <Tooltip title={val}> + <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/> + </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/>} + </div> + </Col> + ) + } else if (card.eleType === 'slider') { + let val = 0 + let color = card.color + + if (card.datatype === 'static') { + val = card.value + } else if (data.hasOwnProperty(card.field)) { + val = parseFloat(data[card.field]) + if (isNaN(val)) { + val = 0 + } + } + + val = val / card.maxValue * 100 + val = parseInt(val * 100) / 100 + + if (card.marks) { + let _color = this.getColor(card.marks) + color = _color ? _color : color + } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={card.style}> + <MkProgress value={val} config={card} color={color}/> + </div> + </Col> + ) + } else if (card.eleType === 'picture') { + let _imagestyle = {} + let _style = card.style ? {margin: '0 auto', ...card.style} : {} + let url = '' + if (card.maxWidth) { + _style.maxWidth = card.maxWidth + if (_style.marginLeft === '0px') { + delete _style.marginLeft + } + if (_style.marginRight === '0px') { + delete _style.marginRight + } + } + + if (card.datatype === 'static') { + url = card.url || '' + if (url === '@icon@') { + url = sessionStorage.getItem('avatar') || '' + } + } else { + url = data[card.field] || '' + } + + if (url === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } - if (val !== '') { + if (_style.borderRadius) { + _imagestyle.borderRadius = _style.borderRadius + } + + if (PicRadio[card.lenWidRadio]) { + _imagestyle.paddingTop = PicRadio[card.lenWidRadio] + } else { + _imagestyle.paddingTop = '100%' + } + + if (card.link) { + _style.cursor = 'pointer' + } + + let scale = url && card.scale === 'true' + let urls = url ? url.split(',').filter(Boolean) : [LostPng] + + if (!url) { + _imagestyle = {backgroundSize: 'contain'} + } + + urls.forEach((u, i) => { + contents.push(<Col key={card.uuid + i} span={card.width}> + <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> + <div + className={'ant-mk-picture' + (scale ? ' scale' : '')} + onClick={(e) => { + if (!scale) return + + e.stopPropagation() + + MKEmitter.emit('mkImageScale', url, urls) + }} + style={{..._imagestyle, backgroundImage: `url('${u}')`}} + ></div> + </div> + </Col>) + }) + } else if (card.eleType === 'splitline') { + let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth + contents.push( + <Col key={card.uuid} span={card.width} style={{minHeight: _borderWidth}}> + <div style={card.style}> + <div className="ant-mk-splitline" style={{borderColor: card.color, borderWidth: _borderWidth}}></div> + </div> + </Col> + ) + } else if (card.eleType === 'barcode') { + let val = '' + + if (card.datatype === 'static') { + val = card.value + } else if (data.hasOwnProperty(card.field)) { + val = data[card.field] || '' + } + + if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={card.style}> + <div style={{height: card.innerHeight || 25}}> + {val ? <BarCode card={card} value={val}/> : null} + </div> + </div> + </Col> + ) + } else if (card.eleType === 'video') { + let url = '' + + if (card.datatype === 'static') { + url = card.url + } else { + url = data[card.field] || '' + } + + if (url === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } + + let poster = '' + + if (card.posterType === 'dynamic') { + poster = data[card.posterField] || '' + } else { + poster = card.posterUrl || '' + } + + let urls = url.split(',').filter(Boolean) + + urls.forEach((u, i) => { + contents.push( + <Col key={card.uuid + i} span={card.width}> + <div className="video-wrap" style={card.style}> + <Video card={card} poster={poster} value={u}/> + </div> + </Col> + ) + }) + } else if (card.eleType === 'qrcode') { + let val = '' + + if (card.datatype === 'static') { + val = card.value + } else if (data.hasOwnProperty(card.field)) { + val = data[card.field] || '' + } + + if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={card.style}> + <div style={{minHeight: card.qrWidth || 50}}> + {val ? <QrCode card={card} value={val}/> : null} + </div> + </div> + </Col> + ) + } else if (card.eleType === 'currentDate') { + let val = moment().format(card.dateFormat || 'YYYY-MM-DD') + if (card.fixStyle === 'alone') { let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> } else { val = `${card.prefix || ''}${val}${card.postfix || ''}` } - } - - if (card.marks) { - let mark = getMark(card.marks, data, _style) - - _style = mark.style - - if (mark.icon) { - if (mark.position === 'front') { - val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> - } else { - val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> + + contents.push( + <Col key={card.uuid} span={card.width}> + <div className="ant-mk-date" style={card.style}> + {val} + </div> + </Col> + ) + } else if (card.eleType === 'formula') { + let val = 0 + let _style = card.style ? {...card.style} : {} + + if (card.$sync) { + if (card.eval === 'false') { + val = '' } - } - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={_style}> - <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> - </div> - </Col> - ) - } else if (card.eleType === 'icon') { - let val = '' - - if (card.datatype === 'static') { - val = card.tooltip - } else if (data.hasOwnProperty(card.field)) { - val = data[card.field] - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - {val ? <Tooltip title={val}> - <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/> - </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight || 'auto'}} type={card.icon}/>} - </div> - </Col> - ) - } else if (card.eleType === 'slider') { - let val = 0 - let color = card.color - - if (card.datatype === 'static') { - val = card.value - } else if (data.hasOwnProperty(card.field)) { - val = parseFloat(data[card.field]) - if (isNaN(val)) { - val = 0 - } - } - - val = val / card.maxValue * 100 - val = parseInt(val * 100) / 100 - - if (card.marks) { - let _color = this.getColor(card.marks) - color = _color ? _color : color - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <MkProgress value={val} config={card} color={color}/> - </div> - </Col> - ) - } else if (card.eleType === 'picture') { - let _imagestyle = {} - let _style = card.style ? {margin: '0 auto', ...card.style} : {} - let url = '' - if (card.maxWidth) { - _style.maxWidth = card.maxWidth - if (_style.marginLeft === '0px') { - delete _style.marginLeft - } - if (_style.marginRight === '0px') { - delete _style.marginRight - } - } - - if (card.datatype === 'static') { - url = card.url || '' - if (url === '@icon@') { - url = sessionStorage.getItem('avatar') || '' - } - } else { - url = data[card.field] || '' - } - - if (url === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - if (url) { - _imagestyle = {backgroundImage: `url('${url}')`} - } else { - _imagestyle = {backgroundImage: `url(${LostPng})`, backgroundSize: 'contain'} - } - - if (_style.borderRadius) { - _imagestyle.borderRadius = _style.borderRadius - } - - if (PicRadio[card.lenWidRadio]) { - _imagestyle.paddingTop = PicRadio[card.lenWidRadio] - } else { - _imagestyle.paddingTop = '100%' - } - - if (card.link) { - _style.cursor = 'pointer' - } - - let scale = url && card.scale === 'true' - - return ( - <Col key={card.uuid} span={card.width}> - <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> - <div - className={'ant-mk-picture' + (scale ? ' scale' : '')} - onClick={(e) => { - if (scale) { - e.stopPropagation() - } else { - return - } - - MKEmitter.emit('mkImageScale', url) - }} - style={_imagestyle} - ></div> - </div> - </Col> - ) - } else if (card.eleType === 'splitline') { - let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <div className="ant-mk-splitline" style={{borderColor: card.color, borderWidth: _borderWidth}}></div> - </div> - </Col> - ) - } else if (card.eleType === 'barcode') { - let val = '' - - if (card.datatype === 'static') { - val = card.value - } else if (data.hasOwnProperty(card.field)) { - val = data[card.field] || '' - } - - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <div style={{height: card.innerHeight || 25}}> - {val ? <BarCode card={card} value={val}/> : null} - </div> - </div> - </Col> - ) - } else if (card.eleType === 'video') { - let url = '' - - if (card.datatype === 'static') { - url = card.url - } else { - url = data[card.field] || '' - } - - if (url === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - let poster = '' - - if (card.posterType === 'dynamic') { - poster = data[card.posterField] || '' - } else { - poster = card.posterUrl || '' - } - - return ( - <Col key={card.uuid} span={card.width}> - <div className="video-wrap" style={card.style}> - <Video card={card} poster={poster} value={url}/> - </div> - </Col> - ) - } else if (card.eleType === 'qrcode') { - let val = '' - - if (card.datatype === 'static') { - val = card.value - } else if (data.hasOwnProperty(card.field)) { - val = data[card.field] || '' - } - - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <div style={{minHeight: card.qrWidth || 50}}> - {val ? <QrCode card={card} value={val}/> : null} - </div> - </div> - </Col> - ) - } else if (card.eleType === 'currentDate') { - let val = moment().format(card.dateFormat || 'YYYY-MM-DD') - - if (card.fixStyle === 'alone') { - let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} - val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> - } else { - val = `${card.prefix || ''}${val}${card.postfix || ''}` - } - - return ( - <Col key={card.uuid} span={card.width}> - <div className="ant-mk-date" style={card.style}> - {val} - </div> - </Col> - ) - } else if (card.eleType === 'formula') { - let val = 0 - let _style = card.style ? {...card.style} : {} - - if (card.$sync) { - if (card.eval === 'false') { - val = '' - } - this.props.syncData.forEach(item => { - let _val = card.formula - Object.keys(item).forEach(key => { - let reg = new RegExp('@' + key + '@', 'ig') - _val = _val.replace(reg, item[key]) + this.props.syncData.forEach(item => { + let _val = card.formula + Object.keys(item).forEach(key => { + let reg = new RegExp('@' + key + '@', 'ig') + _val = _val.replace(reg, item[key]) + }) + if (card.eval !== 'false') { + try { + // eslint-disable-next-line + _val = eval(_val) + } catch (e) { + _val = 0 + } + } + + // if (!val) return + + val += _val }) + } else if (data) { + let _val = card.formula + Object.keys(data).forEach(key => { + let reg = new RegExp('@' + key + '@', 'ig') + _val = _val.replace(reg, data[key]) + }) + if (card.eval !== 'false') { try { // eslint-disable-next-line _val = eval(_val) } catch (e) { - _val = 0 + _val = '' } } - - // if (!val) return - - val += _val - }) - } else if (data) { - let _val = card.formula - Object.keys(data).forEach(key => { - let reg = new RegExp('@' + key + '@', 'ig') - _val = _val.replace(reg, data[key]) - }) - - if (card.eval !== 'false') { - try { - // eslint-disable-next-line - _val = eval(_val) - } catch (e) { - _val = '' - } + + val = _val === undefined ? '' : _val } - - val = _val === undefined ? '' : _val - } - - if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� - return null - } - - if (val !== '') { - if (val && typeof(val) === 'string') { - val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') - val = <span dangerouslySetInnerHTML={{__html: val}}></span> - } - - if (card.fixStyle === 'alone') { - let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} - val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> - } else { - val = `${card.prefix || ''}${val}${card.postfix || ''}` - } - } - - if (card.marks) { - let mark = getMark(card.marks, data, _style) - - _style = mark.style - - if (mark.icon) { - if (mark.position === 'front') { - val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> - } else { - val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> - } - } - } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={_style}> - <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> - </div> - </Col> - ) - } else if (card.eleType === 'button') { - let _disabled = data.$disabled - if (card.control === 'hidden') { - let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' - if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { + + if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� return null } - } else if (card.control === 'disabled') { - let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' - if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { - _disabled = true + + if (val !== '') { + if (val && typeof(val) === 'string') { + val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + val = <span dangerouslySetInnerHTML={{__html: val}}></span> + } + + if (card.fixStyle === 'alone') { + let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} + val = <><span style={_s}>{card.prefix || ''}</span>{val}<span style={_s}>{card.postfix || ''}</span></> + } else { + val = `${card.prefix || ''}${val}${card.postfix || ''}` + } } - } - - let _data = [data] - - if (data.$$type === 'extendCard') { - _data = data.$$selectedData || [] - } else if (card.$sync) { - _data = this.props.syncData - } else if (data.$$empty) { - _data = [] - } - - if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { - return ( - <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <NormalButton - btn={card} - BID={data.$$BID} - BData={data.$$BData || ''} - disabled={_disabled} - setting={cards.setting} - columns={cards.columns} - selectedData={_data} - /> + + if (card.marks) { + let mark = getMark(card.marks, data, _style) + + _style = mark.style + + if (mark.icon) { + if (mark.position === 'front') { + val = <span><MkIcon style={mark.innerStyle} type={mark.icon} /> {val}</span> + } else { + val = <span>{val} <MkIcon style={mark.innerStyle} type={mark.icon} /></span> + } + } + } + + contents.push( + <Col key={card.uuid} span={card.width}> + <div style={_style}> + <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> + </div> </Col> ) - } else if (card.OpenType === 'excelIn') { - return ( - <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <ExcelInButton - btn={card} - BID={data.$$BID} - BData={data.$$BData || ''} - disabled={_disabled} - setting={cards.setting} - selectedData={_data} - /> - </Col> - ) - } else if (card.OpenType === 'excelOut') { - return ( - <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <ExcelOutButton - btn={card} - BID={data.$$BID} - BData={data.$$BData || ''} - disabled={_disabled} - setting={cards.setting} - selectedData={_data} - /> - </Col> - ) - } else if (card.OpenType === 'popview') { - return ( - <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <PopupButton - btn={card} - BID={data.$$BID} - BData={data.$$BData || ''} - disabled={_disabled} - setting={cards.setting} - selectedData={_data} - /> - </Col> - ) - } else if (card.OpenType === 'tab') { - return ( - <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <TabButton - btn={card} - BData={data.$$BData || ''} - disabled={_disabled} - setting={cards.setting} - selectedData={_data} - /> - </Col> - ) - } else if (card.OpenType === 'innerpage') { - return ( - <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <NewPageButton - btn={card} - BData={data.$$BData || ''} - disabled={_disabled} - setting={cards.setting} - selectedData={_data} - /> - </Col> - ) - } else if (card.OpenType === 'funcbutton') { - if (card.funcType === 'changeuser' || card.funcType === 'closetab') { - return ( + } else if (card.eleType === 'button') { + let _disabled = data.$disabled + if (card.control === 'hidden') { + let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' + if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { + return null + } + } else if (card.control === 'disabled') { + let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' + if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { + _disabled = true + } + } + + let _data = [data] + + if (data.$$type === 'extendCard') { + _data = data.$$selectedData || [] + } else if (card.$sync) { + _data = this.props.syncData + } else if (data.$$empty) { + _data = [] + } + + if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { + contents.push( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <ChangeUserButton + <NormalButton + btn={card} + BID={data.$$BID} + BData={data.$$BData || ''} + disabled={_disabled} + setting={cards.setting} + columns={cards.columns} + selectedData={_data} + /> + </Col> + ) + } else if (card.OpenType === 'excelIn') { + contents.push( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <ExcelInButton btn={card} BID={data.$$BID} BData={data.$$BData || ''} @@ -863,10 +788,10 @@ /> </Col> ) - } else if (card.funcType === 'print') { - return ( + } else if (card.OpenType === 'excelOut') { + contents.push( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <PrintButton + <ExcelOutButton btn={card} BID={data.$$BID} BData={data.$$BData || ''} @@ -876,43 +801,106 @@ /> </Col> ) - } else if (card.funcType === 'megvii') { - return ( + } else if (card.OpenType === 'popview') { + contents.push( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <FuncMegvii + <PopupButton btn={card} BID={data.$$BID} + BData={data.$$BData || ''} disabled={_disabled} setting={cards.setting} selectedData={_data} /> </Col> ) - } else if (card.funcType === 'filezip') { - return ( + } else if (card.OpenType === 'tab') { + contents.push( <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> - <FuncZip + <TabButton btn={card} - BID={data.$$BID} + BData={data.$$BData || ''} disabled={_disabled} setting={cards.setting} selectedData={_data} /> </Col> ) + } else if (card.OpenType === 'innerpage') { + contents.push( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <NewPageButton + btn={card} + BData={data.$$BData || ''} + disabled={_disabled} + setting={cards.setting} + selectedData={_data} + /> + </Col> + ) + } else if (card.OpenType === 'funcbutton') { + if (card.funcType === 'changeuser' || card.funcType === 'closetab') { + contents.push( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <ChangeUserButton + btn={card} + BID={data.$$BID} + BData={data.$$BData || ''} + disabled={_disabled} + setting={cards.setting} + selectedData={_data} + /> + </Col> + ) + } else if (card.funcType === 'print') { + contents.push( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <PrintButton + btn={card} + BID={data.$$BID} + BData={data.$$BData || ''} + disabled={_disabled} + setting={cards.setting} + selectedData={_data} + /> + </Col> + ) + } else if (card.funcType === 'megvii') { + contents.push( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <FuncMegvii + btn={card} + BID={data.$$BID} + disabled={_disabled} + setting={cards.setting} + selectedData={_data} + /> + </Col> + ) + } else if (card.funcType === 'filezip') { + contents.push( + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> + <FuncZip + btn={card} + BID={data.$$BID} + disabled={_disabled} + setting={cards.setting} + selectedData={_data} + /> + </Col> + ) + } } } - } + }) - return null + return contents } render() { - const { elements } = this.state - return ( <div className="card-cell-list"> - {elements.map(item => this.getContent(item))} + {this.getContent()} </div> ) } diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index ff124ec..0d24ab6 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Spin, Empty, notification, message, Row, Col, Pagination } from 'antd' +import { DownOutlined } from '@ant-design/icons' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -18,7 +19,6 @@ class DataCard extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -46,8 +46,20 @@ } UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } let _card = null let precards = [] @@ -154,6 +166,7 @@ } _config.wrap.selStyle = _config.wrap.selStyle || 'active' + _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : '' _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout float-' + (_config.wrap.cardFloat || 'left') @@ -427,7 +440,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, search } = this.state @@ -443,7 +456,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, @@ -451,7 +464,7 @@ }) } - async loadData (id) { + async loadData (id, type) { const { mainSearch } = this.props const { config, arr_field, pageIndex, search, BID, BData, selected } = this.state @@ -525,11 +538,26 @@ } } - this.setState({ - activeKey: '', - selectKeys: [], - selectedData: [], - data: result.data.map((item, index) => { + let data = [] + + if (type === 'plus') { + let _data = (this.state.data || []).concat(result.data || []) + data = _data.map((item, index) => { + item.key = index + item.$$uuid = item[config.setting.primaryKey] || '' + item.$$BID = BID || '' + item.$$BData = BData || '' + item.$Index = index + 1 + '' + + if (config.wrap.controlField) { + if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { + item.$disabled = true + } + } + return item + }) + } else { + data = result.data.map((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' @@ -541,9 +569,15 @@ item.$disabled = true } } - return item - }), + }) + } + + this.setState({ + activeKey: '', + selectKeys: [], + selectedData: [], + data: data, total: result.total, loading: false }) @@ -623,6 +657,20 @@ duration: 10 }) } + } + + loadMore = () => { + const { total, pageIndex, loading, config } = this.state + + if (loading || config.setting.pageSize * pageIndex >= total) { + return + } + + this.setState({ + pageIndex: pageIndex + 1 + }, () => { + this.loadData('', 'plus') + }) } prevPage = () => { @@ -782,7 +830,8 @@ {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} {precards.length === 0 && nextcards.length === 0 && (!data || data.length === 0) ? <Empty description={false}/> : null} </div> - {config.wrap.pagestyle !== 'switch' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={t => `鍏� ${t} 鏉} pageSize={config.setting.pageSize} onChange={this.changePageIndex} current={pageIndex}/> : null} + {config.wrap.pagestyle === 'page' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={t => `鍏� ${t} 鏉} pageSize={config.setting.pageSize} onChange={this.changePageIndex} current={pageIndex}/> : null} + {config.wrap.pagestyle === 'more' && config.setting.laypage && data && data.length > 0 ? <div className={'mk-more' + (config.setting.pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>鏌ョ湅鏇村<DownOutlined/></div> : null} </div> ) } diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index a9d15b4..1b7e271 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -145,6 +145,18 @@ padding: 10px; text-align: right; } + .mk-more { + text-align: center; + line-height: 40px; + cursor: pointer; + .anticon-down { + margin-left: 2px; + } + } + .mk-more.disabled { + cursor: not-allowed; + color: #bcbcbc; + } } .custom-data-card-box::-webkit-scrollbar { width: 7px; diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 2c72190..f07fb25 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -16,7 +16,6 @@ class PropCard extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -35,12 +34,24 @@ } UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let _data = { $$empty: true } let _sync = false + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.wrap.datatype !== 'static') { _sync = _config.setting.sync === 'true' @@ -204,11 +215,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -230,7 +250,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) @@ -294,7 +313,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { config } = this.state @@ -302,7 +321,7 @@ let searches = config.setting.useMSearch && mainSearch ? mainSearch : [] - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: '', orderBy: '', search: searches, diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index 314f10b..c0e6424 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -3,6 +3,7 @@ import { connect } from 'react-redux' import { is, fromJS } from 'immutable' import { Spin, notification, Row, Col, Empty, Pagination } from 'antd' +import { DownOutlined } from '@ant-design/icons' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -16,7 +17,6 @@ class TableCard extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -39,12 +39,24 @@ * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 */ UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let _data = null let _sync = _config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.setting.sync === 'true' && data) { _data = data[_config.dataName] || [] @@ -89,6 +101,8 @@ return item }) }) + + _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' this.setState({ sync: _sync, @@ -201,7 +215,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, search } = this.state @@ -217,7 +231,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, @@ -225,7 +239,7 @@ }) } - async loadData () { + async loadData (type) { const { mainSearch } = this.props const { config, arr_field, pageIndex, search, BID, BData } = this.state @@ -266,15 +280,31 @@ start = config.setting.pageSize * (pageIndex - 1) + 1 } - this.setState({ - data: result.data.map((item, index) => { + let data = [] + + if (type === 'plus') { + let _data = (this.state.data || []).concat(result.data || []) + data = _data.map((item, index) => { + item.key = index + item.$$uuid = item[config.setting.primaryKey] || '' + item.$$BID = BID || '' + item.$$BData = BData || '' + item.$Index = index + 1 + '' + return item + }) + } else { + data = result.data.map((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' item.$$BID = BID || '' item.$$BData = BData || '' item.$Index = index + start + '' return item - }), + }) + } + + this.setState({ + data: data, total: result.total, loading: false }) @@ -303,11 +333,12 @@ let menu = null if (card.setting.MenuID) { + let _menu = this.props.permMenus.filter(m => m.MenuID === card.setting.MenuID)[0] || '' menu = { MenuID: card.setting.MenuID, - MenuName: card.setting.MenuName, + MenuName: _menu ? _menu.MenuName : card.setting.MenuName, MenuNo: card.setting.MenuNo, - type: card.setting.tabType + type: _menu ? _menu.type : card.setting.tabType } } else if (card.setting.menu && card.setting.menu.length > 0) { let menu_id = card.setting.menu.slice(-1)[0] @@ -405,6 +436,20 @@ }) } + loadMore = () => { + const { total, pageIndex, loading, config } = this.state + + if (loading || config.setting.pageSize * pageIndex >= total) { + return + } + + this.setState({ + pageIndex: pageIndex + 1 + }, () => { + this.loadData('plus') + }) + } + render() { const { config, loading, data, BID, pageIndex, total } = this.state @@ -425,7 +470,8 @@ {data && data.length === 0 ? <div className="card-row-list" style={{height: config.wrap.contentHeight}}> <Empty description={false}/> </div> : null} - {config.setting.laypage ? <Pagination size="small" current={pageIndex} total={total} onChange={this.changePageIndex} /> : null} + {config.setting.laypage && config.wrap.pagestyle === 'page' ? <Pagination size="small" current={pageIndex} total={total} onChange={this.changePageIndex} /> : null} + {config.setting.laypage && config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (config.setting.pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>鏌ョ湅鏇村<DownOutlined/></div> : null} </div> ) } diff --git a/src/tabviews/custom/components/card/table-card/index.scss b/src/tabviews/custom/components/card/table-card/index.scss index 84afeee..0ef56cb 100644 --- a/src/tabviews/custom/components/card/table-card/index.scss +++ b/src/tabviews/custom/components/card/table-card/index.scss @@ -86,6 +86,18 @@ background: #ffffff; } } + .mk-more { + text-align: center; + line-height: 40px; + cursor: pointer; + .anticon-down { + margin-left: 2px; + } + } + .mk-more.disabled { + cursor: not-allowed; + color: #bcbcbc; + } } .custom-card-box::after { diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 5765bce..5c3334b 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -13,7 +13,6 @@ class DataCard extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -30,13 +29,25 @@ } UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _card = _config.subcards[0] let _cols = new Map() let _data = null let _sync = _config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.setting.sync === 'true' && data) { _data = data[_config.dataName] || [] @@ -175,7 +186,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config } = this.state @@ -183,7 +194,7 @@ let searches = config.setting.useMSearch && mainSearch ? fromJS(mainSearch).toJS() : [] - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 554226a..2b3d4fe 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -13,7 +13,6 @@ class PropCard extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -29,12 +28,24 @@ } UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let _data = {$$empty: true} let _sync = false + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.setting && _config.wrap.datatype !== 'static') { _sync = _config.setting.sync === 'true' @@ -176,7 +187,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { config } = this.state @@ -184,7 +195,7 @@ let searches = config.setting.useMSearch && mainSearch ? mainSearch : [] - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: '', orderBy: '', search: searches, 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 b2449054..b90d017 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -22,7 +22,6 @@ class LineChart extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -45,10 +44,22 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata, BID } = this.props + const { config, data, initdata } = this.props let _config = fromJS(config).toJS() let _data = null let _sync = config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.setting.sync === 'true' && data) { _data = data[config.dataName] || [] @@ -390,11 +401,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -416,7 +436,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) @@ -487,7 +506,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, search } = this.state @@ -503,7 +522,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index a20be1e..9d8dbf7 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -52,7 +52,6 @@ class DashboardChart extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -71,11 +70,23 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata, BID } = this.props + const { config, data, initdata } = this.props let _config = fromJS(config).toJS() let _data = null let _sync = _config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_sync && data) { _data = data[config.dataName] || [] @@ -177,11 +188,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -203,7 +223,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 448b85b..f7fde28 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -18,7 +18,6 @@ class PieChart extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -39,11 +38,23 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata, BID } = this.props + const { config, data, initdata } = this.props let _config = fromJS(config).toJS() let _data = null let _sync = config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.setting.sync === 'true' && data) { _data = data[config.dataName] || [] @@ -133,11 +144,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -159,7 +179,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index bad1040..f5b5693 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -19,7 +19,6 @@ class ScatterChart extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -39,10 +38,22 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata, BID } = this.props + const { config, data, initdata } = this.props let _config = fromJS(config).toJS() let _data = null let _sync = config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.setting.sync === 'true' && data) { _data = data[config.dataName] || [] @@ -127,11 +138,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -153,7 +173,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) @@ -224,7 +243,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, search } = this.state @@ -240,7 +259,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index 310c1ea..3223266 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -16,7 +16,6 @@ class CustomChart extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -34,10 +33,22 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata, BID } = this.props + const { config, data, initdata } = this.props let _config = fromJS(config).toJS() let _data = null let _sync = config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.setting.sync === 'true' && data) { _data = data[config.dataName] || [] @@ -122,11 +133,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -148,7 +168,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) @@ -219,7 +238,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, search } = this.state @@ -235,7 +254,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx index 5eb969e..66338af 100644 --- a/src/tabviews/custom/components/code/sand-box/index.jsx +++ b/src/tabviews/custom/components/code/sand-box/index.jsx @@ -10,7 +10,6 @@ class SandBoxComponent extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -26,13 +25,25 @@ } UNSAFE_componentWillMount () { - const { data, initdata, BID } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _data = {} let _sync = false + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } - if (_config.setting && _config.wrap.datatype !== 'static') { + if (_config.wrap.datatype !== 'static') { _sync = _config.setting.sync === 'true' if (_sync && data) { diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx index 2f9c508..e8f4f4b 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.jsx +++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx @@ -14,7 +14,6 @@ class BraftEditorContent extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -29,11 +28,23 @@ } UNSAFE_componentWillMount () { - const { data, initdata, BID } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _data = {} let _sync = false + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.setting && _config.wrap.datatype !== 'static') { _sync = _config.setting.sync === 'true' diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 35fd004..74d5900 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -19,7 +19,6 @@ class SimpleForm extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -38,11 +37,23 @@ } UNSAFE_componentWillMount () { - const { data, BID, BData } = this.props + const { data } = this.props let config = fromJS(this.props.config).toJS() let _data = null let _sync = false + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.wrap.datatype !== 'static') { _sync = config.setting.sync === 'true' @@ -206,7 +217,12 @@ const { mainSearch } = this.props const { config, arr_field, BID } = this.state - if (config.wrap.datatype === 'static' || (config.setting.supModule && !BID)) { + if (config.wrap.datatype === 'static') { + this.setState({ + data: {$$empty: true} + }) + return + } else if (config.setting.supModule && !BID) { this.setState({ data: null }, () => { diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index 91eb195..c034d19 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -18,7 +18,6 @@ class StepForm extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -37,11 +36,23 @@ } UNSAFE_componentWillMount () { - const { data, BID, BData } = this.props + const { data } = this.props let config = fromJS(this.props.config).toJS() let _data = null let _sync = false + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.wrap.datatype !== 'static') { _sync = config.setting.sync === 'true' @@ -255,7 +266,12 @@ const { mainSearch } = this.props const { config, arr_field, BID } = this.state - if (config.wrap.datatype === 'static' || (config.setting.supModule && !BID)) { + if (config.wrap.datatype === 'static') { + this.setState({ + data: {$$empty: true} + }) + return + } else if (config.setting.supModule && !BID) { this.setState({ data: null }, () => { diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index fc90e76..fd0f2a1 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -18,7 +18,6 @@ class TabForm extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -36,11 +35,23 @@ } UNSAFE_componentWillMount () { - const { data, BID, BData } = this.props + const { data } = this.props let config = fromJS(this.props.config).toJS() let _data = null let _sync = false + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.wrap.datatype !== 'static') { _sync = config.setting.sync === 'true' @@ -216,7 +227,12 @@ const { mainSearch } = this.props const { config, arr_field, BID } = this.state - if (config.wrap.datatype === 'static' || (config.setting.supModule && !BID)) { + if (config.wrap.datatype === 'static') { + this.setState({ + data: {$$empty: true} + }) + return + } else if (config.setting.supModule && !BID) { this.setState({ data: null }, () => { diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index 7874b04..699fd28 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -24,18 +24,18 @@ const PropCard = asyncComponent(() => import('@/tabviews/custom/components/card/prop-card')) const BraftEditor = asyncComponent(() => import('@/tabviews/custom/components/editor/braft-editor')) const SandBox = asyncComponent(() => import('@/tabviews/custom/components/code/sand-box')) +const SimpleForm = asyncComponent(() => import('@/tabviews/custom/components/form/simple-form')) const NormalForm = asyncComponent(() => import('@/tabviews/custom/components/form/step-form')) const TabForm = asyncComponent(() => import('@/tabviews/custom/components/form/tab-form')) const NormalTree = asyncComponent(() => import('@/tabviews/custom/components/tree/antd-tree')) const CarouselDataCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/data-card')) const CarouselPropCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/prop-card')) const Balcony = asyncComponent(() => import('@/tabviews/custom/components/card/balcony')) +const TimeLine = asyncComponent(() => import('@/tabviews/custom/components/timeline/normal-timeline')) const CustomChart = asyncComponent(() => import('@/tabviews/custom/components/chart/custom-chart')) class TabTransfer extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id - bids: PropTypes.any, // 鐖剁骇Id闆� config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 鍏ㄥ眬鎼滅储鏉′欢 } @@ -102,9 +102,16 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ loadmaindata = (params) => { - let param = getStructuredParams(params, this.props.config, this.props.BID || '') + let BID = '' + let BData = window.GLOB.CacheData.get(this.props.config.$pageId) - Api.getLocalConfig(param).then(result => { + if (BData) { + BID = BData.$BID || '' + } + + let param = getStructuredParams(params, this.props.config, BID) + + Api.genericInterface(param).then(result => { if (result.status) { delete result.status delete result.message @@ -128,125 +135,130 @@ } getComponents = () => { - const { BID, bids, config } = this.props + const { config } = this.props const { mainSearch, data } = this.state if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) return config.components.map(item => { - let _bid = BID || '' - let BData = '' - if (item.setting && item.setting.supModule) { - _bid = bids ? bids[item.setting.supModule] || '' : '' - BData = bids ? bids[item.setting.supModule + '_data'] || '' : '' - } - if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} key={item.uuid}> - <AntvBarAndLine data={data} config={item} BID={_bid} mainSearch={mainSearch}/> + <AntvBarAndLine data={data} config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} key={item.uuid}> - <AntvPie data={data} config={item} BID={_bid} mainSearch={mainSearch}/> + <AntvPie data={data} config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'dashboard') { return ( <Col span={item.width} key={item.uuid}> - <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <AntvDashboard config={item} data={data} mainSearch={mainSearch}/> + </Col> + ) + } else if (item.type === 'form' && item.subtype === 'simpleform') { + return ( + <Col span={item.width} key={item.uuid}> + <SimpleForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'stepform') { return ( <Col span={item.width} key={item.uuid}> - <NormalForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <NormalForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'tabform') { return ( <Col span={item.width} key={item.uuid}> - <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <TabForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'scatter') { return ( <Col span={item.width} key={item.uuid}> - <AntvScatter config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <AntvScatter config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <CarouselDataCard config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <CarouselPropCard config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <DataCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <PropCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'tablecard') { return ( <Col span={item.width} key={item.uuid}> - <TableCard config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <TableCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'normaltable') { return ( <Col span={item.width} key={item.uuid}> - <NormalTable config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <NormalTable config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'editable') { return ( <Col span={item.width} key={item.uuid}> - <EditTable config={item} data={data} BID={_bid} BData={BData} mainSearch={mainSearch}/> + <EditTable config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'tree') { return ( <Col span={item.width} key={item.uuid}> - <NormalTree config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <NormalTree config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'editor') { return ( <Col span={item.width} key={item.uuid}> - <BraftEditor config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <BraftEditor config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'code') { return ( <Col span={item.width} key={item.uuid}> - <SandBox config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <SandBox config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'balcony') { return ( <Col span={item.width} key={item.uuid}> - <Balcony config={item} data={data} BID={_bid}/> + <Balcony config={item} data={data}/> + </Col> + ) + } else if (item.type === 'timeline') { + return ( + <Col span={item.width} key={item.uuid}> + <TimeLine config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'chart') { return ( <Col span={item.width} key={item.uuid}> - <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <CustomChart config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else { diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index b36187e..bd053ab 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -12,7 +12,6 @@ class VoucherModule extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 } @@ -29,7 +28,19 @@ } UNSAFE_componentWillMount () { - const { config, BID } = this.props + const { config } = this.props + + let BID = '' + let BData = '' + + if (config.setting.supModule) { + BData = window.GLOB.CacheData.get(config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } this.setState({ config: fromJS(config).toJS(), diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 99f8396..317b96d 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -10,6 +10,7 @@ import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' +import Encrypts from '@/components/encrypts' import '@/assets/css/table.scss' import './index.scss' @@ -122,9 +123,13 @@ content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } else if (col.textFormat === 'encryption') { + content = <span>{col.prefix || ''}<Encrypts value={content} />{col.postfix || ''}</span> } - - content = (col.prefix || '') + content + (col.postfix || '') + + if (col.textFormat !== 'encryption') { + content = (col.prefix || '') + content + (col.postfix || '') + } } if (col.marks) { @@ -172,15 +177,17 @@ } if (content !== '') { - let decimal = col.decimal || 0 + if (col.round) { + content = Math.round(content * col.round) / col.round + } if (col.format === 'percent') { content = content * 100 - decimal = decimal > 2 ? decimal - 2 : 0 } else if (col.format === 'abs') { content = Math.abs(content) } - - content = content.toFixed(decimal) + if (col.round) { + content = content.toFixed(col.decimal) + } if (col.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -235,7 +242,6 @@ photos = photos.split(',').filter(Boolean) } - let cols = 24 / (col.picSort || 1) let paddingTop = '100%' let scale = col.scale === 'true' @@ -245,8 +251,8 @@ resProps.children = ( <div> - {photos && photos.map((url, i) => ( - <Col key={i} span={cols}> + {photos.map((url, i) => ( + <Col key={i} span={col.span || 24}> <div className={'ant-mk-picture' + (scale ? ' scale' : '')} onClick={() => { if (!scale) return MKEmitter.emit('mkImageScale', url, photos) @@ -627,35 +633,21 @@ } else if (item.linkurl) { let src = item.linkurl - if (src.indexOf('paramsmain/') > -1) { - try { - let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/' - let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1]))) - _param.UserID = sessionStorage.getItem('UserID') - _param.LoginUID = sessionStorage.getItem('LoginUID') - _param.User_Name = sessionStorage.getItem('User_Name') - _param.param = __param - src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } - } else { - let con = '?' + let con = '?' - if (/\?/ig.test(src)) { - con = '&' - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - if (field.toLowerCase() === 'id') return - con += `${field}=${record[field] || ''}&` - }) - } - - src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + if (/\?/ig.test(src)) { + con = '&' } + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + window.open(src) } } diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx index 1fbd303..1ce33c9 100644 --- a/src/tabviews/custom/components/share/tabtransfer/index.jsx +++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx @@ -34,11 +34,11 @@ const CarouselDataCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/data-card')) const CarouselPropCard = asyncComponent(() => import('@/tabviews/custom/components/carousel/prop-card')) const Balcony = asyncComponent(() => import('@/tabviews/custom/components/card/balcony')) +const TimeLine = asyncComponent(() => import('@/tabviews/custom/components/timeline/normal-timeline')) const CustomChart = asyncComponent(() => import('@/tabviews/custom/components/chart/custom-chart')) class TabTransfer extends Component { static propTpyes = { - bids: PropTypes.any, // 鐖剁骇Id闆� config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 鍏ㄥ眬鎼滅储鏉′欢 } @@ -122,9 +122,16 @@ * @description 涓昏〃鏁版嵁鍔犺浇 */ loadmaindata = (params) => { - let param = getStructuredParams(params, this.props.config, this.props.BID || '') + let BID = '' + let BData = window.GLOB.CacheData.get(this.props.config.$pageId) - Api.getLocalConfig(param).then(result => { + if (BData) { + BID = BData.$BID || '' + } + + let param = getStructuredParams(params, this.props.config, BID) + + Api.genericInterface(param).then(result => { if (result.status) { delete result.status delete result.message @@ -154,44 +161,42 @@ } getComponents = () => { - const { bids, config } = this.props + const { config } = this.props const { mainSearch, data } = this.state if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) return config.components.map(item => { - let BID = this.props.BID || '' - let BData = '' - if (item.setting && item.setting.supModule) { - BID = bids[item.setting.supModule] || '' - BData = bids[item.setting.supModule + '_data'] || '' - } - if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} key={item.uuid}> - <AntvBarAndLine data={data} config={item} BID={BID} mainSearch={mainSearch}/> + <AntvBarAndLine data={data} config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} key={item.uuid}> - <AntvPie data={data} config={item} BID={BID} mainSearch={mainSearch}/> + <AntvPie data={data} config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'dashboard') { return ( <Col span={item.width} key={item.uuid}> - <AntvDashboard config={item} data={data} BID={BID} mainSearch={mainSearch}/> + <AntvDashboard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'scatter') { return ( <Col span={item.width} key={item.uuid}> - <AntvScatter config={item} data={data} BID={BID} mainSearch={mainSearch}/> + <AntvScatter config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'search') { + let BID = '' + let BData = window.GLOB.CacheData.get(item.$pageId) + if (BData) { + BID = BData.$BID || '' + } return ( <Col span={item.width} key={item.uuid}> <MainSearch config={item} BID={BID} refreshdata={this.resetSearch} /> @@ -200,103 +205,109 @@ } else if (item.type === 'tabs') { return ( <Col span={item.width} key={item.uuid}> - <AntvTabs config={item} BID={BID} bids={bids} mainSearch={mainSearch}/> + <AntvTabs config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <DataCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <PropCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <CarouselDataCard config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <CarouselPropCard config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'tablecard') { return ( <Col span={item.width} key={item.uuid}> - <TableCard config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <TableCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'normaltable') { return ( <Col span={item.width} key={item.uuid}> - <NormalTable config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <NormalTable config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'editable') { return ( <Col span={item.width} key={item.uuid}> - <EditTable config={item} BID={BID} BData={BData} mainSearch={mainSearch}/> + <EditTable config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'group' && item.subtype === 'normalgroup') { return ( <Col span={item.width} key={item.uuid}> - <NormalGroup config={item} BID={BID} bids={bids} mainSearch={mainSearch}/> + <NormalGroup config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'simpleform') { return ( <Col span={item.width} key={item.uuid}> - <SimpleForm config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <SimpleForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'stepform') { return ( <Col span={item.width} key={item.uuid}> - <StepForm config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <StepForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'tabform') { return ( <Col span={item.width} key={item.uuid}> - <TabForm config={item} data={data} BID={BID} BData={BData} mainSearch={mainSearch}/> + <TabForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'tree') { return ( <Col span={item.width} key={item.uuid}> - <NormalTree config={item} data={data} BID={BID} mainSearch={mainSearch}/> + <NormalTree config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'editor') { return ( <Col span={item.width} key={item.uuid}> - <BraftEditor config={item} data={data} BID={BID} mainSearch={mainSearch}/> + <BraftEditor config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'code') { return ( <Col span={item.width} key={item.uuid}> - <SandBox config={item} data={data} BID={BID} mainSearch={mainSearch}/> + <SandBox config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'balcony') { return ( <Col span={item.width} key={item.uuid}> - <Balcony config={item} data={data} BID={BID}/> + <Balcony config={item} data={data}/> + </Col> + ) + } else if (item.type === 'timeline') { + return ( + <Col span={item.width} key={item.uuid}> + <TimeLine config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'chart') { return ( <Col span={item.width} key={item.uuid}> - <CustomChart config={item} data={data} BID={BID} mainSearch={mainSearch}/> + <CustomChart config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else { diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 36170d3..631fd32 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -18,7 +18,6 @@ class EditableTable extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 } @@ -48,11 +47,22 @@ * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 */ UNSAFE_componentWillMount () { - const { BID, BData } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let setting = {..._config.setting, ..._config.wrap} setting.tableId = Utils.getuuid() + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } _config.submit.style = _config.submit.style || {} _config.submit.wrapStyle = {} @@ -457,7 +467,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, orderBy, search, setting} = this.state @@ -473,7 +483,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: searches, diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index 556364e..8651b50 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -14,6 +14,7 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import CusSwitch from './cusSwitch' +import Encrypts from '@/components/encrypts' import '@/assets/css/table.scss' import './index.scss' @@ -301,9 +302,13 @@ content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } else if (col.textFormat === 'encryption') { + content = <span>{col.prefix || ''}<Encrypts value={content} />{col.postfix || ''}</span> } - content = (col.prefix || '') + content + (col.postfix || '') + if (col.textFormat !== 'encryption') { + content = (col.prefix || '') + content + (col.postfix || '') + } } if (col.marks) { @@ -383,15 +388,17 @@ } if (content !== '') { - let decimal = col.decimal || 0 + if (col.round) { + content = Math.round(content * col.round) / col.round + } if (col.format === 'percent') { content = content * 100 - decimal = decimal > 2 ? decimal - 2 : 0 } else if (col.format === 'abs') { content = Math.abs(content) } - - content = content.toFixed(decimal) + if (col.round) { + content = content.toFixed(col.decimal) + } if (col.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -722,9 +729,13 @@ content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } else if (col.textFormat === 'encryption') { + content = <span>{col.prefix || ''}<Encrypts value={content} />{col.postfix || ''}</span> } - content = (col.prefix || '') + content + (col.postfix || '') + if (col.textFormat !== 'encryption') { + content = (col.prefix || '') + content + (col.postfix || '') + } } if (col.marks) { @@ -763,15 +774,17 @@ } if (content !== '') { - let decimal = col.decimal || 0 + if (col.round) { + content = Math.round(content * col.round) / col.round + } if (col.format === 'percent') { content = content * 100 - decimal = decimal > 2 ? decimal - 2 : 0 } else if (col.format === 'abs') { content = Math.abs(content) } - - content = content.toFixed(decimal) + if (col.round) { + content = content.toFixed(col.decimal) + } if (col.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -1199,7 +1212,7 @@ if (!_cell.label && _cell.label !== 0) return if (_map.has(_cell.value)) return - _map.set(_cell.value, true) + _map.set(_cell.value, 0) if (item.linkSubField) { item.linkSubField.forEach(m => { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 62cefcd..d7b7184 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -20,7 +20,6 @@ class NormalTable extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -50,11 +49,23 @@ * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 */ UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let _data = null let _sync = _config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.wrap.controlField) { if (_config.wrap.controlVal) { @@ -474,7 +485,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, orderBy, search, setting} = this.state @@ -490,7 +501,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: searches, diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index a5159a1..483549b 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -13,32 +13,45 @@ class antvTabs extends Component { static propTpyes = { - BID: PropTypes.any, // 椤甸潰BID - bids: PropTypes.any, // 鐖剁骇Id闆� config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 } state = { tabs: null, - parentIds: [], - bids: {}, activeIndex: 1 } UNSAFE_componentWillMount () { - const { config, bids } = this.props + const { config } = this.props let _tabs = fromJS(config).toJS() if (_tabs.setting.supModule) { _tabs.subtabs = [] + + let data = window.GLOB.CacheData.get(_tabs.setting.supModule) + + if (data) { + let val = '' + Object.keys(data).forEach(key => { + if (key.toLowerCase() === _tabs.setting.controlField) { + val = data[key] + } + }) + _tabs.subtabs = config.subtabs.filter(tab => { + if (tab.controlVal === val) { + return false + } else if (/,/ig.test(tab.controlVal)) { + return !tab.controlVal.split(',').includes(val) + } + return true + }) + } } this.setState({ - tabs: _tabs, - parentIds: config.parentIds || [], - bids: bids ? bids : {} + tabs: _tabs }) } @@ -72,13 +85,7 @@ } resetParentParam = (MenuID, id, data) => { - const { parentIds, bids, tabs } = this.state - - if (parentIds.includes(MenuID)) { - this.setState({ - bids: {...bids, [MenuID]: id, [MenuID + '_data']: data} - }) - } + const { tabs } = this.state if (tabs.setting.supModule === MenuID) { if (!data) { @@ -131,8 +138,8 @@ } render() { - const { mainSearch, BID } = this.props - const { tabs, bids } = this.state + const { mainSearch } = this.props + const { tabs } = this.state if (!tabs.subtabs.length) return null @@ -141,7 +148,7 @@ <Tabs defaultActiveKey="1" tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> {tabs.subtabs.map(tab => ( <TabPane tab={<span id={'tab' + tab.uuid}>{tab.icon ? <MkIcon type={tab.icon} /> : null}{tab.label}</span>} style={{backgroundColor: tab.backgroundColor || 'transparent'}} key={tab.uuid}> - <TabTransfer BID={BID} config={tab} bids={bids} mainSearch={mainSearch}/> + <TabTransfer config={tab} mainSearch={mainSearch}/> </TabPane> ))} </Tabs> diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index c4a13c7..1dbcafe 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -15,7 +15,6 @@ class NormalTimeline extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -28,7 +27,8 @@ sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 data: null, // 鏁版嵁 BData: '', - card: null + card: null, + description: false } /** @@ -36,13 +36,25 @@ * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦 */ UNSAFE_componentWillMount () { - const { data, initdata, BID, BData } = this.props + const { data, initdata } = this.props let _config = fromJS(this.props.config).toJS() let _cols = new Map() let _data = null let card = null let _sync = _config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (_config.setting.sync === 'true' && data) { _data = data[_config.dataName] || [] @@ -190,7 +202,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config } = this.state @@ -206,7 +218,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, @@ -217,11 +229,16 @@ async loadData () { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state - + if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ data: [], }) + return + } + + if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') { + this.getExpress() return } @@ -239,11 +256,6 @@ if (requireFields.length > 0) { return } - - // if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') { - // this.getExpress() - // return - // } this.setState({ loading: true @@ -278,16 +290,41 @@ } getExpress = () => { + const { BData } = this.state + + let code = '' + let order = '' + if (BData) { + Object.keys(BData).forEach(key => { + if (key.toLowerCase() === 'expresscode') { + code = BData[key] + } else if (key.toLowerCase() === 'expressno') { + order = BData[key] + } + }) + } + + if (!code || !order) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌蹇��' + (!code ? '鍏徃缂栫爜銆�' : '鍗曞彿銆�'), + duration: 5 + }) + return + } + this.setState({ loading: true }) - Api.wxNginxRequest(`express/yuantong/YT6590674317601`, 'get').then(res => { + Api.wxNginxRequest(`express/${code}/${order}`, 'get').then(res => { if (!res || typeof(res) !== 'string') { notification.error({ top: 92, message: '鏈幏鍙栧埌蹇�掍俊鎭�', duration: 10 }) + } else if (/鏌ヨ鏃犵粨鏋�/.test(res)) { + this.setState({description: res, data: [], loading: false}) } else { let data = res.split(/\n/).filter(Boolean) @@ -395,7 +432,7 @@ } render() { - const { config, loading, data } = this.state + const { config, loading, data, description } = this.state return ( <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}> @@ -413,7 +450,7 @@ {data.map(item => this.getMknodes(item))} </div> : null} {data && data.length === 0 ? <div className="card-row-list" style={{height: config.wrap.contentHeight}}> - <Empty description={false}/> + <Empty description={description}/> </div> : null} </div> ) diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index 9aaf9a1..3d8f850 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -16,7 +16,6 @@ class NormalTree extends Component { static propTpyes = { - BID: PropTypes.any, // 鐖剁骇Id data: PropTypes.array, // 缁熶竴鏌ヨ鏁版嵁 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 mainSearch: PropTypes.any, // 澶栧眰鎼滅储鏉′欢 @@ -37,10 +36,22 @@ } UNSAFE_componentWillMount () { - const { config, data, initdata, BID } = this.props + const { config, data, initdata } = this.props let _config = fromJS(config).toJS() let _data = null let _sync = config.setting.sync === 'true' + + let BID = '' + let BData = '' + + if (_config.setting.supModule) { + BData = window.GLOB.CacheData.get(_config.setting.supModule) + } else { + BData = window.GLOB.CacheData.get(_config.$pageId) + } + if (BData) { + BID = BData.$BID || '' + } if (config.setting.sync === 'true' && data) { _data = data[config.dataName] || [] @@ -119,11 +130,20 @@ if (!config.timer) return - const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } let timer = _change[config.timer] + let repeats = config.timerRepeats || 0 if (!timer) return + + if (repeats > 0 && repeats <=3) { + this.setState({timer, repeats}) + this.timer = setTimeout(() => { + this.timerTask(repeats) + }, timer) + return + } let _param = { func: 's_get_timers_role', @@ -145,7 +165,6 @@ }) return } else if (result.run_type) { - let repeats = config.timerRepeats || 0 this.setState({timer, repeats}) this.timer = setTimeout(() => { this.timerTask(repeats) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 5b729ce..abe3ac2 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -73,11 +73,11 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction } = this.props + const { permAction, MenuID } = this.props let _param = { func: 'sPC_Get_LongParam', - MenuID: this.props.MenuID + MenuID: MenuID } let result = await Api.getCacheConfig(_param) @@ -140,7 +140,9 @@ let skip = config.permission === 'false' || window.GLOB.mkHS let param = this.props.param || {} // url鍙傛暟 - config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param) + window.GLOB.CacheData.set(MenuID, param) + + config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param, MenuID) // 鑾峰彇涓绘悳绱㈡潯浠� let mainSearch = [] @@ -443,8 +445,9 @@ }) } - filterComponent = (components, roleId, permAction, balMap, skip, urlparam) => { + filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId) => { return components.filter(item => { + item.$pageId = pageId if (item.style && item.style.boxShadow) { delete item.style.hShadow @@ -526,21 +529,11 @@ } item.subtabs = item.subtabs.map(tab => { - tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam) + tab.$pageId = pageId + + tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId) return tab }) - - let supIds = [] - item.subtabs.forEach(tab => { - tab.components.forEach(comp => { - if (comp.type === 'tabs' && comp.parentIds) { - supIds.push(...comp.parentIds) - } else if (comp.setting && comp.setting.supModule) { - supIds.push(comp.setting.supModule) - } - }) - }) - item.parentIds = supIds return true } else if (item.type === 'group') { @@ -551,7 +544,7 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam) + item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId) return true } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { @@ -588,8 +581,16 @@ } else if (col.blacklist && col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { col.Hide = 'true' } - if (col.type === 'number' && col.sum === 'true' && !statFields.includes(col.field)) { - statFields.push(col) + if (col.type === 'number') { + if (col.sum === 'true' && !statFields.includes(col.field)) { + statFields.push(col) + } + if (typeof(col.decimal) === 'number') { + col.round = Math.pow(10, col.decimal) + if (col.format === 'percent') { + col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 + } + } } else if (col.type === 'colspan') { col.subcols = getCols(col.subcols || []) if (col.subcols.length === 0) { @@ -597,8 +598,16 @@ } } else if (col.type === 'custom') { col.elements = col.elements.map(cell => { - if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height) { - cell.innerHeight = 'auto' + if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } } else if (cell.eleType === 'icon') { let fontSize = 14 let lineHeight = 1.5 @@ -678,8 +687,6 @@ if (item.type === 'card') { item.subcards && item.subcards.forEach(card => { - let _hasheight = card.style.height && card.style.height !== 'auto' - if (card.style.boxShadow) { delete card.style.hShadow delete card.style.vShadow @@ -711,8 +718,16 @@ card.style = card.style || {} card.style = {...card.style, ...card.btnstyle} } - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { - cell.innerHeight = 'auto' + } else if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } } else if (cell.eleType === 'icon') { let fontSize = 14 let lineHeight = 1.5 @@ -753,8 +768,16 @@ card.style = card.style || {} card.style = {...card.style, ...card.btnstyle} } - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { - cell.innerHeight = 'auto' + } else if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } } else if (cell.eleType === 'icon') { let fontSize = 14 let lineHeight = 1.5 @@ -799,8 +822,16 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) } - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height) { - cell.innerHeight = 'auto' + } else if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } } else if (cell.eleType === 'icon') { let fontSize = 14 let lineHeight = 1.5 @@ -819,7 +850,6 @@ }) } else if ((item.type === 'table' && item.subtype === 'tablecard') || item.type === 'carousel' || item.type === 'timeline') { item.subcards && item.subcards.forEach(card => { - let _hasheight = card.style.height && card.style.height !== 'auto' card.elements = card.elements.filter(cell => { if (cell.eleType === 'button') { if (cell.hidden === 'true') return false @@ -844,8 +874,16 @@ card.style = card.style || {} card.style = {...card.style, ...card.btnstyle} } - } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { - cell.innerHeight = 'auto' + } else if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } } else if (cell.eleType === 'icon') { let fontSize = 14 let lineHeight = 1.5 @@ -906,6 +944,7 @@ // group.subButton.$forbid = true // 涓嶅0鏄庢暟鎹簮鍙橀噺 group.subButton.OpenType = 'formSubmit' group.subButton.execError = 'never' + group.subButton.logLabel = item.$menuname + '-' + group.subButton.label if (!group.subButton.Ot) { group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' @@ -1057,13 +1096,13 @@ } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*') + component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@datam@/ig, 'Y') component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') - _customScript = _customScript.replace(/\$@/ig, '/*') + _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@datam@/ig, 'Y') _customScript = _customScript.replace(/@\$/ig, '*/') } else { - component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '') - _customScript = _customScript.replace(/@\$|\$@/ig, '') + component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '') + _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '') } regs.forEach(cell => { @@ -1119,7 +1158,7 @@ this.setState({loading: true, loadingview: false}) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { delete result.status delete result.message @@ -1183,6 +1222,23 @@ } MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) + + window.GLOB.CacheData.delete(this.props.MenuID) + this.deleteCache(this.state.config.components) + } + + deleteCache = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + this.deleteCache(tab.components) + }) + } else if (item.type === 'group') { + this.deleteCache(item.components) + } else { + window.GLOB.CacheData.delete(item.uuid) + } + }) } reloadview = () => { @@ -1211,51 +1267,46 @@ if (!config || !config.components) return return config.components.map(item => { - let _bid = BID - if (item.setting && item.setting.supModule) { - _bid = '' - } - if (item.type === 'bar' || item.type === 'line') { return ( <Col span={item.width} key={item.uuid}> - <AntvBarAndLine config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <AntvBarAndLine config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'pie') { return ( <Col span={item.width} key={item.uuid}> - <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <AntvPie config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'scatter') { return ( <Col span={item.width} key={item.uuid}> - <AntvScatter config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <AntvScatter config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'dashboard') { return ( <Col span={item.width} key={item.uuid}> - <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <AntvDashboard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'simpleform') { return ( <Col span={item.width} key={item.uuid}> - <SimpleForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <SimpleForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'stepform') { return ( <Col span={item.width} key={item.uuid}> - <StepForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <StepForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'form' && item.subtype === 'tabform') { return ( <Col span={item.width} key={item.uuid}> - <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <TabForm config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'search') { @@ -1267,97 +1318,97 @@ } else if (item.type === 'tabs') { return ( <Col span={item.width} key={item.uuid}> - <AntvTabs config={item} BID={BID} mainSearch={mainSearch} /> + <AntvTabs config={item} mainSearch={mainSearch} /> </Col> ) } else if (item.type === 'card' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <DataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <DataCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'card' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <PropCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'balcony') { return ( <Col span={item.width} key={item.uuid}> - <Balcony config={item} data={data} BID={_bid}/> + <Balcony config={item} data={data}/> </Col> ) } else if (item.type === 'timeline') { return ( <Col span={item.width} key={item.uuid}> - <TimeLine config={item} data={data} BID={_bid}/> + <TimeLine config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'datacard') { return ( <Col span={item.width} key={item.uuid}> - <CarouselDataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'carousel' && item.subtype === 'propcard') { return ( <Col span={item.width} key={item.uuid}> - <CarouselPropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'tablecard') { return ( <Col span={item.width} key={item.uuid}> - <TableCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <TableCard config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'normaltable') { return ( <Col span={item.width} key={item.uuid}> - <NormalTable config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <NormalTable config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'table' && item.subtype === 'editable') { return ( <Col span={item.width} key={item.uuid}> - <EditTable config={item} BID={_bid} mainSearch={mainSearch}/> + <EditTable config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'group' && item.subtype === 'normalgroup') { return ( <Col span={item.width} key={item.uuid}> - <NormalGroup config={item} BID={_bid} mainSearch={mainSearch}/> + <NormalGroup config={item} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'editor') { return ( <Col span={item.width} key={item.uuid}> - <BraftEditor config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <BraftEditor config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'tree') { return ( <Col span={item.width} key={item.uuid}> - <NormalTree config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <NormalTree config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'code') { return ( <Col span={item.width} key={item.uuid}> - <SandBox config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <SandBox config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'chart') { return ( <Col span={item.width} key={item.uuid}> - <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch}/> + <CustomChart config={item} data={data} mainSearch={mainSearch}/> </Col> ) } else if (item.type === 'module' && item.subtype === 'voucher') { return ( <Col span={item.width} key={item.uuid}> - <Voucher config={item} BID={_bid} /> + <Voucher config={item}/> </Col> ) } else { diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index a9f47c9..87e516a 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -210,6 +210,8 @@ 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 } diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index f4b1eea..3ff7443 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -459,6 +459,8 @@ 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 } diff --git a/src/tabviews/rolemanage/index.jsx b/src/tabviews/rolemanage/index.jsx index 6292715..cbcbbf7 100644 --- a/src/tabviews/rolemanage/index.jsx +++ b/src/tabviews/rolemanage/index.jsx @@ -558,7 +558,7 @@ this.getSelectMenuList() }) if (window.GLOB.mainSystemApi) { - Api.getLocalConfig(localParam).then(res => { + Api.genericInterface(localParam).then(res => { if (!res.status) { notification.warning({ top: 92, @@ -627,7 +627,7 @@ }) if (window.GLOB.mainSystemApi) { - Api.getLocalConfig(localParam).then(res => { + Api.genericInterface(localParam).then(res => { if (!res.status) { notification.warning({ top: 92, diff --git a/src/tabviews/scriptmanage/actionList/index.jsx b/src/tabviews/scriptmanage/actionList/index.jsx deleted file mode 100644 index 6ddf524..0000000 --- a/src/tabviews/scriptmanage/actionList/index.jsx +++ /dev/null @@ -1,311 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import moment from 'moment' -import { Button, Modal, notification, message } from 'antd' - -import asyncSpinComponent from '@/utils/asyncSpinComponent' -import options from '@/store/options.js' -import Utils from '@/utils/utils.js' -import Api from '@/api' -import './index.scss' - -const { confirm } = Modal -const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) - -class MainAction extends Component { - static propTpyes = { - BID: PropTypes.string, // 涓昏〃ID - BData: PropTypes.any, // 涓昏〃鏁版嵁 - Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� - MenuID: PropTypes.string, // 鑿滃崟ID - actions: PropTypes.array, // 鎸夐挳缁� - dict: PropTypes.object, // 瀛楀吀椤� - setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� - refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� - selectedData: PropTypes.array // 琛ㄦ牸閫変腑鏁版嵁 - } - - state = { - visible: false, - formdata: null, - tabledata: null, - confirmLoading: false, - execAction: null, - configMap: {} - } - - /** - * @description 瑙﹀彂鎸夐挳鎿嶄綔 - */ - actionTrigger = (item, record) => { - const { setting, selectedData } = this.props - - let _this = this - let data = selectedData || [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } - - if (item.Ot !== 'notRequired' && data.length === 0) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� - notification.warning({ - top: 92, - message: this.props.dict['main.action.confirm.selectline'], - duration: 5 - }) - return - } else if (item.Ot === 'requiredSgl' && data.length !== 1) { - // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 - notification.warning({ - top: 92, - message: this.props.dict['main.action.confirm.selectSingleLine'], - duration: 5 - }) - return - } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿� - notification.warning({ - top: 92, - message: '鏈缃富閿紒', - duration: 5 - }) - return - } - - if (item.OpenType === 'prompt') { - confirm({ - title: this.props.dict['main.action.confirm.tip'], - onOk() { - return new Promise(resolve => { - _this.execSubmit(item, data, resolve) - }) - }, - onCancel() {} - }) - } else if (item.OpenType === 'pop') { - this.setState({ - visible: true, - execAction: item, - tabledata: data - }) - } - } - - /** - * @description 鎸夐挳鎻愪氦鎵ц - */ - execSubmit = (btn, data, _resolve, formdata) => { - const { setting } = this.props - let primaryId = data[0] ? data[0][setting.primaryKey] : '' - - if (btn.sqlType === 'insert') { - primaryId = '' - } - - let values = {} - if (formdata) { - formdata.forEach(_data => { - values[_data.key] = _data.value - }) - } else { - values = data[0] - } - - let param = { // 鑷畾涔夎剼鏈坊鍔犱慨鏀瑰垹闄� - func: 's_custom_script_adduptdel', - ID: primaryId, - func_param: values.func, - Remark: values.Remark, - Sort: values.Sort, - LText: values.LongParam - } - - if (btn.sqlType === 'delete') { - param.LText = window.GLOB.appkey || '' - param.Remark = '' - param.Sort = 0 - param.func_param = '' - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - if (options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - } - - Api.genericInterface(param).then((res) => { - if (res.status) { - this.execSuccess(btn, res) - } else { - this.execError(res, btn) - } - _resolve() - }) - } - - /** - * @description 鎿嶄綔鎴愬姛鍚庡鐞� - * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� - * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� - * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� - * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� - * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� - */ - execSuccess = (btn, res) => { - if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 - notification.success({ - top: 92, - message: res.ErrMesg || this.props.dict['main.action.confirm.success'], - duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 - }) - } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 - Modal.success({ - title: res.ErrMesg || this.props.dict['main.action.confirm.success'] - }) - } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず - - } - - if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { - this.setState({ - visible: false - }) - } - - if (btn.execSuccess !== 'never') { - this.props.refreshdata() - } - } - - /** - * @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: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 - }) - } else if (res.ErrCode === 'F') { - notification.error({ - className: 'notification-custom-error', - top: 92, - message: res.message || res.ErrMesg, - duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10 - }) - } else if (res.ErrCode === 'NM') { - message.error(res.message || res.ErrMesg) - } - } - - - /** - * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� - */ - handleOk = () => { - this.formRef.handleConfirm().then(res => { - this.setState({ - confirmLoading: true - }) - - this.execSubmit(this.state.execAction, this.state.tabledata, () => { - this.setState({ - confirmLoading: false - }) - }, res) - }, () => {}) - } - - /** - * @description 妯℃�佹锛堣〃鍗曪級锛屽彇娑� - */ - handleCancel = () => { - this.setState({ - visible: false - }) - } - - /** - * @description 鏄剧ず妯℃�佹 - */ - getModels = () => { - const { execAction } = this.state - - if (!execAction || !this.state.visible) return - - let title = '' - let width = '62vw' - let clickouter = false - let container = document.body - - if (execAction && execAction.setting) { - title = execAction.setting.title - width = execAction.setting.width + 'vw' - - if (execAction.setting.container === 'tab' && this.props.ContainerId) { - width = execAction.setting.width + '%' - container = () => document.getElementById(this.props.ContainerId) - } - - if (execAction.setting.clickouter === 'close') { - clickouter = true - } - } - - return ( - <Modal - title={title} - maskClosable={clickouter} - getContainer={container} - wrapClassName='action-modal' - visible={this.state.visible} - width={width} - onOk={this.handleOk} - confirmLoading={this.state.confirmLoading} - onCancel={this.handleCancel} - destroyOnClose - > - <MutilForm - dict={this.props.dict} - action={execAction} - inputSubmit={this.handleOk} - configMap={this.state.configMap} - data={this.state.tabledata[0]} - BData={this.props.BData} - wrappedComponentRef={(inst) => this.formRef = inst} - /> - </Modal> - ) - } - - render() { - return ( - <div className="script-button-list script-toolbar-button"> - {this.props.actions.map((item, index) => { - return ( - <Button - className={'mk-btn mk-' + item.class} - icon={item.icon} - key={'action' + index} - onClick={() => {this.actionTrigger(item)}} - >{item.label}</Button> - ) - })} - {this.getModels()} - </div> - ) - } -} - -export default MainAction \ No newline at end of file diff --git a/src/tabviews/scriptmanage/actionList/index.scss b/src/tabviews/scriptmanage/actionList/index.scss deleted file mode 100644 index 8f7def9..0000000 --- a/src/tabviews/scriptmanage/actionList/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.script-button-list.script-toolbar-button { - position: relative; - padding: 15px 20px 5px; - background: #ffffff; - button { - min-width: 65px; - margin-right: 15px; - margin-bottom: 10px; - overflow: hidden; - } - .ant-spin { - position: fixed; - z-index: 1010; - left: calc(50vw - 22px); - top: calc(50vh - 70px); - } -} diff --git a/src/tabviews/scriptmanage/config.jsx b/src/tabviews/scriptmanage/config.jsx deleted file mode 100644 index ec8e807..0000000 --- a/src/tabviews/scriptmanage/config.jsx +++ /dev/null @@ -1,88 +0,0 @@ -// 鐗堟湰鍗囩骇椤甸潰閰嶇疆 -export const scriptMainTable = { - setting: { - "tableName":"s_custom_script", - "tableType":"radio", - "interType":"inner", - "innerFunc":"", - "dataresource":"Select s.* from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid=p.OpenID", - "queryType":"query", - "actionfixed":false, - "columnfixed":false, - "primaryKey":"ID", - "order":"ID desc", - "onload":"true" - }, - tables: [{"TbName":"s_custom_script","Remark":"鑷畾涔夎剼鏈�"}], - search: [ - {"label":"鎻忚堪","field":"Remark","type":"text","initval":"","oriInitval":"", "match":"like","required": false,"ratio":6,"blacklist":[],"uuid":"1587005744706mppigfhf206gciiivf9"} - ], - action:[ - {"label":"娣诲姞","OpenType":"pop","intertype":"inner","innerFunc":"s_custom_script_adduptdel","position":"toolbar","Ot":"notRequired","execSuccess":"grid","execError":"never","icon":"","class":"green","sql":"s_custom_script","sqlType":"insert","uuid":"1587006129803057fs8mb9q151ae6165"}, - {"label":"淇敼","OpenType":"pop","intertype":"inner","innerFunc":"s_custom_script_adduptdel","position":"toolbar","Ot":"requiredSgl","execSuccess":"grid","execError":"never","icon":"","class":"purple","sql":"s_custom_script","sqlType":"update","uuid":"1587007258155ut4nbggg4r66t9uhut2"}, - {"label":"鍒犻櫎","OpenType":"prompt","intertype":"inner","innerFunc":"s_custom_script_adduptdel","position":"toolbar","Ot":"requiredSgl","execSuccess":"grid","execError":"never","icon":"","class":"danger","sql":"s_custom_script","sqlType":"delete","uuid":"1587007300102g2i6nrhtml3fk9053o4"} - ], - columns: [ - {"label":"ID","field":"ID","type":"text","Align":"left","Hide":"true","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"158700581972776t63lf5ev320o0v3a7"}, - {"label":"鍑芥暟","field":"func","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"1587005972372rc3486g45kslpho2hfm"}, - {"label":"鎻忚堪","field":"Remark","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"15870058197274p6dte4omt4smcsrg4e"}, - {"label":"LongParam","field":"LongParam","type":"text","Align":"left","Hide":"true","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"158700581972767qdag1vc4l37olpbra"}, - {"uuid":"1587005819727akuibkaqkhsl1ntbh7a","Align":"left","label":"鎺掑簭","field":"Sort","Hide":"false","IsSort":"true","type":"number","Width":120}, - {"label":"鎿嶄綔鏃ユ湡","field":"ModifyDate","type":"text","Align":"left","Hide":"false","IsSort":"true","Width":120,"prefix":"","postfix":"","matchVal":"","color":"","fieldlength":50,"blacklist":[],"linkmenu":[],"uuid":"1587005860878ckccsiagipdfsfpdiib"} - ], - gridBtn: {"display":false,"Align":"center","IsSort":"false","uuid":"1587005721270gs3nb5u1gs4gsg7g77i","label":"鎿嶄綔","type":"action","style":"button","show":"horizontal","Width":120}, - tabs:[], - tabgroups: ["tabs"], - easyCode: "", - funcs: [ - {"type":"view","subtype":"view","uuid":"1587005717541lov40vg61q7l1rbveon","intertype":"inner","interface":"","tableName":"s_custom_script","innerFunc":"","outerFunc":""}, - {"type":"button","subtype":"btn","uuid":"1587006129803057fs8mb9q151ae6165","label":"娣诲姞","tableName":"s_custom_script","intertype":"inner","interface":"","innerFunc":"","outerFunc":"","callbackFunc":""}, - {"type":"button","subtype":"btn","uuid":"1587007258155ut4nbggg4r66t9uhut2","label":"淇敼","tableName":"s_custom_script","intertype":"inner","interface":"","innerFunc":"","outerFunc":"","callbackFunc":""}, - {"type":"button","subtype":"btn","uuid":"1587007300102g2i6nrhtml3fk9053o4","label":"鍒犻櫎","tableName":"s_custom_script","intertype":"inner","interface":"","innerFunc":"","outerFunc":"","callbackFunc":""} - ] -} - -export const buttonConfig = { - '1587006129803057fs8mb9q151ae6165': { - type: "Modal", - setting: { - "title":"娣诲姞", - "width": 80, - "focus":"func", - "cols":"2", - "finish":"close", - "clickouter":"unclose", - "container":"tab", - "display":"modal" - }, - tables:[ - {"TbName":"s_custom_script","Remark":"鑷畾涔夎剼鏈�"} - ], - fields:[ - {"label":"鍑芥暟",span:12,labelwidth: 33.3,"field":"func","type":"text","initval":"","readonly":"false","required":"true","hidden":"false","readin":"true","fieldlength":50,"regular":"funcname","supField":"","blacklist":[],"uuid":"1587006164634l397q15t49u2pfq02f5"}, - {"label":"鎺掑簭",span:12,labelwidth: 33.3,"field":"Sort","type":"number","initval":0,"decimal":0,"min":"","max":"","readonly":"false","hidden":"false","readin":"true","supField":"","blacklist":[],"uuid":"15870101796149403f2pqfpviuo415m2"}, - {"label":"鎻忚堪",span:24,labelwidth: 16.3,"field":"Remark","type":"textarea","initval":"","readonly":"false","required":"false","hidden":"false","readin":"true","fieldlength":512,"maxRows":6,"supField":"","blacklist":[],"uuid":"1587006199263k8hm45cmtomgu6hd881"}, - {"label":"鑴氭湰",span:24,labelwidth: 16.3,"field":"LongParam","type":"textarea","initval":"","readonly":"false","required":"true","encryption":"true","hidden":"false","readin":"true","fieldlength":12000,"maxRows":20,"supField":"","blacklist":[],"uuid":"1587006209935qbkle15h4d9i9lg9tcu"} - ] - }, - '1587007258155ut4nbggg4r66t9uhut2': { - type: "Modal", - setting: { - "title":"淇敼", - "width": 80, - "focus":"func", - "cols":"2", - "finish":"close", - "clickouter":"unclose", - "container":"tab", - "display":"modal" - }, - tables: [{"TbName":"s_custom_script","Remark":"鑷畾涔夎剼鏈�"}], - fields: [ - {"label":"鍑芥暟",span:12,labelwidth: 33.3,"field":"func","type":"text","initval":"","readonly":"false","required":"true","hidden":"false","readin":"true","fieldlength":50,"regular":"funcname","supField":"","blacklist":[],"uuid":"1587006164634l397q15t49u2pfq02f5"}, - {"label":"鎺掑簭",span:12,labelwidth: 33.3,"field":"Sort","type":"number","initval":0,"decimal":0,"min":"","max":"","readonly":"false","hidden":"false","readin":"true","supField":"","blacklist":[],"uuid":"1587010196675i9m6ie3tv9kg2rhgfi0"}, - {"label":"鎻忚堪",span:24,labelwidth: 16.3,"field":"Remark","type":"textarea","initval":"","readonly":"false","required":"false","hidden":"false","readin":"true","fieldlength":512,"maxRows":6,"supField":"","blacklist":[],"uuid":"1587006199263k8hm45cmtomgu6hd881"}, - {"label":"鑴氭湰",span:24,labelwidth: 16.3,"field":"LongParam","type":"textarea","initval":"","readonly":"false","required":"true","encryption":"true","hidden":"false","readin":"true","fieldlength":12000,"maxRows":20,"supField":"","blacklist":[],"uuid":"1587006209935qbkle15h4d9i9lg9tcu"} - ] - } -} diff --git a/src/tabviews/scriptmanage/index.jsx b/src/tabviews/scriptmanage/index.jsx deleted file mode 100644 index df5e94b..0000000 --- a/src/tabviews/scriptmanage/index.jsx +++ /dev/null @@ -1,349 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { notification, Switch } 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 { scriptMainTable, buttonConfig } from './config' -import MKEmitter from '@/utils/events.js' - -import asyncComponent from '@/utils/asyncComponent' -import asyncSpinComponent from '@/utils/asyncSpinComponent' -import MainAction from './actionList' -import './index.scss' - -const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) -const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) - -class ScriptTable extends Component { - static propTpyes = { - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuID: PropTypes.string // 鑿滃崟Id - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id - config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - searchlist: [], // 鎼滅储鏉′欢 - actions: [], // 鎸夐挳闆� - columns: [], // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� - setting: {}, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: [], // 鍒楄〃鏁版嵁闆� - selectedData: [], // 宸查�夎〃鏍兼暟鎹� - total: 0, // 鎬绘暟 - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - pageIndex: 1, // 椤电爜 - pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - orderBy: '', // 鎺掑簭 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - visible: false // 寮规鏄剧ず闅愯棌鎺у埗 - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - let config = scriptMainTable - - let _arrField = [] // 瀛楁闆� - let _columns = [] // 鏄剧ず鍒� - let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� - let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 - - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid - config.columns.forEach(col => { - if (col.field) { - _arrField.push(col.field) - } - if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 - _hideCol = _hideCol.concat(col.sublist) - } - colMap.set(col.uuid, col) - }) - - // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� - config.columns.forEach(col => { - if (_hideCol.includes(col.uuid)) return - - if (col.type === 'colspan') { - if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 - col.type = 'old_colspan' - } - - let _col = fromJS(col).toJS() - let subcols = [] - _col.sublist && _col.sublist.forEach(sub => { - if (colMap.has(sub)) { - subcols.push(colMap.get(sub)) - } - }) - if (subcols.length > 0) { - _col.subcols = subcols - _columns.push(_col) - } - } else { - _columns.push(col) - } - }) - - this.setState({ - config: config, - setting: config.setting, - searchlist: config.search, - actions: config.action.map(item => { - if (buttonConfig[item.uuid]) { - item = {...buttonConfig[item.uuid], ...item} - } - return item - }), - columns: _columns, - arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search) - }, () => { - this.setState({ - loading: true - }) - this.loadmaindata() - }) - } - - /** - * @description 涓昏〃鏁版嵁鍔犺浇 - */ - async loadmaindata () { - const { setting } = this.state - let param = this.getDefaultParam() - - this.setState({ - pickup: false - }) - - if (options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - } - - let result = await Api.genericInterface(param) - if (result.status) { - this.setState({ - data: result.data.map((item, index) => { - item.key = index - item.$$uuid = item[setting.primaryKey] || '' - return item - }), - total: result.total, - loading: false - }) - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鐨勫弬鏁� - */ - getDefaultParam = () => { - const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state - - let _search = Utils.joinMainSearchkey(search) - - _search = _search ? 'where ' + _search : '' - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field, - menuname: this.props.MenuName || '' - } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - let LText = `select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows` - let DateCount = `select count(1) as total from ${_dataresource} ${_search}` - - 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 = Utils.formatOptions(DateCount) - - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 - - return param - } - - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - loading: true, - pageIndex: 1, - selectedData: [], - search: searches - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - if (sorter.order) { - let _chg = { - ascend: 'asc', - descend: 'desc' - } - sorter.order = _chg[sorter.order] - } - - this.setState({ - loading: true, - selectedData: [], - pageIndex: pagination.current, - pageSize: pagination.pageSize, - orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = () => { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - loading: true, - pageIndex: 1, - selectedData: [] - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - this.setState({ config: {}, searchlist: [], actions: [], columns: [], arr_field: '', setting: {}, data: [], total: 0, - loading: false, pageIndex: 1, pageSize: 10, orderBy: '', search: '', pickup: false, selectedData: [] - }, () => { - this.loadconfig() - }) - } - - /** - * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� - */ - changeSelectedData = (selectedData) => { - this.setState({selectedData}) - } - - /** - * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 - */ - pickupChange = () => { - const { pickup } = this.state - this.setState({ - pickup: !pickup - }) - } - - reloadMenuView = (menuId) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - this.reloadview() - } - - UNSAFE_componentWillMount () { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.loadconfig() - } - - componentDidMount () { - MKEmitter.addListener('reloadMenuView', this.reloadMenuView) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) - } - - render() { - const { searchlist, setting, actions, columns, pickup, selectedData } = this.state - - return ( - <div className="script-manage-table" id={this.state.ContainerId}> - <MainSearch searchlist={searchlist} refreshdata={this.refreshbysearch}/> - <MainAction - BID="" - type="main" - setting={setting} - actions={actions} - dict={this.state.dict} - MenuID={this.props.MenuID} - selectedData={selectedData} - ContainerId={this.state.ContainerId} - refreshdata={this.reloadtable} - /> - <div className="main-table-box"> - {this.state.data && this.state.data.length > 0 ? - <div className="pickchange"> - <Switch title="鏀惰捣" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> - </div> : null - } - <MainTable - tableId={this.props.MenuID} - pickup={pickup} - setting={setting} - columns={columns} - dict={this.state.dict} - data={this.state.data} - total={this.state.total} - MenuID={this.props.MenuID} - loading={this.state.loading} - refreshdata={this.refreshbytable} - buttonTrigger={() => {}} - chgSelectData={this.changeSelectedData} - /> - </div> - </div> - ) - } -} - -export default ScriptTable \ No newline at end of file diff --git a/src/tabviews/scriptmanage/index.scss b/src/tabviews/scriptmanage/index.scss deleted file mode 100644 index 7068f22..0000000 --- a/src/tabviews/scriptmanage/index.scss +++ /dev/null @@ -1,72 +0,0 @@ -.script-manage-table { - position: relative; - min-height: calc(100vh - 94px); - padding-top: 16px; - padding-bottom: 80px; - - .search-line { - padding: 0px 24px 0px; - border-bottom: 1px solid #efefef; - } - - .box404 { - padding-top: 30px; - } - .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-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; - padding: 0 20px; - .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/subtable/index.jsx b/src/tabviews/subtable/index.jsx index d58628f..bc460d3 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -188,6 +188,15 @@ col.linkThdMenu = '' } + if (col.type === 'number') { + col.decimal = col.decimal || 0 + col.round = Math.pow(10, col.decimal) + + if (col.format === 'percent') { + col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 + } + } + col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { statFields.push(col) @@ -842,7 +851,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { Tab, mainSearch, MenuID } = this.props const { arr_field, orderBy, search, setting} = this.state @@ -853,7 +862,7 @@ searches = [...mainSearch, ...search] } - MKEmitter.emit('returnModuleParam', MenuID, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: searches, diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index ff72754..9b576d2 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -160,6 +160,15 @@ if (col.field) { _arrField.push(col.field) + if (col.type === 'number') { + col.decimal = col.decimal || 0 + col.round = Math.pow(10, col.decimal) + + if (col.format === 'percent') { + col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 + } + } + col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈� if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') { statFields.push(col) @@ -782,13 +791,13 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { Tab, MenuID } = this.props const { arr_field, orderBy, search, setting} = this.state if (MenuID !== menuId) return - MKEmitter.emit('returnModuleParam', MenuID, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: search, diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx deleted file mode 100644 index 41c9e8b..0000000 --- a/src/tabviews/verupmanage/actionList/index.jsx +++ /dev/null @@ -1,825 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import moment from 'moment' -import { Button, Modal, notification, message } from 'antd' - -import asyncSpinComponent from '@/utils/asyncSpinComponent' -import Utils, { getSysDefaultSql } from '@/utils/utils.js' -import options from '@/store/options.js' -import { updateForm } from '@/utils/utils-update.js' -import Api from '@/api' -import './index.scss' - -const { confirm } = Modal -const MutilForm = asyncSpinComponent(() => import('@/tabviews/zshare/mutilform')) - -class MainAction extends Component { - static propTpyes = { - BID: PropTypes.string, // 涓昏〃ID - BData: PropTypes.any, // 涓昏〃鏁版嵁 - Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� - type: PropTypes.string, // 鍒ゆ柇褰撳墠涓轰富琛紙main锛夈�佸瓙琛紙sub锛夈�佸瓙琛ㄦ爣绛撅紙subtab锛� - MenuID: PropTypes.string, // 鑿滃崟ID - actions: PropTypes.array, // 鎸夐挳缁� - columns: PropTypes.array, // 鏄剧ず鍒� - dict: PropTypes.object, // 瀛楀吀椤� - setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� - refreshdata: PropTypes.func, // 鎵ц瀹屾垚鍚庢暟鎹埛鏂� - selectedData: PropTypes.array // 琛ㄦ牸閫変腑鏁版嵁 - } - - state = { - visible: false, - formdata: null, - tabledata: null, - confirmLoading: false, - execAction: null, - loadingUuid: '', - configMap: {}, - loadingNumber: '', - } - - refreshdata = (item, type) => { - this.props.refreshdata(item, type) - } - - /** - * @description 瑙﹀彂鎸夐挳鎿嶄綔 - */ - actionTrigger = (item, record) => { - const { setting, type, Tab, BID, selectedData } = this.props - - if (type === 'sub' && Tab && Tab.supMenu && !BID) { - notification.warning({ - top: 92, - message: '闇�瑕佷笂绾т富閿�硷紒', - duration: 5 - }) - return - } - - let _this = this - let data = selectedData || [] - - if (record) { // 琛ㄦ牸涓Е鍙戞寜閽� - data = [record] - } - - if (item.Ot !== 'notRequired' && data.length === 0) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� - notification.warning({ - top: 92, - message: this.props.dict['main.action.confirm.selectline'], - duration: 5 - }) - return - } else if (item.Ot === 'requiredSgl' && data.length !== 1) { - // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 - notification.warning({ - top: 92, - message: this.props.dict['main.action.confirm.selectSingleLine'], - duration: 10 - }) - return - } else if (item.Ot !== 'notRequired' && !setting.primaryKey) { - // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾槸鍚﹁缃富閿� - notification.warning({ - top: 92, - message: '鏈缃富閿紒', - duration: 5 - }) - return - } - - if (item.OpenType === 'prompt') { - confirm({ - title: this.props.dict['main.action.confirm.tip'], - onOk() { - _this.setState({ - loadingUuid: item.uuid - }) - - return new Promise(resolve => { - _this.execSubmit(item, data, resolve) - }) - }, - onCancel() {} - }) - } else if (item.OpenType === 'exec') { - this.setState({loadingUuid: item.uuid}) - this.execSubmit(item, data, () => { - this.setState({loadingUuid: ''}) - }) - } else if (item.OpenType === 'pop') { - item = updateForm(item) - if (item.setting.display === 'prompt') { // 濡傛灉琛ㄥ崟浠ユ槸鍚︽灞曠ず锛屼笉璇锋眰涓嬫媺鑿滃崟淇℃伅 - this.setState({ - execAction: item, - tabledata: data - }, () => { - this.modelconfirm() - }) - } else { - this.setState({ - visible: true, - execAction: item, - tabledata: data - }) - } - } else { - notification.warning({ - top: 92, - message: '灏氫笉鏀寔姝ゅ姛鑳姐�傘�傘��', - duration: 5 - }) - } - } - - /** - * @description 鎸夐挳鎻愪氦鎵ц - */ - execSubmit = (btn, data, _resolve, formdata) => { - const { setting, columns } = this.props - - if (btn.intertype === 'inner') { - // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� - // 鎵撳紑鏂瑰紡涓烘ā鎬佹锛屼娇鐢ㄥ唴閮ㄥ嚱鏁版坊鍔�(鏈夋壒閲忔坊鍔犲満鏅紝宸插幓闄�) - if ( - btn.Ot === 'notRequired' || - btn.Ot === 'requiredSgl' || - (btn.Ot === 'requiredOnce' && btn.OpenType !== 'pop') - ) { - - let param = { // 绯荤粺瀛樺偍杩囩▼ - func: 'sPC_TableData_InUpDe', - BID: this.props.BID - } - let primaryId = setting.primaryKey && data[0] ? (data[0][setting.primaryKey] || '') : '' - - if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� - let ID = '' - if (btn.Ot === 'notRequired') { - - } else if (btn.Ot === 'requiredSgl') { - ID = data[0][setting.primaryKey] - } else if (btn.Ot === 'requiredOnce') { // id鍊兼嫾鎺� - let ids = data.map(d => { return d[setting.primaryKey]}) - ID = ids.join(',') - } - - if (btn.innerFunc) { // 浣跨敤鑷畾涔夊嚱鏁� - param.func = btn.innerFunc - if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 - param[setting.primaryKey] = ID - } - } else if (btn.sql) { - param.ID = primaryId - param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns) // 鏁版嵁婧� - - param.exec_type = 'y' // 鍚庡彴瑙g爜 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } - } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 - if (btn.innerFunc) { - param.func = btn.innerFunc - - if (setting.primaryKey) { // 涓婚敭瀛樺湪鏃讹紝璁剧疆涓婚敭鍙傛暟 - param[setting.primaryKey] = primaryId - } - - formdata.forEach(_data => { - param[_data.key] = _data.value - }) - - } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid - primaryId = '' - if (formdata && setting.primaryKey) { // 琛ㄥ崟涓瓨鍦ㄤ富閿瓧娈碉紝涓婚敭鍊间互琛ㄥ崟涓殑鍊间负鍑� - let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] - if (_form) { - primaryId = _form.value - } - } - param.ID = primaryId || Utils.getguid() - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 鏁版嵁婧� - - param.exec_type = 'y' // 鍚庡彴瑙g爜 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } else if (btn.sql) { - param.ID = primaryId - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns) // 鏁版嵁婧� - - param.exec_type = 'y' // 鍚庡彴瑙g爜 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } - } - - if (param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - Api.genericInterface(param).then((res) => { - if (res.status) { - this.execSuccess(btn, res) - } else { - this.execError(res, btn) - } - _resolve() - }) - } else if (btn.Ot === 'required' || (btn.Ot === 'requiredOnce' && btn.OpenType === 'pop')) { - let _formPrimaryId = '' - if (formdata && setting.primaryKey) { // 琛ㄥ崟涓瓨鍦ㄤ富閿瓧娈碉紝涓婚敭鍊间互琛ㄥ崟涓殑鍊间负鍑� - let _form = formdata.filter(_form => _form.key === setting.primaryKey)[0] - if (_form) { - _formPrimaryId = _form.value - } - } - - let _params = data.map((cell, index) => { - let param = { - func: 'sPC_TableData_InUpDe', - BID: this.props.BID - } - let primaryId = setting.primaryKey ? cell[setting.primaryKey] : '' - - if (btn.OpenType === 'prompt' || btn.OpenType === 'exec') { // 鏄惁寮规鎴栫洿鎺ユ墽琛� - - if (btn.innerFunc) { - param.func = btn.innerFunc - if (setting.primaryKey) { - param[setting.primaryKey] = primaryId - } - } else if (btn.sql) { - param.ID = primaryId - param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns) // 鏁版嵁婧� - - param.exec_type = 'y' // 鍚庡彴瑙g爜 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } - } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 - if (btn.innerFunc) { - param.func = btn.innerFunc - - formdata.forEach(_data => { - if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { - param[_data.key] = cell[_data.key] - } else { - param[_data.key] = _data.value - } - }) - - if (setting.primaryKey) { - param[setting.primaryKey] = primaryId - } - } else if (btn.sql && btn.sqlType === 'insert') { // 绯荤粺鍑芥暟娣诲姞鏃讹紝鐢熸垚uuid - param.ID = _formPrimaryId || Utils.getguid() - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 鏁版嵁婧� - - param.exec_type = 'y' // 鍚庡彴瑙g爜 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } else if (btn.sql) { - if (index !== 0) { - formdata = formdata.map(_data => { - if (_data.readin && cell.hasOwnProperty(_data.key)) { - _data.value = cell[_data.key] - } - return _data - }) - } - - param.ID = primaryId - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns) // 鏁版嵁婧� - - param.exec_type = 'y' // 鍚庡彴瑙g爜 - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - } - } - - if (param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - return param - }) - - if (_params.length <= 20) { - let deffers = _params.map(param => { - return new Promise(resolve => { - Api.genericInterface(param).then(res => { - resolve(res) - }) - }) - }) - Promise.all(deffers).then(result => { - let iserror = false - let errorMsg = '' - result.forEach(res => { - if (res.status) { - errorMsg = res - } else { - iserror = true - errorMsg = res - } - }) - if (!iserror) { - this.execSuccess(btn, errorMsg) - } else { - this.execError(errorMsg, btn) - } - _resolve() - }) - } else { // 瓒呭嚭20涓姹傛椂寰幆鎵ц - if (btn.progress === 'progressbar') { - this.setState({ - loadingTotal: _params.length - }) - } - this.innerLoopRequest(_params, btn, _resolve) - } - } - } else if (btn.intertype === 'outer') { - /** *********************璋冪敤澶栭儴鎺ュ彛************************* */ - - let _params = [] // 璇锋眰鍙傛暟鏁扮粍 - - if (btn.Ot === 'notRequired' || btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') { - let param = { - BID: this.props.BID - } - - if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 - formdata.forEach(_data => { - param[_data.key] = _data.value - }) - } - - // 鑾峰彇id - if (btn.Ot === 'notRequired') { - - } else if (btn.Ot === 'requiredSgl' && setting.primaryKey) { - param[setting.primaryKey] = data[0][setting.primaryKey] - } else if (btn.Ot === 'requiredOnce' && setting.primaryKey) { - let ids = data.map(d => { return d[setting.primaryKey]}) - param[setting.primaryKey] = ids.join(',') - } - - _params.push(param) - } else if (btn.Ot === 'required') { - // 閫夋嫨澶氳锛屽惊鐜皟鐢� - _params = data.map((cell, index) => { - let _cell = { - BID: this.props.BID, - } - - let _formparam = {} - if (btn.OpenType === 'pop' && formdata) { // 琛ㄥ崟 - formdata.forEach(_data => { - if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { - _formparam[_data.key] = cell[_data.key] - } else { - _formparam[_data.key] = _data.value - } - }) - } - - if (setting.primaryKey) { - _cell[setting.primaryKey] = cell[setting.primaryKey] - } - - _cell = {..._formparam, ..._cell} - - return _cell - }) - } - - if (_params.length > 1 && btn.progress === 'progressbar') { - this.setState({ - loadingTotal: _params.length - }) - } - - // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛� - this.outerLoopRequest(_params, btn, _resolve) - } - } - - /** - * @description 鍐呴儴璇锋眰寰幆鎵ц - */ - innerLoopRequest = (params, btn, _resolve) => { - if (!params && params.length === 0) return - - let param = params.shift() - - this.setState({ - loadingNumber: params.length - }) - - Api.genericInterface(param).then(res => { - if (res.status) { - if (params.length === 0) { - this.execSuccess(btn, res) - _resolve() - } else { - this.innerLoopRequest(params, btn, _resolve) - } - } else { - this.execError(res, btn) - _resolve() - } - }) - } - - /** - * @description 澶栭儴璇锋眰寰幆鎵ц - */ - outerLoopRequest = (params, btn, _resolve) => { - if (!params && params.length === 0) return - - let param = params.shift() - let _outParam = null - let _localParam = null - let errRes = null - - this.setState({ - loadingNumber: params.length - }) - - 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 - - // 浣跨敤澶勭悊鍚庣殑鏁版嵁璋冪敤澶栭儴鎺ュ彛 - let keys = Object.keys(res) // 鎻愪氦澶栭儴鎺ュ彛鍓嶏紝娣诲姞BID - if (keys.filter(key => key.toLowerCase() === 'bid').length === 0) { - res.BID = this.props.BID - } - - 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 (btn.outerFunc === 's_app_version_upt') { // 鏇存柊鐗堟湰鍙� - if (window.GLOB.mainSystemApi) { - res.rduri = window.GLOB.mainSystemApi - } - } else if (btn.sysInterface === 'true' && options.cloudServiceApi) { - res.rduri = options.cloudServiceApi - } 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 - - if (response.UpType === 'SSO' && window.GLOB.mainSystemApi) { - _localParam = {..._outParam, ...response} - - response.rduri = window.GLOB.mainSystemApi - - if (_localParam.LTextOut) { - _localParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - _localParam.secretkey = Utils.encrypt(_localParam.LTextOut, _localParam.timestamp) - _localParam.open_key = Utils.encryptOpenKey(_localParam.secretkey, _localParam.timestamp) - } - } - delete response.UpType - - let _callbackparam = {..._outParam, ...response} - if (_callbackparam.LTextOut) { - _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp) - _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) - } - - return Api.getLocalConfig(_callbackparam) - } else { - if (response.status) { - // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� - - if (params.length === 0) { - this.execSuccess(btn, response) - _resolve() - } else { - this.outerLoopRequest(params, btn, _resolve) - } - } else { - this.execError(response, btn) - _resolve() - } - } - }).then(res => { - if (!res) return - - if (_localParam) { - if (!res.status) { - errRes = res - } - return Api.getLocalConfig(_localParam) - } else if (res.status) { - if (params.length === 0) { - this.execSuccess(btn, res) - _resolve() - } else { - this.outerLoopRequest(params, btn, _resolve) - } - } else { - this.execError(res, btn) - _resolve() - } - }).then(res => { - if (!res) return - - if (res.status && !errRes) { - if (params.length === 0) { - this.execSuccess(btn, res) - _resolve() - } else { - this.outerLoopRequest(params, btn, _resolve) - } - } else { - this.execError(errRes || res, btn) - _resolve() - } - }) - } - - /** - * @description 鎿嶄綔鎴愬姛鍚庡鐞� - * 1銆乪xcel瀵煎嚭锛屾垚鍔熷悗鍙栨秷瀵煎嚭鎸夐挳鍔犺浇涓姸鎬� - * 2銆佺姸鎬佺爜涓� S 鏃讹紝鏄剧ず鎴愬姛淇℃伅鍚庣郴缁熼粯璁や俊鎭� - * 3銆佺姸鎬佺爜涓� -1 鏃讹紝涓嶆樉绀轰换浣曚俊鎭� - * 4銆佹ā鎬佹鎵ц鎴愬姛鍚庢槸鍚﹀叧闂� - * 5銆侀�氱煡涓诲垪琛ㄥ埛鏂� - */ - execSuccess = (btn, res) => { - if (res && res.ErrCode === 'S') { // 鎵ц鎴愬姛 - notification.success({ - top: 92, - message: res.ErrMesg || this.props.dict['main.action.confirm.success'], - duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 - }) - } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 - Modal.success({ - title: res.ErrMesg || this.props.dict['main.action.confirm.success'] - }) - } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず - - } - - if (btn.OpenType === 'pop' && btn.setting && btn.setting.finish !== 'unclose') { - this.setState({ - visible: false - }) - } - - this.setState({ - loadingUuid: '', - loadingNumber: '' - }) - - this.refreshdata(btn, 'success') - } - - /** - * @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: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 - }) - } else if (res.ErrCode === 'F') { - notification.error({ - className: 'notification-custom-error', - top: 92, - message: res.message || res.ErrMesg, - duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10 - }) - } else if (res.ErrCode === 'NM') { - message.error(res.message || res.ErrMesg) - } - - this.setState({ - loadingUuid: '', - loadingNumber: '' - }) - - this.refreshdata(btn, 'error') - } - - modelconfirm = () => { - const { BData } = this.props - const { execAction, tabledata } = this.state - let _this = this - - let result = [] - execAction.fields.forEach(item => { - if (!item.field) return - let _readin = item.readin !== 'false' - let _initval = item.initval - - if (item.type === 'linkMain' || item.type === 'funcvar') { - _readin = false - } - - if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { - _initval = BData[item.field] - } else if (_readin && tabledata[0] && tabledata[0].hasOwnProperty(item.field)) { - _initval = tabledata[0][item.field] - } - - 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 - } - - result.push({ - key: item.field, - readonly: item.readonly === 'true', - readin: _readin, - fieldlen: _fieldlen, - type: item.type, - value: _initval - }) - }) - - confirm({ - title: this.props.dict['main.action.confirm.tip'], - onOk() { - _this.setState({ - loadingUuid: execAction.uuid - }) - - return new Promise(resolve => { - _this.execSubmit(execAction, tabledata, resolve, result) - }) - }, - onCancel() {} - }) - } - - /** - * @description 妯℃�佹锛堣〃鍗曪級锛岀‘璁� - */ - handleOk = () => { - this.formRef.handleConfirm().then(res => { - this.setState({ - confirmLoading: true - }) - - this.execSubmit(this.state.execAction, this.state.tabledata, () => { - this.setState({ - confirmLoading: false - }) - }, res) - }, () => {}) - } - - /** - * @description 妯℃�佹锛堣〃鍗曪級锛屽彇娑� - */ - handleCancel = () => { - this.setState({ - visible: false - }) - } - - /** - * @description 鏄剧ず妯℃�佹 - */ - getModels = () => { - const { execAction } = this.state - - if (!execAction || !this.state.visible) return - - let title = '' - let width = '62vw' - let clickouter = false - let container = document.body - - if (execAction && execAction.setting) { - title = execAction.setting.title - width = execAction.setting.width + 'vw' - - if (execAction.setting.container === 'tab' && this.props.ContainerId) { - width = execAction.setting.width + '%' - container = () => document.getElementById(this.props.ContainerId) - } - - if (execAction.setting.clickouter === 'close') { - clickouter = true - } - } - - if (this.props.type === 'subtab') { - container = document.body - } - - return ( - <Modal - title={title} - maskClosable={clickouter} - getContainer={container} - wrapClassName='action-modal' - visible={this.state.visible} - width={width} - onOk={this.handleOk} - confirmLoading={this.state.confirmLoading} - onCancel={this.handleCancel} - destroyOnClose - > - <MutilForm - dict={this.props.dict} - action={execAction} - inputSubmit={this.handleOk} - configMap={this.state.configMap} - data={this.state.tabledata[0]} - BData={this.props.BData} - wrappedComponentRef={(inst) => this.formRef = inst} - /> - </Modal> - ) - } - - render() { - const { loadingUuid, loadingNumber } = this.state - - return ( - <div className="verup-button-list verup-toolbar-button"> - {this.props.actions.map((item, index) => { - let label = item.label - if (loadingUuid === item.uuid && loadingNumber) { - label = label + '(' + loadingNumber + ')' - } - return ( - <Button - className={'mk-btn mk-' + item.class} - icon={item.icon} - key={'action' + index} - onClick={() => {this.actionTrigger(item)}} - loading={loadingUuid === item.uuid} - >{label}</Button> - ) - })} - {this.getModels()} - </div> - ) - } -} - -export default MainAction \ No newline at end of file diff --git a/src/tabviews/verupmanage/actionList/index.scss b/src/tabviews/verupmanage/actionList/index.scss deleted file mode 100644 index 9751b46..0000000 --- a/src/tabviews/verupmanage/actionList/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.verup-button-list.verup-toolbar-button { - position: relative; - padding: 10px 20px 5px; - background: #ffffff; - button { - min-width: 65px; - margin-right: 15px; - margin-bottom: 10px; - overflow: hidden; - } - .ant-spin { - position: fixed; - z-index: 1010; - left: calc(50vw - 22px); - top: calc(50vh - 70px); - } -} diff --git a/src/tabviews/verupmanage/config.jsx b/src/tabviews/verupmanage/config.jsx deleted file mode 100644 index 527dcec..0000000 --- a/src/tabviews/verupmanage/config.jsx +++ /dev/null @@ -1,159 +0,0 @@ -// 鐗堟湰鍗囩骇椤甸潰閰嶇疆 -export const verupMainTable = { - setting: { - tableName: 'sVersion', - tableType: 'radio', - interType: 'inner', - actionfixed: false, - columnfixed: false, - primaryKey: 'ID', - order: 'ID desc', - innerFunc: '', - dataresource: 'select * from sVersion_Local where deleted=0 and status=10 and appkey=@Appkey@', - queryType: 'query', - }, - search:[ - {label: '浼犺緭鍙�', field: 'VersionName', type: 'text', initval:'', oriInitval: '', required: false, match: 'like', uuid: '1581736007223d84ddmht4gdfb1850nh'} - ], - action:[ - {label:'娣诲姞',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersiondetail_Up',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sVersion_Local_add',position:'toolbar',$toolbtn: true,Ot:'notRequired',execSuccess:'grid',execError:'never',icon:'',class:'green',uuid:'1583979660949vpssdb2p2lsqff9abkr'}, - {label:'鍏抽棴',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',$toolbtn: true,Ot:'requiredSgl',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersion',sqlType:'LogicDelete',uuid:'1583979660949msql0p8bgiiedlu4r82', - verify: { - default: 'false', - invalid: 'true', - uniques: [], - contrasts: [], - accountdate: 'false', - customverifys: [], - billcodes: [], - voucher: {enabled: false}, - scripts:[ - { - sql: 'declare @Vid nvarchar(50)\nset @Vid=\'\'\nselect top 1 @Vid=id from sVersionDetail_Local where BID=@ID@ and Status =10\n\nif @Vid=\'\'\nbegin\n delete sVersion_Local where id =@ID@\n delete sVersionDetail_Local where bid =@ID@\nend\nelse\nbegin\n update sVersion_Local set deleted=1,Modifydate=getdate(),ModifyUserID=@UserID@ where id =@ID@\nend', - uuid: '15839986098557o6ri091qo9flrc5c0a' - } - ] - } - }, - // {OpenType:"prompt",Ot:"notRequired",callbackFunc:"",position:"toolbar",sysInterface:"true",execSuccess:"grid",label:"鏇存柊鐗堟湰",intertype:"outer",execError:"never",class:"primary", - // icon:"",interface:"http://cloud.mk9h.cn/webapi/dostars",innerFunc:"",uuid:"15926364942911efnal5pv6r92if2vr2",outerFunc:"s_app_version_upt"} - ], - columns:[ - {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736658674f11dg01sqdneu8bbn2q'}, - {label:'浼犺緭鍙�',field:'VersionName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'158173670848068ku8o5a7csuiepd4v8'}, - {label:'璇存槑',field:'ProgramName',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15817367246420ubig4dkim4on7bv3kp'}, - {label:'鐘舵��',field:'StatusName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736695990kvpkao3d14etkc88c12'}, - {label:'鍒涘缓鏃堕棿',field:'CreateDate',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1581736740656s2o0llughpc779l0qti'} - ], - gridBtn: {display: false}, - tabs:[ - {label:'鑴氭湰',type:'SubTable',linkTab:'15839835082267ac69e4gm0ig6ac00ob',icon:'',supMenu:'1583979633842550imkchl4qt4qppsiv'/* mainTable */,equalTab:[],uuid:'1583979660949hguu6ildhut1ig5mco1'}, - {label:'宸叉墽琛�',type:'SubTable',linkTab:'1583984646423lo60vt7snppb55lslbt',icon:'',supMenu:'1583979633842550imkchl4qt4qppsiv'/* mainTable */,equalTab:[],uuid:'1583984632864kedhlvu7l31us7pkmbq'} - ] -} - -export const buttonConfig = { - '1583979660949vpssdb2p2lsqff9abkr': { - type: 'Modal', - version: '1.0', - setting:{title: '娣诲姞',width:45,focus:'VersionName',finish:'close',clickouter:'unclose',container:'tab',display:'modal'}, - tables:[], - fields:[ - {label:'浼犺緭鍙�',field:'VersionName',span:24,labelwidth: 33.3,type:'text',initval:'',regular:'letter&number',readonly:'false',required:'true',hidden:'false',fieldlength:20,readin:'true',uuid:'1581738428097qgoe876i5u0866373uu'} - ] - }, - '1583983849299g1qfd28g3c9n9e0e57a': { - type:'Modal', - setting:{ - title:'鎵ц', - width:60, - focus:'SrcID', - cols:'2', - finish:'close', - clickouter:'unclose', - container:'tab', - display:'prompt' - }, - groups: [], - fields: [ - {'label':'SrcID','field':'SrcID','type':'text','initval':'','regular':'','readonly':'false','required':'true','hidden':'false','fieldlength':50,'readin':'true','supField':'','uuid':'1584001255960ns626a3pkfkhk04hn7u'} - ] - } -} - -export const tabConfig = { - '15839835082267ac69e4gm0ig6ac00ob': { - tabName:'鑴氭湰', - tabNo:'sVersionDetail_LocalM', - Remark:'', - uuid:'15839835082267ac69e4gm0ig6ac00ob', - setting:{ - tableName:'sVersionDetail_Local', - tableType:'checkbox', - interType:'inner', - innerFunc:'', - dataresource:'select * from sVersionDetail_Local where BID=@BID@ and deleted=0 and status=0', - queryType:'query', - primaryKey:'ID', - order:'Sort', - onload:'true' - }, - search:[ - {label:'缁煎悎鏌ヨ',field:'Remark,KeyWords,TypeName',type:'text',initval:'', oriInitval: '', required: false,match:'like','ratio':6,uuid:'1583983588787acl55md59fu9kpb52db'} - ], - action:[ - {label:'鎵ц',OpenType:'pop',intertype:'outer',innerFunc:'',sysInterface:'true',outerFunc:'s_get_sVersionDetail_Ltext',interface:'http://cloud.mk9h.cn/webapi/dostars',callbackFunc:'s_sDataDictb_TBBack',position:'toolbar',$toolbtn: true,execSuccess:'grid',execError:'never',icon:'',class:'primary',Ot:'required',progress: 'progressbar',uuid:'1583983849299g1qfd28g3c9n9e0e57a',verify:null}, - {label:'鍏抽棴',OpenType:'prompt',intertype:'inner',innerFunc:'',position:'toolbar',$toolbtn: true,Ot:'required',progress: 'progressbar',execSuccess:'grid',execError:'never',icon:'',class:'border-danger',sql:'sVersionDetail_Local',sqlType:'LogicDelete',uuid:'1583984089282i4i140hacimbki9s5gh', - verify:{ - default: 'true', - invalid: 'true', - uniques: [], - contrasts: [], - accountdate: 'false', - customverifys: [], - billcodes: [], - voucher: {enabled: false}, - scripts: [] - } - } - ], - columns:[ - {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983669503v35f3e7f52iosklnomg'}, - {label:'鍏抽敭瀛�',field:'KeyWords',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15839836784475gl5v26qgual768ab8u'}, - {label:'鎻忚堪',field:'Remark',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'15839837044624m3k41m7omhs6q8f9fo'}, - {label:'绫诲瀷',field:'TypeName',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983717421ts67iu14hmmeqivel5e'}, - {label:'鎺掑簭',field:'Sort',type:'text',Align:'left',Hide:'false',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583983728654ks05hor8mgiqbp61ivl'}, - {label:'SrcID',field:'SrcID',type:'text',Align:'left',Hide:'true',IsSort:'false',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1584001165784gu23d35b43i860n0a19'} - ], - gridBtn: {display: false} - }, - '1583984646423lo60vt7snppb55lslbt': { - tabName:'宸叉墽琛�', - tabNo:'sVersionDetail_Local_ReadyM', - Remark:'', - uuid:'1583984646423lo60vt7snppb55lslbt', - setting:{ - tableName:'sVersionDetail_Local', - tableType:'checkbox', - interType:'inner', - innerFunc:'', - dataresource:'select * from sVersionDetail_Local where BID=@BID@ and deleted=0 and status=10', - queryType:'query', - primaryKey:'ID', - order:'Sort', - onload:'true' - }, - search:[ - {label:'缁煎悎鏌ヨ',field:'Remark,KeyWords,TypeName',type:'text',initval:'', oriInitval: '', required: false,match:'like',uuid:'15839847143720ggaaukqtfhp3mirsuc'} - ], - action:[], - columns:[ - {label:'ID',field:'ID',type:'text',Align:'left',Hide:'true',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984775854fkg1kriv6un6v6r21mu'}, - {label:'鍏抽敭瀛�',field:'KeyWords',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984782136vspicmogvs44o5c0u8n'}, - {label:'鎻忚堪',field:'Remark',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984799089vi8v268uur6mhqmi71o'}, - {label:'绫诲瀷',field:'TypeName',type:'text',Align:'left',Hide:'false',IsSort:'true',Width:120,prefix:'',postfix:'',matchVal:'',color:'',fieldlength:50,uuid:'1583984810593u53835abq83e7h63vce'}, - {label:'鎺掑簭',field:'Sort',type:'number',Align:'left',Hide:'false',IsSort:'true',Width:120,'decimal':0,'format':'',prefix:'',postfix:'',match:'',matchVal:'',color:'',uuid:'1583984826744bttg6mt4oqskckpoasl'} - ], - gridBtn: {display: false} - } -} diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx deleted file mode 100644 index d982822..0000000 --- a/src/tabviews/verupmanage/index.jsx +++ /dev/null @@ -1,523 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { notification, Tabs, Switch } 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/asyncComponent' -import asyncSpinComponent from '@/utils/asyncSpinComponent' -import { verupMainTable, buttonConfig } from './config' -import MkIcon from '@/components/mk-icon' -import MKEmitter from '@/utils/events.js' -import MainAction from './actionList' -import './index.scss' - -const SubTable = asyncSpinComponent(() => import('./subtabtable')) -const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) -const MainTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) - -const { TabPane } = Tabs - -class VerupTable extends Component { - static propTpyes = { - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuID: PropTypes.string // 鑿滃崟Id - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - ContainerId: Utils.getuuid(), // 鑿滃崟澶栧眰html Id - config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - searchlist: [], // 鎼滅储鏉′欢 - actions: [], // 鎸夐挳闆� - columns: [], // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� - setting: {}, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: [], // 鍒楄〃鏁版嵁闆� - selectedData: [], // 宸查�夎〃鏍兼暟鎹� - total: 0, // 鎬绘暟 - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - pageIndex: 1, // 椤电爜 - pageSize: 10, // 姣忛〉鏁版嵁鏉℃暟 - orderBy: '', // 鎺掑簭 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - BIDs: {}, // 涓婄骇琛╥d - pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 - refreshtabs: null // 闇�瑕佸埛鏂扮殑鏍囩闆� - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - let config = verupMainTable - - let _arrField = [] // 瀛楁闆� - let _columns = [] // 鏄剧ず鍒� - let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� - let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护 - - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid - config.columns.forEach(col => { - if (col.field) { - _arrField.push(col.field) - } - if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 - _hideCol = _hideCol.concat(col.sublist) - } - colMap.set(col.uuid, col) - }) - - // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� - config.columns.forEach(col => { - if (_hideCol.includes(col.uuid)) return - - if (col.type === 'colspan') { - if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 - col.type = 'old_colspan' - } - - let _col = fromJS(col).toJS() - let subcols = [] - _col.sublist && _col.sublist.forEach(sub => { - if (colMap.has(sub)) { - subcols.push(colMap.get(sub)) - } - }) - if (subcols.length > 0) { - _col.subcols = subcols - _columns.push(_col) - } - } else { - _columns.push(col) - } - }) - - this.setState({ - config: config, - setting: config.setting, - searchlist: config.search, - actions: config.action.map(item => { - item.$menuId = this.props.MenuID - - if (buttonConfig[item.uuid]) { - item = {...buttonConfig[item.uuid], ...item} - } - item.$toolbtn = true - - return item - }), - columns: _columns, - arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search) - }, () => { - this.setState({ - loading: true - }) - this.loadmaindata() - }) - } - - /** - * @description 涓昏〃鏁版嵁鍔犺浇 - */ - async loadmaindata () { - const { setting, ContainerId } = this.state - let param = '' - - if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) { - param = this.getCustomParam() - } else { - param = this.getDefaultParam() - } - - this.setState({ - selectedData: [], - pickup: false - }) - - MKEmitter.emit('changeTableLine', ContainerId, this.props.MenuID, '', '') - - if (!param) { // 鏈幏鍙栧弬鏁版椂锛屼笉鍙戣姹� - return - } - - let result = await Api.genericInterface(param) - if (result.status) { - this.setState({ - data: result.data.map((item, index) => { - item.key = index - item.$$uuid = item[setting.primaryKey] || '' - return item - }), - total: result.total, - loading: false, - BIDs: {[this.props.MenuID] : ''} - }) - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� - */ - getCustomParam = () => { - const { pageIndex, pageSize, orderBy, search, setting } = this.state - - let _search = Utils.formatCustomMainSearch(search) - - let param = { - PageIndex: pageIndex, - PageSize: pageSize, - OrderCol: orderBy || setting.order, - ..._search - } - - if (setting.interType === 'inner') { - param.func = setting.innerFunc - } else { - if (setting.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - - if (setting.outerFunc) { - param.func = setting.outerFunc - } - } - - return param - } - - /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鐨勫弬鏁� - */ - getDefaultParam = () => { - const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state - - if (!arr_field) { - notification.warning({ - top: 92, - message: '鏈缃樉绀哄垪锛�', - duration: 5 - }) - return null - } - - let _search = Utils.joinMainSearchkey(search) - - _search = _search ? 'where ' + _search : '' - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field, - menuname: this.props.MenuName || '' - } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 - let fieldmap = new Map() - let options = search.map(item => { - let _field = item.key - - if (fieldmap.has(_field)) { - _field = _field + '1' - } - - fieldmap.set(item.key, true) - - return { - reg: new RegExp('@' + _field, 'ig'), - value: item.value - } - }) - - options.reverse() - - options.forEach(item => { - _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) - }) - - _search = '' - } - - let LText = ` select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` - let DateCount = `select count(1) as total from ${_dataresource} ${_search}` - - 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 = Utils.formatOptions(DateCount) - - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 - - return param - } - - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - loading: true, - pageIndex: 1, - search: searches - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - if (sorter.order) { - let _chg = { - ascend: 'asc', - descend: 'desc' - } - sorter.order = _chg[sorter.order] - } - - this.setState({ - loading: true, - pageIndex: pagination.current, - pageSize: pagination.pageSize, - orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = () => { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - pageIndex: 1, - loading: true - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 椤甸潰鍒锋柊锛岄噸鏂拌幏鍙栭厤缃� - */ - reloadview = () => { - MKEmitter.emit('resetTable', this.props.MenuID) // 鍒楄〃閲嶇疆 - this.setState({ - config: {}, - searchlist: [], - actions: [], - columns: [], - arr_field: '', - setting: {}, - data: [], - total: 0, - loading: false, - pageIndex: 1, - pageSize: 10, - orderBy: '', - search: '', - BIDs: {}, - pickup: false - }, () => { - this.loadconfig() - }) - } - - /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (btn, type) => { - if (btn.execSuccess === 'grid' && type === 'success') { - this.reloadtable() - } else if (btn.execError === 'grid' && type === 'error') { - this.reloadtable() - } else if (btn.execSuccess === 'view' && type === 'success') { - this.reloadview() - } else if (btn.execError === 'view' && type === 'error') { - this.reloadview() - } - } - - /** - * @description 瀛愯〃鎿嶄綔瀹屾垚鍚庡埛鏂颁富琛� - */ - handleMainTable = (type, tab) => { - if (type === 'maingrid' && tab.supMenu === 'mainTable') { - this.reloadtable() - } else if (type === 'maingrid' && tab.supMenu) { - this.setState({ - refreshtabs: [tab.supMenu] - }, () => { - this.setState({ - refreshtabs: null - }) - }) - } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { - this.setState({ - refreshtabs: tab.equalTab - }, () => { - this.setState({ - refreshtabs: null - }) - }) - } - } - - /** - * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� - */ - changeSelectedData = (selectedData) => { - this.setState({selectedData}) - } - - /** - * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 - */ - pickupChange = () => { - const { pickup } = this.state - this.setState({ - pickup: !pickup - }) - } - - reloadMenuView = (menuId) => { - const { MenuID } = this.props - - if (MenuID !== menuId) return - - this.reloadview() - } - - 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('reloadMenuView', this.reloadMenuView) - MKEmitter.addListener('changeTableLine', this.changeTableLine) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) - MKEmitter.removeListener('changeTableLine', this.changeTableLine) - } - - render() { - const { searchlist, setting, actions, columns, pickup, config, selectedData, pageSize } = this.state - - return ( - <div className="veruptable" id={this.state.ContainerId}> - <MainSearch searchlist={searchlist} refreshdata={this.refreshbysearch}/> - <MainAction - BID="" - type="main" - setting={setting} - actions={actions} - columns={columns} - dict={this.state.dict} - MenuID={this.props.MenuID} - selectedData={selectedData} - ContainerId={this.state.ContainerId} - refreshdata={this.refreshbyaction} - /> - <div className="main-table-box"> - {this.state.data && this.state.data.length > 0 ? - <div className="pickchange"> - <Switch title="鏀惰捣" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> - </div> : null - } - <MainTable - tableId={this.props.MenuID} - pickup={pickup} - setting={setting} - columns={columns} - pageSize={pageSize} - dict={this.state.dict} - data={this.state.data} - total={this.state.total} - MenuID={this.props.MenuID} - loading={this.state.loading} - refreshdata={this.refreshbytable} - buttonTrigger={() => {}} - ContainerId={this.state.ContainerId} - chgSelectData={this.changeSelectedData} - /> - </div> - {config.tabs ? <Tabs defaultActiveKey="0"> - {config.tabs.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} - refreshtabs={this.state.refreshtabs} - ContainerId={this.state.ContainerId} - BID={this.state.BIDs[_tab.supMenu] || ''} - BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} - handleMainTable={(type) => this.handleMainTable(type, _tab)} - /> - </TabPane> - ) - })} - </Tabs> : null} - </div> - ) - } -} - -export default VerupTable \ No newline at end of file diff --git a/src/tabviews/verupmanage/index.scss b/src/tabviews/verupmanage/index.scss deleted file mode 100644 index 68df191..0000000 --- a/src/tabviews/verupmanage/index.scss +++ /dev/null @@ -1,79 +0,0 @@ -.veruptable { - position: relative; - min-height: calc(100vh - 94px); - padding-top: 16px; - padding-bottom: 80px; - - .search-line { - padding: 0px 24px 0px; - border-bottom: 1px solid #efefef; - } - - .box404 { - padding-top: 30px; - } - .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-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; - padding: 0 20px; - .pickchange { - position: absolute; - right: 0px; - top: -25px; - .ant-switch { - z-index: 1; - float: right; - margin-right: 20px; - margin-bottom: 5px; - } - } - } - > .ant-tabs { - padding: 0px 20px; - margin-bottom: 20px; - .ant-tabs-tab:not(.ant-tabs-tab-active) { - cursor: pointer; - } - } -} diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx deleted file mode 100644 index fd00229..0000000 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ /dev/null @@ -1,469 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import { notification, Switch} 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 { buttonConfig, tabConfig } from '../config' -import MKEmitter from '@/utils/events.js' - -import asyncComponent from '@/utils/asyncComponent' -import asyncSpinComponent from '@/utils/asyncSpinComponent' -import SubAction from '../actionList' - -import './index.scss' - -const MainSearch = asyncComponent(() => import('@/tabviews/zshare/topSearch')) -const SubTable = asyncSpinComponent(() => import('@/tabviews/zshare/normalTable')) - -class VerupSubTabViewTable extends Component { - static propTpyes = { - Tab: PropTypes.object, // 鏍囩淇℃伅 - BID: PropTypes.string, // 涓婄骇鏁版嵁ID - BData: PropTypes.any, // 涓婄骇鏁版嵁 - MenuID: PropTypes.string, // 鑿滃崟Id - SupMenuID: PropTypes.string, // 涓婄骇鑿滃崟Id - ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID - handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 - refreshtabs:PropTypes.any - } - - state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, - config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - searchlist: null, // 鎼滅储鏉′欢 - actions: null, // 鎸夐挳闆� - columns: null, // 鏄剧ず鍒� - arr_field: '', // 鏌ヨ瀛楁闆� - setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 - data: null, // 鍒楄〃鏁版嵁闆� - selectedData: [], // 宸查�夎〃鏍兼暟鎹� - total: 0, // 鎬绘暟 - loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� - pageIndex: 1, // 椤电爜 - pageSize: 100, // 姣忛〉鏁版嵁鏉℃暟 - orderBy: '', // 鎺掑簭 - search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� - popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� - popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 - visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 - pickup: false, // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - BID: '', - BData: '' - } - - /** - * @description 涓婄骇鑿滃崟id鍙樺寲鏃讹紝鍒锋柊鏁版嵁 - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { - this.reloadtable() - } - } - - /** - * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 - */ - async loadconfig () { - const { Tab, BID, BData } = this.props - - let config = tabConfig[this.props.MenuID] - - let _arrField = [] // 瀛楁闆� - let _columns = [] // 鏄剧ず鍒� - let _hideCol = [] // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆� - let colMap = new Map() - - // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid - config.columns.forEach(col => { - if (col.field) { - _arrField.push(col.field) - } - if (col.type === 'colspan' && col.sublist) { // 绛涢�夐殣钘忓垪 - _hideCol = _hideCol.concat(col.sublist) - } - colMap.set(col.uuid, col) - }) - - // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈� - config.columns.forEach(col => { - if (_hideCol.includes(col.uuid)) return - - if (col.type === 'colspan') { - if (col.unfold !== 'true') { // 涓嶅睍寮�涓烘棫鐗堝悎骞跺垪 - col.type = 'old_colspan' - } - let _col = fromJS(col).toJS() - let subcols = [] - _col.sublist && _col.sublist.forEach(sub => { - if (colMap.has(sub)) { - subcols.push(colMap.get(sub)) - } - }) - if (subcols.length > 0) { - _col.subcols = subcols - _columns.push(_col) - } - } else { - _columns.push(col) - } - }) - - if (config.setting.interType === 'inner' && !config.setting.innerFunc) { - config.setting.interType = 'system' - } - - this.setState({ - BID: BID || '', - BData: BData || '', - config: config, - setting: config.setting, - searchlist: config.search, - actions: config.action.map(item => { - if (buttonConfig[item.uuid]) { - item = {...buttonConfig[item.uuid], ...item} - } - item.$toolbtn = true - return item - }), - columns: _columns, - arr_field: _arrField.join(','), - search: Utils.initMainSearch(config.search) // 鎼滅储鏉′欢鍒濆鍖栵紙鍚湁鏃堕棿鏍煎紡锛岄渶瑕佽浆鍖栵級 - }, () => { - if (config.setting.onload !== 'false' && (!Tab.supMenu || BID)) { // 鍒濆鍖栧彲鍔犺浇 - this.setState({ - loading: true - }) - this.loadmaindata() - } - }) - } - - /** - * @description 瀛愯〃鏁版嵁鍔犺浇 - */ - async loadmaindata (type) { - const { setting, BID } = this.state - let param = '' - - if (type === 'refresh') { - if (!BID) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃 - this.setState({ - data: [], - total: 0, - loading: false - }) - - return - } - } - - if (setting.interType === 'system') { - param = this.getDefaultParam(BID) - } else { - param = this.getCustomParam(BID) - } - - let result = await Api.genericInterface(param) - if (result.status) { - this.setState({ - data: result.data.map((item, index) => { - item.key = index - item.$$uuid = item[setting.primaryKey] || '' - item.$$BID = BID || '' - return item - }), - total: result.total, - pickup: false, - loading: false - }) - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } - } - - /** - * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙� - */ - getCustomParam = (BID) => { - const { pageIndex, pageSize, orderBy, search, setting } = this.state - - let _search = Utils.formatCustomMainSearch(search) - - let param = { - PageIndex: pageIndex, - PageSize: pageSize, - OrderCol: orderBy || setting.order, - BID: BID, - ..._search - } - - if (setting.interType === 'inner') { - param.func = setting.innerFunc - } else { - if (setting.sysInterface === 'true' && options.cloudServiceApi) { - param.rduri = options.cloudServiceApi - } else if (setting.sysInterface !== 'true') { - param.rduri = setting.interface - } - - if (setting.outerFunc) { - param.func = setting.outerFunc - } - } - - return param - } - - /** - * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼鐨勫弬鏁� - */ - getDefaultParam = (BID) => { - const { arr_field, pageIndex, pageSize, orderBy, search, setting } = this.state - - let _search = Utils.joinMainSearchkey(search) - _search = _search ? 'where ' + _search : '' - - let param = { - func: 'sPC_Get_TableData', - obj_name: 'data', - arr_field: arr_field, - BID: BID, - menuname: this.props.Tab.label || '' - } - - let _orderBy = orderBy || setting.order - let _dataresource = setting.dataresource - - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (setting.queryType === 'statistics') { // 缁熻鏁版嵁婧愶紝鍐呭鏇挎崲 - let fieldmap = new Map() - let options = search.map(item => { - let _field = item.key - - if (fieldmap.has(_field)) { - _field = _field + '1' - } - - fieldmap.set(item.key, true) - - return { - reg: new RegExp('@' + _field, 'ig'), - value: item.value - } - }) - - options.reverse() - - options.forEach(item => { - _dataresource = _dataresource.replace(item.reg, `'${item.value}'`) - }) - - _search = '' - } - - let LText = ` select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${_orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` - let DateCount = `select count(1) as total from ${_dataresource} ${_search}` - - 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 = Utils.formatOptions(DateCount) - - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 - - return param - } - - /** - * @description 鎼滅储鏉′欢鏀瑰彉鏃讹紝閲嶇疆琛ㄦ牸鏁版嵁 - * 鍚湁鍒濆涓嶅姞杞界殑椤甸潰锛屼慨鏀硅缃� - */ - refreshbysearch = (searches) => { - MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 - this.setState({ - loading: true, - pageIndex: 1, - selectedData: [], - search: searches - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鏉′欢鏀瑰彉鏃堕噸缃暟鎹紙鍒嗛〉鎴栨帓搴忥級 - */ - refreshbytable = (pagination, filters, sorter) => { - if (sorter.order) { - let _chg = { - ascend: 'asc', - descend: 'desc' - } - sorter.order = _chg[sorter.order] - } - - this.setState({ - loading: true, - selectedData: [], - pageIndex: pagination.current, - pageSize: pagination.pageSize, - orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = () => { - MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 - this.setState({ - loading: true, - pageIndex: 1, - selectedData: [] - }, () => { - this.loadmaindata() - }) - } - - /** - * @description 琛ㄦ牸閫夋嫨椤瑰垏鎹� - */ - changeSelectedData = (selectedData) => { - this.setState({selectedData}) - } - - /** - * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤� - */ - refreshbyaction = (btn, type) => { - if (btn.execSuccess === 'grid' && type === 'success') { - this.reloadtable() - } else if (btn.execError === 'grid' && type === 'error') { - this.reloadtable() - } - } - - /** - * @description 鏁版嵁灞曞紑鍚堝苟鍒囨崲 - */ - pickupChange = () => { - const { pickup } = this.state - - this.setState({ - pickup: !pickup - }) - } - - changeTableLine = (ContainerId, tableId, id, data) => { - const { Tab } = this.props - - if (tableId !== Tab.supMenu) return - - this.setState({BData: data, BID: id}) - - if (id !== this.state.BID) { - MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆 - this.setState({ - pageIndex: 1, - selectedData: [] - }, () => { - this.loadmaindata('refresh') - }) - } - } - - UNSAFE_componentWillMount() { - // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁 - this.loadconfig() - } - - componentDidMount () { - MKEmitter.addListener('changeTableLine', this.changeTableLine) - } - - shouldComponentUpdate (nextProps, nextState) { // handleMainTable 鍑芥暟鍒ゆ柇鏃朵笉鐩哥瓑 - return !is(fromJS(this.state), fromJS(nextState)) - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('changeTableLine', this.changeTableLine) - } - - render() { - const { BID, BData, setting, searchlist, actions, columns, pickup, selectedData, pageSize } = this.state - - return ( - <div className="verup-subtable" id={'subtable' + this.props.MenuID}> - {searchlist && searchlist.length ? - <MainSearch searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null - } - {actions ? - <div className="sub-action"> - <SubAction - type="sub" - BID={BID} - BData={BData} - setting={setting} - actions={actions} - columns={columns} - Tab={this.props.Tab} - dict={this.state.dict} - selectedData={selectedData} - MenuID={this.props.SupMenuID} - refreshdata={this.refreshbyaction} - ContainerId={this.props.ContainerId} - /> - </div> : null - } - {columns ? - <div className="subtable-box"> - {this.state.data && this.state.data.length > 0 ? - <Switch title="鏀惰捣" className="subtable-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null - } - <SubTable - tableId={this.props.Tab.uuid} - pickup={pickup} - setting={setting} - columns={columns} - pageSize={pageSize} - dict={this.state.dict} - data={this.state.data} - total={this.state.total} - MenuID={this.props.MenuID} - loading={this.state.loading} - refreshdata={this.refreshbytable} - buttonTrigger={() => {}} - chgSelectData={this.changeSelectedData} - /> - </div> : null - } - </div> - ) - } -} - -export default VerupSubTabViewTable \ No newline at end of file diff --git a/src/tabviews/verupmanage/subtabtable/index.scss b/src/tabviews/verupmanage/subtabtable/index.scss deleted file mode 100644 index e2964c1..0000000 --- a/src/tabviews/verupmanage/subtabtable/index.scss +++ /dev/null @@ -1,47 +0,0 @@ -.verup-subtable { - position: relative; - min-height: 200px; - - > .top-search { - padding: 0 0px 20px; - } - >.sub-action { - min-height: 25px; - .verup-button-list { - padding: 10px 0px 5px; - } - } - .normal-data-table { - padding: 0px; - } - .box404 { - padding-top: 30px; - } - .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; - left: calc(50% - 22px); - top: 100px; - } - .subtable-box { - position: relative; - .subtable-pickup { - position: absolute; - right: 5px; - top: -22px; - z-index: 1; - } - } -} diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 81148eb..01747a5 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -412,6 +412,8 @@ if (window.GLOB.mkHS) { if (btn.sysInterface === 'true' && options.cloudServiceApi) { param.rduri = options.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { if (window.GLOB.systemType === 'production' && btn.proInterface) { param.rduri = btn.proInterface diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 5c7df9c..ed16f15 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -61,7 +61,6 @@ componentDidMount () { MKEmitter.addListener('triggerBtnId', this.actionTrigger) - MKEmitter.addListener('returnModuleParam', this.triggerExcelout) } UNSAFE_componentWillReceiveProps (nextProps) { @@ -92,7 +91,6 @@ return } MKEmitter.removeListener('triggerBtnId', this.actionTrigger) - MKEmitter.removeListener('returnModuleParam', this.triggerExcelout) } /** @@ -148,7 +146,7 @@ return } - MKEmitter.emit('queryModuleParam', btn.$menuId, btn.uuid) + MKEmitter.emit('queryModuleParam', btn.$menuId, this.triggerExcelout) if (window.GLOB.systemType === 'production') { MKEmitter.emit('queryTrigger', {menuId: btn.uuid, name: '瀵煎嚭Excel'}) } @@ -157,10 +155,8 @@ /** * @description Excel 瀵煎嚭 */ - triggerExcelout = (menuId, btnId, viewParam) => { + triggerExcelout = (viewParam) => { const { btn } = this.props - - if (btn.$menuId !== menuId || btn.uuid !== btnId || !viewParam) return let name = `${viewParam.menuName}${moment().format('YYYYMMDDHHmmss')}.xlsx` let pageSize = 1000 @@ -246,6 +242,8 @@ if (window.GLOB.mkHS) { if (btn.sysInterface === 'true' && options.cloudServiceApi) { param.rduri = options.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { if (window.GLOB.systemType === 'production' && btn.proInterface) { param.rduri = btn.proInterface @@ -292,6 +290,8 @@ 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') { if (window.GLOB.systemType === 'production' && btn.proInterface) { res.rduri = btn.proInterface @@ -361,6 +361,8 @@ 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') { if (window.GLOB.systemType === 'production' && btn.proInterface) { res.rduri = btn.proInterface @@ -433,6 +435,8 @@ if (window.GLOB.mkHS) { if (btn.sysInterface === 'true' && options.cloudServiceApi) { param.rduri = options.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { if (window.GLOB.systemType === 'production' && btn.proInterface) { param.rduri = btn.proInterface @@ -483,11 +487,22 @@ exportExcel = (data) => { const { btn } = this.props - let columns = btn.verify.columns.filter(col => col.output !== 'false') + let imgCol = false + let columns = btn.verify.columns.filter(col => { + if (col.output === 'false') return false + + if (col.type === 'image') { + imgCol = true + } + + if (col.type === 'number' && (col.decimal || col.decimal === 0) ) { + col.round = Math.pow(10, col.decimal) + } + + return col + }) try { - let imgCol = columns.filter(col => col.type === 'image')[0] - if (imgCol) { const column = columns.map(item => { let col = { @@ -511,11 +526,18 @@ item.$Index = index + 1 + '' columns.forEach((col, i) => { - if (item[col.Column] && col.abs === 'true') { - _row[col.Column] = Math.abs(item[col.Column]) - } else { - _row[col.Column] = item[col.Column] + let val = item[col.Column] + if (typeof(val) === 'number') { + if (col.abs === 'true') { + val = Math.abs(val) + } + if (col.round) { + val = Math.round(val * col.round) / col.round + val = val.toFixed(col.decimal) + } } + + _row[col.Column] = val }) table.push(_row) @@ -528,23 +550,14 @@ } else { this.execSuccess({ErrCode: 'S', ErrMesg: '瀵煎嚭鎴愬姛锛�'}) } - } else { let _header = [] let _topRow = {} let colwidth = [] - let abses = [] columns.forEach(col => { - if (_topRow[col.Column]) return - _header.push(col.Column) _topRow[col.Column] = col.Text - - if (col.abs === 'true') { - abses.push(col.Column) - } - colwidth.push({width: col.Width || 20}) }) @@ -557,12 +570,20 @@ item.$Index = index + 1 + '' - _header.forEach(field => { - if (item[field] && abses.includes(field)) { - _row[field] = Math.abs(item[field]) - } else { - _row[field] = item[field] + columns.forEach((col, i) => { + let val = item[col.Column] + + if (typeof(val) === 'number') { + if (col.abs === 'true') { + val = Math.abs(val) + } + if (col.round) { + val = Math.round(val * col.round) / col.round + val = val.toFixed(col.decimal) + } } + + _row[col.Column] = val }) table.push(_row) @@ -842,7 +863,7 @@ } if (param.custom_script) { - param.custom_script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 = `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} ` regoptions.forEach(item => { @@ -863,7 +884,7 @@ ` } } else if (LText) { - LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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}' + LText = `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}' ${LText} ` } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index d58c19e..d6cceab 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -100,7 +100,6 @@ if (btn.OpenType === 'formSubmit') { MKEmitter.addListener('triggerFormSubmit', this.actionSubmit) } - MKEmitter.addListener('returnModuleParam', this.resetModuleParam) if (btn.autoMatic) { MKEmitter.addListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit) @@ -156,7 +155,6 @@ } MKEmitter.removeListener('triggerBtnId', this.actionTrigger) MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit) - MKEmitter.removeListener('returnModuleParam', this.resetModuleParam) MKEmitter.removeListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit) } @@ -204,14 +202,6 @@ this.execSubmit(data, () => {}, res.form) } - resetModuleParam = (menuId, btnId, param) => { - const { btn } = this.props - - if (btn.$menuId !== menuId || btn.uuid !== btnId || !param) return - - this.moduleParams = param - } - /** * @description 鎸夐挳鐘舵�佹敼鍙� */ @@ -248,7 +238,7 @@ let _this = this let data = record || selectedData || [] - + if (btn.Ot !== 'notRequired' && data.length === 0) { // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� notification.warning({ @@ -606,9 +596,13 @@ param.LText = Utils.formatOptions(param.LText) } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (index !== 0) { + let _cell = {} + Object.keys(cell).forEach(key => { + _cell[key.toLowerCase()] = cell[key] + }) formdata = formdata.map(_data => { - if (_data.readin && cell.hasOwnProperty(_data.key)) { - _data.value = cell[_data.key] + if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { + _data.value = _cell[_data.key.toLowerCase()] } return _data }) @@ -716,7 +710,7 @@ }) } - if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) @@ -741,9 +735,13 @@ if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (index !== 0) { + let _cell = {} + Object.keys(cell).forEach(key => { + _cell[key.toLowerCase()] = cell[key] + }) formdata = formdata.map(_data => { - if (_data.readin && cell.hasOwnProperty(_data.key)) { - _data.value = cell[_data.key] + if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { + _data.value = _cell[_data.key.toLowerCase()] } return _data }) @@ -757,7 +755,7 @@ param[setting.primaryKey] = primaryId } - if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) @@ -903,7 +901,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@bid nvarchar(50)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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),@bid nvarchar(50)${_declarefields} ` let userName = sessionStorage.getItem('User_Name') || '' @@ -959,16 +957,10 @@ btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && btn.verify && btn.verify.invalid === 'true' && setting.dataresource ) { - MKEmitter.emit('queryModuleParam', btn.$menuId, btn.uuid) - setTimeout(() => { - if (this.moduleParams) { - this.execRealSubmit(data, _resolve, formdata) - } else { - setTimeout(() => { - this.execRealSubmit(data, _resolve, formdata) - }, 100) - } - }, 50) + MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => { + this.moduleParams = param + this.execRealSubmit(data, _resolve, formdata) + }) } else { this.execRealSubmit(data, _resolve, formdata) } @@ -1227,8 +1219,24 @@ const { btn } = this.props let param = null + let callback = result.mk_ex_invoke - if (btn.callbackType === 'script' || btn.callbackType === 'default') { + delete result.mk_ex_invoke + + if (callback === 'false' || callback === false) { + if (result.status) { + if (params.length === 0) { + this.execSuccess(result) + _resolve() + } else { + this.customLoopRequest(params, _resolve) + } + } else { + this.execError(result) + _resolve() + } + return + } else if (btn.callbackType === 'script' || btn.callbackType === 'default') { param = this.getCallBackSql(result, record) } else if (btn.callbackType === 'func') { param = { @@ -1565,6 +1573,11 @@ res.BID = this.props.BID } + if (res.mk_api_key) { + record.mk_api_key = res.mk_api_key + } + delete res.mk_api_key + this.outerOuterRequest(params, res, record, _resolve) } } else { @@ -1585,8 +1598,14 @@ result.func = btn.outerFunc } if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { + if (btn.outerFunc === 's_app_version_upt') { // special 鏇存柊鐗堟湰鍙锋椂璁块棶sso + if (window.GLOB.mainSystemApi) { + result.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'true' && options.cloudServiceApi) { result.rduri = options.cloudServiceApi + result.userid = sessionStorage.getItem('CloudUserID') || '' + result.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { if (window.GLOB.systemType === 'production' && btn.proInterface) { result.rduri = btn.proInterface @@ -1595,7 +1614,7 @@ } } - // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 if (result.func === 's_sDataDictb_TBBack' && result.LTextOut) { result.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') result.secretkey = Utils.encrypt(result.LTextOut, result.timestamp) @@ -1628,7 +1647,36 @@ let param = null - if (btn.callbackType === 'script' || btn.callbackType === 'default') { + if (record.mk_api_key) { + result.mk_api_key = record.mk_api_key + } + + let callback = result.mk_ex_invoke + + delete result.mk_ex_invoke + + if (callback === 'false' || callback === false) { + if (result.status) { + if (params.length === 0) { + this.execSuccess(result) + _resolve() + } else { + this.outerLoopRequest(params, _resolve) + } + } else { + this.execError(result) + _resolve() + } + return + } else if (window.GLOB.mkHS && btn.outerFunc === 's_get_sVersionDetail_Ltext' && btn.callbackFunc) { // special 鐗堟湰鍗囩骇鍥炶皟澶勭悊 + if (result.status) { + this.verupRequest(params, result, outParam, _resolve) + } else { + this.execError(result) + _resolve() + } + return + } else if (btn.callbackType === 'script' || btn.callbackType === 'default') { param = this.getCallBackSql(result, record) } else if (btn.callbackType === 'func' || btn.callbackFunc) { delete result.message @@ -1640,7 +1688,7 @@ func: btn.callbackFunc } - // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) @@ -1676,6 +1724,71 @@ _resolve() } }) + } + + verupRequest = (params, result, outParam, _resolve) => { + const { btn } = this.props + + delete result.message + delete result.status + + result.func = btn.callbackFunc + + let ssoParam = null + let callParam = {...outParam, ...result} + + if (callParam.LTextOut) { + callParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + callParam.secretkey = Utils.encrypt(callParam.LTextOut, callParam.timestamp) + callParam.open_key = Utils.encryptOpenKey(callParam.secretkey, callParam.timestamp) + } + + if (callParam.UpType === 'SSO' && window.GLOB.mainSystemApi) { + ssoParam = fromJS(callParam).toJS() + + ssoParam.rduri = window.GLOB.mainSystemApi + + delete ssoParam.UpType + } else { + delete callParam.UpType + } + + if (ssoParam) { + Api.genericInterface(ssoParam).then(res => { + if (!res.status) { + this.execError(res) + _resolve() + } else { + Api.genericInterface(callParam).then(re => { + if (!re.status) { + this.execError(re) + _resolve() + } else { + if (params.length === 0) { + this.execSuccess(res) + _resolve() + } else { + this.outerLoopRequest(params, _resolve) + } + } + }) + } + }) + } else { + Api.genericInterface(callParam).then(re => { + if (!re.status) { + this.execError(re) + _resolve() + } else { + if (params.length === 0) { + this.execSuccess(re) + _resolve() + } else { + this.outerLoopRequest(params, _resolve) + } + } + }) + } } /** @@ -1847,11 +1960,8 @@ _param.miniprogram.pagepath = `/pages/index/index?MenuId=${verify.wxNoteLinkMenuId}` } } - - let keys = [] + verify.wxNoteKeys.forEach(item => { - keys.push(item.key) - _param.data[item.key] = {value: '', color: item.color} }) @@ -1867,9 +1977,9 @@ m.client_msg_id = item.send_id } - keys.forEach(key => { - if (item[key] !== undefined) { - m.data[key].value = item[key] + verify.wxNoteKeys.forEach(note => { + if (item[note.value] !== undefined) { + m.data[note.key].value = item[note.value] } }) @@ -2008,7 +2118,7 @@ _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk' _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk' - Api.getLocalConfig(_param).then(result => { + Api.genericInterface(_param).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -2060,10 +2170,13 @@ }) MKEmitter.emit('autoExecOver', btn.uuid, 'error') return + } else if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { + this.setState({ + loading: false + }) } this.setState({ - loading: false, loadingNumber: '', loadingTotal: '', }) @@ -2237,11 +2350,25 @@ } modelconfirm = () => { - const { BData, btn } = this.props + const { btn, BID } = this.props const { btnconfig, selines } = this.state let _this = this let result = [] + let _data = {} + let BData = {} + + if (selines[0]) { + Object.keys(selines[0]).forEach(key => { + _data[key.toLowerCase()] = selines[0][key] + }) + } + if (this.props.BData) { + Object.keys(this.props.BData).forEach(key => { + BData[key.toLowerCase()] = this.props.BData[key] + }) + } + btnconfig.fields.forEach(item => { if (!item.field) return let _readin = item.readin !== 'false' @@ -2251,10 +2378,12 @@ _readin = false } - if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { - _initval = BData[item.field] - } else if (_readin && selines[0] && selines[0].hasOwnProperty(item.field)) { - _initval = selines[0][item.field] + let key = item.field.toLowerCase() + + if (item.type === 'linkMain' && BData.hasOwnProperty(key)) { + _initval = BData[key] + } else if (_readin && _data.hasOwnProperty(key)) { + _initval = _data[key] } else if (item.type === 'date' && _initval) { _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD') } else if (item.type === 'datemonth' && _initval) { @@ -2263,15 +2392,17 @@ _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD HH:mm:ss') } + if (_initval === undefined) { + _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 - } - - if (_initval === undefined) { - _initval = '' + } else if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_initval)) { // 鐗规畩瀛楁鏇挎崲 + _initval = _initval.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (BID || '')) } let _type = item.type diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index ff0cd12..d2bfa95 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -379,7 +379,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { result.tempId = tempId resolve(result) }) @@ -726,9 +726,16 @@ _param[setting.primaryKey] = cell[setting.primaryKey] } + let _cell = {} + if (index !== 0) { + Object.keys(cell).forEach(key => { + _cell[key.toLowerCase()] = cell[key] + }) + } + formlist.forEach(_data => { - if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) { - _param[_data.key] = cell[_data.key] + if (index !== 0 && _data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { + _param[_data.key] = _cell[_data.key.toLowerCase()] } else { _param[_data.key] = _data.value } @@ -818,6 +825,8 @@ 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') { if (window.GLOB.systemType === 'production' && btn.proInterface) { res.rduri = btn.proInterface @@ -931,6 +940,16 @@ error = '鎵撳嵃妯℃澘瑙f瀽閿欒锛�' } else { let control = [] + let rotate = configParam.rotate || 0 + let offsetTop = 0 + let offsetLeft = 0 + + if (rotate === 90) { + offsetTop = configParam.width - configParam.height + } else if (rotate === 270) { + offsetLeft = configParam.height - configParam.width + } + configParam.elements.forEach(element => { let _field = element.field @@ -943,11 +962,12 @@ Type: element.type, Value: element.value || '', Field: _field, - Left: element.left, - Top: element.top, + Left: element.left + offsetLeft, + Top: element.top + offsetTop, Width: element.width, Height: element.height, - Rotate: element.rotate, + Rotate: rotate, + // Rotate: element.rotate, BorderSize: element.borderSize / 10, BorderColor: element.borderColor, Align: element.align, @@ -1015,6 +1035,12 @@ control.push(item) }) + let down = false + + if (rotate === 90 || rotate === 270) { + down = true + } + _configparam = { Version: '', Title: configParam.name, @@ -1022,8 +1048,8 @@ Description: configParam.remark, PrintTempNO: configParam.PrintTempNO, PageSetting: { - Width: configParam.width, - Height: configParam.height, + Width: down ? configParam.height : configParam.width, + Height: down ? configParam.width : configParam.height, Left: '0', Right: '0', Top: '0', @@ -1153,12 +1179,21 @@ }) if (list.length === 0) { - this.execError({ - ErrCode: 'N', - message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', - ErrMesg: '', - status: false - }) + if (btn.verify.emptyTip === 'false') { + this.execSuccess({ + ErrCode: '-1', + message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', + ErrMesg: '', + status: true + }) + } else { + this.execError({ + ErrCode: 'N', + message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', + ErrMesg: '', + status: false + }) + } return } else if (_errors.length > 0) { let lackerror = [] @@ -1314,17 +1349,17 @@ const { btn } = this.props const { autoMatic } = this.state - if ((res && (res.ErrCode === 'S' || !res.ErrCode)) || autoMatic) { // 鎵ц鎴愬姛 + if ((res.ErrCode === 'S' || !res.ErrCode) || autoMatic) { // 鎵ц鎴愬姛 notification.success({ top: 92, message: res.ErrMesg || this.state.dict['main.action.confirm.success'], duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2 }) - } else if (res && res.ErrCode === 'Y') { // 鎵ц鎴愬姛 + } else if (res.ErrCode === 'Y') { // 鎵ц鎴愬姛 Modal.success({ title: res.ErrMesg || this.state.dict['main.action.confirm.success'] }) - } else if (res && res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず + } else if (res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず } @@ -1519,10 +1554,22 @@ } modelconfirm = () => { - const { BData } = this.props const { btnconfig, selines } = this.state let _this = this let result = [] + let _data = {} + let BData = {} + + if (selines[0]) { + Object.keys(selines[0]).forEach(key => { + _data[key.toLowerCase()] = selines[0][key] + }) + } + if (this.props.BData) { + Object.keys(this.props.BData).forEach(key => { + BData[key.toLowerCase()] = this.props.BData[key] + }) + } btnconfig.fields.forEach(item => { if (!item.field) return @@ -1533,10 +1580,10 @@ _readin = false } - if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { - _initval = BData[item.field] - } else if (_readin && selines[0] && selines[0].hasOwnProperty(item.field)) { - _initval = selines[0][item.field] + if (item.type === 'linkMain' && BData.hasOwnProperty(item.field.toLowerCase())) { + _initval = BData[item.field.toLowerCase()] + } else if (_readin && _data.hasOwnProperty(item.field.toLowerCase())) { + _initval = _data[item.field.toLowerCase()] } else if (item.type === 'date' && _initval) { _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD') } else if (item.type === 'datemonth' && _initval) { diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index f3cd9cf..8a350a5 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -157,11 +157,12 @@ let menu = null if (btn.MenuID) { + let _menu = this.props.permMenus.filter(m => m.MenuID === btn.MenuID)[0] || '' menu = { MenuID: btn.MenuID, - MenuName: btn.MenuName, + MenuName: _menu ? _menu.MenuName : btn.MenuName, MenuNo: btn.MenuNo, - type: btn.tabType + type: _menu ? _menu.type : btn.tabType } } else if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu.slice(-1)[0] diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index ffb77bc..710d82e 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -45,8 +45,10 @@ record = {} componentDidMount () { - const { data, BData, action } = this.props + const { action } = this.props + let data = {} + let BData = {} let linkFields = {} // 鍏宠仈鑿滃崟 let controlFields = {} // 鎺у埗琛ㄥ崟 let deForms = [] // 闇�瑕佸姩鎬佽幏鍙栦笅鎷夎彍鍗曠殑琛ㄥ崟 @@ -55,6 +57,17 @@ let formlist = fromJS(action.fields).toJS() let fieldMap = new Map() let check = action.setting.formType === 'check' + + if (this.props.data) { + Object.keys(this.props.data).forEach(key => { + data[key.toLowerCase()] = this.props.data[key] + }) + } + if (this.props.BData) { + Object.keys(this.props.BData).forEach(key => { + BData[key.toLowerCase()] = this.props.BData[key] + }) + } formlist = formlist.filter(item => { if (item.supField) { // 澶氬眰琛ㄥ崟鎺у埗 @@ -87,8 +100,8 @@ if (item.type === 'split' || item.type === 'formula') return true if (item.type === 'hint') { - if (item.field && data && data[item.field]) { - item.message = data[item.field] + if (item.field && data[item.field.toLowerCase()]) { + item.message = data[item.field.toLowerCase()] } delete item.field return true @@ -113,6 +126,8 @@ item.writein = item.writein !== 'false' item.hidden = item.hidden === 'true' item.fieldlength = item.fieldlength || 50 + + let key = item.field.toLowerCase() if (item.type === 'funcvar') { readin = false @@ -145,11 +160,11 @@ let newval = '$empty' - if (readin && data && data.hasOwnProperty(item.field)) { - newval = data[item.field] + if (readin && data.hasOwnProperty(key)) { + newval = data[key] } if (item.type === 'linkMain') { - newval = BData && BData[item.field] ? BData[item.field] : '$empty' + newval = BData[key] || '$empty' } else if (item.type === 'date') { // 鏃堕棿鎼滅储 let format = 'YYYY-MM-DD' let _format = 'YYYY-MM-DD HH:mm:ss' @@ -258,22 +273,27 @@ if (item.regular) { if (item.regular === 'number') { _rules.push({ - pattern: /^[0-9.-]*$/ig, + pattern: /^[0-9.-]*$/, message: formRule.input.numbermsg }) } else if (item.regular === 'letter') { _rules.push({ - pattern: /^[a-zA-Z]*$/ig, + pattern: /^[a-zA-Z]*$/, message: formRule.input.lettermsg + }) + } else if (item.regular === 'letter_number') { + _rules.push({ + pattern: /^[a-zA-Z0-9]*$/, + message: '璇疯緭鍏ユ暟瀛楁垨瀛楁瘝' }) } else if (item.regular === 'letter&number') { _rules.push({ - pattern: /^[a-zA-Z0-9@_.]*$/ig, + pattern: /^[a-zA-Z0-9@_.]*$/, message: '璇疯緭鍏ユ暟瀛椼�佸瓧姣嶄互鍙夽_.' }) } else if (item.regular === 'phone') { _rules.push({ - pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ig, + pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, message: '璇锋纭緭鍏ユ墜鏈哄彿' }) } else if (item.regular === 'email') { @@ -283,7 +303,7 @@ }) } else if (item.regular === 'funcname') { _rules.push({ - pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig, + pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/, message: formRule.input.funcname }) } @@ -423,8 +443,8 @@ if (fieldMap.has(item.linkField)) { item.supInitVal = fieldMap.get(item.linkField).initval || '' - } else if (data && data.hasOwnProperty(item.linkField)) { - item.supInitVal = data[item.linkField] + } else if (data.hasOwnProperty(item.linkField.toLowerCase())) { + item.supInitVal = data[item.linkField.toLowerCase()] } item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.value === '') @@ -635,6 +655,10 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + if (form.database === 'sso' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } return ( new Promise(resolve => { @@ -674,21 +698,29 @@ let _formlist = fromJS(this.state.formlist).toJS().map(item => { if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = [] + let map = new Map() result[item.field].forEach(cell => { - let _cell = { key: Utils.getuuid() } + let _cell = { key: Utils.getuuid() , ParentID: ''} + + if (item.linkField && cell[item.linkField] !== undefined) { + _cell.ParentID = cell[item.linkField] + } if (item.type !== 'checkcard') { _cell.value = cell[item.valueField] - _cell.label = cell[item.valueText] - if (!_cell.label && _cell.label !== 0) return + _cell.label = cell[item.valueText] + '' + if (!_cell.label || map.has(_cell.ParentID + _cell.value)) return + + map.set(_cell.ParentID + _cell.value, 0) } else { _cell.$value = cell[item.cardValField] _cell = {..._cell, ...cell} + + if (map.has(_cell.ParentID + _cell.$value)) return + + map.set(_cell.ParentID + _cell.$value, 0) } - - if (item.linkField) { - _cell.ParentID = cell[item.linkField] === undefined ? '' : cell[item.linkField] - } + if (item.subFields) { item.subFields.forEach(m => { _cell[m.field] = cell[m.field] === undefined ? '' : cell[m.field] @@ -881,7 +913,7 @@ } else if (item.type === 'textarea') { content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>) } else if (item.type === 'rate') { - content = (<Rate count={item.rateCount} disabled={item.readonly} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <MkIcon type={item.character}/> : <StarFilled />} allowHalf={item.allowHalf}/>) + content = (<Rate count={item.rateCount} disabled={item.readonly} style={{color: item.color || '#fadb14'}} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <MkIcon type={item.character}/> : <StarFilled />} allowHalf={item.allowHalf}/>) } else if (item.type === 'brafteditor') { content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>) label = item.hidelabel !== 'true' ? label : '' @@ -947,10 +979,8 @@ if (item.interception === 'true') { // 鍘婚櫎棣栧熬绌烘牸 _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') } - if (item.type === 'text') { // 鐗规畩瀛楁鏇挎崲 - _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey) - _item.value = _item.value.replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')) - _item.value = _item.value.replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) + if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 鐗规畩瀛楁鏇挎崲 + _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || '')) } } else if (item.type.indexOf('date') > -1) { if (item.declareType === 'nvarchar(50)') { diff --git a/src/tabviews/zshare/mutilform/mkInput/index.jsx b/src/tabviews/zshare/mutilform/mkInput/index.jsx index f147110..7bd5605 100644 --- a/src/tabviews/zshare/mutilform/mkInput/index.jsx +++ b/src/tabviews/zshare/mutilform/mkInput/index.jsx @@ -83,9 +83,13 @@ handleChange = (e) => { let val = e.target.value - let submit = /\n/ig.test(val) + let submit = /\n/g.test(val) - val = val.replace(/\n/ig, '') + val = val.replace(/\n/g, '') + + if (submit && /^\s+$/.test(val)) { + submit = false + } let _val = val diff --git a/src/tabviews/zshare/mutilform/mkSelect/index.jsx b/src/tabviews/zshare/mutilform/mkSelect/index.jsx index 54c46f4..821fb89 100644 --- a/src/tabviews/zshare/mutilform/mkSelect/index.jsx +++ b/src/tabviews/zshare/mutilform/mkSelect/index.jsx @@ -196,6 +196,7 @@ id={config.uuid} mode="multiple" defaultValue={value} + dropdownMatchSelectWidth={config.dropdown !== 'false'} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} onChange={this.mutilselectChange} disabled={config.readonly} diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 555c45c..b355463 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -2,11 +2,12 @@ import PropTypes from 'prop-types' import md5 from 'md5' import { is, fromJS } from 'immutable' -import { Table, Affix, Typography } from 'antd' +import { Table, Affix, Typography, Col } from 'antd' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' +import Encrypts from '@/components/encrypts' import '@/assets/css/table.scss' import './index.scss' @@ -16,6 +17,13 @@ const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton')) const TabButton = asyncComponent(() => import('@/tabviews/zshare/actionList/tabbutton')) const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton')) +const Video = asyncComponent(() => import('@/components/video')) + +const PicRadio = { + '4:3': '75%', '3:2': '66.67%', '16:9': '56.25%', '2:1': '50%', '3:1': '33.33%', '4:1': '25%', + '5:1': '20%', '6:1': '16.67%', '7:1': '14.29%', '8:1': '12.5%', '9:1': '11.11%', + '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%' +} class BodyRow extends React.Component { shouldComponentUpdate (nextProps) { @@ -360,34 +368,20 @@ } else if (item.linkurl) { let src = item.linkurl - if (src.indexOf('paramsmain/') > -1) { - try { - let _url = item.linkurl.split('paramsmain/')[0] + 'paramsmain/' - let _param = JSON.parse(window.decodeURIComponent(window.atob(item.linkurl.split('paramsmain/')[1]))) - _param.UserID = sessionStorage.getItem('UserID') - _param.LoginUID = sessionStorage.getItem('LoginUID') - _param.User_Name = sessionStorage.getItem('User_Name') - _param.param = __param - src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param))) - } catch (e) { - console.warn('鑿滃崟鍙傛暟瑙f瀽閿欒锛�') - } - } else { - let con = '?' + let con = '?' - if (/\?/ig.test(src)) { - con = '&' - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - if (field.toLowerCase() === 'id') return - con += `${field}=${record[field] || ''}&` - }) - } - - src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + if (/\?/ig.test(src)) { + con = '&' } + + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` window.open(src) } @@ -467,9 +461,13 @@ content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` } else if (item.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } else if (item.textFormat === 'encryption') { + content = <span>{item.prefix || ''}<Encrypts value={content} />{item.postfix || ''}</span> } - content = (item.prefix || '') + content + (item.postfix || '') + if (item.textFormat !== 'encryption') { + content = (item.prefix || '') + content + (item.postfix || '') + } } if (item.marks) { @@ -556,13 +554,13 @@ } if (content !== '') { - let decimal = item.decimal || 0 + content = Math.round(content * item.round) / item.round + if (item.format === 'percent') { content = content * 100 - decimal = decimal > 2 ? decimal - 2 : 0 } - - content = content.toFixed(decimal) + + content = content.toFixed(item.decimal) if (item.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -641,6 +639,7 @@ } } else if (item.type === 'picture') { let photos = '' + let style = {borderRadius: '2px'} if (item.field && record.hasOwnProperty(item.field)) { photos = record[item.field] + '' } @@ -650,19 +649,45 @@ photos = photos.split(',').filter(Boolean) } - let maxHeight = item.maxHeight || 128 + if (PicRadio[item.lenWidRadio]) { + style.paddingTop = PicRadio[item.lenWidRadio] + } else { + style.paddingTop = '100%' + } + + let scale = item.scale === 'true' + return ( <div className="picture-col"> - {photos && photos.map((url, i) => { - if (item.scale === 'true') { - return <img style={{maxHeight: maxHeight}} className="image-scale" onClick={(e) => { + {photos.map((url, i) => (<Col key={i} span={item.span || 24}> + <div + className={'mk-picture' + (scale ? ' image-scale' : '')} + onClick={(e) => { + if (!scale) return + e.stopPropagation() + MKEmitter.emit('mkImageScale', url, photos) - }} key={`${i}`} src={url} alt=""/> - } else { - return <img style={{maxHeight: maxHeight}} key={`${i}`} src={url} alt=""/> - } - })} + }} + style={{...style, backgroundImage: `url('${url}')`}} + ></div> + </Col>))} + </div> + ) + } else if (item.type === 'video') { + let url = '' + if (item.field && record.hasOwnProperty(item.field)) { + url = record[item.field] + '' + } + + if (!url) { + return ( + <div className="video-wrap"></div> + ) + } + return ( + <div className="video-wrap"> + <Video card={item} value={url}/> </div> ) } else if (item.type === 'textarea') { @@ -806,13 +831,13 @@ } if (content !== '') { - let decimal = col.decimal || 0 + content = Math.round(content * col.round) / col.round + if (col.format === 'percent') { content = content * 100 - decimal = decimal > 2 ? decimal - 2 : 0 } - content = content.toFixed(decimal) + content = content.toFixed(col.decimal) if (col.format === 'thdSeparator') { content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') @@ -855,7 +880,7 @@ } photos.forEach(photo => { - images.push({url: photo, align: col.Align, scale: col.scale === 'true', maxHeight: col.maxHeight || 128}) + images.push({url: photo, align: col.Align, scale: col.scale === 'true'}) }) } else if (col.type === 'text') { let content = record[col.field] @@ -865,9 +890,13 @@ content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } else if (col.textFormat === 'encryption') { + content = <span>{col.prefix || ''}<Encrypts value={content} />{col.postfix || ''}</span> } - - content = (col.prefix || '') + content + (col.postfix || '') + + if (col.textFormat !== 'encryption') { + content = (col.prefix || '') + content + (col.postfix || '') + } } if (col.marks) { @@ -990,12 +1019,12 @@ <div className="content-fence-top" style={images[0] ? {textAlign: images[0].align} : null}> {images.map((_img, index) => { if (_img.scale) { - return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={(e) => { + return <img className="image-scale" onClick={(e) => { e.stopPropagation() MKEmitter.emit('mkImageScale', _img.url, images.map(g => g.url)) }} key={`${index}`} src={_img.url} alt=""/> } else { - return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>) + return (<img key={`${index}`} src={_img.url} alt=""/>) } })} </div> @@ -1012,11 +1041,11 @@ <div className="content-fence-left" style={images[0] ? {textAlign: images[0].align} : null}> {images.map((_img, index) => { if (_img.scale) { - return <img style={{maxHeight: _img.maxHeight}} className="image-scale" onClick={() => { + return <img className="image-scale" onClick={() => { MKEmitter.emit('mkImageScale', _img.url, images.map(g => g.url)) }} key={`${index}`} src={_img.url} alt=""/> } else { - return (<img style={{maxHeight: _img.maxHeight}} key={`${index}`} src={_img.url} alt=""/>) + return (<img key={`${index}`} src={_img.url} alt=""/>) } })} </div> diff --git a/src/tabviews/zshare/normalTable/index.scss b/src/tabviews/zshare/normalTable/index.scss index ebc746e..31344f4 100644 --- a/src/tabviews/zshare/normalTable/index.scss +++ b/src/tabviews/zshare/normalTable/index.scss @@ -121,6 +121,7 @@ img { max-width: 100%; + max-height: 128px; display: block; } img + img { @@ -142,6 +143,7 @@ img { max-width: 100%; + max-height: 128px; display: block; float: right; } @@ -167,12 +169,15 @@ } } .picture-col { - img { - max-width: 100%; - display: inline-block; + margin-left: -5px; + margin-right: -5px; + >.ant-col { + padding: 5px; } - img + img { - margin-top: 10px; + .mk-picture { + background-color: #d9d9d9; + background-position: center center; + background-size: cover; } .image-scale { cursor: zoom-in; @@ -202,6 +207,12 @@ padding-left: 0px; } } + + .video-wrap { + .video-react-playback-rate { + display: none; + } + } } .ant-table-tbody > tr > td[rowspan] { vertical-align: middle; diff --git a/src/tabviews/zshare/topSearch/dategroup/index.scss b/src/tabviews/zshare/topSearch/dategroup/index.scss index 59410f2..57d4a16 100644 --- a/src/tabviews/zshare/topSearch/dategroup/index.scss +++ b/src/tabviews/zshare/topSearch/dategroup/index.scss @@ -49,7 +49,8 @@ background-color: #ffffff; } .ant-tag-checkable-checked { - border-color: #1890ff; + border-color: var(--mk-sys-color); + background: var(--mk-sys-color); } .table-search-date-group-value { position: absolute; diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 421f356..857e9f1 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -228,7 +228,7 @@ advanceValues, searchlist: _list }, () => { - if (!window.GLOB.mkHS && options.sysType === 'local' && !window.GLOB.systemType) { + if (!window.GLOB.mkHS && options.sysType === 'local' && window.GLOB.systemType !== 'production') { this.improveSimpleSearch(deForms) } else { this.improveSearch(mainItems, localItems) @@ -241,7 +241,7 @@ const { BID } = this.props let deffers = [] - if (!window.GLOB.mkHS && window.GLOB.systemType !== 'production') { + if (!window.GLOB.mkHS && options.sysType !== 'local') { localItems = [...localItems, ...mainItems] mainItems = [] } @@ -360,6 +360,10 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) + if (item.database === 'sso' && window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } + return ( new Promise(resolve => { setTimeout(() => { @@ -398,26 +402,33 @@ let _searchlist = fromJS(this.state.searchlist).toJS().map(item => { if (['select', 'link', 'multiselect', 'checkcard'].includes(item.type) && result[item.field] && result[item.field].length > 0) { let options = [] + let map = new Map() result[item.field].forEach(cell => { let _item = { - key: Utils.getuuid() - } - - if (item.type !== 'checkcard') { - _item.Value = cell[item.valueField] - _item.Text = cell[item.valueText] - if (!_item.Text && _item.Text !== 0) { - return - } - } else { - _item.$value = cell[item.cardValField] - _item = {..._item, ...cell} + key: Utils.getuuid(), + ParentID: '' } if (item.linkField) { _item.ParentID = cell[item.linkField] } + if (item.type !== 'checkcard') { + _item.Value = cell[item.valueField] + _item.Text = cell[item.valueText] + '' + + if (!_item.Text || map.has(_item.ParentID + _item.Value)) return + + map.set(_item.ParentID + _item.Value, 0) + } else { + _item.$value = cell[item.cardValField] + _item = {..._item, ...cell} + + if (map.has(_item.ParentID + _item.$value)) return + + map.set(_item.ParentID + _item.$value, 0) + } + options.push(_item) }) diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index fdceaff..272e505 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -519,7 +519,7 @@ delete localParam.EasyCode delete localParam.open_edition - Api.getLocalConfig(localParam) + Api.genericInterface(localParam) } else { this.setState({ menuloading: false, diff --git a/src/templates/calendarconfig/index.scss b/src/templates/calendarconfig/index.scss index a03c742..d40120f 100644 --- a/src/templates/calendarconfig/index.scss +++ b/src/templates/calendarconfig/index.scss @@ -54,37 +54,6 @@ } } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } .config-button { min-width: 65px; } diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 7ec73f5..f536dba 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -732,7 +732,7 @@ }) } this.props.reloadmenu() - Api.getLocalConfig(localParam) + Api.genericInterface(localParam) } else { this.setState({ menuloading: false, diff --git a/src/templates/comtableconfig/index.scss b/src/templates/comtableconfig/index.scss index fc49fea..4eb1f51 100644 --- a/src/templates/comtableconfig/index.scss +++ b/src/templates/comtableconfig/index.scss @@ -74,37 +74,6 @@ } } } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } .config-button { min-width: 65px; } diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index aef7eda..c01acf3 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -5,8 +5,8 @@ import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' import moment from 'moment' -import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Empty, Switch, Tooltip } from 'antd' -import { QuestionCircleOutlined, CloseOutlined, RedoOutlined, SettingOutlined, PlusOutlined, DeleteOutlined, EditOutlined, SnippetsOutlined } from '@ant-design/icons' +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 zhCN from '@/locales/zh-CN/model.js' @@ -22,7 +22,6 @@ import SettingForm from './settingform' import DragElement from './dragelement' import GroupForm from './groupform' -import EditCard from '@/templates/zshare/editcard' import MenuForm from '@/templates/zshare/menuform' import SourceElement from '@/templates/zshare/dragsource' @@ -31,7 +30,6 @@ import './index.scss' const { Panel } = Collapse -const { Option } = Select const { confirm } = Modal const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) const CreateFunc = asyncComponent(() => import('@/templates/zshare/createfunc')) @@ -49,7 +47,6 @@ dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 config: null, // 椤甸潰閰嶇疆 modaltype: '', // 妯℃�佹绫诲瀷锛屾帶鍒舵ā鎬佹鏄剧ず - tableVisible: false, // 鏁版嵁琛ㄥ瓧娈垫ā鎬佹 tableColumns: [], // 琛ㄦ牸鏄剧ず鍒� fields: null, // 鎼滅储鏉′欢鍙婃樉绀哄垪锛屽彲閫夊瓧娈� menuformlist: null, // 鍩烘湰淇℃伅琛ㄥ崟瀛楁 @@ -61,7 +58,6 @@ settingVisible: false, // 鍏ㄥ眬閰嶇疆妯℃�佹 closeVisible: false, // 鍏抽棴妯℃�佹 tables: [], // 鍙敤琛ㄥ悕 - selectedTables: [], // 宸查�夎〃鍚� originMenu: null, // 鍘熷鑿滃崟 delActions: [], // 鍒犻櫎鎸夐挳鍒楄〃 tabviews: [], // 鎵�鏈夋爣绛鹃〉 @@ -143,7 +139,6 @@ openEdition: btnTab.open_edition || '', columns: columns, originMenu: JSON.parse(JSON.stringify(_config)), - selectedTables: _config.tables, menuformlist: [ { type: 'text', @@ -195,73 +190,6 @@ duration: 5 }) } - }) - - let deffers = this.state.selectedTables.map(item => { - return new Promise(resolve => { - Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: item.TbName}).then(res => { - res.TBName = item.TbName - resolve(res) - }) - }) - }) - Promise.all(deffers).then(response => { - let _columns = [] - response.forEach(res => { - if (res.status) { - let tabmsg = { - tableName: res.TBName, - columns: res.FDName.map(item => { - let _type = item.FieldType.toLowerCase() - let _decimal = 0 - if (/^nvarchar/.test(_type)) { - _type = 'text' - } else if (/^int/.test(_type)) { - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - if (_decimal > 4) { - _decimal = 4 - } - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - if (_decimal > 4) { - _decimal = 4 - } - _type = 'number' - } else if (/^datetime/.test(_type)) { - _type = 'datetime' - } else if (/^date/.test(_type)) { - _type = 'date' - } else { - _type = 'text' - } - - return { - field: item.FieldName, - label: item.FieldDec, - type: _type, - datatype: _type, - decimal: _decimal - } - }) - } - _columns.push(tabmsg) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - - this.setState({ - tableColumns: _columns - }) }) Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => { @@ -608,7 +536,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, @@ -749,7 +677,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param) + Api.genericInterface(param) } let _config = {...config, setting: setting} @@ -856,7 +784,7 @@ } let _LongParam = '' - let _config = {...config, tables: this.state.selectedTables} + let _config = {...config} // 鏁版嵁鏉ユ簮涓烘煡璇笖鏈缃富閿椂锛屽惎鐢ㄤ负false if (_config.setting.datatype === 'query' && !_config.setting.primaryKey) { @@ -1227,7 +1155,7 @@ onCancel() {} }) } else { - let _config = {...config, tables: this.state.selectedTables} + let _config = {...config} if (!is(fromJS(_config), fromJS(originMenu))) { this.setState({ @@ -1237,174 +1165,6 @@ this.handleViewBack() } } - } - - queryField = (type) => { - const {selectedTables, tableColumns, config} = this.state - // 鍒ゆ柇鏄惁宸查�夋嫨琛ㄥ悕 - if (selectedTables.length === 0) { - notification.warning({ - top: 92, - message: '璇烽�夋嫨琛ㄥ悕锛�', - duration: 5 - }) - return - } - - // 琛ㄥ瓧娈甸泦杞负map鏁版嵁 - let columns = new Map() - tableColumns.forEach(table => { - table.columns.forEach(column => { - columns.set(column.field, column) - }) - }) - - if (type === 'search') { - // 娣诲姞鎼滅储鏉′欢锛屽瓧娈甸泦涓瓨鍦ㄦ悳绱㈡潯浠跺瓧娈碉紝浣跨敤鎼滅储鏉′欢瀵硅薄鏇挎崲瀛楁闆嗭紝璁剧疆鏁版嵁绫诲瀷 - config.groups.forEach(group => { - group.sublist.forEach(item => { - if (columns.has(item.field)) { - let _datatype = columns.get(item.field).datatype - columns.set(item.field, {...item, selected: true, datatype: _datatype}) - } - }) - }) - } - - // 鏄剧ず瀛楁闆嗗脊绐� - this.setState({ - tableVisible: true, - fields: [...columns.values()] - }) - } - - addFieldSubmit = () => { - const {config} = this.state - // 瀛楁闆嗕负绌猴紝鍏抽棴寮圭獥 - if (!this.state.fields || this.state.fields.length === 0) { - this.setState({ - tableVisible: false, - }) - } - - // 鑾峰彇宸查�夊瓧娈甸泦鍚� - let cards = this.refs.searchcard.state.selectCards - let columnsMap = new Map() - cards.forEach(card => { - columnsMap.set(card.field, card) - }) - - let groups = config.groups.map(group => { - group.sublist = group.sublist.map(item => { - if (columnsMap.has(item.field)) { - let cell = columnsMap.get(item.field) - - if (cell.selected && cell.type !== item.type) { // 鏁版嵁绫诲瀷淇敼 - item.type = cell.type - item.initval = '' - } - columnsMap.delete(item.field) - } - return item - }) - return group - }) - - let items = [...columnsMap.values()].map(item => { - let newcard = { - uuid: Utils.getuuid(), - label: item.label, - field: item.field, - initval: '', - type: item.type, - resourceType: '0', - options: [], - orderType: 'asc' - } - - return newcard - }) - - groups = groups.map(group => { - if (group.isDefault) { - group.sublist = [...group.sublist, ...items] - group.sublist = group.sublist.filter(item => !item.origin) - } - return group - }) - - this.setState({ - config: {...config, groups: groups} - }) - notification.success({ - top: 92, - message: '鎿嶄綔鎴愬姛', - duration: 2 - }) - } - - onTableChange = (value) => { - const {tables, selectedTables, tableColumns} = this.state - - let _table = tables.filter(item => item.TbName === value)[0] - let isSelected = !!selectedTables.filter(cell => cell.TbName === value)[0] - if (!isSelected) { - this.setState({ - selectedTables: [...selectedTables, _table] - }) - Api.getSystemConfig({func: 'sPC_Get_FieldName', TBName: value}).then(res => { - if (res.status) { - let tabmsg = { - tableName: _table.name, - columns: res.FDName.map(item => { - let _type = item.FieldType.toLowerCase() - let _decimal = 0 - if (/^nvarchar/.test(_type)) { - _type = 'text' - } else if (/^int/.test(_type)) { - _type = 'number' - } else if (/^decimal/.test(_type)) { - _decimal = _type.split(',')[1] - _decimal = parseInt(_decimal) - _type = 'number' - } else if (/^datetime/.test(_type)) { - _type = 'datetime' - } else if (/^date/.test(_type)) { - _type = 'date' - } else { - _type = 'text' - } - - return { - field: item.FieldName, - label: item.FieldDec, - type: _type, - datatype: _type, - decimal: _decimal - } - }) - } - this.setState({ - tableColumns: [...tableColumns, tabmsg] - }) - } else { - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) - } - }) - } - } - - deleteTable = (table) => { - const {selectedTables, tableColumns} = this.state - - this.setState({ - selectedTables: selectedTables.filter(item => item.TbName !== table.TbName), - tableColumns: tableColumns.filter(item => item.tableName !== table.TbName) - }) } changeSetting = () => { @@ -1434,7 +1194,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param) + Api.genericInterface(param) } if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) { @@ -1454,7 +1214,7 @@ param.LText = Utils.formatOptions(param.LText) param.secretkey = Utils.encrypt('', param.timestamp) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, @@ -1493,7 +1253,7 @@ }) } else { this.menuformRef.handleConfirm().then(res => { - let _config = {...config, tables: this.state.selectedTables} + let _config = {...config} if (!is(fromJS(originMenu), fromJS(_config))) { notification.warning({ @@ -1778,43 +1538,6 @@ formlist={this.state.menuformlist} wrappedComponentRef={(inst) => this.menuformRef = inst} /> - {/* 琛ㄥ悕娣诲姞 */} - <div className="ant-col ant-form-item-label"> - <label> - <Tooltip placement="topLeft" title="姝ゅ鍙互娣诲姞閰嶇疆鐩稿叧鐨勫父鐢ㄨ〃锛屽湪娣诲姞鎼滅储鏉′欢鍜屾樉绀哄垪鏃讹紝鍙�氳繃宸ュ叿鏍忎腑鐨勬坊鍔犳寜閽紝鎵归噺娣诲姞琛ㄦ牸鐩稿叧瀛楁銆�"> - <QuestionCircleOutlined className="mk-form-tip" /> - {this.state.dict['header.menu.table.add']} - </Tooltip> - </label> - </div> - <Select - showSearch - className="tables" - style={{ width: '100%' }} - optionFilterProp="children" - value="璇烽�夋嫨琛ㄥ悕" - onChange={this.onTableChange} - showArrow={false} - getPopupContainer={() => document.getElementById('common-basedata')} - filterOption={(input, option) => { - return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 || - option.props.value.toLowerCase().indexOf(input.toLowerCase()) >= 0 - }} - > - {this.state.tables.map((table, index) => ( - <Option key={index} title={table.TbName} value={table.TbName}>{table.Remark}</Option> - ))} - </Select> - {this.state.selectedTables.length > 0 && <List - size="small" - bordered - dataSource={this.state.selectedTables} - renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}> - {item.Remark + ' (' + item.TbName + ')'} - <CloseOutlined onClick={() => this.deleteTable(item)}/> - <div className="bottom-mask"></div> - </List.Item>} - />} </Panel> {/* 鎼滅储鏉′欢娣诲姞 */} <Panel header={this.state.dict['header.menu.form']} key="1"> @@ -1823,7 +1546,6 @@ return (<SourceElement key={index} content={item}/>) })} </div> - <Button type="primary" block onClick={() => this.queryField('search')}>鎵归噺娣诲姞</Button> </Panel> {/* 鎸夐挳娣诲姞 */} <Panel header={this.state.dict['header.menu.action']} key="2"> @@ -1877,9 +1599,9 @@ </div> } style={{ width: '100%' }}> <SettingOutlined onClick={this.changeSetting} /> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> + {/* <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> <QuestionCircleOutlined style={{position: 'relative', color: '#c49f47', left: '5px', top: '20px'}} /> - </Tooltip> + </Tooltip> */} <Collapse activeKey={config.groups.map(group => group.uuid)} expandIconPosition={'right'} @@ -1910,9 +1632,9 @@ ))} </Collapse> <div className="action-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> + {/* <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> <QuestionCircleOutlined style={{position: 'absolute', color: '#c49f47', left: '5px', top: '5px'}} /> - </Tooltip> + </Tooltip> */} <DragElement type="action" list={this.state.config.action} @@ -1974,29 +1696,6 @@ inputSubmit={this.handleSubmit} wrappedComponentRef={(inst) => this.actionFormRef = inst} /> - </Modal> - {/* 鏍规嵁瀛楁鍚嶆坊鍔犳樉绀哄垪鍙婃悳绱㈡潯浠� */} - <Modal - wrapClassName="common-table-fields-modal" - title={this.state.dict['model.edit']} - visible={this.state.tableVisible} - width={'65vw'} - maskClosable={false} - cancelText={this.state.dict['model.close']} - onOk={this.addFieldSubmit} - onCancel={() => { // 鍙栨秷娣诲姞 - this.setState({ - tableVisible: false - }) - }} - destroyOnClose - > - {this.state.fields && this.state.fields.length > 0 ? - <EditCard data={this.state.fields} ref="searchcard" type={'form'} dict={this.state.dict} /> : null - } - {(!this.state.fields || this.state.fields.length === 0) && - <Empty /> - } </Modal> {/* 鎸夐挳浣跨敤绯荤粺瀛樺偍杩囩▼鏃讹紝楠岃瘉淇℃伅妯℃�佹 */} <Modal diff --git a/src/templates/formtabconfig/index.scss b/src/templates/formtabconfig/index.scss index dc1d5ad..d555524 100644 --- a/src/templates/formtabconfig/index.scss +++ b/src/templates/formtabconfig/index.scss @@ -59,41 +59,6 @@ color: #1890ff; border-bottom: 1px solid #e8e8e8; } - .tables { - .ant-select-selection-selected-value { - opacity: 0.4!important; - } - } - .ant-list { - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } .config-button { min-width: 65px; } diff --git a/src/templates/modalconfig/dragelement/card.jsx b/src/templates/modalconfig/dragelement/card.jsx index 3b2f64f..d4dc506 100644 --- a/src/templates/modalconfig/dragelement/card.jsx +++ b/src/templates/modalconfig/dragelement/card.jsx @@ -16,7 +16,7 @@ const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) const CheckCard = asyncComponent(() => import('../checkCard')) -const Card = ({ id, card, moveCard, findCard, editCard, closeCard, copyCard, showField }) => { +const Card = ({ id, card, moveCard, findCard, editCard, closeCard, copyCard, showField, setStyle }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: 'form', id, originalIndex }, @@ -55,7 +55,7 @@ const changeStyle = () => { let options = ['font1'] - MKEmitter.emit('changeStyle', ['form', card.uuid], options, card.style || {}) + MKEmitter.emit('changeStyle', options, card.style || {}, (s) => {setStyle(s, id)}) } let selectval = '' diff --git a/src/templates/modalconfig/dragelement/index.jsx b/src/templates/modalconfig/dragelement/index.jsx index a0f19a3..4db46b0 100644 --- a/src/templates/modalconfig/dragelement/index.jsx +++ b/src/templates/modalconfig/dragelement/index.jsx @@ -37,6 +37,14 @@ handleForm(card) } + const setStyle = (style, id) => { + const { card, index } = findCard(id) + + const _cards = update(cards, { $splice: [[index, 1, {...card, style}]] }) + + handleList(_cards) + } + const closeCard = id => { const { card } = findCard(id) closeForm(card) @@ -124,6 +132,7 @@ card={card} showField={showField} moveCard={moveCard} + setStyle={setStyle} editCard={editCard} closeCard={closeCard} copyCard={copyCard} diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index e6212f8..9f35ed0 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -430,7 +430,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, diff --git a/src/templates/modalconfig/index.scss b/src/templates/modalconfig/index.scss index dfa0948..9325eb1 100644 --- a/src/templates/modalconfig/index.scss +++ b/src/templates/modalconfig/index.scss @@ -55,41 +55,6 @@ } } } - .tables { - .ant-select-selection-selected-value { - opacity: 0.4!important; - } - } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } } .tools::-webkit-scrollbar { width: 4px; diff --git a/src/templates/modalconfig/source.jsx b/src/templates/modalconfig/source.jsx index d3818c5..c437d38 100644 --- a/src/templates/modalconfig/source.jsx +++ b/src/templates/modalconfig/source.jsx @@ -91,6 +91,11 @@ }, { type: 'form', + label: '澶氳鏂囨湰', + subType: 'textarea', + }, + { + type: 'form', label: CommonDict['model.form.multiselect'], subType: 'multiselect', }, @@ -133,11 +138,6 @@ type: 'form', label: CommonDict['model.form.datemonth'], subType: 'datemonth', - }, - { - type: 'form', - label: CommonDict['model.form.textarea'], - subType: 'textarea', }, { type: 'form', diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index 0a94c8d..c034b51 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -164,7 +164,7 @@ reReadonly.interface = false reRequired.interface = true } else if (intertype === 'outer') { - shows.push('procMode', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackType', 'output') + shows.push('procMode', 'sysInterface', 'interface', 'outerFunc', 'callbackType', 'output') // reRequired.innerFunc = false if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') @@ -181,6 +181,8 @@ if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -212,13 +214,15 @@ reOptions.Ot = requireOptions.filter(op => ['notRequired', 'requiredSgl'].includes(op.value)) if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -231,12 +235,14 @@ reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc') reRequired.innerFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -275,13 +281,15 @@ if (_funcType === 'print') { shows.push('execMode', 'intertype', 'Ot', 'execSuccess', 'execError', 'resetPageIndex') if (this.record.intertype === 'outer') { - shows.push('innerFunc', 'sysInterface', 'interface', 'proInterface', 'outerFunc', 'callbackFunc') + shows.push('innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc') reRequired.innerFunc = false reRequired.callbackFunc = false if (this.record.sysInterface === 'false') { reReadonly.interface = false reRequired.interface = true + + shows.push('proInterface') } else { reReadonly.interface = true reRequired.interface = false @@ -294,6 +302,10 @@ shows.push('refreshTab') } else if (_funcType === 'megvii') { shows.push('subFunc', 'progress') + } else if (_funcType === 'refund') { + shows.push('Ot', 'execSuccess', 'execError') + + reOptions.Ot = requireOptions.filter(op => op.value === 'requiredSgl') } else if (_funcType === 'filezip') { reOptions.Ot = requireOptions reRequired.innerFunc = false diff --git a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx index 5369beb..5de06eb 100644 --- a/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/dragaction/index.jsx @@ -64,6 +64,10 @@ let _val = fromJS(copycard).toJS() try { + if (_val.control) { + delete _val.controlField + delete _val.controlVal + } delete _val.$srcId let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId') diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 2e82251..d520cdf 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -1,8 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Tooltip, Modal, notification, Button } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' +import { Modal, notification, Button } from 'antd' import moment from 'moment' import Api from '@/api' @@ -915,9 +914,6 @@ return ( <div className="model-table-action-list" style={config.charts && config.charts.length > 1 ? {paddingTop: 25} : null}> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃寜閽�嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬寜閽嫋鑷虫澶勬坊鍔狅紝濡傞�夋嫨鎸夐挳绫诲瀷涓鸿〃鍗曘�佹柊鏍囩椤电瓑鍚湁閰嶇疆椤甸潰鐨勬寜閽紝鍙湪宸︿晶宸ュ叿鏍�-鎸夐挳-鍙厤缃寜閽锛岀偣鍑绘寜閽畬鎴愮浉鍏抽厤缃�傛敞锛氬綋璁剧疆鎸夐挳鏄剧ず浣嶇疆涓鸿〃鏍兼椂锛屾樉绀哄垪浼氬鍔犳搷浣滃垪銆�"> - <QuestionCircleOutlined style={{color: '#c49f47', position: 'absolute', left: '5px', top: '5px'}} /> - </Tooltip> <DragElement list={actionlist} setting={this.props.config.setting} diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index 586de39..ad293e5 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -50,7 +50,7 @@ } let _sql = `Declare @${btn.sheet} table (${_dec}jskey nvarchar(50) ) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) + Declare @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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512) Select @ErrorCode='', @retmsg='' ` @@ -185,7 +185,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/columnform/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/columnform/index.jsx index bb1de82..1cae7b2 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/columnform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/columnform/index.jsx @@ -79,19 +79,20 @@ })(<InputNumber min={5} max={200} precision={0} />)} </Form.Item> </Col> - <Col span={5}> + <Col span={6}> <Form.Item label="绫诲瀷"> {getFieldDecorator('type', { initialValue: 'text' })( <Radio.Group style={{whiteSpace: 'nowrap'}}> <Radio value="text">鏂囨湰</Radio> + <Radio value="number">鏁板��</Radio> <Radio value="image">鍥剧墖</Radio> </Radio.Group> )} </Form.Item> </Col> - <Col span={4} className="add"> + <Col span={3} className="add"> <Button onClick={this.handleConfirm} type="primary" className="mk-green"> 娣诲姞 </Button> diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx index eb41078..9d3d7e7 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx @@ -39,7 +39,7 @@ columns = columns.filter(item => item.Column !== '$Index') let fields = columns.map(item => item.Column) - let _sql = `Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000) + let _sql = `Declare @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),@ErrorCode nvarchar(50), @retmsg nvarchar(4000) ` this.setState({ @@ -173,7 +173,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 489a1b5..a1587be 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -39,14 +39,15 @@ inputType: 'input', editable: true, unique: true, - width: '20%' + width: '17%' }, { title: this.props.dict['model.name'], dataIndex: 'Text', inputType: 'input', editable: true, - width: '20%' + unique: true, + width: '17%' }, { title: this.props.dict['model.form.columnWidth'], @@ -55,25 +56,28 @@ min: 5, max: 200, editable: true, - width: '14%', + width: '12%', render: (text) => text || 20 }, { title: '绫诲瀷', dataIndex: 'type', - inputType: 'radio', + inputType: 'select', editable: true, required: false, - width: '18%', + width: '14%', render: (text) => { if (text === 'image') { return '鍥剧墖' + } else if (text === 'number') { + return '鏁板��' } else { return '鏂囨湰' } }, options: [ {value: 'text', text: '鏂囨湰'}, + {value: 'number', text: '鏁板��'}, {value: 'image', text: '鍥剧墖'} ] }, @@ -95,6 +99,16 @@ {value: 'true', text: '鏄�'}, {value: 'false', text: '鍚�'} ] + }, + { + title: '灏忔暟浣�', + dataIndex: 'decimal', + inputType: 'number', + min: 0, + max: 18, + editable: true, + required: false, + width: '12%' }, { title: '瀵煎嚭', @@ -657,7 +671,7 @@ this.setState({ loading: true }) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { this.setState({ loading: false }) @@ -703,7 +717,7 @@ if (fields.includes(item.field) || !item.field) return fields.push(item.field) - columns.push({ + let cell = { Column: item.field, Text: item.label, Width: 20, @@ -711,7 +725,14 @@ output: 'true', type: 'text', uuid: Utils.getuuid() - }) + } + + if (item.type === 'number') { + cell.type = 'number' + cell.decimal = item.decimal + } + + columns.push(cell) }) this.setState({ @@ -740,7 +761,7 @@ changeColumns = (columns) => { const { verify } = this.state - if (columns[0] && (columns[0].type !== 'image' && columns[0].type !== 'text')) { + if (columns[0] && (columns[0].type !== 'image' && columns[0].type !== 'text' && columns[0].type !== 'number')) { columns = columns.map(col => { let _cell = { uuid: Utils.getuuid(), @@ -888,7 +909,7 @@ param.timestamp = timestamp param.secretkey = Utils.encrypt('', timestamp) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { _resolve() } else { @@ -939,7 +960,7 @@ <Button className="excel-col-add mk-red" title="娓呯┖Excel鍒�" onClick={this.clearField}> 娓呯┖Excel鍒� </Button> - <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index銆�</div> + <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index锛涙暟鍊肩被鍨嬪鍑烘椂鍙繘琛屾暟鎹鐞嗭紙鍙栫粷瀵瑰�笺�佷繚鐣欏皬鏁颁綅锛夈��</div> <EditTable actions={['edit', 'move', 'copy', 'del']} type="excelcolumn" wrappedComponentRef={(inst) => this.columnRef = inst} data={verify.columns} columns={excelColumns} onChange={this.changeColumns}/> </TabPane> {card.intertype === 'system' ? <TabPane tab={ diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index c8fa24e..f1d391d 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -32,7 +32,7 @@ }) if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } @@ -127,7 +127,7 @@ ` } else { sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_dataresource}` } sql = sql.replace(/\n\s{8}/ig, '\n') diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index e39bcca..6dc199d 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio } from 'antd' +import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio, Tooltip } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' import moment from 'moment' import Api from '@/api' @@ -331,7 +332,24 @@ )} </Form.Item> </Col> : null } - {printMode === 'normal' ? <Col span={8} offset={8}> + {printMode === 'normal' ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鎵撳嵃鍒楄〃涓虹┖鏃讹紝鏄惁鎻愮ず鐢ㄦ埛銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 绌哄�兼彁绀� + </Tooltip> + }> + {getFieldDecorator('emptyTip', { + initialValue: verify.emptyTip || 'true' + })( + <Radio.Group> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {printMode === 'normal' ? <Col span={8}> <img className="legend" src={this.state.selectimg} alt=""/> </Col> : null } </Row> @@ -359,6 +377,7 @@ </Form> </TabPane> <TabPane tab="淇℃伅鎻愮ず" key="7"> + <div style={{textAlign: 'center', fontSize: '13px', marginBottom: '10px'}}>鎵撳嵃淇℃伅涓鏋滃瓨鍦ㄧ綉缁滆祫婧愶紙鍥剧墖锛夛紝璇风‘淇濊祫婧愬彲浠ユ甯歌闂紝璧勬簮涓嶅瓨鍦ㄦ椂浼氭姤鏁版嵁寮傚父銆�</div> <Form {...formItemLayout}> <Row gutter={24}> <Col offset={6} span={6}> diff --git a/src/templates/sharecomponent/columncomponent/columnform/index.jsx b/src/templates/sharecomponent/columncomponent/columnform/index.jsx index a69897e..ec356a5 100644 --- a/src/templates/sharecomponent/columncomponent/columnform/index.jsx +++ b/src/templates/sharecomponent/columncomponent/columnform/index.jsx @@ -12,7 +12,8 @@ number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'], link: ['label', 'field', 'type', 'nameField', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'fieldlength', 'blacklist'], textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'fieldlength', 'blacklist'], - picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'maxHeight'], + picture: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'span'], + video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'fieldlength', 'blacklist', 'aspectRatio'], index: ['label', 'type', 'Align', 'Width'] } diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index 4d1dd74..52a345f 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -1,8 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Tooltip, Modal, notification, Switch, message } from 'antd' -import { QuestionCircleOutlined, CopyOutlined } from '@ant-design/icons' +import { Modal, notification, Switch, message } from 'antd' +import { CopyOutlined } from '@ant-design/icons' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' @@ -506,12 +506,7 @@ return ( <div className="model-table-column-list"> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃樉绀哄垪銆嬩腑锛岄�夋嫨瀵瑰簲绫诲瀷鐨勬樉绀哄垪鎷栬嚦姝ゅ娣诲姞锛涙垨鐐瑰嚮銆婃坊鍔犳樉绀哄垪銆嬫寜閽壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ�傛敞锛氭坊鍔犲悎骞跺垪鏃讹紝闇�璁剧疆鍙�夊垪銆�"> - <QuestionCircleOutlined style={{color: '#c49f47', position: 'relative', left: '-15px', top: '5px'}} /> - </Tooltip> - {columnlist && columnlist.length > 0 ? - <CopyOutlined className="column-copy" title="copy" onClick={this.copycolumn} /> : null - } + {columnlist && columnlist.length > 0 ? <CopyOutlined className="column-copy" title="copy" onClick={this.copycolumn} /> : null} <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={this.onFieldChange} /> <DragElement list={columnlist} @@ -528,7 +523,7 @@ <Modal title="鏄剧ず鍒�-缂栬緫" visible={modaltype === 'columns'} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -547,7 +542,7 @@ <Modal title={dict['model.form.colspan'] + '-' + dict['model.edit']} visible={modaltype === 'colspan'} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} @@ -565,7 +560,7 @@ <Modal title="鎿嶄綔鍒�-缂栬緫" visible={modaltype === 'gridbtn'} - width={800} + width={850} maskClosable={false} onOk={this.handleSubmit} onCancel={this.editModalCancel} diff --git a/src/templates/sharecomponent/columncomponent/index.scss b/src/templates/sharecomponent/columncomponent/index.scss index d2ea50c..6d09190 100644 --- a/src/templates/sharecomponent/columncomponent/index.scss +++ b/src/templates/sharecomponent/columncomponent/index.scss @@ -1,6 +1,6 @@ .model-table-column-list { position: relative; - padding: 0px 20px 100px; + padding: 16px 20px 100px; .ant-switch { position: absolute; diff --git a/src/templates/sharecomponent/searchcomponent/dategroup/index.scss b/src/templates/sharecomponent/searchcomponent/dategroup/index.scss index 3e0369e..57adcd0 100644 --- a/src/templates/sharecomponent/searchcomponent/dategroup/index.scss +++ b/src/templates/sharecomponent/searchcomponent/dategroup/index.scss @@ -13,6 +13,7 @@ } .ant-tag-checkable-checked { border-color: #1890ff; + background: #1890ff; } } diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index 9be4910..5f5132c 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -1,8 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Tooltip, Modal, notification, Switch } from 'antd' -import { QuestionCircleOutlined } from '@ant-design/icons' +import { Modal, notification, Switch } from 'antd' import moment from 'moment' import Api from '@/api' @@ -45,22 +44,6 @@ searchlist: fromJS(this.props.config.search).toJS() }) } - - // /** - // * @description 鐩戝惉鍒版悳绱㈡潯浠跺鍒舵椂锛岃Е鍙戞悳绱㈡潯浠剁紪杈� - // */ - // UNSAFE_componentWillReceiveProps (nextProps) { - // const { searchlist } = this.state - - // if (!is(fromJS(nextProps.config.search), fromJS(this.props.config.search)) && !is(fromJS(nextProps.config.search), fromJS(searchlist))) { - // let len = nextProps.config.search.length - // let item = nextProps.config.search[len - 1] - // if (item && item.focus) { - // this.handleSearch(item) - // } - // this.setState({searchlist: fromJS(nextProps.config.search).toJS()}) - // } - // } componentDidMount () { MKEmitter.addListener('plusSearch', this.plusSearch) @@ -257,7 +240,7 @@ param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ sqlVerifing: false, @@ -371,9 +354,6 @@ return ( <div className={'model-table-search-list length' + searchlist.length + (showField ? ' show-field' : '')}> - <Tooltip placement="bottomLeft" overlayClassName="middle" title="鍦ㄥ乏渚у伐鍏锋爮銆婃悳绱€�嬩腑锛岄�夋嫨瀵瑰簲鎼滅储妗嗘嫋鑷虫澶勬坊鍔狅紱鎴栫偣鍑绘寜閽�婃坊鍔犳悳绱㈡潯浠躲�嬫壒閲忔坊鍔狅紝閫夋嫨鎵归噺娣诲姞鏃讹紝闇�鎻愬墠閫夋嫨浣跨敤琛ㄣ��"> - <QuestionCircleOutlined style={{color: '#c49f47', position: 'relative', left: '-15px', top: '5px'}} /> - </Tooltip> <FieldsComponent config={{uuid: config.uuid, search: searchlist}} type="search" /> <Switch className="switch-field-show" checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} /> <DragElement diff --git a/src/templates/sharecomponent/searchcomponent/index.scss b/src/templates/sharecomponent/searchcomponent/index.scss index 29bbb21..4a4a374 100644 --- a/src/templates/sharecomponent/searchcomponent/index.scss +++ b/src/templates/sharecomponent/searchcomponent/index.scss @@ -1,5 +1,5 @@ .model-table-search-list { - padding: 1px 24px 20px; + padding: 16px 24px 20px; min-height: 87px; position: relative; border-bottom: 1px solid #d9d9d9; diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index a478d38..58a558c 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -301,7 +301,7 @@ param.timestamp = timestamp param.secretkey = Utils.encrypt('', timestamp) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { resolve() } else { diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx index c07d5f6..f047810 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/settingform/index.jsx @@ -10,6 +10,8 @@ import CodeMirror from '@/templates/zshare/codemirror' import './index.scss' +const { TextArea } = Input + class SettingForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� @@ -119,7 +121,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param) + Api.genericInterface(param) } resolve(values) @@ -226,6 +228,16 @@ </Form.Item> </Col> : null} {interType === 'outer' ? <Col span={8}> + <Form.Item label="澶栭儴鍑芥暟"> + {getFieldDecorator('outerFunc', { + initialValue: setting.outerFunc || '', + rules: [ + + ] + })(<Input placeholder={''} autoComplete="off" />)} + </Form.Item> + </Col> : null} + {interType === 'outer' ? <Col span={24} className="data-source"> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { initialValue: setting.interface || '', @@ -235,17 +247,7 @@ message: this.props.dict['form.required.input'] + '鎺ュ彛鍦板潃!' }, ] - })(<Input placeholder={''} autoComplete="off" />)} - </Form.Item> - </Col> : null} - {interType === 'outer' ? <Col span={8}> - <Form.Item label="澶栭儴鍑芥暟"> - {getFieldDecorator('outerFunc', { - initialValue: setting.outerFunc || '', - rules: [ - - ] - })(<Input placeholder={''} autoComplete="off" />)} + })(<TextArea rows={2}/>)} </Form.Item> </Col> : null} {interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}> diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx index 478739f..3b15e0e 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/utils.jsx @@ -22,7 +22,7 @@ } if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } @@ -133,7 +133,7 @@ ` } else { sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_dataresource}` } sql = sql.replace(/\n\s{8}/ig, '\n') diff --git a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx index 7a60231..df973b7 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/datasource/index.jsx @@ -29,6 +29,7 @@ interType: 'system', procMode: 'script', requestMode: 'system', + sysInterface: 'false', controlField: '', tableType: '', funcTooltip: '', @@ -68,6 +69,7 @@ procMode: setting.procMode || 'script', requestMode: setting.requestMode || 'system', controlField: setting.controlField || '', + sysInterface: setting.sysInterface || 'false', tableType: setting.tableType, funcTooltip: tooltip, funcRules: rules @@ -152,7 +154,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param) + Api.genericInterface(param) } resolve(values) @@ -178,10 +180,15 @@ this.setState({ requestMode: value }) - } else if (key === 'sysInterface' && value === 'true') { - this.props.form.setFieldsValue({ - interface: window.GLOB.mainSystemApi || '' + } else if (key === 'sysInterface') { + this.setState({ + sysInterface: value }) + if (value === 'true') { + this.props.form.setFieldsValue({ + interface: window.GLOB.mainSystemApi || '' + }) + } } this.props.updateStatus({[key]: value}) } @@ -197,7 +204,7 @@ render() { const { setting, dict, menu, config, columns } = this.props const { getFieldDecorator } = this.props.form - const { interType, funcRules, funcTooltip, procMode, requestMode, tableType, controlField } = this.state + const { interType, funcRules, funcTooltip, procMode, requestMode, tableType, controlField, sysInterface } = this.state const formItemLayout = { labelCol: { @@ -266,7 +273,7 @@ {interType === 'outer' ? <Col span={12}> <Form.Item label={dict['header.form.sysInterface']}> {getFieldDecorator('sysInterface', { - initialValue: setting.sysInterface || 'false', + initialValue: sysInterface, rules: [ { required: true, @@ -321,19 +328,19 @@ </Form.Item> </Col> : null} {interType === 'outer' || interType === 'custom' ? <Col className="data-source" span={24}> - <Form.Item label="娴嬭瘯鍦板潃"> + <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { - initialValue: setting.interface || '', + initialValue: setting.interface || (interType === 'outer' && sysInterface === 'true' ? window.GLOB.mainSystemApi : ''), rules: [ { - required: true, - message: dict['form.required.input'] + '娴嬭瘯鍦板潃!' + required: interType === 'outer' && sysInterface === 'true' ? false : true, + message: dict['form.required.input'] + '鎺ュ彛鍦板潃!' }, ] - })(<TextArea rows={2} />)} + })(<TextArea rows={2} readOnly={interType === 'outer' && sysInterface === 'true'}/>)} </Form.Item> </Col> : null} - {interType === 'outer' || interType === 'custom' ? <Col className="data-source" span={24}> + {(interType === 'outer' && sysInterface !== 'true') || interType === 'custom' ? <Col className="data-source" span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="姝e紡绯荤粺鎵�浣跨敤鐨勭殑鎺ュ彛鍦板潃銆�"> <QuestionCircleOutlined className="mk-form-tip" /> diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 2fec3e1..eb8577c 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -334,6 +334,14 @@ param.timestamp = timestamp param.secretkey = Utils.encrypt('', timestamp) + if (r.errors) { + notification.warning({ + top: 92, + message: r.errors, + duration: 5 + }) + } + let sumParam = null if (r.sumSql) { sumParam = { @@ -346,10 +354,10 @@ sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) } - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { if (sumParam) { - Api.getLocalConfig(sumParam).then(res => { + Api.genericInterface(sumParam).then(res => { if (res.status) { _resolve() } else { diff --git a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx index 0f40714..144b09e 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx @@ -296,7 +296,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { this.setState({ loading: false, diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx index a9f3e69..2f6b872 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx @@ -18,7 +18,7 @@ }) if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } @@ -35,8 +35,8 @@ }) } - _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) - _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${timestamp}'`) + _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`) + _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') @@ -110,11 +110,11 @@ ${_sql} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' ` } else { sumSql = `/* sql sum楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_sql}` } } @@ -134,22 +134,41 @@ ${_dataresource} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' ` } else { sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_dataresource}` } + sql = sql.replace(/\n\s{8}/ig, '\n') console.info(sql) + + let errors = [] + + if (/@[0-9a-zA-Z_]+@/ig.test(sql)) { + let arr = sql.match(/@[0-9a-zA-Z_]+@/ig) + + arr.forEach(item => { + let reg = new RegExp(item, 'ig') + if (reg.test(_dataresource)) { + errors.push(`鏁版嵁婧愪腑瀛樺湪鏈浛鎹㈠��${item}`) + } + scripts && scripts.forEach(script => { + if (reg.test(script.sql)) { + errors.push(`鑷畾涔夎剼鏈�(${script.$index})瀛樺湪鏈浛鎹㈠��${item}`) + } + }) + }) + } if (sumSql) { sumSql = sumSql.replace(/\n\s{10}/ig, '\n') console.info(sumSql) } - return { sql, sumSql } + return { sql, sumSql, errors: errors.join('锛�') } } /** @@ -170,7 +189,7 @@ }) if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index f2da2b6..5a084df 100644 --- a/src/templates/sharecomponent/tablecomponent/index.jsx +++ b/src/templates/sharecomponent/tablecomponent/index.jsx @@ -8,8 +8,6 @@ import Api from '@/api' import options from '@/store/options.js' import Utils from '@/utils/utils.js' -import zhCN from '@/locales/zh-CN/model.js' -import enUS from '@/locales/en-US/model.js' import { queryTableSql } from '@/utils/option.js' import './index.scss' @@ -24,7 +22,6 @@ } state = { - dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, tables: [], // 绯荤粺琛� tableFields: [], // 宸查�夎〃瀛楁闆� selectedTables: [], // 宸查�夎〃 @@ -268,16 +265,16 @@ render() { const { containerId } = this.props - const { dict, tables, selectedTables } = this.state + const { tables, selectedTables } = this.state return ( - <div className="model-table-tablemanage-view"> + <div className="model-tablename-manage-view"> {/* 琛ㄥ悕娣诲姞 */} <div className="ant-col ant-form-item-label"> <label> <Tooltip placement="topLeft" title="姝ゅ鍙互娣诲姞椤甸潰閰嶇疆鐩稿叧鐨勫父鐢ㄨ〃锛屽彲閫氳繃宸ュ叿鏍忎腑鐨勬坊鍔犳寜閽紝鍙壒閲忔坊鍔犺〃鏍肩浉鍏冲瓧娈点��"> <QuestionCircleOutlined className="mk-form-tip" /> - {dict['header.menu.table.add']} + 琛ㄥ悕 </Tooltip> </label> </div> @@ -307,7 +304,6 @@ renderItem={(item, index) => <List.Item key={index} title={item.Remark + ' (' + item.TbName + ')'}> {item.Remark + ' (' + item.TbName + ')'} <CloseOutlined onClick={() => this.deleteTable(item)}/> - <div className="bottom-mask"></div> </List.Item>} />} </div> diff --git a/src/templates/sharecomponent/tablecomponent/index.scss b/src/templates/sharecomponent/tablecomponent/index.scss index aa254b7..407a9e9 100644 --- a/src/templates/sharecomponent/tablecomponent/index.scss +++ b/src/templates/sharecomponent/tablecomponent/index.scss @@ -1,7 +1,33 @@ -.model-table-tablemanage-view { +.model-tablename-manage-view { + >.ant-list { + margin-top: 20px; + .ant-list-item { + display: -webkit-box; + padding-right: 20px; + position: relative; + padding-left: 5px; + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + min-height: 55px; + width: 100%; + .anticon { + position: absolute; + top: 0px; + right: 0px; + padding: 3px 3px 10px 10px; + cursor: pointer; + } + } + } .tables { + width: 66.66666667%!important; .ant-select-selection-selected-value { opacity: 0.4!important; } } + >.ant-form-item-label { + width: 33.33333333%; + } } \ No newline at end of file diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/datasource/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/datasource/index.jsx index 0bf23eb..6c21f28 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/datasource/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/datasource/index.jsx @@ -10,6 +10,8 @@ import CodeMirror from '@/templates/zshare/codemirror' import './index.scss' +const { TextArea } = Input + class SettingForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� @@ -137,7 +139,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - Api.getLocalConfig(param) + Api.genericInterface(param) } resolve(values) @@ -284,7 +286,7 @@ })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} </Form.Item> </Col> : null} - {interType === 'outer' ? <Col span={12}> + {interType === 'outer' ? <Col span={24} className="data-source"> <Form.Item label="鎺ュ彛鍦板潃"> {getFieldDecorator('interface', { initialValue: setting.interface || '', @@ -294,7 +296,7 @@ message: dict['form.required.input'] + '鎺ュ彛鍦板潃!' } ] - })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} + })(<TextArea rows={2}/>)} </Form.Item> </Col> : null} {interType === 'outer' ? <Col span={12}> diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index b3958a5..0abd359 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -145,7 +145,7 @@ param.timestamp = timestamp param.secretkey = Utils.encrypt('', timestamp) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { _resolve() } else { diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx index 4a49e77..0444260 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx @@ -18,7 +18,7 @@ }) if (_customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + _customScript = `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 ='' ${_customScript} ` } @@ -77,7 +77,7 @@ ` } else { sql = `/* sql 楠岃瘉 */ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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 ='' + 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 ='' ${_dataresource}` } sql = sql.replace(/\n\s{8}/ig, '\n') diff --git a/src/templates/subtableconfig/index.scss b/src/templates/subtableconfig/index.scss index 0adcbba..4f91d6e 100644 --- a/src/templates/subtableconfig/index.scss +++ b/src/templates/subtableconfig/index.scss @@ -63,37 +63,6 @@ border-bottom: 1px solid #e8e8e8; } } - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } .config-button { min-width: 65px; } diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx index 0d4a1ab..c5da906 100644 --- a/src/templates/treepageconfig/index.jsx +++ b/src/templates/treepageconfig/index.jsx @@ -426,7 +426,7 @@ }) this.props.reloadmenu() - Api.getLocalConfig(localParam) + Api.genericInterface(localParam) if (this.state.closeVisible) { this.props.handleView() @@ -456,7 +456,7 @@ }) this.props.reloadmenu() - Api.getLocalConfig(localParam) + Api.genericInterface(localParam) if (this.state.closeVisible) { this.props.handleView() diff --git a/src/templates/treepageconfig/index.scss b/src/templates/treepageconfig/index.scss index 2ee9942..b998125 100644 --- a/src/templates/treepageconfig/index.scss +++ b/src/templates/treepageconfig/index.scss @@ -53,38 +53,6 @@ } } } - - .ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - .bottom-mask { - position: absolute; - width: 100%; - height: 8px; - bottom: 0; - left: 0; - background: #ffffff; - border-radius: 8px; - } - } - } .config-button { min-width: 65px; } diff --git a/src/templates/zshare/createfunc/index.jsx b/src/templates/zshare/createfunc/index.jsx index 92e31e1..b37c619 100644 --- a/src/templates/zshare/createfunc/index.jsx +++ b/src/templates/zshare/createfunc/index.jsx @@ -59,7 +59,7 @@ _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - return Api.getLocalConfig(_param) + return Api.genericInterface(_param) }).then(res => { if (!res) return res @@ -143,7 +143,7 @@ _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) - return Api.getLocalConfig(_param) + return Api.genericInterface(_param) }).then(res => { if (!res || res === 'create') return res @@ -171,7 +171,7 @@ _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) - return Api.getLocalConfig(_param) + return Api.genericInterface(_param) }).then(res => { this.setState({ loading: false diff --git a/src/templates/zshare/createinterface/index.jsx b/src/templates/zshare/createinterface/index.jsx index 4156e22..e9f01cf 100644 --- a/src/templates/zshare/createinterface/index.jsx +++ b/src/templates/zshare/createinterface/index.jsx @@ -262,7 +262,7 @@ new Promise(resolve => { // 鑾峰彇浜戠瀛樺偍杩囩▼淇℃伅 - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -558,7 +558,7 @@ _mainParam = fromJS(param).toJS() - return Api.getLocalConfig(param) + return Api.genericInterface(param) }).then(res => { if (res === false) return res diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 0e784c6..ef844cd 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -977,11 +977,14 @@ initVal: card.funcType || '', required: true, options: [{ - value: 'changeuser', - text: '鍒囨崲鐢ㄦ埛' - }, { value: 'print', text: '鏍囩鎵撳嵃' + }, { + value: 'refund', + text: '閫�娆�' + }, { + value: 'changeuser', + text: '鍒囨崲鐢ㄦ埛' }, { value: 'closetab', text: '鏍囩鍏抽棴' @@ -1203,7 +1206,7 @@ type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', - initVal: card.callbackType || (card.callbackFunc ? 'func' : 'script'), + initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), tooltip: '浣跨敤鍚庡彴鑴氭湰鎵ц鏃讹紝闇�瑕侀厤鍚堣鍒掍换鍔°��', required: true, options: [{ @@ -1624,6 +1627,9 @@ value: 'picture', text: Formdict['model.form.picture'] }, { + value: 'video', + text: '瑙嗛' + }, { value: 'link', text: Formdict['model.form.href'] }, { @@ -1712,6 +1718,26 @@ }] }, { + type: 'number', + key: 'startTime', + precision: 0, + label: '寮�濮嬫椂闂�', + initVal: card.startTime || 0, + tooltip: '瑙嗛寮�濮嬫挱鏀剧殑鏃堕棿锛岀敤浜庤皟鏁磋棰戝垵濮嬪寲灞曠ず鐨勭晫闈€��', + required: false + }, + { + type: 'select', + key: 'aspectRatio', + label: '闀垮姣�', + initVal: card.aspectRatio || '16:9', + required: true, + options: [ + { value: '4:3', text: '4:3' }, + { value: '16:9', text: '16:9' } + ] + }, + { type: 'radio', key: 'rowspan', label: '琛屽悎骞�', @@ -1762,10 +1788,10 @@ type: 'select', key: 'format', label: Formdict['header.form.format'], - initVal: card.format || '', + initVal: card.format || 'none', options: [{ - value: '', - text: Formdict['model.empty'] + value: 'none', + text: '鏃�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' @@ -1782,10 +1808,13 @@ type: 'select', key: 'textFormat', label: Formdict['header.form.format'], - initVal: card.textFormat || '', + initVal: card.textFormat || 'none', options: [{ - value: '', - text: Formdict['model.empty'] + value: 'none', + text: '鏃�' + }, { + value: 'encryption', + text: '鍔犲瘑' }, { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' @@ -1814,15 +1843,39 @@ }, { type: 'number', - key: 'maxHeight', + key: 'span', min: 1, - max: 1000, - decimal: 0, - label: '鏈�澶ч珮搴�', - tooltip: '鍥剧墖鍦ㄨ〃鏍间腑鏄剧ず鐨勬渶澶ч珮搴�', - tooltipClass: 'middle', - initVal: card.maxHeight || 128, + max: 24, + precision: 0, + label: '鍥剧墖瀹藉害', + initVal: card.span || 24, + tooltip: '鏍呮牸甯冨眬锛岀瓑鍒嗕负24浠姐��', required: true + }, + { + type: 'select', + key: 'lenWidRadio', + label: '闀垮姣�', + initVal: card.lenWidRadio || '1:1', + required: true, + options: [ + { value: '1:1', text: '1:1' }, + { value: '4:3', text: '4:3' }, + { value: '3:2', text: '3:2' }, + { value: '16:9', text: '16:9' }, + { value: '2:1', text: '2:1' }, + { value: '3:1', text: '3:1' }, + { value: '4:1', text: '4:1' }, + { value: '5:1', text: '5:1' }, + { value: '6:1', text: '6:1' }, + { value: '7:1', text: '7:1' }, + { value: '8:1', text: '8:1' }, + { value: '9:1', text: '9:1' }, + { value: '10:1', text: '10:1' }, + { value: '3:4', text: '3:4' }, + { value: '2:3', text: '2:3' }, + { value: '9:16', text: '9:16' }, + ] }, { type: 'radio', @@ -2378,6 +2431,9 @@ value: 'select', text: Formdict['model.form.select'] }, { + value: 'textarea', + text: '澶氳鏂囨湰' + }, { value: 'multiselect', text: Formdict['model.form.multiselect'] }, { @@ -2407,9 +2463,6 @@ // }, { // value: 'datetime', // text: '鏃ユ湡锛堝垎/绉掞級' - }, { - value: 'textarea', - text: Formdict['model.form.textarea'] }, { value: 'cascader', text: '绾ц仈鑿滃崟' @@ -3013,8 +3066,11 @@ value: 'letter', text: '瀛楁瘝' }, { + value: 'letter_number', + text: '鏁板瓧鎴栧瓧姣�' + }, { value: 'letter&number', - text: '鏁板瓧銆佸瓧姣嶄互鍙奯@_.' + text: '鏁板瓧銆佸瓧姣嶄互鍙夽_.' }, { value: 'phone', text: '鎵嬫満鍙�' @@ -3055,15 +3111,15 @@ }, { type: 'radio', - key: 'allowHalf', - label: '鍗婇��', - initVal: card.allowHalf || 'false', + key: 'hidden', + label: "闅愯棌", + initVal: card.hidden || 'false', options: [{ value: 'true', - text: '鏀寔' + text: Formdict['model.true'] }, { value: 'false', - text: '涓嶆敮鎸�' + text: Formdict['model.false'] }] }, { @@ -3082,21 +3138,8 @@ { type: 'radio', key: 'required', - label: Formdict['model.required'], + label: "蹇呭~", initVal: card.required || 'true', - options: [{ - value: 'true', - text: Formdict['model.true'] - }, { - value: 'false', - text: Formdict['model.false'] - }] - }, - { - type: 'radio', - key: 'hidden', - label: Formdict['model.hidden'], - initVal: card.hidden || 'false', options: [{ value: 'true', text: Formdict['model.true'] @@ -3153,14 +3196,14 @@ type: 'radio', key: 'readin', label: '鑷姩濉厖', - tooltip: '鏄惁灏嗚〃鏍奸�変腑鐨勬暟鎹嚜鍔ㄥ~鍏呭埌琛ㄥ崟锛堝瓧娈电浉鍚岋級', + tooltip: '灏嗚〃鏍奸�変腑鐨勬暟鎹嚜鍔ㄥ~鍏呭埌琛ㄥ崟涓�傛敞锛氬湪鎵归噺鎿嶄綔鏃讹紝濡傛兂瑕佹墍閫夎锛堝綋鍓嶅瓧娈碉級鍏ㄩ儴淇敼璇疯涓哄惁鎴栭琛屻��', initVal: card.readin || 'true', options: [{ value: 'true', - text: Formdict['model.true'] + text: '鏄�' }, { value: 'false', - text: Formdict['model.false'] + text: '鍚�' }, { value: 'top', text: '棣栬' @@ -3181,6 +3224,26 @@ }] }, { + type: 'radio', + key: 'allowHalf', + label: '鍗婇��', + initVal: card.allowHalf || 'false', + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'color', + key: 'color', + label: '棰滆壊', + initVal: card.color || '#fadb14', + required: true + }, + { type: 'number', min: 1, max: 100, diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 08bcdb9..2b1a8e2 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -25,7 +25,7 @@ checkbox: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'arrange', 'marginTop', 'marginBottom'], radio: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'setAll', 'emptyText', 'splitline', 'arrange', 'marginTop', 'marginBottom'], checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'width', 'multiple', 'splitline', 'marginTop', 'marginBottom'], - multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'], + multiselect: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'dropdown'], link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'declare', 'setAll', 'linkField', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'], fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom'], switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'], @@ -35,7 +35,7 @@ textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom'], cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator'], color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'], - rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'rateCount', 'character', 'place'], + rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'color', 'rateCount', 'character', 'place'], hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'], split: ['label', 'type', 'marginTop', 'marginBottom', 'splitline'], formula: ['label', 'type', 'marginTop', 'marginBottom', 'splitline', 'span', 'labelwidth', 'formula', 'eval', 'postfix'], diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index 5159200..49dbd06 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -4,6 +4,7 @@ import { Form, Row, Col, Select, Radio, Tooltip, Input } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' +import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import './index.scss' @@ -20,17 +21,69 @@ state = { wxTemps: [], + selectTemp: null, miniTemps: [], } componentDidMount() { + const { verify } = this.props let wxTemps = sessionStorage.getItem('wxTemplates') - let miniTemps = sessionStorage.getItem('wxMiniTemplates') - wxTemps = wxTemps ? JSON.parse(wxTemps) : [] - miniTemps = miniTemps ? JSON.parse(miniTemps) : [] + if (window.GLOB.WXAppID && !wxTemps) { + Api.wxAccessToken().then(res => { + let wxtoken = res.oa_access_token || '' + // let minitoken = res.mini_access_token || '' + + if (wxtoken) { + Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { + let temps = [] + if (res.template_list) { + temps = res.template_list.filter(item => item.primary_industry) + let selectTemp = temps.filter(item => item.template_id === verify.wxTemplateId)[0] - this.setState({wxTemps, miniTemps}) + if (selectTemp) { + selectTemp.content = selectTemp.content.replace(/\r\n|\n/g, '<br/>') + selectTemp.example = selectTemp.example.replace(/\r\n|\n/g, '<br/>') + } + + this.setState({wxTemps: temps, selectTemp}) + } + + sessionStorage.setItem('wxTemplates', JSON.stringify(temps)) + localStorage.setItem('wxTemplates', JSON.stringify(temps)) + + localStorage.removeItem('wxTemplates') + }) + } else { + sessionStorage.setItem('wxTemplates', JSON.stringify([])) + localStorage.setItem('wxTemplates', JSON.stringify([])) + + localStorage.removeItem('wxTemplates') + } + // if (minitoken) { + // Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => { + // if (res.errmsg === 'ok' && res.data) { + // sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data)) + // } else { + // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) + // } + // }) + // } else { + // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) + // } + }) + } else if (wxTemps) { + wxTemps = JSON.parse(wxTemps) + + let selectTemp = wxTemps.filter(item => item.template_id === verify.wxTemplateId)[0] + + if (selectTemp) { + selectTemp.content = selectTemp.content.replace(/\r\n|\n/g, '<br/>') + selectTemp.example = selectTemp.example.replace(/\r\n|\n/g, '<br/>') + } + + this.setState({wxTemps, selectTemp}) + } } handleConfirm = () => { @@ -72,6 +125,10 @@ _verify.wxNoteLinkMenuId = '' _verify.wxNoteCallback = 'false' _verify.wxNoteKeys = null + + if (this.state.selectTemp) { + this.setState({selectTemp: null}) + } } this.props.onChange(_verify) @@ -89,6 +146,7 @@ const { verify } = this.props let _verify = {...verify, wxTemplateId: val} + let selectTemp = {content: option.props.content.replace(/\r\n|\n/g, '<br/>'), example: option.props.example.replace(/\r\n|\n/g, '<br/>')} let keys = [] if (option.props.content) { @@ -116,6 +174,8 @@ return item }) + + this.setState({selectTemp}) this.props.onChange(_verify) } @@ -150,7 +210,7 @@ render() { const { unionFields, verify, notes, card } = this.props - const { wxTemps } = this.state + const { wxTemps, selectTemp } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -295,7 +355,7 @@ <Form.Item label="娑堟伅妯℃澘" required> <Select value={verify.wxTemplateId} onSelect={this.onWxTemplateChange}> {wxTemps.map(option => - <Select.Option key={option.template_id} content={option.content} value={option.template_id}> + <Select.Option key={option.template_id} content={option.content} example={option.example} value={option.template_id}> {option.title} </Select.Option> )} @@ -336,7 +396,7 @@ </Col> : null} {verify.wxNoteLink === 'miniProgram' ? <Col span={8}> <Form.Item label={ - <Tooltip placement="bottomLeft" title={`璺宠浆鑷冲皬绋嬪簭鎸囧畾鑿滃崟锛岀┖鍊奸粯璁よ烦杞嚦灏忕▼搴忛椤点�俙}> + <Tooltip placement="top" title="娣诲姞鑿滃崟ID鍙烦杞嚦灏忕▼搴忔寚瀹氶〉闈紝绌哄�奸粯璁よ烦杞嚦灏忕▼搴忛椤点�傛敞锛氭暟鎹噷涓鏋滄湁bid瀛楁锛堝�间笉涓虹┖锛夛紝鎵撳紑灏忕▼搴忔椂浼氬仛涓築ID浼犲叆椤甸潰涓��"> <QuestionCircleOutlined className="mk-form-tip" /> 鑿滃崟ID </Tooltip> @@ -361,7 +421,31 @@ <ColorSketch value={item.color || '#ffffff'} onChange={(val, hex) => {this.onWxNoteColorChange(item.key, hex)}} /> </Form.Item> </Col>) : null} - + {selectTemp && verify.wxNoteKeys ? <Col span={24} className="wx-note"> + <div className="note-wrap"> + <div className="note"> + <p>鍐呭绀轰緥</p> + <div dangerouslySetInnerHTML={{ __html: selectTemp.example }}></div> + </div> + </div> + <div className="note-wrap"> + <div className="note"> + <p>妯℃澘淇℃伅</p> + <div dangerouslySetInnerHTML={{ __html: selectTemp.content }}></div> + </div> + </div> + <div className="note-wrap"> + <div className="note"> + <p>娑堟伅浣�</p> + <div> + <p>openid: "鎺ユ敹鑰卭penid",</p> + <p>send_id: "闃查噸鍏d",</p> + {verify.wxNoteKeys.map(item => <p>{item.value}: "=> {item.key}",</p>)} + <p>bid: "璺宠浆灏忕▼搴忔椂锛屽彲浣滀负BID銆�"</p> + </div> + </div> + </div> + </Col> : null} </Row> </Form> ) diff --git a/src/templates/zshare/verifycard/baseform/index.scss b/src/templates/zshare/verifycard/baseform/index.scss index 1d1830e..4cd6283 100644 --- a/src/templates/zshare/verifycard/baseform/index.scss +++ b/src/templates/zshare/verifycard/baseform/index.scss @@ -23,4 +23,31 @@ width: 75px; } } +} +.wx-note { + display: flex; + .note-wrap { + flex: 1; + + .note { + border: 1px solid #d9d9d9; + width: 270px; + margin: 0 auto; + border-radius: 4px; + height: 100%; + + >p { + text-align: center; + border-bottom: 1px solid #d9d9d9; + padding: 7px; + margin-bottom: 0px; + } + >div { + padding: 15px; + p { + margin-bottom: 0px; + } + } + } + } } \ No newline at end of file diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx index f14e1be..ce8b2f5 100644 --- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx +++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx @@ -155,7 +155,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx index 6ae1a37..1b96426 100644 --- a/src/templates/zshare/verifycard/customform/index.jsx +++ b/src/templates/zshare/verifycard/customform/index.jsx @@ -123,7 +123,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 2211b58..7b42a66 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -185,7 +185,7 @@ param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { this.setState({ loading: false, diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 9b40df1..a5a49eb 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -666,7 +666,7 @@ } }).then(_fields => { let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'] - let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(50)', '@mk_organization nvarchar(50)', '@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)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)'] + let _declare = ['@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)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)'] let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\''] let fieldArr = _usefulfields.map(_f => _f.toLowerCase()) let hasBid = false diff --git a/src/utils/option.js b/src/utils/option.js index 6e6bb25..2183750 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -57,6 +57,13 @@ isSystem: true }, // { + // title: '鍩虹琛ㄦ牸锛堟柊锛�', + // type: 'BaseTable', + // url: nortable, + // baseconfig: '', + // isSystem: true + // }, + // { // title: '涓诲瓙琛ㄨ〃鏍�', // type: 'CommonTable', // url: mainsubtable, diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 0b94159..5163438 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -58,6 +58,8 @@ 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 } @@ -114,7 +116,7 @@ let _customScript = '' if (setting.customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + _customScript = `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}' ${setting.customScript} ` @@ -215,7 +217,7 @@ ` } } else { - LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + LText = `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}' ${LText} ` @@ -261,6 +263,13 @@ if (window.GLOB.mkHS) { // 浜戠鏁版嵁楠岃瘉 param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + + // special HS鑷畾涔夊嚱鏁版煡璇� + if (setting.tableName === 's_custom_script' && options.cloudServiceApi) { + param.rduri = options.cloudServiceApi + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + } } return param @@ -302,7 +311,7 @@ } if (setting.customScript) { - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + _customScript = `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}' ${setting.customScript} ` @@ -377,7 +386,7 @@ insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ ` } else { - LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + LText = `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}' ${LText} ` @@ -480,7 +489,7 @@ if (sql) { sql = `/*鍓嶇疆鑴氭湰*/ - declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + 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}' ${sql} aaa: @@ -555,7 +564,7 @@ fullName = sessionStorage.getItem('CloudFullName') || '' } - let _prevCustomScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + let _prevCustomScript = `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}' ${errSql} ` @@ -755,7 +764,7 @@ userName = sessionStorage.getItem('CloudUserName') || '' fullName = sessionStorage.getItem('CloudFullName') || '' } - _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + _customScript = `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}' ${_customScript} ` diff --git a/src/utils/utils.js b/src/utils/utils.js index 3ceef58..06f55ca 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1096,7 +1096,7 @@ _sql = ` /* 绯荤粺鐢熸垚 */ declare @${sheet} table (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50) ) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) + Declare @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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) 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}' ${_initCustomScript} @@ -1131,7 +1131,7 @@ _sql = ` /* 绯荤粺鐢熸垚 */ declare @${sheet} table (jskey nvarchar(50)) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) + Declare @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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) 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}' ` @@ -1314,7 +1314,7 @@ _sql = ` /* 绯荤粺鐢熸垚 */ declare @${sheet} table (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(50) ) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) + Declare @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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) 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}' ${_initCustomScript} @@ -1349,7 +1349,7 @@ _sql = ` /* 绯荤粺鐢熸垚 */ declare @${sheet} table (jskey nvarchar(50)) - Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) + Declare @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),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512) 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}' ` @@ -1544,7 +1544,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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),@bid nvarchar(50)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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),@bid nvarchar(50)${_declarefields} ` let userName = sessionStorage.getItem('User_Name') || '' diff --git a/src/views/appcheck/index.jsx b/src/views/appcheck/index.jsx index 7317ebb..1023652 100644 --- a/src/views/appcheck/index.jsx +++ b/src/views/appcheck/index.jsx @@ -67,13 +67,15 @@ func: 's_get_kei' } - param.rduri = window.GLOB.mainSystemApi + if (window.GLOB.mainSystemApi) { + param.rduri = window.GLOB.mainSystemApi + } this.setState({ loading: true }) - Api.getLocalConfig(param).then(result => { + Api.genericInterface(param).then(result => { if (result.status) { let selectApp = null let applist = result.data.map(item => { diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index 7e3734a..a39380c 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -1225,7 +1225,7 @@ </Modal> <Modal title={'娣诲姞鑴氭湰'} - width={750} + width={900} maskClosable={false} visible={scriptVisible} onCancel={() => this.setState({scriptVisible: false, confirmloading: false})} diff --git a/src/views/appmanage/scriptform/index.jsx b/src/views/appmanage/scriptform/index.jsx index 67c6224..5bc53d2 100644 --- a/src/views/appmanage/scriptform/index.jsx +++ b/src/views/appmanage/scriptform/index.jsx @@ -151,11 +151,11 @@ const formItemLayout = { labelCol: { xs: { span: 24 }, - sm: { span: 8 } + sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, - sm: { span: 16 } + sm: { span: 18 } } } return ( @@ -226,10 +226,9 @@ message: '璇烽�夋嫨椤甸潰!' }] })( - <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 || - option.props.extra.toLowerCase().indexOf(input.toLowerCase()) >= 0}> + <Select showSearch dropdownMatchSelectWidth={false} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}> {views.map(item => { - return <Select.Option key={item.MenuID} extra={item.MenuNo || ''} value={item.MenuID}>{item.MenuName}</Select.Option> + return <Select.Option key={item.MenuID} value={item.MenuID}>{item.MenuName + ' ' + item.MenuNo}</Select.Option> })} </Select> )} diff --git a/src/views/appmanage/scriptform/index.scss b/src/views/appmanage/scriptform/index.scss index 74e8f0b..4520a20 100644 --- a/src/views/appmanage/scriptform/index.scss +++ b/src/views/appmanage/scriptform/index.scss @@ -3,10 +3,10 @@ .remark { .ant-form-item-label { - width: 16%; + width: 12%; } .ant-form-item-control-wrapper { - width: 84%; + width: 88%; } } } \ No newline at end of file diff --git a/src/views/basedesign/index.jsx b/src/views/basedesign/index.jsx index b742a63..807ea77 100644 --- a/src/views/basedesign/index.jsx +++ b/src/views/basedesign/index.jsx @@ -1,5 +1,4 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' import { notification, Spin, ConfigProvider } from 'antd' import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' @@ -22,17 +21,8 @@ sessionStorage.setItem('isEditState', 'true') class BaseDesign extends Component { - static propTpyes = { - menulist: PropTypes.any, // 涓夌骇鑿滃崟鍒楄〃 - exitEdit: PropTypes.func, // 閫�鍑虹紪杈戠姸鎬� - supMenu: PropTypes.object, // 瀵瑰簲鐨勪笂绾ц彍鍗� - supMenuList: PropTypes.array // 涓婄骇鑿滃崟鍒楄〃锛岀敤浜庝笁绾ц彍鍗曞垏鎹笂绾ц彍鍗� - } - state = { loading: false, // 缂栬緫鑿滃崟鎴栦娇鐢ㄥ凡浣跨敤妯℃澘鏃讹紝鑾峰彇閰嶇疆淇℃伅 - btnParam: null, // 缂栬緫鎸夐挳鐨勯厤缃俊鎭� - menulist: null, // 缂栬緫涓殑鑿滃崟 tabview: '', // 閫夋嫨妯℃澘绐楀彛锛坱emplate锛夈�佸熀纭�琛ㄦ牸閰嶇疆锛圕ommonTable锛夈�佽〃鍗曪紙Modal锛夈�佸瓙琛紙SubTable锛� editMenu: null, // 缂栬緫鑿滃崟 editAction: null, // 缂栬緫鎸夐挳 @@ -186,7 +176,6 @@ return ( <div className="mk-base-design-wrap"> <ConfigProvider locale={_locale}> - <Header/> {this.state.tabview === 'TreePage' ? <TreePageConfig diff --git a/src/views/basedesign/menuform/index.jsx b/src/views/basedesign/menuform/index.jsx deleted file mode 100644 index 5e09244..0000000 --- a/src/views/basedesign/menuform/index.jsx +++ /dev/null @@ -1,175 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select } from 'antd' -import './index.scss' - -const { TextArea } = Input - -class MainSearch extends Component { - static propTpyes = { - menu: PropTypes.object, // 鑿滃崟淇℃伅 - inputSubmit: PropTypes.func // 鍥炶溅鎻愪氦 - } - - state = { - supMenuList: [] - } - - UNSAFE_componentWillMount () { - this.setState({ - supMenuList: this.props.menu.supMenuList - }) - } - - changeMenu = (val) => { - const { menu } = this.state - - let submenu = menu.fstMenuList.filter(item => item.MenuID === val)[0] - - if (submenu) { - this.setState({ - supMenuList: submenu.children - }, () => { - this.props.form.setFieldsValue({ParentID: submenu.children[0] ? submenu.children[0].MenuID : ''}) - }) - } else { - this.setState({ - supMenuList: [] - }, () => { - this.props.form.setFieldsValue({ParentID: ''}) - }) - } - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - onEnterSubmit = (e) => { - // 琛ㄥ崟鍥炶溅鎻愪氦 - if (e.key !== 'Enter') return - - this.props.inputSubmit && this.props.inputSubmit() - } - - render() { - const { getFieldDecorator } = this.props.form - const { menu } = this.state - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 16 } - } - } - - return ( - <Form {...formItemLayout} style={{paddingRight: '20px'}} onKeyDown={this.onEnterSubmit}> - <Row gutter={24}> - <Col span={22}> - <Form.Item label={'涓�绾ц彍鍗�'}> - {getFieldDecorator('fstMenuId', { - initialValue: menu.fstMenuId, - rules: [ - { - required: true, - message: '璇烽�夋嫨涓婄骇鑿滃崟!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - onChange={this.changeMenu} - > - {menu.fstMenuList.map(option => - <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - <Col span={22}> - <Form.Item label={'浜岀骇鑿滃崟'}> - {getFieldDecorator('ParentID', { - initialValue: menu.ParentId, - rules: [ - { - required: true, - message: '璇烽�夋嫨涓婄骇鑿滃崟!' - } - ] - })( - <Select - showSearch - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - > - {menu.supMenuList.map(option => - <Select.Option key={option.MenuID} value={option.MenuID}>{option.text || option.MenuName}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - <Col span={22}> - <Form.Item label={'鑿滃崟鍚嶇О'}> - {getFieldDecorator('MenuName', { - initialValue: menu.MenuName || '', - rules: [ - { - required: true, - message: '璇疯緭鍏ヨ彍鍗曞悕绉�!' - } - ] - })(<Input placeholder="" autoFocus autoComplete="off" />)} - </Form.Item> - </Col> - <Col span={22}> - <Form.Item label={'鑿滃崟鍙傛暟'}> - {getFieldDecorator('MenuNo', { - initialValue: menu.MenuNo || '', - rules: [ - { - required: true, - message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!' - } - ] - })(<Input placeholder="" autoComplete="off" />)} - </Form.Item> - </Col> - {menu.Template === 'NewPage' ? <Col span={22}> - <Form.Item label={'閾炬帴鍦板潃'}> - {getFieldDecorator('url', { - initialValue: menu.url || '', - rules: [ - { - required: true, - message: '璇疯緭鍏ラ〉闈㈠湴鍧�!' - }, - { - max: 1024, - message: '鍦板潃鏈�闀夸负1024涓瓧绗�!' - } - ] - })(<TextArea rows={2} />)} - </Form.Item> - </Col> : null} - </Row> - </Form> - ) - } -} - -export default Form.create()(MainSearch) \ No newline at end of file diff --git a/src/views/basedesign/menuform/index.scss b/src/views/basedesign/menuform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/views/basedesign/menuform/index.scss +++ /dev/null diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index a571e21..3b63525 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -150,7 +150,7 @@ _param.rduri = window.GLOB.mainSystemApi } - Api.getLocalConfig(_param).then(result => { + Api.genericInterface(_param).then(result => { if (result.status) { let config = '' @@ -457,7 +457,7 @@ let _script = item.script if (index === 0) { - _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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) + _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}' ${_script} ` @@ -501,7 +501,7 @@ let componentId = item.componentId delete item.componentId return new Promise(resolve => { - Api.getLocalConfig(item).then(res => { + Api.genericInterface(item).then(res => { if (!res.status) { notification.warning({ top: 92, diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index cef0467..01a85fd 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -3,6 +3,7 @@ import {connect} from 'react-redux' import { Dropdown, Menu, Modal, notification, Switch, Button, Popover } from 'antd' import { MenuFoldOutlined, SettingOutlined, AppstoreOutlined, DownOutlined, HomeOutlined, ApiOutlined, PlusOutlined, EditOutlined, MenuOutlined } from '@ant-design/icons' +import moment from 'moment' import asyncComponent from '@/utils/asyncComponent' import { @@ -61,8 +62,12 @@ async loadmenu () { // 鑾峰彇涓昏彍鍗� - let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'} - _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' + let _param = { + func: 's_get_pc_menus', + systemType: options.sysType, + pro_sys: window.GLOB.systemType === 'production' ? 'Y' : '', + debug: 'Y' + } let result = await Api.getSystemConfig(_param) @@ -99,7 +104,6 @@ } getMenulist = (result) => { - let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt'] let menulist = [] let thdMenuList = [] result.fst_menu && result.fst_menu.forEach(fst => { @@ -150,23 +154,17 @@ level: 'third' } - if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { - trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') - trdItem.forbidden = true - } else { - try { - trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} - } catch (e) { - trdItem.PageParam = {OpenType: 'newtab'} - } + try { + trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} trdItem.type = trdItem.PageParam.Template || trdItem.type - trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType + trdItem.OpenType = trdItem.PageParam.OpenType + } catch (e) { + trdItem.PageParam = {OpenType: 'newtab'} + } - if (trdItem.type === 'CustomPage' && this.state.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄� - trdItem.forbidden = true - } + if (trdItem.type === 'CustomPage' && this.state.memberLevel < 20) { // 浼氬憳绛夌骇澶т簬绛変簬20鏃讹紝鏈夌紪杈戞潈闄� + trdItem.forbidden = true } thdMenuList.push(trdItem) @@ -207,7 +205,6 @@ this.props.modifyMainMenu(this.state.menulist[0] || null) } - addMemuSubmit = () => { // 鏂板缓鑿滃崟锛氭彁浜� this.addMenuFormRef.handleConfirm().then(param => { @@ -238,6 +235,106 @@ }) }, () => {}) } + + setSystemFuncs = () => { + if (!window.GLOB.WebSql && !window.GLOB.IndexDB) { + return + } + this.getfuncTime().then(res => { + Api.getSystemFuncs(res.createDate).then(result => { + if (!result.status) { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } else if (result.func_detail && result.func_detail.length > 0) { + this.writeFuncs(result.func_detail) + } + }) + }) + } + + writeFuncs = (funcs) => { + let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + + let sys_datetime = sessionStorage.getItem('sys_datetime') + let app_datetime = sessionStorage.getItem('app_datetime') + if (sys_datetime && app_datetime) { + let seconds = Math.floor((new Date().getTime() - app_datetime) / 1000) + timestamp = moment(sys_datetime, 'YYYY-MM-DD HH:mm:ss').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss') + } + + if (window.GLOB.WebSql) { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql('DELETE FROM FUNCS') + + funcs.forEach(item => { + if (!item.key_sql) return + tx.executeSql('INSERT INTO FUNCS (func_code, key_sql) VALUES (?, ?)', [item.func_code, item.key_sql]) + }) + tx.executeSql(`UPDATE VERSIONS SET createDate='${timestamp}' where CDefine1='funcs'`) + }) + } else { + let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') + + objectStore.clear() + + funcs.forEach(item => { + if (!item.key_sql) return + item.id = item.func_code + objectStore.add(item) + }) + + let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) + } + } + + getfuncTime = () => { + return new Promise((resolve, reject) => { + if (window.GLOB.WebSql) { + window.GLOB.WebSql.transaction(tx => { + tx.executeSql("SELECT * FROM VERSIONS where CDefine1='funcs'", [], (tx, results) => { + let rows = results.rows + if (rows.length === 0) { + tx.executeSql('DELETE FROM FUNCS') + tx.executeSql('INSERT INTO VERSIONS (version, createDate, CDefine1) VALUES (?, ?, ?)', ['1.0', '1970-01-01 14:59:09.000', 'funcs']) + resolve({createDate: '1970-01-01 14:59:09.000'}) + } else { + resolve(rows[0]) + } + }, (tx, results) => { + reject() + console.warn(results) + }) + }) + } else { + let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + let request = objectStore.get('funcs') + + request.onerror = (event) => { + console.warn(event) + reject() + } + + request.onsuccess = () => { + if (request.result) { + resolve(request.result) + } else { + let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + + add.onerror = () => { + reject() + } + add.onsuccess = () => { + resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + } + } + } + } + }) + } UNSAFE_componentWillMount () { sessionStorage.setItem('isEditState', 'true') @@ -248,6 +345,17 @@ } componentDidMount () { + window.addEventListener('storage', (e) => { + if (e.key === 'menuUpdate') { + this.reload() + } else if (e.key === 'wxTemplates') { + if (e.newValue) { + sessionStorage.setItem('wxTemplates', e.newValue) + } + } + }) + MKEmitter.addListener('mkUpdateMenuList', this.reload) + if (window.GLOB.systemType !== 'production') { setTimeout(() => { Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { @@ -278,15 +386,12 @@ sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) } }) - }, 50) + }, 100) + + setTimeout(() => { + this.setSystemFuncs() + }, 200) } - - window.addEventListener('storage', (e) => { - if (e.key !== 'menuUpdate') return - - this.reload() - }) - MKEmitter.addListener('mkUpdateMenuList', this.reload) } /** diff --git a/src/views/design/header/versions/index.jsx b/src/views/design/header/versions/index.jsx index b2883da..806b3ac 100644 --- a/src/views/design/header/versions/index.jsx +++ b/src/views/design/header/versions/index.jsx @@ -116,7 +116,7 @@ res.func = 's_sVersion_Local_add' res.VersionName = version.id - Api.getLocalConfig(res).then(result => { + Api.genericInterface(res).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -151,7 +151,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) param.DateCount = '' - Api.getLocalConfig(param).then(response => { + Api.genericInterface(param).then(response => { if (!response.status) { notification.warning({ top: 92, @@ -232,7 +232,7 @@ } execSso = (ssoParam, scripts) => { - Api.getLocalConfig(ssoParam).then(res => { + Api.genericInterface(ssoParam).then(res => { if (!res.status) { notification.warning({ top: 92, @@ -260,7 +260,7 @@ } execLocal = (localParam, ssoParam, scripts) => { - Api.getLocalConfig(localParam).then(res => { + Api.genericInterface(localParam).then(res => { if (!res.status) { notification.warning({ top: 92, @@ -327,7 +327,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) - Api.getLocalConfig(param).then(response => { + Api.genericInterface(param).then(response => { if (!response.status) { notification.warning({ top: 92, diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index 2356a2a..8942896 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -3,7 +3,6 @@ import enUS from 'antd/es/locale/en_US' import zhCN from 'antd/es/locale/zh_CN' -import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import Header from './header' import { setGLOBFuncs } from '@/utils/utils.js' @@ -17,38 +16,6 @@ class Design extends Component { componentDidMount() { setGLOBFuncs() - - // 鑾峰彇寰俊鍏紬鍙峰強灏忕▼搴忔秷鎭ā鏉� - if (window.GLOB.systemType !== 'production' && window.GLOB.WXAppID && !sessionStorage.getItem('wxTemplates')) { - Api.wxAccessToken().then(res => { - let wxtoken = res.oa_access_token || '' - // let minitoken = res.mini_access_token || '' - - if (wxtoken) { - Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { - if (res.template_list) { - let temps = res.template_list.filter(item => item.primary_industry) - sessionStorage.setItem('wxTemplates', JSON.stringify(temps)) - } else if (res.errcode === 0) { - sessionStorage.setItem('wxTemplates', JSON.stringify([])) - } - }) - } else { - sessionStorage.setItem('wxTemplates', JSON.stringify([])) - } - // if (minitoken) { - // Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => { - // if (res.errmsg === 'ok' && res.data) { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data)) - // } else { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) - // } - // }) - // } else { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) - // } - }) - } } render () { diff --git a/src/views/design/sidemenu/editthdmenu/index.jsx b/src/views/design/sidemenu/editthdmenu/index.jsx index 82c9b25..8d12124 100644 --- a/src/views/design/sidemenu/editthdmenu/index.jsx +++ b/src/views/design/sidemenu/editthdmenu/index.jsx @@ -114,6 +114,11 @@ let _param = window.btoa(window.encodeURIComponent(JSON.stringify(_menu))) window.open(`#/basedesign/${_param}`) + } else if (_menu.PageParam.Template === 'BaseTable') { + sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) + let _param = window.btoa(window.encodeURIComponent(JSON.stringify(_menu))) + + window.open(`#/tabledesign/${_param}`) } else if (_menu.PageParam.Template === 'CustomPage') { let _param = { MenuType: 'custom', diff --git a/src/views/design/sidemenu/index.jsx b/src/views/design/sidemenu/index.jsx index 4c68f48..c5c76ff 100644 --- a/src/views/design/sidemenu/index.jsx +++ b/src/views/design/sidemenu/index.jsx @@ -46,8 +46,15 @@ menu = fromJS(menu).toJS() let openKey = '' - if (menu.children[0]) { - openKey = menu.openId || menu.children[0].MenuID + // 鑿滃崟鏇存柊鏃讹紝灞曞紑鍘熶簩绾ц彍鍗� + if (this.props.mainMenu && menu.MenuID === this.props.mainMenu.MenuID && this.state.openKeys && this.state.openKeys[0]) { + openKey = this.state.openKeys[0] + if (menu.children.filter(m => m.MenuID === openKey).length === 0) { + openKey = '' + } + } + if (!openKey && menu.children[0]) { + openKey = menu.children[0].MenuID } this.setState({ @@ -117,6 +124,11 @@ let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) window.open(`#/basedesign/${_param}`) + } else if (cell.type === 'BaseTable') { + sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree)) + let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell))) + + window.open(`#/tabledesign/${_param}`) } else if (['RolePermission', 'NewPage'].includes(cell.type)) { let _cell = fromJS(cell).toJS() _cell.Template = _cell.PageParam.Template @@ -295,7 +307,7 @@ key={item.MenuID} title={ <span className={!editLevel && index === 0 ? 'edit-control' : ''}> - <MkIcon type={item.PageParam.Icon} /> + <MkIcon type={item.PageParam ? item.PageParam.Icon : 'folder'} /> <span>{item.MenuName}</span> </span> } diff --git a/src/views/design/sidemenu/thdmenuplus/index.jsx b/src/views/design/sidemenu/thdmenuplus/index.jsx index bbf051e..8d3ab63 100644 --- a/src/views/design/sidemenu/thdmenuplus/index.jsx +++ b/src/views/design/sidemenu/thdmenuplus/index.jsx @@ -70,6 +70,7 @@ _templates.push({ uuid: temp.MenuID, title: temp.MenuName, + MenuNo: temp.MenuNo, type: temp.Template, url: illust[temp.Template], disabled: temp.disabled || false, @@ -311,21 +312,23 @@ </Row> <Row> {this.state.usedTemplates.map((template, index) => { - if (!tempSearchKey || template.title.toLowerCase().indexOf(tempSearchKey.toLowerCase()) >= 0) { - return ( - <Col key={template.type + index} className={template.disabled ? 'disabled' : ''} title={template.disTitle || ''} span={6}> - <Card - title={template.title}> - <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> - <div className="card-operation"> - <Button type="primary" onClick={() => {this.useTemplate(template, 'user')}}>浣跨敤妯℃澘</Button> - </div> - </Card> - </Col> - ) - } else { - return null + if (tempSearchKey) { + if ((template.title + template.MenuNo).toLowerCase().indexOf(tempSearchKey.toLowerCase()) === -1) { + return null + } } + + return ( + <Col key={template.type + index} className={template.disabled ? 'disabled' : ''} title={template.disTitle || ''} span={6}> + <Card + title={template.title}> + <img onClick={() => {this.previewPicture(template)}} src={template.url} alt=""/> + <div className="card-operation"> + <Button type="primary" onClick={() => {this.useTemplate(template, 'user')}}>浣跨敤妯℃澘</Button> + </div> + </Card> + </Col> + ) })} </Row> </TabPane> diff --git a/src/views/imdesign/index.scss b/src/views/imdesign/index.scss index 2ad3e4b..8f951be 100644 --- a/src/views/imdesign/index.scss +++ b/src/views/imdesign/index.scss @@ -61,36 +61,6 @@ .ant-form-item { margin-bottom: 10px; } - .model-table-tablemanage-view { - >.ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - } - } - >.tables { - width: 66.66666667%!important; - } - >.ant-form-item-label { - width: 33.33333333%; - } - } } } diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index ef494ff..b4f267e 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -18,10 +18,6 @@ const iszhCN = sessionStorage.getItem('lang') !== 'en-US' const _href = window.location.href.split('#')[0] -if (localStorage.getItem(_href + 'paramsmain')) { - sessionStorage.setItem('history', localStorage.getItem(_href + 'paramsmain')) - localStorage.removeItem(_href + 'paramsmain') -} class Login extends Component { state = { @@ -643,7 +639,7 @@ // positecgroup // if (res.users_upt === 'true' && window.GLOB.systemType === 'production') { - // Api.getLocalConfig ({ + // Api.genericInterface ({ // func: 's_Get_local_u_deleted', // users_upt_date: res.users_upt_date, // userid: result.UserID, @@ -659,7 +655,7 @@ // LoginUID: result.LoginUID // }).then(ssores => { // if (!ssores.status) return - // Api.getLocalConfig ({ + // Api.genericInterface ({ // func: 's_get_local_u_create', // user_ids_local: ssores.user_ids_local, // userid: result.UserID, diff --git a/src/views/login/loginform.jsx b/src/views/login/loginform.jsx index 899f6d0..c3ccfd1 100644 --- a/src/views/login/loginform.jsx +++ b/src/views/login/loginform.jsx @@ -309,7 +309,7 @@ }) LoginVerCodeTimer = setTimeout(this.resetVerCodeDelay, 1000) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { } else { diff --git a/src/views/main/index.jsx b/src/views/main/index.jsx index 926696f..257b4b8 100644 --- a/src/views/main/index.jsx +++ b/src/views/main/index.jsx @@ -5,6 +5,7 @@ import asyncComponent from '@/utils/asyncComponent' import Header from '@/components/header' +import MKEmitter from '@/utils/events.js' import Sidemenu from '@/components/sidemenu' import QueryLog from '@/components/querylog' import ImgScale from '@/components/imgScale' @@ -20,6 +21,18 @@ navBar: window.GLOB.navBar } + componentDidMount () { + MKEmitter.addListener('resetSelectLine', this.resetParentParam) + } + + componentWillUnmount () { + MKEmitter.removeListener('resetSelectLine', this.resetParentParam) + } + + resetParentParam = (MenuID, id, data) => { + window.GLOB.CacheData.set(MenuID, {...data, $BID: id}) + } + render () { const { navBar } = this.state const isSideMenu = !['linkage_navigation', 'linkage', 'menu_board'].includes(navBar) diff --git a/src/views/mainparams/index.jsx b/src/views/mainparams/index.jsx new file mode 100644 index 0000000..ac337c6 --- /dev/null +++ b/src/views/mainparams/index.jsx @@ -0,0 +1,48 @@ +import React, {Component} from 'react' +import { Spin } from 'antd' + +import './index.scss' + +class MainParams extends Component { + componentDidMount() { + sessionStorage.setItem('ThirdMenu', this.props.match.params.menuId) + + if (sessionStorage.getItem('UserID')) { + this.props.history.replace('/main') + } else { + localStorage.setItem('getSessionStorage', window.GLOB.appkey) + + window.addEventListener('storage', function(event) { + if (event.key === 'sessionStorage' && event.newValue && !sessionStorage.getItem('UserID')) { + let values = event.newValue + values = JSON.parse(values) + + Object.keys(values).forEach(key => { + sessionStorage.setItem(key, values[key]) + }) + } + }) + + setTimeout(() => { + localStorage.removeItem('getSessionStorage') + localStorage.removeItem('sessionStorage') + + if (sessionStorage.getItem('UserID')) { + this.props.history.replace('/main') + } else { + this.props.history.replace('/login') + } + }, 20) + } + } + + render () { + return ( + <div className="main-params-login"> + <Spin size="large" /> + </div> + ) + } +} + +export default MainParams \ No newline at end of file diff --git a/src/views/mainparams/index.scss b/src/views/mainparams/index.scss new file mode 100644 index 0000000..d2a3dd5 --- /dev/null +++ b/src/views/mainparams/index.scss @@ -0,0 +1,7 @@ +.main-params-login { + .ant-spin { + position: absolute; + left: calc(50vw - 22px); + top: 45vh; + } +} \ No newline at end of file diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 4d65fa0..df6d527 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -1073,7 +1073,7 @@ return ( <ConfigProvider locale={_locale}> - <div className={'pc-menu-view ' + (MenuType || '')} id="mk-menu-design-view"> + <div className={'pc-menu-view ' + (MenuType || '')}> <Header /> <DndProvider backend={HTML5Backend}> <div className="menu-body"> diff --git a/src/views/menudesign/index.scss b/src/views/menudesign/index.scss index 1c3cc47..6e9f063 100644 --- a/src/views/menudesign/index.scss +++ b/src/views/menudesign/index.scss @@ -1,5 +1,6 @@ body { overflow-x: hidden; + overflow-y: hidden; } .pc-menu-view { background: #000; @@ -100,36 +101,6 @@ .ant-collapse-content-box { .ant-form-item { margin-bottom: 10px; - } - .model-table-tablemanage-view { - >.ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - } - } - >.tables { - width: 66.66666667%!important; - } - >.ant-form-item-label { - width: 33.33333333%; - } } } } @@ -248,7 +219,4 @@ background: transparent!important; border-radius: 0!important; } -} -body { - overflow-y: hidden; } \ No newline at end of file diff --git a/src/views/menudesign/menuform/index.jsx b/src/views/menudesign/menuform/index.jsx index 78f5593..05349bb 100644 --- a/src/views/menudesign/menuform/index.jsx +++ b/src/views/menudesign/menuform/index.jsx @@ -28,10 +28,7 @@ UNSAFE_componentWillMount () { const { MenuId, config } = this.props - let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'} - _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : '' - - Api.getSystemConfig(_param).then(result => { + Api.getSystemConfig({func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}).then(result => { if (result.status) { let thdMenu = null let thdMenuList = [] diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 5b6484a..15218a9 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -1323,9 +1323,8 @@ config.loginview = false config.tabview = false - if (config.permission !== 'true') { + if (roleParam.children.length === 0) { roleParam.pass = true - roleParam.children = [] } config.components.forEach(item => { diff --git a/src/views/mobdesign/index.scss b/src/views/mobdesign/index.scss index 273160d..0dfd9d5 100644 --- a/src/views/mobdesign/index.scss +++ b/src/views/mobdesign/index.scss @@ -108,36 +108,6 @@ .ant-form-item { margin-bottom: 10px; } - .model-table-tablemanage-view { - >.ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - } - } - >.tables { - width: 66.66666667%!important; - } - >.ant-form-item-label { - width: 33.33333333%; - } - } } } @@ -308,7 +278,7 @@ display: block; } } - .url-field-component, .model-table-tablemanage-view, .ant-typography { + .url-field-component, .model-tablename-manage-view, .ant-typography { display: none; } } diff --git a/src/views/mobdesign/menuform/index.jsx b/src/views/mobdesign/menuform/index.jsx index 13e2920..60d0442 100644 --- a/src/views/mobdesign/menuform/index.jsx +++ b/src/views/mobdesign/menuform/index.jsx @@ -30,23 +30,6 @@ } this.props.updateConfig(_config) - // if (key === 'cacheUseful') { - // this.props.updateConfig({...config, cacheUseful: value}) - // } else if (key === 'timeUnit') { - // this.props.updateConfig({...config, timeUnit: value}) - // } else if (key === 'advertUrl') { - // this.props.updateConfig({...config, advertUrl: value}) - // } else if (key === 'advertTime') { - // this.props.updateConfig({...config, advertTime: value}) - // } else if (key === 'pullRefresh') { - // this.props.updateConfig({...config, pullRefresh: value}) - // } else if (key === 'statusBarbgColor') { - // this.props.updateConfig({...config, statusBarbgColor: value}) - // } else if (key === 'permission') { - // this.props.updateConfig({...config, permission: value}) - // } else if (key === 'share') { - // this.props.updateConfig({...config, share: value}) - // } } // 鑿滃崟鍚嶇О @@ -130,7 +113,7 @@ )} </Form.Item> </Col> - <Col span={24}> + {/* <Col span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="璺宠繃鏉冮檺楠岃瘉鏃讹紝椤甸潰涓粍浠跺強鎸夐挳涓嶅湪杩涜鏉冮檺鎺у埗銆�"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -146,7 +129,7 @@ </Radio.Group> )} </Form.Item> - </Col> + </Col> */} <Col span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="浣跨敤鐧诲綍楠岃瘉鍚庯紝鐢ㄦ埛蹇呴』鐧诲綍绯荤粺鍚庢墠鍙互璁块棶锛屾敞锛氬惈鏈夌櫥褰曠粍浠剁殑椤甸潰涓棤鏁堛��"> diff --git a/src/views/pay/index.jsx b/src/views/pay/index.jsx index d4afd08..788a5c5 100644 --- a/src/views/pay/index.jsx +++ b/src/views/pay/index.jsx @@ -74,7 +74,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.status) { let _total = res.amount ? parseFloat(res.amount.total) : '' @@ -174,7 +174,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) - Api.getLocalConfig(param).then(res => { + Api.genericInterface(param).then(res => { if (res.pay_status) { this.setState({ overdone: true diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index c0f43de..8f0fe1c 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -1053,9 +1053,8 @@ nodes.login = true nodes.children = [] } - if (config.permission !== 'true') { + if (nodes.children.length === 0) { nodes.pass = true - nodes.children = [] } return nodes diff --git a/src/views/pcdesign/index.scss b/src/views/pcdesign/index.scss index 60a0d03..881e06c 100644 --- a/src/views/pcdesign/index.scss +++ b/src/views/pcdesign/index.scss @@ -113,36 +113,6 @@ .ant-form-item { margin-bottom: 10px; } - .model-table-tablemanage-view { - >.ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - } - } - >.tables { - width: 66.66666667%!important; - } - >.ant-form-item-label { - width: 33.33333333%; - } - } } } diff --git a/src/views/pcdesign/menuform/index.jsx b/src/views/pcdesign/menuform/index.jsx index 1439d02..8b16673 100644 --- a/src/views/pcdesign/menuform/index.jsx +++ b/src/views/pcdesign/menuform/index.jsx @@ -25,8 +25,8 @@ this.props.updateConfig({...config, cacheUseful: value}) } else if (key === 'timeUnit') { this.props.updateConfig({...config, timeUnit: value}) - } else if (key === 'permission') { - this.props.updateConfig({...config, permission: value}) + // } else if (key === 'permission') { + // this.props.updateConfig({...config, permission: value}) } } @@ -111,7 +111,7 @@ )} </Form.Item> </Col> - <Col span={24}> + {/* <Col span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="璺宠繃鏉冮檺楠岃瘉鏃讹紝椤甸潰涓粍浠跺強鎸夐挳涓嶅湪杩涜鏉冮檺鎺у埗銆�"> <QuestionCircleOutlined className="mk-form-tip" /> @@ -127,7 +127,7 @@ </Radio.Group> )} </Form.Item> - </Col> + </Col> */} <Col span={24}> <Form.Item label={ <Tooltip placement="topLeft" title="浣跨敤鐧诲綍楠岃瘉鍚庯紝鐢ㄦ埛蹇呴』鐧诲綍绯荤粺鍚庢墠鍙互璁块棶锛屾敞锛氬惈鏈夌櫥褰曠粍浠剁殑椤甸潰涓棤鏁堛��"> diff --git a/src/views/popdesign/index.scss b/src/views/popdesign/index.scss index 416bbb5..2d06a62 100644 --- a/src/views/popdesign/index.scss +++ b/src/views/popdesign/index.scss @@ -78,36 +78,6 @@ .ant-form-item { margin-bottom: 10px; } - .model-table-tablemanage-view { - >.ant-list { - margin-top: 20px; - .ant-list-item { - display: -webkit-box; - padding-right: 20px; - position: relative; - padding-left: 5px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - min-height: 55px; - width: 100%; - .anticon { - position: absolute; - top: 0px; - right: 0px; - padding: 3px 3px 10px 10px; - cursor: pointer; - } - } - } - >.tables { - width: 66.66666667%!important; - } - >.ant-form-item-label { - width: 33.33333333%; - } - } } } diff --git a/src/views/printTemplate/option.js b/src/views/printTemplate/option.js index 690ae65..24e4b88 100644 --- a/src/views/printTemplate/option.js +++ b/src/views/printTemplate/option.js @@ -134,6 +134,10 @@ { text: 'qrcode', value: 'qrcode' + }, + { + text: 'datamatrix', + value: 'datamatrix' } ] @@ -256,6 +260,14 @@ initval: config.height, min: 1, required: true + }, + { + type: 'select', + key: 'rotate', + label: '鏃嬭浆瑙掑害', + initval: config.rotate || 0, + required: false, + options: Rotate } ] } @@ -412,14 +424,14 @@ required: false, options: Fontfamily }, - { - type: 'select', - key: 'rotate', - label: '鏃嬭浆瑙掑害', - initval: item.rotate, - required: false, - options: Rotate - }, + // { + // type: 'select', + // key: 'rotate', + // label: '鏃嬭浆瑙掑害', + // initval: item.rotate, + // required: false, + // options: Rotate + // }, { type: 'number', key: 'borderSize', @@ -543,14 +555,14 @@ precision: 0, required: true }, - { - type: 'select', - key: 'rotate', - label: '鏃嬭浆瑙掑害', - initval: item.rotate, - required: false, - options: Rotate - }, + // { + // type: 'select', + // key: 'rotate', + // label: '鏃嬭浆瑙掑害', + // initval: item.rotate, + // required: false, + // options: Rotate + // }, { type: 'number', key: 'borderSize', @@ -706,14 +718,14 @@ precision: 0, required: true }, - { - type: 'select', - key: 'rotate', - label: '鏃嬭浆瑙掑害', - initval: item.rotate, - required: false, - options: Rotate - }, + // { + // type: 'select', + // key: 'rotate', + // label: '鏃嬭浆瑙掑害', + // initval: item.rotate, + // required: false, + // options: Rotate + // }, { type: 'number', key: 'borderSize', @@ -853,14 +865,14 @@ precision: 0, required: true }, - { - type: 'select', - key: 'rotate', - label: '鏃嬭浆瑙掑害', - initval: item.rotate, - required: false, - options: Rotate - }, + // { + // type: 'select', + // key: 'rotate', + // label: '鏃嬭浆瑙掑害', + // initval: item.rotate, + // required: false, + // options: Rotate + // }, { type: 'number', key: 'borderSize', diff --git a/src/views/printTemplate/print.js b/src/views/printTemplate/print.js index d6c75cb..7089c83 100644 --- a/src/views/printTemplate/print.js +++ b/src/views/printTemplate/print.js @@ -69,13 +69,13 @@ let textLineSpace = 5 // 缁樺埗鏃惰闂磋窛锛岄槻姝㈡枃瀛楅噸鍙� context.save() - if (element.rotate) { // 鍏冪礌鏃嬭浆鏃讹紝璁剧疆鐢诲竷鏃嬭浆瑙掑害 - let _cx = element.left + element.width / 2 - let _cy = element.top + element.height / 2 - context.translate(_cx, _cy) // 绉诲姩鍘熺偣 - context.rotate(element.rotate * Math.PI / 180) - context.translate(-_cx, -_cy) // 鎭㈠鍘熺偣 - } + // if (element.rotate) { // 鍏冪礌鏃嬭浆鏃讹紝璁剧疆鐢诲竷鏃嬭浆瑙掑害 + // let _cx = element.left + element.width / 2 + // let _cy = element.top + element.height / 2 + // context.translate(_cx, _cy) // 绉诲姩鍘熺偣 + // context.rotate(element.rotate * Math.PI / 180) + // context.translate(-_cx, -_cy) // 鎭㈠鍘熺偣 + // } if (selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� context.shadowBlur = 5 diff --git a/src/views/systemfunc/index.jsx b/src/views/systemfunc/index.jsx index b52f35d..1a9abe7 100644 --- a/src/views/systemfunc/index.jsx +++ b/src/views/systemfunc/index.jsx @@ -16,6 +16,11 @@ UNSAFE_componentWillMount() { sessionStorage.setItem('isEditState', 'true') window.GLOB.mkHS = true + + Object.defineProperty(window, 'debugger', { + writable: false, + value: false + }) } render () { diff --git a/src/views/systemfunc/sidemenu/config.jsx b/src/views/systemfunc/sidemenu/config.jsx index 40e4bf2..f98e20f 100644 --- a/src/views/systemfunc/sidemenu/config.jsx +++ b/src/views/systemfunc/sidemenu/config.jsx @@ -5,30 +5,30 @@ PageParam: {Icon: 'folder'}, children: [{ src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1581067625930haged11ieaivpavv77k', MenuNo: 'sDatasM', MenuName: '鏁版嵁瀛楀吀', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1581734956310scks442ul2d955g9tu5', MenuNo: 'sVersionM', MenuName: '浼犺緭鍙风鐞�', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1583991994144ndddg0bhh0is6shi0v1', MenuNo: 'sVersionQueryM', MenuName: '浼犺緭鍙锋煡璇�', }, { src: '', systems: ['production', 'local', 'SSO', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'VerupTable'}, - type: 'VerupTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1583979633842550imkchl4qt4qppsiv', MenuNo: 'sVersionMUpgrade', MenuName: '鐗堟湰鍗囩骇', @@ -41,67 +41,67 @@ MenuName: '鏍囩椤电鐞�', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1578900109100np8aqd0a77q3na46oas', MenuNo: 'sPrintTemplateM', MenuName: '鏍囩鎵撳嵃妯℃澘', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '16044812935562g807p3p12huk8kokmb', MenuNo: 'sPrintTemplate_webM', MenuName: '鍗曟嵁鎵撳嵃妯℃澘', }, { src: '', systems: ['SSO', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1585192949946f3et2ts8tn82krmumdf', MenuNo: 'MyAppManage', MenuName: '绯荤粺UI', }, { src: '', systems: ['SSO', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '15855615451212m12ip23vpcm79kloro', MenuNo: 'sUsersAppM', MenuName: '绯荤粺鐢ㄦ埛绠$悊', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ScriptTable'}, - type: 'ScriptTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1587005717541lov40vg61q7l1rbveon', MenuNo: 's_custom_scriptM', MenuName: '鑷畾涔夊嚱鏁�', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1590458676585agbbr63t6ihighg2i1g', MenuNo: 'LdropdownmenuNewM', MenuName: '閫氱敤涓嬫媺鑿滃崟', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1602315375262ikd33ii0nii34pt861o', MenuNo: 's_worksflow_roleM', MenuName: '鍏抽敭瑙掕壊绠$悊', // }, { // src: '', - // PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - // type: 'ManageTable', + // PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + // type: 'CommonTable', // MenuID: '1606794243739c5ihs58lucpskp3r4s2', // MenuNo: 's_custom_componentsM', // MenuName: '鑷畾涔夌粍浠�', }, { src: '', systems: ['production', 'local'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '15827879285193g85m3i2uprektpgmpf', MenuNo: 'bd_mes_techM', MenuName: '宸ヨ壓涓绘暟鎹�', @@ -112,50 +112,50 @@ PageParam: {Icon: 'folder'}, children: [{ src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1582771068837vsv54a089lgp45migbg', MenuNo: 'KUNTitleM', MenuName: '鎺ュ彛涓绘暟鎹�', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1582777675954ifu05upurs465omoth7', MenuNo: 'KUNMainM', MenuName: '鏌ヨ鎺ュ彛', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '158294809668898cklbv6c5bou8e1fpu', MenuNo: 'KUNMainMOut_advanced', MenuName: '楂橀樁鏌ヨ', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1584676379094iktph45fb8imhg96bql', MenuNo: 'KUNMainM_Out_usual', MenuName: '閫氱敤鏌ヨ鎺ュ彛', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1584695125339vo5g7iqgfn01qmrd6s2', MenuNo: 'KUNMainM_In_usual', MenuName: '閫氱敤鍐欏叆鎺ュ彛', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1584699661372vhmpp9dn9foo0eob722', MenuNo: 'KUNMainM_In', MenuName: '鍐欏叆鎺ュ彛', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '15848421131551gg04ie8sitsd3f7467', MenuNo: 'KUNOsMainM', MenuName: '澶栭儴鎺ュ彛', @@ -166,29 +166,29 @@ PageParam: {Icon: 'folder'}, children: [{ src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1589782279158ngr675kk3oksin35sul', MenuNo: 'bd_msn_emailM', MenuName: '閭欢鏈嶅姟鍣�', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1589788042787ffdt9hle4s45k9r1nvs', MenuNo: 'bd_msn_email_tempM', MenuName: '閭欢妯℃澘', // }, { // src: '', - // PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - // type: 'ManageTable', + // PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + // type: 'CommonTable', // MenuID: '15900310928174dro07ihfckghpb5h13', // MenuNo: 'bd_msn_sms_tempM', // MenuName: '澶т簬鐭俊妯℃澘', // }, { // src: '', - // PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - // type: 'ManageTable', + // PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + // type: 'CommonTable', // MenuID: '1599613340050c8nu6rbst9d4emnnbsq', // MenuNo: 's_sms_qxM', // MenuName: '濂囦簯鐭俊妯℃澘', @@ -200,8 +200,8 @@ children: [{ src: '', systems: ['local', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1594095599055qicg2eb642v5qglhnuo', MenuNo: 's_weixin_pay_bdM', MenuName: '寰俊鏀粯', @@ -213,38 +213,38 @@ children: [{ src: '', systems: ['production', 'local', 'SSO', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1577972969199lei1g0qkvlh4tkc908m', MenuNo: 'sModularM', MenuName: '绯荤粺妯″潡', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1578479100252lfbp29v1kafk4s4q4ig', MenuNo: 'BDLanguagePacksM', MenuName: '璇█鍖�', }, { src: '', systems: ['production', 'local', 'SSO', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1577971621421tg4v0i1ur8873k7e0ob', MenuNo: 'sSystemParametersM', MenuName: '鎺ュ彛鍦板潃', }, { src: '', systems: ['production', 'local', 'SSO', 'cloud'], - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1577929944419lgc5h3hepum765e2k7u', MenuNo: 'sProcExcepM', MenuName: '鎶ラ敊鏃ュ織', }, { src: '', - PageParam: {OpenType: 'newtab', Template: 'ManageTable'}, - type: 'ManageTable', + PageParam: {OpenType: 'newtab', Template: 'CommonTable'}, + type: 'CommonTable', MenuID: '1588493493409k9guqp067d31lu7blsv', MenuNo: 's_job_stepM', MenuName: '璁″垝浠诲姟', diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx new file mode 100644 index 0000000..72f85d8 --- /dev/null +++ b/src/views/tabledesign/index.jsx @@ -0,0 +1,905 @@ +import React, { Component } from 'react' +import { DndProvider } from 'react-dnd' +import { withRouter } from 'react-router' +import { is, fromJS } from 'immutable' +import moment from 'moment' +import HTML5Backend from 'react-dnd-html5-backend' +import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography } from 'antd' +import { DoubleLeftOutlined, DoubleRightOutlined } from '@ant-design/icons' + +import Api from '@/api' +import Utils, { setGLOBFuncs } from '@/utils/utils.js' +import antdZhCN from 'antd/es/locale/zh_CN' +import MKEmitter from '@/utils/events.js' +import asyncComponent from '@/utils/asyncComponent' + +import './index.scss' + +const { Panel } = Collapse +const { confirm } = Modal +const { Paragraph } = Typography +const _locale = antdZhCN + +const MenuForm = asyncComponent(() => import('./menuform')) +const Header = asyncComponent(() => import('@/menu/header')) +const MenuShell = asyncComponent(() => import('@/menu/tableshell')) +const BgController = asyncComponent(() => import('@/pc/bgcontroller')) +const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) +const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const Versions = asyncComponent(() => import('@/menu/versions')) +const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) +const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent')) +const PictureController = asyncComponent(() => import('@/menu/picturecontroller')) +const ModalController = asyncComponent(() => import('@/menu/modalconfig/controller')) +const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent')) + +sessionStorage.setItem('isEditState', 'true') +sessionStorage.setItem('appType', '') // 搴旂敤绫诲瀷 +document.body.className = '' + +class TableDesign extends Component { + state = { + MenuId: '', + ParentId: '', + MenuName: '', + MenuNo: '', + activeKey: 'basedata', + menuloading: false, + oriConfig: null, + config: null, + customComponents: [], + comloading: false, + settingshow: true, + modalStatus: false // 寮圭獥鏄惁寮�鍚紝鍒ゆ柇ctrl+s鏄惁鍙敤 + } + + UNSAFE_componentWillMount() { + sessionStorage.setItem('editMenuType', 'menu') // 缂栬緫鑿滃崟绫诲瀷 + + window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� + window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 + window.GLOB.urlFields = [] // url鍙橀噺 + window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + + try { + let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + + this.setState({ + MenuId: param.MenuID, + ParentId: param.ParentId || '', + MenuName: param.MenuName || '', + MenuNo: param.MenuNo || '', + }, () => { + this.getMenuParam() + }) + } catch (e) { + notification.warning({ + top: 92, + message: '鑿滃崟淇℃伅瑙f瀽閿欒锛�', + duration: 5 + }) + } + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + componentDidMount () { + MKEmitter.addListener('modalStatus', this.modalStatus) + MKEmitter.addListener('changePopview', this.initPopview) + MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) + MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) + MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) + setTimeout(() => { + if (sessionStorage.getItem('app_custom_components')) { + let list = sessionStorage.getItem('app_custom_components') + list = JSON.parse(list) + + this.setCustomComponent(list) + } else { + this.updateCustomComponent() + } + this.getAppPictures() + this.getPrintTemp() + this.getRoleFields() + setGLOBFuncs() + }, 1000) + + 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') { + if (this.state.modalStatus) { + notification.warning({ + top: 92, + message: '璇蜂繚瀛�' + this.state.modalStatus, + duration: 5 + }) + return false + } + + let node = document.getElementById('save-modal-config') + if (!node) { + node = document.getElementById('save-config') + } + + if (node) { + node.click() + } + return false + } + } + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('modalStatus', this.modalStatus) + MKEmitter.removeListener('changePopview', this.initPopview) + MKEmitter.removeListener('triggerMenuSave', this.triggerMenuSave) + MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) + MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) + } + + modalStatus = (val) => { + this.setState({modalStatus: val}) + } + + triggerMenuSave = () => { + this.submitConfig() + } + + getPrintTemp = () => { + if (!sessionStorage.getItem('printTemps')) { + let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate + where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' + union select ID,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + on a.PrintTempNO=b.PrintTempNO + left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c + on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` + + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(_sql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + 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) { + let temps = res.data.map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + + sessionStorage.setItem('printTemps', JSON.stringify(temps)) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + }) + } + } + + getAppPictures = () => { + if (sessionStorage.getItem('app_videos') || sessionStorage.getItem('app_pictures')) return + + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'image', + type: 'search' + }).then(res => { + if (res.status) { + sessionStorage.setItem('app_pictures', JSON.stringify(res.data || [])) + } + + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'video', + type: 'search' + }).then(res => { + if (res.status) { + sessionStorage.setItem('app_videos', JSON.stringify(res.data || [])) + } + }) + Api.getSystemConfig({ + func: 's_url_db_adduptdel', + PageIndex: 0, // 0 浠h〃鍏ㄩ儴 + PageSize: 0, // 0 浠h〃鍏ㄩ儴 + typecharone: 'color', + type: 'search' + }).then(res => { + if (res.status) { + sessionStorage.setItem('app_colors', JSON.stringify(res.data || [])) + } + }) + }) + } + + updateCustomComponent = () => { + Api.getSystemConfig({ + func: 's_get_custom_components', + typename: '', + typecharone: '' + }).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } else if (res.cus_list) { + sessionStorage.setItem('app_custom_components', JSON.stringify(res.cus_list)) + this.setCustomComponent(res.cus_list) + } + }) + } + + setCustomComponent = (cus_list) => { + let coms = [] + + cus_list.forEach(item => { + let config = '' + + try { + config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param))) + } catch (e) { + console.warn('Parse Failure') + config = '' + } + + if (!config || !item.c_name) return + + window.GLOB.UserComponentMap.set(item.c_id, item.c_name) + coms.push({ + uuid: item.c_id, + type: 'menu', + title: item.c_name, + url: item.images, + component: config.type, + subtype: config.subtype, + config + }) + }) + this.setState({customComponents: coms}) + } + + updateComponentStyle = (parentId, keys, style) => { + const { config } = this.state + + if (config.uuid !== parentId) return + + let components = config.components.map(item => { + if (keys.includes(item.uuid)) { + item.style = {...item.style, ...style} + } + return item + }) + + this.setState({ + config: {...config, components}, + comloading: true + }, () => { + this.setState({ + comloading: false + }) + }) + } + + initPopview = (card, btn) => { + const { oriConfig, config } = this.state + + if (!is(fromJS(oriConfig), fromJS(config))) { + notification.warning({ + top: 92, + message: '閰嶇疆宸蹭慨鏀癸紝璇蜂繚瀛橈紒', + duration: 5 + }) + return + } + + let _btn = fromJS(btn).toJS() + _btn.MenuName = config.MenuName + '-' + card.name + '-' + btn.label + _btn.ParentMenuID = config.uuid + + this.props.history.push('/popdesign/' + window.btoa(window.encodeURIComponent((JSON.stringify(_btn))))) + } + + closeView = () => { + const { oriConfig, config } = this.state + + if (!config) { + window.close() + return + } + + if (!is(fromJS(oriConfig), fromJS(config))) { + confirm({ + title: '閰嶇疆宸蹭慨鏀癸紝鏀惧純淇濆瓨鍚楋紵', + content: '', + onOk() { + window.close() + }, + onCancel() {} + }) + } else { + window.close() + } + } + + getMenuParam = () => { + const { MenuId, ParentId, MenuName, MenuNo } = this.state + + let param = { + func: 'sPC_Get_LongParam', + MenuID: MenuId + } + + Api.getSystemConfig(param).then(result => { + if (result.status) { + let config = null + + try { + config = result.LongParam ? JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) : null + } catch (e) { + console.warn('Parse Failure') + config = null + } + + if (!config) { + config = { + version: 1.0, + uuid: MenuId, + MenuID: MenuId, + parentId: ParentId, + Template: 'BaseTable', + easyCode: '', + enabled: false, + MenuName: MenuName, + MenuNo: MenuNo, + tables: [], + components: [ + { + uuid: Utils.getuuid(), + type: 'table', + tabId: '', + parentId: '', + format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 + pageable: true, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� + switchable: true, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� + dataName: '', + width: 24, + search: [ + { origin: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text', match: 'like' }, + { origin: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'select', match: 'equal' } + ], + action: [ + { origin: true, uuid: Utils.getuuid(), label: '娣诲姞', intertype: 'system', OpenType: 'pop', execSuccess: 'grid', icon: 'plus', class: 'green', style: {color: 'rgb(255, 255, 255)', background: 'rgb(38, 194, 129)', marginRight: '15px'} }, + { origin: true, uuid: Utils.getuuid(), label: '淇敼', intertype: 'system', OpenType: 'pop', execSuccess: 'grid', icon: 'form', class: 'purple', style: {color: 'rgb(255, 255, 255)', background: 'rgb(142, 68, 173)', marginRight: '15px'} }, + { origin: true, uuid: Utils.getuuid(), label: '鍒犻櫎', intertype: 'system', OpenType: 'prompt', execSuccess: 'grid', Ot: 'required', icon: 'delete', class: 'danger', style: {color: 'rgb(255, 255, 255)', background: 'rgb(255, 77, 79)', marginRight: '15px'} } + ], + name: '涓昏〃', + subtype: 'basetable', + setting: { interType: 'system' }, + wrap: {}, + style: {}, + headerStyle: {}, + columns: [], + cols: [ + { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label1', field: '', Hide: 'false', type: 'text', Width: 120 }, + { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label2', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, + { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label3', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, + ], + scripts: [], + isNew: true + } + ], + viewType: 'menu', + style: { + backgroundColor: '#ffffff', backgroundImage: '', + paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px' + }, + } + } else { + config.uuid = MenuId + config.MenuID = MenuId + config.Template = 'BaseTable' + } + + config.open_edition = result.open_edition || '' + window.GLOB.urlFields = config.urlFields || [] + + this.setState({ + oriConfig: config, + config: fromJS(config).toJS() + }) + window.GLOB.customMenu = config + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + } + + getMenuMessage = (delButtons) => { + const { config } = this.state + let buttons = [] + let _sort = 1 + + let traversal = (components) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + traversal(tab.components) + }) + } else if (item.type === 'group') { + traversal(item.components) + } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { + item.action && item.action.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + card.backElements && card.backElements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } else if (item.type === 'carousel' || item.type === 'timeline') { + item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } else if (item.type === 'balcony') { + item.elements && item.elements.forEach(cell => { + if (cell.eleType !== 'button') return + if (cell.hidden === 'true') { + delButtons.push(cell.uuid) + return + } + buttons.push(`select '${cell.uuid}' as menuid, '${item.name + '-' + cell.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + } else if (item.type === 'line' || item.type === 'bar' || item.type === 'chart') { + item.action && item.action.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + } else if (item.type === 'table' && (item.subtype === 'normaltable' || item.subtype === 'editable')) { + item.action && item.action.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + item.cols && item.cols.forEach(col => { + if (col.type !== 'action') return + col.elements.forEach(btn => { + if (btn.hidden === 'true') { + delButtons.push(btn.uuid) + return + } + buttons.push(`select '${btn.uuid}' as menuid, '${item.name + '-' + btn.label}' as menuname, '${_sort * 10}' as Sort`) + _sort++ + }) + }) + } + }) + } + + traversal(config.components) + + return buttons + } + + submitConfig = () => { + let config = fromJS(this.state.config).toJS() + + if (!config.MenuName || !config.MenuNo || !config.fstMenuId || !config.parentId) { + notification.warning({ + top: 92, + message: '璇峰畬鍠勮彍鍗曞熀鏈俊鎭紒', + duration: 5 + }) + return + } + + this.setState({ + menuloading: true + }) + + setTimeout(() => { + if (config.enabled && this.verifyConfig()) { + config.enabled = false + } + + let param = { + func: 'sPC_TrdMenu_AddUpt', + FstID: config.fstMenuId || '', + SndID: config.parentId, + ParentID: config.parentId, + MenuID: config.uuid, + MenuNo: config.MenuNo || '', + EasyCode: config.easyCode || '', + Template: 'BaseTable', + MenuName: config.MenuName || '', + PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}), + LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))), + open_edition: config.open_edition, + LText: '', + LTexttb: '' + } + + param.LText = Utils.formatOptions(param.LText) + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + let btnParam = { // 娣诲姞鑿滃崟鎸夐挳 + func: 'sPC_Button_AddUpt', + Type: 40, // 娣诲姞鑿滃崟涓嬬殑鎸夐挳type涓�40锛屾寜閽笅鐨勬寜閽畉ype涓�60 + ParentID: config.uuid, + MenuNo: config.MenuNo, + Template: 'BaseTable', + PageParam: '', + LongParam: '', + LText: [] + } + + let delButtons = [] + + btnParam.LText = this.getMenuMessage(delButtons) + 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) + + new Promise(resolve => { + resolve(true) + }).then(res => { // 鎸夐挳鍒犻櫎 + if (delButtons.length === 0) { + return { + status: true + } + } else { + let _param = { + func: 'sPC_MainMenu_Del', + MenuID: delButtons.join(',') + } + return Api.getSystemConfig(_param) + } + }).then(res => { // 椤甸潰淇濆瓨 + if (!res) return + + if (res.status) { + return Api.getSystemConfig(param) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return false + } + }).then(res => { // 椤甸潰鎸夐挳鍏崇郴淇濆瓨 + if (!res) return + + if (res.status) { + let ori = this.state.oriConfig + if (config.MenuName !== ori.MenuName || config.MenuNo !== ori.MenuNo || config.parentId !== ori.parentId) { + localStorage.setItem('menuUpdate', new Date().getTime()) + } + config.open_edition = res.open_edition || '' + this.setState({ + config, + oriConfig: fromJS(config).toJS(), + }) + + if (btnParam.LText) { + return Api.getSystemConfig(btnParam) + } else { + return { + status: true + } + } + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return false + } + }).then(res => { // 鎸夐挳澶嶅埗 + if (!res) return + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + return false + } + }).then(res => { + if (res && res.status) { + this.setState({ + menuloading: false + }) + notification.success({ + top: 92, + message: '淇濆瓨鎴愬姛', + duration: 2 + }) + } else { + this.setState({ + menuloading: false + }) + } + MKEmitter.emit('completeSave') + }) + }, 300 + (+sessionStorage.getItem('mkDelay'))) + } + + getRoleFields = () => { + if (sessionStorage.getItem('sysRoles')) return + Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { + if (res.status) { + let _permFuncField = [] + let _sysRoles = [] + + if (res.Roles && res.Roles.length > 0) { + _sysRoles = res.Roles.map(role => { + return { + uuid: Utils.getuuid(), + value: role.RoleID, + text: role.RoleName + } + }) + } + + if (res.sModular && res.sModular.length > 0) { + res.sModular.forEach(field => { + if (field.ModularNo) { + _permFuncField.push(field.ModularNo) + } + }) + _permFuncField = _permFuncField.sort() + } + + sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles)) + sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField)) + } + }) + } + + onEnabledChange = () => { + const { config } = this.state + + if (!config || (!config.enabled && this.verifyConfig(true))) { + return + } + + this.setState({ + config: {...config, enabled: !config.enabled} + }) + } + + verifyConfig = (show) => { + const { config } = this.state + let error = '' + + let check = (components) => { + components.forEach(item => { + if (error) return + + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + check(tab.components) + }) + return + } else if (item.type === 'group') { + check(item.components) + return + } else if (!item.errors || item.errors.length === 0) { + return + } + + item.errors.forEach(err => { + if (err.level !== 0 || error) return + error = `缁勪欢銆�${item.name}銆�${err.detail}` + }) + }) + } + + check(config.components) + + if (show && error) { + notification.warning({ + top: 92, + message: error, + duration: 5 + }) + } + + return error + } + + // 鏇存柊閰嶇疆淇℃伅 + updateConfig = (config) => { + this.setState({ + config: config + }) + window.GLOB.customMenu = config + } + + resetConfig = (config) => { + this.setState({ + config, + comloading: true + }, () => { + this.setState({ + comloading: false + }) + }) + window.GLOB.customMenu = config + } + + insert = (item) => { + let config = fromJS(this.state.config).toJS() + + config.components.push(item) + + this.setState({config}) + window.GLOB.customMenu = config + + notification.success({ + top: 92, + message: '绮樿创鎴愬姛锛�', + duration: 2 + }) + } + + changeSetting = () => { + this.setState({settingshow: !this.state.settingshow}) + + setTimeout(() => { + MKEmitter.emit('tabsChange', 'all') + }, 400) + } + + render () { + const { activeKey, comloading, MenuId, config, settingshow, ParentId, menuloading } = this.state + + return ( + <ConfigProvider locale={_locale}> + <div className="pc-table-view"> + <Header /> + <DndProvider backend={HTML5Backend}> + <div className="menu-body"> + <div className={'menu-setting ' + (!settingshow ? 'hidden' : '')}> + <div className="draw"> + {settingshow ? <DoubleLeftOutlined onClick={this.changeSetting}/> : <DoubleRightOutlined onClick={this.changeSetting}/>} + </div> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + {/* 鍩烘湰淇℃伅 */} + <Panel header="鍩烘湰淇℃伅" key="basedata"> + {/* 鑿滃崟淇℃伅 */} + {config ? <MenuForm + config={config} + MenuId={MenuId} + parentId={ParentId} + MenuName={config.MenuName} + MenuNo={config.MenuNo} + updateConfig={this.updateConfig} + /> : null} + {config ? <UrlFieldComponent + config={config} + updateConfig={this.updateConfig} + /> : null} + {/* 琛ㄥ悕娣诲姞 */} + {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} + {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> : null} + </Panel> + <Panel header="椤甸潰鏍峰紡" key="background"> + {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} + </Panel> + </Collapse> + </div> + <div className={'menu-view' + (menuloading ? ' saving' : '')}> + <Card title={ + <div style={{paddingLeft: '15px'}}> {config && config.MenuName} </div> + } bordered={false} extra={ + <div> + <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> + <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> + <SysInterface config={config} updateConfig={this.updateConfig}/> + <PictureController/> + <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} /> + <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> + <Button type="default" onClick={this.closeView}>鍏抽棴</Button> + </div> + } style={{ width: '100%' }}> + {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} + </Card> + </div> + </div> + </DndProvider> + <StyleController /> + <ModalController /> + </div> + </ConfigProvider> + ) + } +} + +export default withRouter(TableDesign) \ No newline at end of file diff --git a/src/views/tabledesign/index.scss b/src/views/tabledesign/index.scss new file mode 100644 index 0000000..c022ade --- /dev/null +++ b/src/views/tabledesign/index.scss @@ -0,0 +1,211 @@ +body { + overflow-x: hidden; + overflow-y: hidden; +} +.pc-table-view { + background: #000; + min-height: 100vh; + .mk-hidden { + text-decoration: line-through!important; + span { + text-decoration: line-through!important; + } + } + .eye-open { + .component-name { + display: block; + } + .anticon-tool { + display: none; + } + } + .component-name { + position: absolute; + z-index: 9; + display: none; + left: 0; + right: 0; + top: 0; + bottom: 0; + background: rgba(255, 255, 255, 0.9); + border: 1px solid #1890ff; + .center { + position: absolute; + font-size: 16px; + left: 50%; + top: 50%; + color: #1890ff; + transform: translate(-50%, -50%); + max-width: 70%; + .title { + text-align: center; + } + } + .error { + text-align: center; + color: red; + display: block; + } + .waring { + color: orange; + } + } + >.menu-body { + width: 100vw; + height: 100vh; + overflow-x: hidden; + position: relative; + background: #ffffff; + padding: 50px 0px 0px 0px; + + .menu-setting { + position: fixed; + left: 0; + top: 48px; + z-index: 10; + height: calc(100vh - 48px); + width: 280px; + background: #ffffff; + box-shadow: 0px 2px 5px #bcbcbc; + transition: left 0.3s; + + .draw { + position: absolute; + z-index: 11; + background: #ffffff; + right: -20px; + top: 0px; + box-shadow: 0 0 1px #959595; + border-radius: 0 2px 2px 0px; + + .anticon { + padding: 12px 3px; + } + } + > .ant-collapse { + height: 100%; + overflow-y: auto; + overflow-x: hidden; + background-color: #ffffff; + border-radius: 0px; + padding-bottom: 30px; + .ant-collapse-item.ant-collapse-item-active { + border-bottom: 1px solid #d9d9d9; + } + .ant-collapse-header { + padding: 11px 16px 10px 40px; + border-bottom: 1px solid #d9d9d9; + background: #1890ff; + color: #ffffff; + } + .ant-collapse-content-box { + padding: 10px; + .ant-form-item { + margin-bottom: 10px; + } + } + } + + >.ant-tabs { + >.ant-tabs-bar { + border-bottom: 1px solid #181F29; + margin-bottom: 0px; + min-height: 48px; + .ant-tabs-tab { + padding: 14px 16px; + color: rgba(255, 255, 255, 0.85); + } + .ant-tabs-tab-active.ant-tabs-tab { + color: #1890ff; + } + } + } + } + .menu-setting >.ant-collapse::-webkit-scrollbar { + width: 4px; + } + .menu-setting >.ant-collapse::-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); + } + .menu-setting >.ant-collapse::-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); + } + + .menu-setting.hidden { + left: -300px; + } + .menu-setting.hidden + .menu-view { + width: 100vw; + margin-left: 0px; + } + + .menu-view { + position: relative; + width: calc(100vw - 280px); + margin-left: 280px; + height: calc(100vh - 50px); + overflow-y: auto; + transition: all 0.3s; + + > .ant-card { + >.ant-card-head { + margin-bottom: 0px; + position: relative; + .ant-card-head-title { + color: #1890ff; + padding: 5px 0; + } + .ant-card-extra { + padding: 5px 0; + button { + margin-left: 10px; + } + >div >div >button, .style-control-button { + padding: 0px 7px; + } + .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-body { + padding: 0px; + } + } + } + .menu-view.saving { + .anticon-tool { + display: none; + } + } + .menu-view::-webkit-scrollbar { + width: 7px; + } + .menu-view::-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); + } + .menu-view::-webkit-scrollbar-track { + box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0.07); + background: rgba(0, 0, 0, 0); + } + } +} \ No newline at end of file diff --git a/src/views/tabledesign/menuform/index.jsx b/src/views/tabledesign/menuform/index.jsx new file mode 100644 index 0000000..b779db1 --- /dev/null +++ b/src/views/tabledesign/menuform/index.jsx @@ -0,0 +1,338 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Input, Select, notification, Radio, Tooltip, Switch } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' + +import Api from '@/api' +import options from '@/store/options.js' +import './index.scss' + +const { TextArea } = Input + +class CustomMenuForm extends Component { + static propTpyes = { + config: PropTypes.object, + MenuId: PropTypes.string, + MenuName: PropTypes.string, + MenuNo: PropTypes.string, + parentId: PropTypes.string, + updateConfig: PropTypes.func + } + + state = { + fstMenuId: '', + menulist: [], + smenulist: [] + } + + UNSAFE_componentWillMount () { + const { MenuId, config } = this.props + Api.getSystemConfig({func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}).then(result => { + if (result.status) { + let thdMenu = null + let thdMenuList = [] + let menulist = result.fst_menu.map(fst => { + let fstItem = { + MenuID: fst.MenuID, + MenuName: fst.MenuName, + value: fst.MenuID, + label: fst.MenuName, + isLeaf: false, + children: [] + } + + if (fst.snd_menu) { + fstItem.children = fst.snd_menu.map(snd => { + let sndItem = { + ParentId: fst.MenuID, + MenuID: snd.MenuID, + MenuName: snd.MenuName, + value: snd.MenuID, + label: snd.MenuName, + children: [] + } + + if (snd.trd_menu) { + sndItem.children = snd.trd_menu.map(trd => { + let trdItem = { + FstId: fst.MenuID, + ParentId: snd.MenuID, + MenuID: trd.MenuID, + MenuName: trd.MenuName, + MenuNo: trd.MenuNo, + EasyCode: trd.EasyCode, + value: trd.MenuID, + label: trd.MenuName, + type: 'CommonTable', + // disabled: trd.MenuID === MenuId + disabled: false + } + + if (MenuId === trd.MenuID) { + thdMenu = trdItem + } + + if (trd.PageParam) { + try { + trd.PageParam = JSON.parse(trd.PageParam) + trdItem.type = trd.PageParam.Template || 'CommonTable' + } catch (e) { + + } + } + + thdMenuList.push(trdItem) + + return trdItem + }) + } + return sndItem + }) + } + return fstItem + }) + + let smenulist = [] + menulist.forEach(item => { + if (thdMenu && (item.MenuID === thdMenu.FstId)) { + smenulist = item.children + } + }) + sessionStorage.setItem('fstMenuList', JSON.stringify(menulist)) + sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList)) + this.props.updateConfig({...config, fstMenuId: thdMenu ? thdMenu.FstId : ''}) + + this.setState({ + fstMenuId: thdMenu ? thdMenu.FstId : '', + menulist, + smenulist + }, () => { + this.props.form.setFieldsValue({ + fstMenuId: thdMenu ? thdMenu.FstId : '', + parentId: thdMenu ? thdMenu.ParentId : '' + }) + }) + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + } + + // 涓�浜岀骇鑿滃崟鍒囨崲 + selectChange = (key, value) => { + const { config } = this.props + const { menulist } = this.state + + if (key === 'fstMenuId') { + let smenulist = [] + menulist.forEach(item => { + if (item.MenuID === value) { + smenulist = item.children + } + }) + + this.setState({ + smenulist + }, () => { + let _id = smenulist[0] ? smenulist[0].MenuID : '' + this.props.form.setFieldsValue({parentId: _id}) + this.props.updateConfig({...config, fstMenuId: value, parentId: _id}) + }) + } else if (key === 'parentId') { + this.props.updateConfig({...config, parentId: value}) + } else if (key === 'timeUnit') { + this.props.updateConfig({...config, timeUnit: value}) + } else if (key === 'OpenType') { + this.props.updateConfig({...config, OpenType: value}) + } else if (key === 'hidden') { + this.props.updateConfig({...config, hidden: value}) + } else if (key === 'permission') { + this.props.updateConfig({...config, permission: value}) + } + } + + // 鑿滃崟鍚嶇О + changeName = (e) => { + this.props.updateConfig({...this.props.config, MenuName: e.target.value}) + } + + // 鑿滃崟鍙傛暟 + changeNo = (e) => { + this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) + } + + // 鍔╄鐮� + changeEasyCode = (e) => { + this.props.updateConfig({...this.props.config, easyCode: e.target.value}) + } + + changeRemark = (e) => { + this.props.updateConfig({...this.props.config, Remark: e.target.value}) + } + + changeCacheDay = (val) => { + if (typeof(val) !== 'number') { + val = '' + } + this.props.updateConfig({...this.props.config, cacheTime: val}) + } + + render() { + const { MenuName, MenuNo, config } = this.props + const { menulist, smenulist } = this.state + const { getFieldDecorator } = this.props.form + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} className="custom-menu-form"> + <Row> + <Col span={24}> + <Form.Item label="涓�绾ц彍鍗�"> + {getFieldDecorator('fstMenuId', { + initialValue: '', + rules: [ + { + required: true, + message: '璇烽�夋嫨涓�绾ц彍鍗�!' + } + ] + })( + <Select onChange={(value) => {this.selectChange('fstMenuId', value)}}> + {menulist.map(option => + <Select.Option key={option.MenuID} value={option.MenuID}> + {option.MenuName} + </Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="浜岀骇鑿滃崟"> + {getFieldDecorator('parentId', { + initialValue: '', + rules: [ + { + required: true, + message: '璇烽�夋嫨浜岀骇鑿滃崟!' + } + ] + })( + <Select onChange={(value) => {this.selectChange('parentId', value)}}> + {smenulist.map(option => + <Select.Option key={option.MenuID} value={option.MenuID}> + {option.MenuName} + </Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鑿滃崟鍚嶇О"> + {getFieldDecorator('MenuName', { + initialValue: MenuName, + rules: [ + { + required: true, + message: '璇疯緭鍏ヨ彍鍗曞悕绉�!' + } + ] + })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鑿滃崟鍙傛暟"> + {getFieldDecorator('MenuNo', { + initialValue: MenuNo, + rules: [ + { + required: true, + message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!' + } + ] + })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鎵撳紑鏂瑰紡"> + {getFieldDecorator('OpenType', { + initialValue: config.OpenType || 'newtab', + rules: [ + { + required: true, + message: '璇烽�夋嫨鎵撳紑鏂瑰紡!' + } + ] + })( + <Radio.Group onChange={(e) => {this.selectChange('OpenType', e.target.value)}}> + <Radio value="newtab">鏍囩椤�</Radio> + <Radio value="newpage">鏂伴〉闈�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label={ + <Tooltip placement="topLeft" title="璺宠繃鏉冮檺楠岃瘉鏃讹紝椤甸潰涓粍浠跺強鎸夐挳涓嶅湪杩涜鏉冮檺鎺у埗銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鏉冮檺楠岃瘉 + </Tooltip> + }> + {getFieldDecorator('permission', { + initialValue: config.permission || 'true' + })( + <Radio.Group onChange={(e) => {this.selectChange('permission', e.target.value)}}> + <Radio value="true">浣跨敤</Radio> + <Radio value="false">涓嶄娇鐢�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label={'闅愯棌鑿滃崟'}> + <Switch checkedChildren={'鏄�'} checked={config.hidden === 'true'} unCheckedChildren={'鍚�'} onChange={(value) => { + this.selectChange('hidden', value + '') + }} /> + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="鍔╄鐮�"> + {getFieldDecorator('easyCode', { + initialValue: config.easyCode + })(<Input placeholder="" autoComplete="off" onChange={this.changeEasyCode}/>)} + </Form.Item> + </Col> + <Col span={24}> + <Form.Item label="澶囨敞"> + {getFieldDecorator('Remark', { + initialValue: config.Remark || '', + rules: [ + { + max: 512, + message: '澶囨敞鏈�澶�512涓瓧绗︼紒' + } + ] + })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(CustomMenuForm) \ No newline at end of file diff --git a/src/views/tabledesign/menuform/index.scss b/src/views/tabledesign/menuform/index.scss new file mode 100644 index 0000000..fa61282 --- /dev/null +++ b/src/views/tabledesign/menuform/index.scss @@ -0,0 +1,8 @@ +.custom-menu-form { + .ant-form-item { + height: 50px; + .ant-form-explain { + font-size: 12px; + } + } +} \ No newline at end of file -- Gitblit v1.8.0