From f561deb896de5754d94d17447f3d87aedcbd3198 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 18 九月 2023 20:02:38 +0800 Subject: [PATCH] Merge branch 'positec' into bms --- src/menu/debug/index.scss | 9 src/templates/zshare/modalform/index.jsx | 2 src/menu/components/calendar/board/index.scss | 15 src/menu/picturecontroller/index.jsx | 4 src/mob/searchconfig/index.jsx | 22 src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx | 18 src/menu/components/share/pastebasetable/index.jsx | 4 src/menu/components/share/searchcomponent/index.jsx | 23 src/views/mkiframe/index.jsx | 4 src/templates/zshare/verifycard/customscript/index.jsx | 58 src/tabviews/custom/components/group/normal-group/index.scss | 12 src/menu/datasource/index.jsx | 14 src/tabviews/custom/popview/index.jsx | 7 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 40 src/tabviews/basetable/index.jsx | 6 src/templates/modalconfig/index.jsx | 24 src/menu/tablenodes/index.jsx | 4 src/tabviews/home/index.jsx | 2 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 24 src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 61 - src/mob/modalconfig/index.jsx | 24 src/tabviews/commontable/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 94 - src/menu/components/table/edit-table/columns/editColumn/index.jsx | 29 src/menu/header/index.jsx | 19 src/views/tabledesign/index.scss | 4 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 122 ++ src/views/menudesign/index.jsx | 6 src/menu/datasource/verifycard/index.jsx | 131 ++- src/menu/components/card/double-data-card/options.jsx | 26 src/tabviews/custom/components/calendar/board/index.scss | 15 src/menu/components/form/tab-form/index.jsx | 25 src/menu/components/share/actioncomponent/formconfig.jsx | 4 src/tabviews/custom/components/chart/antv-pie/index.jsx | 11 src/menu/pastecontroller/index.jsx | 4 src/menu/header/index.scss | 51 - src/menu/versions/index.jsx | 4 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 17 src/tabviews/custom/components/chart/antv-X6/index.jsx | 17 src/tabviews/custom/components/carousel/prop-card/index.jsx | 2 src/tabviews/custom/index.jsx | 6 src/views/menudesign/index.scss | 4 src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx | 22 src/menu/debug/index.jsx | 203 +++++ src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx | 8 src/menu/components/group/normal-group/index.jsx | 1 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 13 src/menu/datasource/verifycard/utils.jsx | 57 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 24 src/tabviews/custom/components/card/double-data-card/index.scss | 28 src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx | 12 src/tabviews/custom/components/module/account/index.jsx | 24 src/components/header/index.jsx | 32 src/tabviews/zshare/topSearch/index.jsx | 4 src/tabviews/custom/components/card/double-data-card/index.jsx | 22 src/templates/zshare/verifycard/callbackcustomscript/index.jsx | 33 src/tabviews/custom/components/chart/antv-G6/index.jsx | 24 src/templates/zshare/unattended/index.jsx | 4 src/menu/datasource/verifycard/customscript/index.jsx | 31 src/tabviews/custom/components/card/cardItem/index.jsx | 37 src/templates/sharecomponent/searchcomponent/index.jsx | 23 src/menu/components/form/simple-form/index.jsx | 23 src/tabviews/custom/components/carousel/data-card/index.jsx | 2 src/views/tabledesign/index.jsx | 10 src/tabviews/custom/components/calendar/board/index.jsx | 20 src/templates/zshare/verifycard/customform/index.jsx | 31 src/api/index.js | 69 + src/views/mobdesign/index.scss | 2 src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx | 24 src/tabviews/custom/components/form/simple-form/index.jsx | 2 src/tabviews/subtable/index.jsx | 2 src/menu/sysinterface/index.jsx | 4 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 57 - src/menu/components/group/normal-group/index.scss | 8 src/utils/utils.js | 100 ++ src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 82 + src/index.js | 2 src/tabviews/custom/components/form/tab-form/index.jsx | 2 src/tabviews/custom/components/card/table-card/index.jsx | 27 src/tabviews/zshare/actionList/tabbutton/index.jsx | 17 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 16 src/menu/components/form/step-form/index.jsx | 23 src/tabviews/custom/components/carousel/cardItem/index.jsx | 35 src/templates/zshare/formconfig.jsx | 2 src/menu/datasource/verifycard/settingform/index.jsx | 5 src/templates/zshare/verifycard/index.jsx | 2 src/menu/replaceField/index.jsx | 4 src/menu/components/search/main-search/index.jsx | 22 src/tabviews/custom/components/form/step-form/index.jsx | 2 src/menu/modalconfig/index.jsx | 24 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx | 23 91 files changed, 1,147 insertions(+), 1,067 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index ace3093..8804daa 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1067,6 +1067,75 @@ data: qs.stringify(data) }) } + + /** + * @description sql妫�楠� + */ + sDebug (sql, rduri = null) { + let param = { + func: 's_debug_sql', + exec_type: 'y', + timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), + userid: sessionStorage.getItem('UserID') || '', + lang: sessionStorage.getItem('lang') || '', + SessionUid: localStorage.getItem('SessionUid') || '', + LoginUID: sessionStorage.getItem('LoginUID') || '', + appkey: window.GLOB.appkey || '' + } + + if (window.GLOB.externalDatabase !== null) { + sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) + } + + console.info(`/* sql 楠岃瘉 */\n${sql.replace(/\n\s{6,20}/ig, '\n')}`) + + sql = sql.replace(/\n/ig, ' ') + + param.LText = Utils.formatOptions(sql) + param.secretkey = Utils.encrypt('', param.timestamp) + + param = this.encryptParam(param) + + let url = '/webapi/dostars' + + if (rduri) { + url = rduri + } + + let timer = setTimeout(() => { + let _param = { + func: 's_debug_sql_cancel', + userid: sessionStorage.getItem('UserID') || '', + lang: sessionStorage.getItem('lang') || '', + SessionUid: localStorage.getItem('SessionUid') || '', + LoginUID: sessionStorage.getItem('LoginUID') || '', + appkey: window.GLOB.appkey || '' + } + _param = this.encryptParam(_param) + axios({ + url: `${url}/s_debug_sql_cancel`, + method: 'post', + data: JSON.stringify(_param) + }) + }, 20000) + + return new Promise(resolve => { + axios({ + url: `${url}/s_debug_sql`, + method: 'post', + data: JSON.stringify(param) + }).then(res => { + clearTimeout(timer) + if (/Shared Memory Provider|浼氳瘽澶勪簬缁堟鐘舵�亅褰撳墠鍛戒护鍙戠敓浜嗕弗閲嶉敊璇�/.test(res.message)) { + res.message = '楠岃瘉澶辫触锛岃妫�鏌QL涓槸鍚﹀瓨鍦ㄦ寰幆銆�' + } + resolve(res) + }, () => { + clearTimeout(timer) + resolve({status: false, ErrCode: 'E', message: '楠岃瘉澶辫触锛�1璇锋鏌QL涓槸鍚﹀瓨鍦ㄦ寰幆锛�2璇锋鏌ョ綉缁滆繛鎺ユ槸鍚︽甯搞��'}) + }) + }) + } } export default new Api() \ No newline at end of file diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 4ad3d8a..9269928 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -60,7 +60,7 @@ if (e.key === 'getSessionStorage' && e.newValue === window.GLOB.appkey) { localStorage.setItem('sessionStorage', JSON.stringify(sessionStorage)) } else if (e.key === 'getSysPermission' && e.newValue === window.GLOB.appkey) { - localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: window.GLOB.mkThdMenus, mkActions: window.GLOB.mkActions})) + localStorage.setItem('sysPermissions', JSON.stringify({mkThdMenus: this.state.thdMenuList, mkActions: window.GLOB.mkActions})) } else if (e.key === 'menuUpdate') { let vals = e.newValue.split(',') let menuId = vals[1] @@ -180,13 +180,22 @@ } window.GLOB.mainMenu = mainMenu - window.GLOB.mkThdMenus = [...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}] + + thdMenuList.forEach(item => { + window.GLOB.mkThdMenus.set(item.MenuID, item) + }) + + window.GLOB.mkThdMenus.set('home_page_id', {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}) MKEmitter.emit('mainMenuChange') if (_menu) { this.openTab(_menu, 0) } + + setTimeout(() => { + this.getwork() + }, 100) }) // 鑾峰彇瑙掕壊鏉冮檺, edition_type 鎺ュ彛鐗堟湰鎺у埗 ''銆�'Y'銆�'A' @@ -205,7 +214,7 @@ _permAction[menu.MenuID] = true }) } - } else { + } else if (!/PRIMARY KEY/ig.test(result.message)) { notification.error({ top: 92, message: result.message, @@ -218,6 +227,23 @@ }, 50) } + getwork = () => { + if (sessionStorage.getItem('work_grade')) return + + Api.genericInterface({func: 's_get_local_my_worker_v1'}).then(result => { + sessionStorage.setItem('work_grade', result.work_grade || 0) + sessionStorage.setItem('work_group', result.work_group || '') + + if (!result.status && sessionStorage.getItem('debug') === 'true') { + notification.error({ + top: 92, + message: /s_get_local_my_worker_v1/.test(result.message) ? '鑱屽憳淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛樸��' : result.message, + duration: 10 + }) + } + }) + } + openTab = (menu, times) => { if (times > 50) return times++ diff --git a/src/index.js b/src/index.js index 120b285..ca03d34 100644 --- a/src/index.js +++ b/src/index.js @@ -241,7 +241,6 @@ let lang = localStorage.getItem(_href + 'lang') || (config.defaultLang !== 'en-US' ? 'zh-CN' : 'en-US') sessionStorage.setItem('lang', lang) - GLOB.mkThdMenus = [] // 涓夌骇鑿滃崟 GLOB.mkActions = {} // 鎸夐挳鏉冮檺闆� Object.defineProperty(GLOB, 'appId', { @@ -309,6 +308,7 @@ window.GLOB.CacheData = new Map() // 瀛樺偍閫変腑鏁版嵁 window.GLOB.SearchBox = new Map() // 瀛樺偍鎼滅储鏉′欢 window.GLOB.SyncData = new Map() // 瀛樺偍鍚屾鏌ヨ鏁版嵁 + window.GLOB.mkThdMenus = new Map() // 涓夌骇鑿滃崟 render(Route) }) diff --git a/src/menu/components/calendar/board/index.scss b/src/menu/components/calendar/board/index.scss index a81b171..9758bdc 100644 --- a/src/menu/components/calendar/board/index.scss +++ b/src/menu/components/calendar/board/index.scss @@ -4,21 +4,6 @@ padding: 20px; color: rgba(0, 0, 0, 0.85); - .loading-data { - position: absolute; - top: 0; - left: 20px; - right: 20px; - bottom: 0; - z-index: 2; - opacity: 0.5; - background: #ffffff; - .ant-spin-spinning { - position: absolute; - left: 50%; - top: 270px; - } - } .mk-calendar-control { text-align: right; .ant-select { diff --git a/src/menu/components/card/double-data-card/options.jsx b/src/menu/components/card/double-data-card/options.jsx index dac4c9e..3bdc566 100644 --- a/src/menu/components/card/double-data-card/options.jsx +++ b/src/menu/components/card/double-data-card/options.jsx @@ -60,22 +60,6 @@ precision: 0, required: true }, - // { - // type: 'radio', - // field: 'layout', - // label: '鍗$墖甯冨眬', - // initval: wrap.layout || 'grid', - // tooltip: appType === 'mob' ? '寮规�у竷灞�鏃讹紝婊戝姩鍔犺浇鏃犳晥' : '', - // required: false, - // options: [ - // {value: 'grid', label: '鏍呮牸甯冨眬'}, - // {value: 'flex', label: '寮规�у竷灞�'}, - // ], - // controlFields: [ - // {field: 'printHeight', values: ['flex']}, - // {field: 'cardFloat', values: ['grid']}, - // ] - // }, { type: 'radio', field: 'pagestyle', @@ -127,14 +111,14 @@ type: 'select', field: 'selStyle', label: '閫変腑椋庢牸', - initval: wrap.selStyle || 'active', - tooltip: '瀛樺湪杈规鏃讹紝杈规浼氫娇鐢ㄧ郴缁熻壊銆�', + initval: wrap.selStyle || 'check', + // tooltip: '瀛樺湪杈规鏃讹紝杈规浼氫娇鐢ㄧ郴缁熻壊銆�', required: false, options: [ {value: 'none', label: '鏃�'}, - {value: 'active', label: '澶栭槾褰�'}, - {value: 'backFont', label: '鑳屾櫙+鏂囧瓧'}, - {value: 'font', label: '鏂囧瓧'}, + // {value: 'active', label: '澶栭槾褰�'}, + // {value: 'backFont', label: '鑳屾櫙+鏂囧瓧'}, + // {value: 'font', label: '鏂囧瓧'}, {value: 'check', label: '鍕鹃�夛紙鍦嗘锛�'}, {value: 'check square', label: '鍕鹃�夛紙鏂规锛�'} ] diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index bc66a55..de1c0ca 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Popover, Modal, Button, Switch, notification, message } from 'antd' import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' @@ -437,26 +436,18 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, editform: null, diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 1d81503..bfa2708 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Popover, Modal, Button, Switch, notification, message } from 'antd' import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' @@ -539,26 +538,18 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, editform: null, diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index 18b4656..0d6e367 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Popover, Modal, Button, Switch, notification, message } from 'antd' import { PlusOutlined, SettingOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' @@ -543,27 +542,19 @@ this.setState({ sqlVerifing: true }) - - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) + + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, editform: null, diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx index 2786f97..ae1d50b 100644 --- a/src/menu/components/group/normal-group/index.jsx +++ b/src/menu/components/group/normal-group/index.jsx @@ -187,7 +187,6 @@ } trigger="hover"> <ToolOutlined /> </Popover> - {/* {group.setting && group.setting.print === 'true' ? <Button className="print-button" onClick={this.print}><PrinterOutlined /></Button> : null} */} <GroupComponents config={group} handleList={this.updateComponent} deleteCard={this.deleteCard} /> </div> ) diff --git a/src/menu/components/group/normal-group/index.scss b/src/menu/components/group/normal-group/index.scss index 63a4dd9..f616fad 100644 --- a/src/menu/components/group/normal-group/index.scss +++ b/src/menu/components/group/normal-group/index.scss @@ -17,14 +17,6 @@ padding: 5px; background: rgba(255, 255, 255, 0.55); } - .print-button, .print-button:hover, .print-button:focus, .print-button:active { - position: absolute; - right: 40px; - top: 0px; - border: 0; - background: transparent; - color: #bcbcbc; - } } .menu-group-edit-box.padding:before { content: ' '; diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index f526199..90368da 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Modal, notification, Popover, Switch, message } from 'antd' import { PlusOutlined, EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -256,25 +255,16 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: res.dataSource - } + let sql = res.dataSource + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, visible: false diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 361a3a6..0169f0f 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -647,7 +647,7 @@ type: 'select', key: 'popClose', label: '鍏抽棴鍚�', - initVal: card.popClose || 'never', + initVal: card.popClose || 'grid', required: true, options: [{ value: 'never', @@ -1756,7 +1756,7 @@ type: 'select', key: 'popClose', label: '鍏抽棴鍚�', - initVal: card.popClose || 'never', + initVal: card.popClose || 'grid', required: true, options: [{ value: 'never', diff --git a/src/menu/components/share/pastebasetable/index.jsx b/src/menu/components/share/pastebasetable/index.jsx index 5c8eb9a..84811f8 100644 --- a/src/menu/components/share/pastebasetable/index.jsx +++ b/src/menu/components/share/pastebasetable/index.jsx @@ -95,7 +95,7 @@ const { visible } = this.state return ( - <div style={{display: 'inline-block'}}> + <> {type === 'page' ? <Button icon="snippets" style={{color: '#1890ff', borderColor: '#1890ff'}} onClick={() => {this.setState({visible: true})}} >绮樿创</Button> : <SnippetsOutlined style={{color: 'purple'}} onClick={() => {this.setState({visible: true})}} />} <Modal title="绮樿创" @@ -108,7 +108,7 @@ > <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> </Modal> - </div> + </> ) } } diff --git a/src/menu/components/share/searchcomponent/index.jsx b/src/menu/components/share/searchcomponent/index.jsx index 3d94abe..01ecd13 100644 --- a/src/menu/components/share/searchcomponent/index.jsx +++ b/src/menu/components/share/searchcomponent/index.jsx @@ -2,11 +2,9 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Modal, notification } from 'antd' -import moment from 'moment' import MKEmitter from '@/utils/events.js' import Api from '@/api' -import Utils from '@/utils/utils.js' import { getSearchForm } from '@/templates/zshare/formconfig' import SearchForm from '@/templates/sharecomponent/searchcomponent/searchform' @@ -204,25 +202,16 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: res.dataSource - } + let sql = res.dataSource + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, searchlist: _searchlist, diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx index 14f0606..bfc6cad 100644 --- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -449,27 +448,19 @@ this.setState({ loading: true }) - - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${values.dataSource}` - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${values.dataSource}` + + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) + + let rduri = '' if (window.GLOB.mainSystemApi && values.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({visible: false, loading: false, formlist: null}) this.props.submitCol(values) this.record = null 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 9aab9bf..216d0fe 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 @@ -2,7 +2,6 @@ import PropTypes from 'prop-types' import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' -import moment from 'moment' import Utils from '@/utils/utils.js' import Api from '@/api' @@ -195,23 +194,9 @@ } } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) if (skip) { this.setState({ @@ -225,8 +210,8 @@ }) } else { this.setState({loading: true}) - Api.genericInterface(param).then(res => { - if (res.status) { + Api.sDebug(sql).then(res => { + if (res.status || res.ErrCode === '-2') { this.setState({ loading: false, editItem: null diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 26b3808..eda176e 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -20,14 +20,7 @@ mainSearch: [], visible: false, loading: false, - setting: null, record: {} - } - - UNSAFE_componentWillMount () { - const { config } = this.props - - this.setState({setting: fromJS(config.setting).toJS()}) } shouldComponentUpdate (nextProps, nextState) { @@ -227,6 +220,13 @@ } this.setState({loading: false, visible: false}) + + if (res.cols) { + res.cols = [...config.cols, ...res.cols] + } else { + delete res.cols + } + this.props.updateConfig({...config, ...res}) }, () => { this.setState({loading: false}) diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx index 63146d0..5babfa1 100644 --- a/src/menu/datasource/verifycard/customscript/index.jsx +++ b/src/menu/datasource/verifycard/customscript/index.jsx @@ -19,7 +19,8 @@ searches: PropTypes.array, // 鎼滅储鏉′欢 systemScripts: PropTypes.array, // 绯荤粺鑴氭湰 scriptSubmit: PropTypes.func, // 鑴氭湰楠岃瘉鍚庢彁浜� - scriptsChange: PropTypes.func // 鑴氭湰楠岃瘉 + scriptsChange: PropTypes.func, + addProcess: PropTypes.func } state = { @@ -40,9 +41,19 @@ _usefulFields.push(item.field) _usefulFields.push(item.datefield) _usefulFields.push(item.datefield + '1') - } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { + } else if (['dateweek', 'datemonth'].includes(item.type)) { _usefulFields.push(item.field) _usefulFields.push(item.field + '1') + } else if (item.type === 'daterange') { + let _skey = item.field + let _ekey = item.field + '1' + + if (/,/.test(item.field)) { + _skey = item.field.split(',')[0] + _ekey = item.field.split(',')[1] + } + _usefulFields.push(_skey) + _usefulFields.push(_ekey) } else if (item.type === 'date' && _usefulFields.includes(item.field)) { _usefulFields.push(item.field + '1') } else { @@ -66,9 +77,19 @@ _usefulFields.push(item.field) _usefulFields.push(item.datefield) _usefulFields.push(item.datefield + '1') - } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { + } else if (['dateweek', 'datemonth'].includes(item.type)) { _usefulFields.push(item.field) _usefulFields.push(item.field + '1') + } else if (item.type === 'daterange') { + let _skey = item.field + let _ekey = item.field + '1' + + if (/,/.test(item.field)) { + _skey = item.field.split(',')[0] + _ekey = item.field.split(',')[1] + } + _usefulFields.push(_skey) + _usefulFields.push(_ekey) } else if (item.type === 'date' && _usefulFields.includes(item.field)) { _usefulFields.push(item.field + '1') } else { @@ -220,6 +241,9 @@ if (value === 'defaultsql') { value = this.props.defaultsql + } else if (value === 'flowsql') { + value = `/* select a.*,w.remark as remark_w,w.statusname as statusname_w,w.status as status_w,w.works_flow_param from (鏁版嵁婧�) a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */` + this.props.addProcess() } _sql = _sql.replace(/\s{6}$/, '') @@ -341,6 +365,7 @@ onSelect={this.selectScript} > <Select.Option style={{whiteSpace: 'normal'}} key="default" value="defaultsql">榛樿sql</Select.Option> + {window.GLOB.process ? <Select.Option style={{whiteSpace: 'normal'}} key="default" value="flowsql">榛樿sql锛堝伐浣滄祦锛�</Select.Option> : null} <Select.Option key="debugger" value={`z_debug: select @ErrorCode='E',@retmsg='娴嬭瘯鏂偣' goto aaa`}> 娴嬭瘯鏂偣 </Select.Option> diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index f11fcde..266395c 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -22,6 +22,7 @@ const { TabPane } = Tabs const { Paragraph } = Typography const { Search } = Input +const { confirm } = Modal const CodeMirror = asyncComponent(() => import('@/templates/zshare/codemirror')) const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent')) @@ -51,6 +52,7 @@ reload: false, script: null, scriptValue: '', + cols: null, colColumns: [ { title: '鍚嶇О', @@ -383,7 +385,7 @@ } return new Promise((resolve, reject) => { - this.sqlverify(resolve, reject, false, scripts) + this.sqlverify(resolve, reject, 'script', scripts) }) } @@ -447,7 +449,7 @@ loading: false }) this.getdefaultSql() - }, true) + }, 'change') }) }, () => { this.setState({loading: false}) @@ -579,7 +581,7 @@ submitDataSource = () => { const { config, mainSearch } = this.props - const { activeKey, setting, columns, subColumns, scripts } = this.state + const { activeKey, setting, columns, subColumns, scripts, cols } = this.state if (config.subtype === 'dualdatacard') { let arr = columns.map(col => col.field.toLowerCase()) @@ -620,7 +622,7 @@ defaultSearch: _search, setting: res }, () => { - this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols }) }, reject, 'submit') }) }, () => { reject() @@ -635,7 +637,7 @@ reject() return } - this.sqlverify(() => { resolve({setting, columns, subColumns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') } else if (activeKey === 'subcolumns') { if (this.subdatasource && this.subdatasource.state.editingKey) { notification.warning({ @@ -646,7 +648,7 @@ reject() return } - this.sqlverify(() => { resolve({setting, columns, subColumns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') } else if (activeKey === 'scripts') { let _loading = false if (this.scriptsForm && this.scriptsForm.state.editItem) { @@ -665,12 +667,12 @@ return } - this.sqlverify(() => { resolve({setting, columns, subColumns, scripts }) }, reject, false) + this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') } }) } - sqlverify = (resolve, reject, change = false, testScripts) => { + sqlverify = (resolve, reject, type, testScripts) => { const { config } = this.props const { columns, setting, scripts, searches, defaultSearch, debugId } = this.state @@ -679,7 +681,7 @@ if (testScripts) { _scripts = testScripts.filter(item => item.status !== 'false') } - if (!change && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) { + if (type !== 'change' && setting.interType === 'system' && setting.execute === 'false' && _scripts.length === 0) { notification.warning({ top: 92, message: '涓嶆墽琛岄粯璁ql鏃讹紝璇锋坊鍔犺嚜瀹氫箟鑴氭湰锛�', @@ -689,14 +691,13 @@ return } - if (change && columns.length === 0) { + if (type === 'change' && columns.length === 0) { reject() return } if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, config.type, '2023-04-20 15:29:37') + let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, config.type) let _debugId = md5(r.sql) @@ -713,52 +714,31 @@ }) } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: r.sql - } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = timestamp - param.secretkey = Utils.encrypt('', timestamp) - - let sumParam = null - if (r.sumSql) { - sumParam = { - func: 's_debug_sql', - exec_type: 'y', - LText: r.sumSql - } - sumParam.LText = Utils.formatOptions(sumParam.LText) - sumParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) - } - - Api.genericInterface(param).then(result => { - if (result.status) { - if (sumParam) { - Api.genericInterface(sumParam).then(res => { - if (res.status) { - this.setState({debugId: _debugId}, () => { - resolve() - }) - } else { + Api.sDebug(r.sql).then(result => { + if (result.status || result.ErrCode === '-2') { + this.setState({debugId: _debugId}, () => { + resolve() + }) + } else { + if (type === 'submit') { + Modal.confirm({ + title: result.message, + okText: '鐭ラ亾浜�', + cancelText: '寮哄埗淇濆瓨', + onOk: () => { reject() - Modal.error({ - title: res.message - }) + }, + onCancel() { + resolve() } }) } else { - this.setState({debugId: _debugId}, () => { - resolve() + reject() + Modal.error({ + title: result.message, + okText: '鐭ラ亾浜�' }) } - } else { - reject() - Modal.error({ - title: result.message - }) } }) } else { @@ -799,7 +779,7 @@ this.setState({loading: true}) - this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, false, _scripts) + this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, 'script', _scripts) } updatefields = (columns) => { @@ -965,6 +945,49 @@ message.success('澶嶅埗鎴愬姛銆�') } + addProcess = () => { + const { config } = this.props + const { columns } = this.state + + if (config.subtype === 'dualdatacard') return + + let fields = [] + let cols = [] + let _cols = columns.map(item => item.field.toLowerCase()) + + if (!_cols.includes('remark_w')) { + fields.push({ uuid: Utils.getuuid(), label: '澶囨敞', field: 'remark_w', datatype: 'Nvarchar(50)', fieldlength: 50, type: 'text' }) + cols.push({ uuid: Utils.getuuid(), Width: 120, label: '澶囨敞', field: 'remark_w', type: 'text', Hide: 'false', IsSort: 'false', fieldlength: 50 }) + } + if (!_cols.includes('statusname_w')) { + fields.push({ uuid: Utils.getuuid(), label: '鐘舵��', field: 'statusname_w', datatype: 'Nvarchar(50)', fieldlength: 50, type: 'text' }) + cols.push({ uuid: Utils.getuuid(), Width: 120, label: '鐘舵��', field: 'statusname_w', type: 'text', Hide: 'false', IsSort: 'false', fieldlength: 50 }) + } + if (!_cols.includes('works_flow_param')) { + fields.push({ uuid: Utils.getuuid(), label: '娴佺▼鍙傛暟', field: 'works_flow_param', datatype: 'Nvarchar(512)', fieldlength: 512, type: 'text' }) + cols.push({ uuid: Utils.getuuid(), Width: 120, label: '娴佺▼鍙傛暟', field: 'works_flow_param', type: 'text', Hide: 'true', IsSort: 'false', fieldlength: 512 }) + } + + if (fields.length === 0) return + + const that = this + + if (config.subtype !== 'basetable') { + cols = null + } + + confirm({ + content: cols ? '鏄剧ず鍒椾腑鏄惁娣诲姞宸ヤ綔娴佸瓧娈碉紵' : '瀛楁闆嗕腑鏄惁娣诲姞宸ヤ綔娴佸瓧娈碉紵', + onOk() { + that.setState({ + cols: cols, + columns: [...fields, ...columns] + }) + }, + onCancel() {} + }) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -995,6 +1018,7 @@ setting={setting} scripts={scripts} updateStatus={this.updateStatus} + addProcess={this.addProcess} wrappedComponentRef={(inst) => this.settingForm = inst} /> : null} </TabPane> @@ -1058,6 +1082,7 @@ systemScripts={this.state.systemScripts} scriptsChange={this.scriptsChange} scriptSubmit={this.scriptSubmit} + addProcess={this.addProcess} wrappedComponentRef={(inst) => this.scriptsForm = inst} /> <EditTable actions={['move']} data={scripts} columns={scriptsColumns} onChange={this.changeScripts}/> diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 3255937..612259d 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -16,6 +16,7 @@ class SettingForm extends Component { static propTpyes = { updateStatus: PropTypes.func, + addProcess: PropTypes.func, config: PropTypes.object, // 缁勪欢閰嶇疆 setting: PropTypes.object, // 鏁版嵁婧愰厤缃� columns: PropTypes.array, // 鍒楄缃� @@ -183,11 +184,13 @@ addProcess = () => { let _sql = this.props.form.getFieldValue('dataresource') - _sql = _sql + `\n/* select a.*,case when isnull(w.remark,'')='' then a.remark else w.remark end as remark_w,case when isnull(w.statusname,'')='' then a.statusname else w.statusname end as statusname_w,w.status as status_w from 鏁版嵁婧� a left join (select * from s_my_works_flow where works_flow_code='娴佺▼缂栫爜' and deleted=0) w on a.id=w.works_flow_id where isnull(w.status,0)=0 */` + _sql = _sql + `\n/* select a.*,w.remark as remark_w,w.statusname as statusname_w,w.status as status_w,w.works_flow_param from (鏁版嵁婧�) a inner join (select * from s_my_works_flow where works_flow_code=@works_flow_code@ and status=0 and deleted=0) w on a.id=w.works_flow_id */` this.props.form.setFieldsValue({ dataresource: _sql }) + + this.props.addProcess() } render() { diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index 71bb2b5..ad11e06 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -7,7 +7,7 @@ * @return {Object} setting 椤甸潰璁剧疆 * @return {Array} columns 鏄剧ず瀛楁 */ - static getDebugSql (setting, scripts, columns, searches = [], defSearch, type, timestamp) { + static getDebugSql (setting, scripts, columns, searches = [], defSearch, type) { let sql = '' let error = '' let _dataresource = '' @@ -47,13 +47,19 @@ }) } - _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) - _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) - _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) + _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) + _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) + _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'1949-10-01 15:00:00'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') _tailScript = _tailScript.replace(/@\$|\$@/ig, '') + + if (window.GLOB.process) { + _dataresource = _dataresource.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) + _customScript = _customScript.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) + _tailScript = _tailScript.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) + } _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') _customScript = _customScript.replace(/@select\$|\$select@/ig, '') @@ -97,46 +103,53 @@ if (!item.field) return if (item.datefield) { _regoptions.push({ - var: new RegExp('@' + item.datefield, 'ig'), reg: new RegExp('@' + item.datefield + '@', 'ig') }) _regoptions.push({ - var: new RegExp('@' + item.datefield + '1', 'ig'), reg: new RegExp('@' + item.datefield + '1@', 'ig') }) } - if (['dateweek', 'datemonth', 'daterange', 'range'].includes(item.type)) { + if (['dateweek', 'datemonth', 'range'].includes(item.type)) { _regoptions.push({ - var: new RegExp('@' + item.field, 'ig'), reg: new RegExp('@' + item.field + '@', 'ig') }) _regoptions.push({ - var: new RegExp('@' + item.field + '1', 'ig'), reg: new RegExp('@' + item.field + '1@', 'ig') + }) + } else if (item.type === 'daterange') { + let _skey = item.field + let _ekey = item.field + '1' + + if (/,/.test(item.field)) { + _skey = item.field.split(',')[0] + _ekey = item.field.split(',')[1] + } + + _regoptions.push({ + reg: new RegExp('@' + _skey + '@', 'ig') + }) + _regoptions.push({ + reg: new RegExp('@' + _ekey + '@', 'ig') }) } else if (item.type === 'date') { if (_fields.includes(item.field)) { _regoptions.push({ - var: new RegExp('@' + item.field + '1', 'ig'), reg: new RegExp('@' + item.field + '1@', 'ig') }) } else { _fields.push(item.field) _regoptions.push({ - var: new RegExp('@' + item.field, 'ig'), reg: new RegExp('@' + item.field + '@', 'ig') }) } } else if (item.type === 'text' || item.type === 'select') { item.field.split(',').forEach(field => { _regoptions.push({ - var: new RegExp('@' + field, 'ig'), reg: new RegExp('@' + field + '@', 'ig') }) }) } else { _regoptions.push({ - var: new RegExp('@' + item.field, 'ig'), reg: new RegExp('@' + item.field + '@', 'ig') }) } @@ -178,31 +191,25 @@ } if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} + sql = `${_customScript} ${_dataresource} ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { - sql = `/* sql 楠岃瘉 */ - 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 = `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} ${_tailScript} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `/* sql 楠岃瘉 */ - 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 = `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 = [] @@ -247,8 +254,6 @@ }) }) } - - sql = sql.replace(/\n/g, ' ') return { error, sql, errors: errors.join('锛�') } } diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx new file mode 100644 index 0000000..8e5849c --- /dev/null +++ b/src/menu/debug/index.jsx @@ -0,0 +1,203 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +// import { fromJS } from 'immutable' +import { Modal, Button } from 'antd' +// import moment from 'moment' + +// import Api from '@/api' +// import Utils from '@/utils/utils.js' +import './index.scss' + +class DebugSql extends Component { + static propTpyes = { + config: PropTypes.object + } + + state = { + visible: false, + confirming: false, + } + + trigger = () => { + // const { config } = this.props + + // let list = [] + // let mainSearch = [] + } + + // formatSearch (config) { + // if (!config.search) return [] + + // let values = [] + + // config.search.forEach(item => { + // item.hidden = item.Hide === 'true' + // item.required = !item.hidden && item.required === 'true' + // item.advanced = item.advanced === 'true' + // item.$forbid = item.query === 'false' + // item.precision = item.precision || 'day' + + // if (item.type === 'date') { // 鏃堕棿鎼滅储 + // let format = 'YYYY-MM-DD' + // if (item.precision === 'day') { + + // } else if (item.precision === 'hour') { + // format = 'YYYY-MM-DD HH' + // } else if (item.precision === 'minute') { + // format = 'YYYY-MM-DD HH:mm' + // } else if (item.precision === 'second') { + // format = 'YYYY-MM-DD HH:mm:ss' + // } + + // item.initval = item.initval ? moment().subtract(item.initval, 'days').format(format) : '' + // } else if (item.type === 'datemonth') { + // item.initval = item.initval ? moment().subtract(item.initval, 'month').format('YYYY-MM') : '' + // } else if (item.type === 'dateweek') { + // item.initval = item.initval ? moment().subtract(item.initval * 7, 'days').format('YYYY-MM-DD') : '' + // } else if (item.type === 'daterange') { + // let format = 'YYYY-MM-DD' + // if (item.precision === 'day') { + + // } else if (item.precision === 'hour') { + // format = 'YYYY-MM-DD HH' + // } else if (item.precision === 'minute') { + // format = 'YYYY-MM-DD HH:mm' + // } else if (item.precision === 'second') { + // format = 'YYYY-MM-DD HH:mm:ss' + // } + // if (item.initval === 'week') { + // item.initval = [moment().startOf('week').format(format), moment().endOf('week').format(format)].join(',') + // } else if (item.initval === 'month') { + // item.initval = [moment().startOf('month').format(format), moment().endOf('month').format(format)].join(',') + // } else if (item.initval === 'lastMonth') { + // item.initval = [moment().subtract(1, 'months').startOf('month').format(format), moment().subtract(1, 'months').endOf('month').format(format)].join(',') + // } else if (item.initval) { + // try { + // let _initval = JSON.parse(item.initval) + // let _vals = [moment().subtract(_initval[0], 'days').format(format), moment().subtract(_initval[1], 'days').format(format)] + // item.initval = _vals.join(',') + // } catch (e) { + // item.initval = '' + // } + // } + // } else if (item.type === 'group') { + // if (item.initval && item.initval[0]) { + // let _type = item.initval[0] + // let _val = item.initval[1] + // let _dateRange = '' + + // if (_type === 'day') { + // _dateRange = [moment().subtract(_val, 'days').format('YYYY-MM-DD'), + // moment().subtract(_val, 'days').format('YYYY-MM-DD')] + // } else if (_type === 'week') { + // _dateRange = [moment().subtract(_val * 7, 'days').startOf('week').format('YYYY-MM-DD'), + // moment().subtract(_val * 7, 'days').endOf('week').format('YYYY-MM-DD')] + // } else if (_type === 'month') { + // _dateRange = [moment().subtract(_val, 'month').startOf('month').format('YYYY-MM-DD'), + // moment().subtract(_val, 'month').endOf('month').format('YYYY-MM-DD')] + // } else if (_type === 'quarter') { + // let _differ = parseInt(moment().format('MM')) % 3 + // let _pdiffer = 0 + // let _ndiffer = 0 + + // // 宸�艰绠� + // switch(_differ) { + // case 0: + // _pdiffer = 2 + // _ndiffer = 0 + // break + // case 1: + // _pdiffer = 0 + // _ndiffer = -2 + // break + // case 2: + // _pdiffer = 1 + // _ndiffer = -1 + // break + // default: + // } + // _dateRange = [moment().subtract(_pdiffer + _val * 3, 'month').startOf('month').format('YYYY-MM-DD'), + // moment().subtract(_ndiffer + _val * 3, 'month').endOf('month').format('YYYY-MM-DD')] + // } else if (_type === 'year') { + // let _year = parseInt(moment().format('YYYY')) - _val + // _dateRange = [_year + '-01-01', _year + '-12-31'] + // } else if (_type === 'customized') { + // try { + // _val = JSON.parse(_val) + // } catch (e) { + // _val = [0, 0] + // } + // _dateRange = [moment().subtract(_val[0], 'days').format('YYYY-MM-DD'), + // moment().subtract(_val[1], 'days').format('YYYY-MM-DD')] + // } + + // item.initval = _dateRange.join(',') + // item.initType = _type + // } else { + // item.initval = '' + // item.initType = '' + // } + // } + + // item.oriInitval = item.initval + + // if (values) { + // item.initval = values[item.field] || '' + // } + + // if (item.blacklist && item.blacklist.length > 0 && !item.hidden) { + // if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { + // item.hidden = true + // item.required = false + // } + // } + + // if (item.required) { + // required = true + // } + + // if (item.type === 'text' || item.type === 'select') { + // if (/,/.test(item.field)) { + // item.field.split(',').forEach(field => { + // keys.push(field.toLowerCase()) + // }) + // } else { + // keys.push(item.field.toLowerCase()) + // } + // } else if (item.type === 'group') { + // keys.push(item.field.toLowerCase()) + // keys.push(item.datefield.toLowerCase()) + // } + + // return item + // }) + + // config.$s_keys = keys + // config.$s_req = required + // } + + + render() { + const { visible, confirming } = this.state + + return ( + <> + <Button className="mk-border-yellow" icon="bug" onClick={this.trigger}>璋冭瘯</Button> + <Modal + title="SQL楠岃瘉" + wrapClassName="debug-modal" + visible={visible} + width={600} + maskClosable={false} + onOk={this.submit} + onCancel={() => { this.setState({ visible: false })}} + confirmLoading={confirming} + destroyOnClose + > + </Modal> + </> + ) + } +} + +export default DebugSql \ No newline at end of file diff --git a/src/menu/debug/index.scss b/src/menu/debug/index.scss new file mode 100644 index 0000000..de57aff --- /dev/null +++ b/src/menu/debug/index.scss @@ -0,0 +1,9 @@ +.replace-field-modal { + .ant-modal { + top: 70px; + } + .ant-modal-body { + min-height: 150px; + padding-top: 40px; + } +} \ No newline at end of file diff --git a/src/menu/header/index.jsx b/src/menu/header/index.jsx index c1234dd..9617900 100644 --- a/src/menu/header/index.jsx +++ b/src/menu/header/index.jsx @@ -1,5 +1,4 @@ import React, {Component} from 'react' -import { is, fromJS } from 'immutable' import avatar from '@/assets/img/avatar.jpg' import MainLogo from '@/assets/img/main-logo.png' @@ -11,21 +10,19 @@ userName: sessionStorage.getItem('CloudUserName') } - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - render () { + const { menuName } = this.props return ( <header className="menu-header-container"> <div className="header-logo"><img src={MainLogo} alt=""/></div> - <div className="header-setting"> - <img src={this.state.avatar} alt=""/> - <span> - <span className="username">{this.state.userName}</span> - </span> - </div> + <div className="menu-name">{menuName}</div> + <div className="header-setting"> + <img src={this.state.avatar} alt=""/> + <span> + <span className="username">{this.state.userName}</span> + </span> + </div> </header> ) } diff --git a/src/menu/header/index.scss b/src/menu/header/index.scss index 756bea5..c5626f6 100644 --- a/src/menu/header/index.scss +++ b/src/menu/header/index.scss @@ -10,7 +10,7 @@ border-bottom: 1px solid #000; .header-logo { - float: left; + position: absolute; width: 180px; line-height: 48px; text-align: center; @@ -22,8 +22,17 @@ max-height: 40px; } } + .menu-name { + text-align: center; + color: #ffffff; + line-height: 45px; + font-size: 16px; + margin-left: 40px; + } .header-setting { - float: right; + position: absolute; + right: 0px; + top: 0px; line-height: 48px; margin-right: 10px; img { @@ -43,44 +52,6 @@ text-overflow: ellipsis; white-space: nowrap; } - } - } - - >.ant-menu { - float: left; - width: unset; - .ant-menu-item { - margin-bottom: 0; - float: left; - width: unset; - cursor: default; - .anticon-arrow-left { - height: 24px; - cursor: pointer; - } - .ant-btn { - color: #fff; - width: unset; - cursor: pointer; - height: 37px; - background: transparent; - border: 0; - .anticon-save { - margin-right: 0; - } - } - .ant-btn[ant-click-animating-without-extra-node="true"]::after { - display: none!important; - } - .ant-btn::before { - display: none!important; - } - } - .ant-menu-item.ant-menu-item-selected { - background-color: transparent; - } - .ant-menu-item:not(:last-child) { - border-right: 1px solid #353535; } } } \ No newline at end of file diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 9791220..ced3019 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -3,12 +3,10 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import moment from 'moment' import { Button, Card, Modal, Collapse, notification, Switch, message } from 'antd' import { SettingOutlined, CopyOutlined } from '@ant-design/icons' import Api from '@/api' -import Utils from '@/utils/utils.js' import { getModalForm } from '@/templates/zshare/formconfig' import SourceElement from '@/templates/modalconfig/dragelement/source' @@ -264,26 +262,18 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, config: _config, diff --git a/src/menu/pastecontroller/index.jsx b/src/menu/pastecontroller/index.jsx index 652a0f0..513c64e 100644 --- a/src/menu/pastecontroller/index.jsx +++ b/src/menu/pastecontroller/index.jsx @@ -94,7 +94,7 @@ const { visible } = this.state return ( - <div className="mk-view-paste" style={{display: 'inline-block'}}> + <> <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={() => {this.setState({visible: true})}}><SnippetsOutlined />绮樿创</Button> <Modal title="绮樿创" @@ -107,7 +107,7 @@ > <PasteForm wrappedComponentRef={(inst) => this.pasteFormRef = inst} inputSubmit={this.pasteSubmit}/> </Modal> - </div> + </> ) } } diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index f91da59..1dac26d 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -261,7 +261,7 @@ const { visible, editvisible, card, filpictures, filvideos, piclist, vidlist, imageKey, videoKey, pageSize, picIndex, vidIndex, colorlist, iconlist } = this.state return ( - <div style={{display: 'inline-block'}}> + <> <Button className="mk-border-purple" onClick={this.trigger}><PictureOutlined /> 璧勬簮绠$悊</Button> <Modal wrapClassName="mk-pop-modal picture-control-model" @@ -389,7 +389,7 @@ > <EditForm card={card} wrappedComponentRef={(inst) => this.editFormRef = inst} inputSubmit={this.save}/> </Modal> - </div> + </> ) } } diff --git a/src/menu/replaceField/index.jsx b/src/menu/replaceField/index.jsx index 11289e7..4e47d3a 100644 --- a/src/menu/replaceField/index.jsx +++ b/src/menu/replaceField/index.jsx @@ -636,7 +636,7 @@ const { visible, loadingTable, tables, confirming } = this.state return ( - <div className="mk-replace-field" style={{display: 'inline-block'}}> + <> <Button className="mk-border-yellow" icon="swap" loading={loadingTable} onClick={this.trigger}>瀛楁鏇挎崲</Button> <Modal title="瀛楁鏇挎崲" @@ -651,7 +651,7 @@ > <SettingForm tables={tables} wrappedComponentRef={(inst) => this.settingRef = inst}/> </Modal> - </div> + </> ) } } diff --git a/src/menu/sysinterface/index.jsx b/src/menu/sysinterface/index.jsx index a486c0e..6c88dcc 100644 --- a/src/menu/sysinterface/index.jsx +++ b/src/menu/sysinterface/index.jsx @@ -253,7 +253,7 @@ const { visible, columns, interfaces } = this.state return ( - <div className="mk-sys-interface" style={{display: 'inline-block'}}> + <> <Button className="mk-border-danger" onClick={this.trigger}><DatabaseOutlined /> 鍏叡鏁版嵁婧�</Button> <Modal title="鍏叡鏁版嵁婧�" @@ -272,7 +272,7 @@ <PlusOutlined key="add-interface" onClick={this.addInterface}/> <EditTable key="manage-interface" actions={['copy']} type="interface" data={interfaces} columns={columns} onChange={this.changeScripts}/> </Modal> - </div> + </> ) } } diff --git a/src/menu/tablenodes/index.jsx b/src/menu/tablenodes/index.jsx index 7fe455e..c04da88 100644 --- a/src/menu/tablenodes/index.jsx +++ b/src/menu/tablenodes/index.jsx @@ -800,7 +800,7 @@ const { visible, loading, empty } = this.state return ( - <div style={{display: 'inline-block'}}> + <> <Button style={{borderColor: '#8E44AD', color: '#8E44AD'}} onClick={this.trigger}><ForkOutlined /> 琛ㄥ叧绯诲浘</Button> <Modal title="" @@ -824,7 +824,7 @@ <span className="tip">娉細鐐瑰嚮琛ㄥ悕锛堝彸渚э級鍙睍寮�/鏀惰捣鑿滃崟锛屽乏渚ф鑹叉爣娉ㄤ负鎺ュ彛鎴栧嚱鏁板悕銆�</span> </div> </Modal> - </div> + </> ) } } diff --git a/src/menu/versions/index.jsx b/src/menu/versions/index.jsx index 01fb94d..7f584ae 100644 --- a/src/menu/versions/index.jsx +++ b/src/menu/versions/index.jsx @@ -128,7 +128,7 @@ const { visible, preconfirming, nextconfirming } = this.state return ( - <div style={{display: 'inline-block'}}> + <> <Button style={{borderColor: '#40a9ff', color: '#40a9ff'}} onClick={this.trigger}><CalendarOutlined /> 鐗堟湰绠$悊</Button> <Modal title="" @@ -148,7 +148,7 @@ <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>鍙栨秷</Button> </div> </Modal> - </div> + </> ) } } diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx index c33da82..a408c9a 100644 --- a/src/mob/modalconfig/index.jsx +++ b/src/mob/modalconfig/index.jsx @@ -3,12 +3,10 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import moment from 'moment' import { Button, Modal, Collapse, notification, Switch, message } from 'antd' import { LeftOutlined } from '@ant-design/icons' import Api from '@/api' -import Utils from '@/utils/utils.js' import { getModalForm } from '@/templates/zshare/formconfig' import SourceElement from '@/templates/modalconfig/dragelement/source' @@ -261,26 +259,18 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, config: _config, diff --git a/src/mob/searchconfig/index.jsx b/src/mob/searchconfig/index.jsx index 62c27cb..15d5fd2 100644 --- a/src/mob/searchconfig/index.jsx +++ b/src/mob/searchconfig/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import moment from 'moment' import { Button, Modal, Collapse, notification, Switch } from 'antd' import { SettingOutlined, LeftOutlined, SearchOutlined, PlusOutlined } from '@ant-design/icons' @@ -229,25 +228,16 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: res.dataSource - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + let sql = res.dataSource + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, group: _group, diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index e6b4a31..ce12936 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -190,6 +190,10 @@ }) } + if (config.flow_code) { + regs.push({ reg: /@works_flow_code@/ig, value: config.flow_code }) + } + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName, config.process === 'true') let autoMatic = null @@ -416,7 +420,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.pop() - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index b688628..865ed68 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -349,7 +349,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.slice(-1)[0] - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/custom/components/calendar/board/index.jsx b/src/tabviews/custom/components/calendar/board/index.jsx index 77727e6..fddbe03 100644 --- a/src/tabviews/custom/components/calendar/board/index.jsx +++ b/src/tabviews/custom/components/calendar/board/index.jsx @@ -493,31 +493,29 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (config.wrap.click === 'menu') { - let menuId = config.wrap.MenuID || config.wrap.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menuId = config.wrap.menu.slice(-1)[0] + let menu = null - if (!menu && config.wrap.MenuName && config.wrap.tabType) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (config.wrap.MenuID) { menu = { - MenuID: menuId, + MenuID: config.wrap.MenuID, MenuName: config.wrap.MenuName, - MenuNo: config.wrap.MenuNo || '', type: config.wrap.tabType } } if (!menu) return - let newtab = { - ...menu, - param: {$BID: data.$$uuid || ''} - } + menu.param = {$BID: data.$$uuid || ''} Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } } diff --git a/src/tabviews/custom/components/calendar/board/index.scss b/src/tabviews/custom/components/calendar/board/index.scss index 3957fc3..583e54d 100644 --- a/src/tabviews/custom/components/calendar/board/index.scss +++ b/src/tabviews/custom/components/calendar/board/index.scss @@ -4,21 +4,6 @@ padding: 20px; color: rgba(0, 0, 0, 0.85); - .loading-data { - position: absolute; - top: 0; - left: 20px; - right: 20px; - bottom: 0; - z-index: 2; - opacity: 0.5; - background: #ffffff; - .ant-spin-spinning { - position: absolute; - left: 50%; - top: 270px; - } - } .mk-calendar-control { text-align: right; .ant-select { diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx index d7d8a72..aa25ec8 100644 --- a/src/tabviews/custom/components/card/cardItem/index.jsx +++ b/src/tabviews/custom/components/card/cardItem/index.jsx @@ -1,7 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { notification } from 'antd' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' @@ -16,10 +15,8 @@ data: PropTypes.object, } - state = {} - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.props.data), fromJS(nextProps.data)) + return !is(fromJS(this.props), fromJS(nextProps)) } /** @@ -55,7 +52,6 @@ let newtab = { MenuID: menu.MenuID, MenuName: menu.MenuName, - MenuNo: menu.MenuNo || '', type: menu.tabType, param: {} } @@ -72,43 +68,34 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (card.setting.click === 'menu') { - let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menuId = card.setting.menu.slice(-1)[0] + let menu = null - if (!menu && card.setting.MenuName && card.setting.tabType) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { menu = { - MenuID: menuId, + MenuID: card.setting.MenuID, MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo || '', type: card.setting.tabType } } - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } + if (!menu) return - let newtab = { - ...menu, - param: {} - } + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return if (key === 'children') return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else if (card.setting.click === 'link') { let src = card.setting.linkurl diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 53048cb..d803a09 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -1033,36 +1033,34 @@ if (subcard.setting.click || card.setting.position !== 'inner' || card.setting.click !== 'menu') return - let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menuId = card.setting.menu.slice(-1)[0] + let menu = null - if (!menu && card.setting.MenuName && card.setting.tabType) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { menu = { - MenuID: menuId, + MenuID: card.setting.MenuID, MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo || '', type: card.setting.tabType } } if (!menu) return - let newtab = { - ...menu, - param: {} - } + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = item.$$uuid || '' + menu.param.$BID = item.$$uuid || '' Object.keys(item).forEach(key => { if (/^\$/.test(key)) return if (key === 'children') return - newtab.param[key] = item[key] + menu.param[key] = item[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } onDoubleClick = (i, subClass) => { diff --git a/src/tabviews/custom/components/card/double-data-card/index.scss b/src/tabviews/custom/components/card/double-data-card/index.scss index c6a13e8..e0b3f63 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.scss +++ b/src/tabviews/custom/components/card/double-data-card/index.scss @@ -22,16 +22,6 @@ } } } - .data-zoom.scale { - .card-row-list { - .mk-card:hover { - >.card-item-box { - z-index: 1; - transform: scale(1.05); - } - } - } - } .card-row-list { flex: 10; max-width: 100%; @@ -42,24 +32,6 @@ >.ant-col { width: 5%; flex: 1; - } - } - .card-row-list.float-center { - text-align: center; - >.ant-col { - display: inline-block; - float: none; - text-align: left; - vertical-align: top; - } - } - .card-row-list.float-right { - text-align: right; - >.ant-col { - display: inline-block; - float: none; - text-align: left; - vertical-align: top; } } .card-item-box { diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index f131f2c..8dcb134 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -462,41 +462,32 @@ openView = (card, data) => { if (card.setting.click === 'menu' && card.setting.menu) { let menuId = card.setting.menu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!menu && card.setting.MenuName && card.setting.MenuID) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { menu = { MenuID: card.setting.MenuID, MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo || '', type: card.setting.tabType } } - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } + if (!menu) return - let newtab = { - ...menu, - param: {} - } + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else if (card.setting.click === 'link') { let src = card.setting.linkurl diff --git a/src/tabviews/custom/components/carousel/cardItem/index.jsx b/src/tabviews/custom/components/carousel/cardItem/index.jsx index e502391..1ed6197 100644 --- a/src/tabviews/custom/components/carousel/cardItem/index.jsx +++ b/src/tabviews/custom/components/carousel/cardItem/index.jsx @@ -16,10 +16,6 @@ data: PropTypes.object, } - state = { - card: null, // 鍗$墖淇℃伅锛屽寘鎷鍙嶉潰 - } - /** * @description 鎼滅储鏉′欢鍒濆鍖� */ @@ -45,29 +41,34 @@ if (!card.setting.click || data.$disabled) return - if (card.setting.click === 'menu' && card.setting.MenuID) { - let menu = { - MenuID: card.setting.MenuID, - MenuName: card.setting.MenuName, - MenuNo: card.setting.MenuNo, - type: card.setting.tabType + if (card.setting.click === 'menu') { + let menuId = card.setting.menu.slice(-1)[0] + let menu = null + + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (card.setting.MenuID) { + menu = { + MenuID: card.setting.MenuID, + MenuName: card.setting.MenuName, + type: card.setting.tabType + } } - let newtab = { - ...menu, - param: {} - } + if (!menu) return + + menu.param = {} if (card.setting.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else if (card.setting.click === 'link') { let src = card.setting.linkurl diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index dcdd491..45a3656 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -82,8 +82,8 @@ if (!_config.wrap.height) { // 鍏煎 _config.wrap.height = _config.style.height || '300px' - delete _config.style.height } + delete _config.style.height _card.style.height = _config.wrap.height diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 273c51a..572b869 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -74,8 +74,8 @@ if (!_config.wrap.height) { // 鍏煎 _config.wrap.height = _config.style.height || '300px' - delete _config.style.height } + delete _config.style.height _config.subcards.forEach(card => { card.style.height = _config.wrap.height diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index 9fdeb1e..64536d5 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -1660,34 +1660,32 @@ if (!data) return let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } - newtab = { - ...newtab, - param: {} - } + if (!menu) return + + menu.param = {} if (plot.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else { if (data) { this.selectedId = data.$$uuid || '' diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx index 32267f3..3b654c5 100644 --- a/src/tabviews/custom/components/chart/antv-X6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx @@ -1939,20 +1939,23 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (plot.click === 'menu') { let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } - MKEmitter.emit('modifyTabs', {...newtab, param: {$BID: sign}}, true) + if (!menu) return + + menu.param = {$BID: sign} + + MKEmitter.emit('modifyTabs', menu, true) } else { MKEmitter.emit('resetSelectLine', config.uuid, sign, {}) } 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 7f2b2cf..46c4260 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -1875,34 +1875,32 @@ MKEmitter.emit('modifyTabs', newtab, true) } else if (plot.click === 'menu') { let menuId = plot.menu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && plot.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId)} + } else if (plot.MenuID) { + menu = { MenuID: plot.MenuID, MenuName: plot.MenuName, - MenuNo: plot.MenuNo, type: plot.tabType } - } else if (!newtab) { - return } + + if (!menu) return - newtab = { - ...newtab, - param: {} - } + menu.param = {} if (plot.joint === 'true') { - newtab.param.$BID = data.$$uuid || '' + menu.param.$BID = data.$$uuid || '' Object.keys(data).forEach(key => { if (/^\$/.test(key)) return - newtab.param[key] = data[key] + menu.param[key] = data[key] }) } - MKEmitter.emit('modifyTabs', newtab, true) + MKEmitter.emit('modifyTabs', menu, true) } else { MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) } diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 3605b32..f589d40 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -1031,16 +1031,9 @@ let menu_id = plot.linkmenu.slice(-1)[0] chart.on('element:dblclick', (ev) => { - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' - if (!menu) { - notification.warning({ - top: 92, - message: '鑿滃崟宸插垹闄ゆ垨娌℃湁璁块棶鏉冮檺锛�', - duration: 5 - }) - return - } + if (!menu) return try { let data = ev.data.data diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index 73ca3d9..8115aea 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -207,7 +207,7 @@ execSuccess = (btn, id) => { if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index cd83384..895ff53 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -268,7 +268,7 @@ if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index 6286532..01a21ed 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -221,7 +221,7 @@ execSuccess = (btn, id) => { if (btn.linkmenu && btn.linkmenu.length > 0) { let menu_id = btn.linkmenu[btn.linkmenu.length - 1] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + let menu = window.GLOB.mkThdMenus.get(menu_id) || '' if (!menu) return diff --git a/src/tabviews/custom/components/group/normal-group/index.scss b/src/tabviews/custom/components/group/normal-group/index.scss index cafae68..3869386 100644 --- a/src/tabviews/custom/components/group/normal-group/index.scss +++ b/src/tabviews/custom/components/group/normal-group/index.scss @@ -1,16 +1,4 @@ .normal-group-wrap { - .print-button, .print-button:hover, .print-button:focus, .print-button:active { - position: absolute; - right: 0px; - top: 0px; - z-index: 2; - border: 0; - background: transparent; - } - .print-button:hover, .print-button:focus, .print-button:active { - color: var(--mk-sys-color5); - } - .group-header { position: relative; height: 45px; diff --git a/src/tabviews/custom/components/module/account/index.jsx b/src/tabviews/custom/components/module/account/index.jsx index a4f2cb1..24d04ca 100644 --- a/src/tabviews/custom/components/module/account/index.jsx +++ b/src/tabviews/custom/components/module/account/index.jsx @@ -160,24 +160,18 @@ addBook = () => { const { config } = this.props - let menuId = config.wrap.MenuID - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] - - if (!menu && config.wrap.MenuNo) { - menu = { - MenuID: menuId, - MenuName: config.wrap.MenuName, - MenuNo: config.wrap.MenuNo || '', - type: config.wrap.tabType - } - } - - let newtab = { - ...menu, + let menu = { + MenuID: config.wrap.MenuID, + MenuName: config.wrap.MenuName, + type: config.wrap.tabType, param: {} } - MKEmitter.emit('modifyTabs', newtab, true) + if (window.GLOB.mkThdMenus.has(config.wrap.MenuID)) { + menu = {...window.GLOB.mkThdMenus.get(config.wrap.MenuID), param: {}} + } + + MKEmitter.emit('modifyTabs', menu, true) } render() { diff --git a/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx b/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx index 6c5c151..4c629f2 100644 --- a/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx +++ b/src/tabviews/custom/components/module/voucher/saveAsTemp/index.jsx @@ -18,15 +18,13 @@ UNSAFE_componentWillMount() { let menuId = '16289973311406f3ko9nm8ehotdmu80o' - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = window.GLOB.mkThdMenus.get(menuId) if (menu) { - let newtab = { + this.setState({menu: { ...menu, param: {} - } - - this.setState({menu: newtab}) + }}) } } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 7d5f9c3..7eb85d2 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -231,6 +231,10 @@ }) } + if (config.flow_code) { + regs.push({ reg: /@works_flow_code@/ig, value: config.flow_code }) + } + config.$cache = config.cacheLocal === 'true' config.$time = config.localCacheTime || 0 @@ -642,7 +646,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.pop() - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 4555cbd..2c36b13 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -123,6 +123,11 @@ }) } + if (Tab.$process && window.GLOB.UserCacheMap.has(Tab.$flowId)) { + let flow = window.GLOB.UserCacheMap.get(Tab.$flowId) + regs.push({ reg: /@works_flow_code@/ig, value: flow.flow_code || '' }) + } + config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid) // 鑾峰彇涓绘悳绱㈡潯浠� @@ -395,7 +400,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.pop() - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/home/index.jsx b/src/tabviews/home/index.jsx index d91ecef..d8b8d6c 100644 --- a/src/tabviews/home/index.jsx +++ b/src/tabviews/home/index.jsx @@ -39,7 +39,7 @@ check = (times) => { times++ - if ((window.GLOB.mkThdMenus.length > 0 && window.GLOB.mkActions.loaded) || times > 50) { + if ((window.GLOB.mkThdMenus.size > 0 && window.GLOB.mkActions.loaded) || times > 50) { this.setState({ waiting: false }) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 64cc21a..9f16abd 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -165,7 +165,7 @@ if (col.linkmenu && col.linkmenu.length > 0) { let menu_id = col.linkmenu.slice(-1)[0] - col.linkThdMenu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menu_id)[0] || '' + col.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' } else { col.linkThdMenu = '' } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index a3785f0..cc4a956 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -451,12 +451,6 @@ } } - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } - param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) @@ -492,12 +486,6 @@ param.key_back_type = 'Y' } } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -523,12 +511,6 @@ if (btn.output) { param.key_back_type = 'Y' } - } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } param.exec_type = 'y' // 鍚庡彴瑙g爜 @@ -596,12 +578,6 @@ param.key_back_type = 'Y' } } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -642,12 +618,6 @@ param.key_back_type = 'Y' } } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') - } param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -673,12 +643,6 @@ if (btn.output) { param.key_back_type = 'Y' } - } - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') - } else { - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } param.exec_type = 'y' // 鍚庡彴瑙g爜 @@ -769,7 +733,7 @@ } if (retmsg) { - param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, primaryId, this.props.BID) + param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, this.props.BID) } _params.push(param) @@ -819,7 +783,7 @@ } if (retmsg) { - param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, primaryId, this.props.BID) + param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, this.props.BID) } return param @@ -832,7 +796,7 @@ /** * @description 鑾峰彇鍥炶皟鑴氭湰鐨勫瓧娈靛畾涔� */ - getSysDeclareSql = (btn, formdata, data, columns, primaryId, BID = '') => { + getSysDeclareSql = (btn, formdata, data, columns, BID = '') => { let datavars = {} // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪 // 闇�瑕佸0鏄庣殑鍙橀噺闆� let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid'] @@ -999,20 +963,6 @@ /* 鏄剧ず鍒楀彉閲忚祴鍊� */ select ${_initColfields.join(',')} ` - } - - _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) - _sql = _sql.replace(/@BID@/ig, `'${BID}'`) - _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - _sql = _sql.replace(/@typename@/ig, `'admin'`) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _sql = _sql.replace(/@datam@/ig, '\'Y\'') - } else { - _sql = _sql.replace(/@datam@/ig, '\'\'') } return _sql @@ -1195,6 +1145,8 @@ * @description 鑷畾涔夎姹傚惊鐜墽琛� */ customLoopRequest = (params, _resolve) => { + const { setting, btn } = this.props + let param = params.shift() this.setState({ @@ -1206,6 +1158,10 @@ ID: param.ID || '', callbacksql: param.$callbacksql || '', mk_api_key: '' + } + + if (!record.ID && btn.Ot !== 'notRequired' && param[setting.primaryKey]) { + record.ID = param[setting.primaryKey] } delete param.$callbacksql @@ -1567,7 +1523,7 @@ param.func = 'sPC_TableData_InUpDe' if (record.BID) { - param.BID = this.props.BID + param.BID = record.BID } if (record.ID) { param.ID = record.ID @@ -1597,6 +1553,8 @@ if (btn.output) { _backCustomScript += ` aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` + + param.key_back_type = 'Y' } else { _backCustomScript += ` aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` @@ -1612,7 +1570,7 @@ sql = sql + _backCustomScript sql = sql.replace(/@ID@/ig, `'${record.ID || ''}'`) - sql = sql.replace(/@BID@/ig, `'${this.props.BID || ''}'`) + sql = sql.replace(/@BID@/ig, `'${record.BID || ''}'`) sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) @@ -1771,7 +1729,7 @@ * @description 澶栭儴璇锋眰寰幆鎵ц */ outerLoopRequest = (params, _resolve) => { - if (!params && params.length === 0) return + const { setting, btn } = this.props let param = params.shift() @@ -1783,6 +1741,10 @@ BID: param.BID || '', ID: param.ID || '', callbacksql: param.$callbacksql || '' + } + + if (!record.ID && btn.Ot !== 'notRequired' && param[setting.primaryKey]) { + record.ID = param[setting.primaryKey] } delete param.$callbacksql @@ -2200,22 +2162,22 @@ if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0 && sign !== '@no_target_menu@') { let menuId = btn.openmenu.slice(-1)[0] - let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!newtab && btn.MenuID) { - newtab = { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: id }} + } else if (btn.MenuID) { + menu = { MenuID: btn.MenuID, MenuName: btn.MenuName, - MenuNo: btn.MenuNo, - type: btn.tabType + type: btn.tabType, + param: { $BID: id } } - } else if (!newtab) { - return } - newtab = {...newtab, param: { $BID: id }} - - MKEmitter.emit('modifyTabs', newtab, true) + if (menu) { + MKEmitter.emit('modifyTabs', menu, true) + } } if (btn.execSuccess === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx index 184f2c8..c34cf31 100644 --- a/src/tabviews/zshare/actionList/tabbutton/index.jsx +++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx @@ -146,14 +146,16 @@ } } else if (btn.linkmenu && btn.linkmenu.length > 0) { let menuId = btn.linkmenu.slice(-1)[0] - let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + let menu = null - if (!menu && btn.MenuName && btn.MenuID) { + if (window.GLOB.mkThdMenus.has(menuId)) { + menu = {...window.GLOB.mkThdMenus.get(menuId), param: { $BID: primaryId }} + } else if (btn.MenuID) { menu = { MenuID: btn.MenuID, MenuName: btn.MenuName, - MenuNo: btn.MenuNo, - type: btn.tabType + type: btn.tabType, + param: { $BID: primaryId } } } @@ -166,12 +168,7 @@ return } - newtab = { - ...menu, - param: { - $BID: primaryId - } - } + newtab = menu } if (btn.openTab === 'view') { diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 7b3a720..29db100 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -41,7 +41,7 @@ sign = '' UNSAFE_componentWillMount () { - const { config } = this.props + const { config, BID } = this.props let _searchlist = [] let fieldMap = new Map() @@ -144,6 +144,8 @@ if (item.resourceType === '1' && item.dataSource) { let _option = Utils.getSelectQueryOptions(item) + _option.sql = _option.sql.replace(/@BID@/ig, `'${BID || ''}'`) + if (window.GLOB.debugger === true) { console.info(_option.sql) } diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 0ce29b4..669ef9e 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -3,12 +3,10 @@ import { is, fromJS } from 'immutable' import { DndProvider } from 'react-dnd' import HTML5Backend from 'react-dnd-html5-backend' -import moment from 'moment' import { Button, Card, Modal, Collapse, notification, Switch } from 'antd' import { SettingOutlined } from '@ant-design/icons' import Api from '@/api' -import Utils from '@/utils/utils.js' import { getModalForm } from '@/templates/zshare/formconfig' import SourceElement from './dragelement/source' @@ -392,26 +390,18 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) - ${res.dataSource}` - } + let sql = `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) + ${res.dataSource}` - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, config: _config, diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index 07c8db4..582c6b5 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -3,7 +3,6 @@ import { is, fromJS } from 'immutable' import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' -import moment from 'moment' import Utils from '@/utils/utils.js' import Api from '@/api' @@ -212,23 +211,8 @@ } } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail + sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) if (skip) { this.setState({ @@ -242,8 +226,8 @@ }) } else { this.setState({loading: true}) - Api.genericInterface(param).then(res => { - if (res.status) { + Api.sDebug(sql).then(res => { + if (res.status || res.ErrCode === '-2') { this.setState({ loading: false, editItem: null diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index cb4990f..7b474da 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -388,48 +388,100 @@ const { verify } = this.state let _columns = JSON.parse(JSON.stringify(verify.columns)) + let _names = {} + let _cols = _columns.map(item => { + let key = item.Column.toLowerCase() + _names[key] = item.Text - let _cols = _columns.map(col => col.Column) + return key + }) + let names = {$up: false} columns.forEach(col => { - if (col.field && !_cols.includes(col.field)) { - let _type = 'Nvarchar(50)' - let _limit = '50' - if (col.type === 'number' && !col.decimal) { - _type = 'Int' - _limit = '' - } else if (col.type === 'number') { - _type = 'Decimal(18,' + col.decimal + ')' - _limit = col.decimal + if (!col.field) return + let key = col.field.toLowerCase() + if (_cols.includes(key)) { + if (_names[key] !== col.label) { + names.$up = true + names[key] = col.label } - - let _cell = { - uuid: col.uuid, - Column: col.field, - Text: col.label, - type: _type, - limit: _limit, - import: 'true', - required: 'true' - } - - if (_type !== 'Nvarchar(50)') { - _cell.min = 0 - _cell.max = 999999 - } - - _columns.push(_cell) + return } + + let _type = 'Nvarchar(50)' + let _limit = '50' + if (col.type === 'number' && !col.decimal) { + _type = 'Int' + _limit = '' + } else if (col.type === 'number') { + _type = 'Decimal(18,' + col.decimal + ')' + _limit = col.decimal + } + + let _cell = { + uuid: col.uuid, + Column: col.field, + Text: col.label, + type: _type, + limit: _limit, + import: 'true', + required: 'true' + } + + if (_type !== 'Nvarchar(50)') { + _cell.min = 0 + _cell.max = 999999 + } + + _columns.push(_cell) }) - this.setState({ - verify: { - ...verify, - columns: _columns - } - }, () => { - this.resetUniqueColumns() - }) + if (names.$up) { + const that = this + + confirm({ + content: '閮ㄥ垎瀛楁鍚嶇О涓庢樉绀哄垪涓嶄竴鑷达紝鏄惁鏇存柊锛�', + onOk() { + _columns = _columns.map(item => { + let key = item.Column.toLowerCase() + + if (names[key]) { + item.Text = names[key] + } + + return item + }) + + that.setState({ + verify: { + ...verify, + columns: _columns + } + }, () => { + that.resetUniqueColumns() + }) + }, + onCancel() { + that.setState({ + verify: { + ...verify, + columns: _columns + } + }, () => { + that.resetUniqueColumns() + }) + } + }) + } else { + this.setState({ + verify: { + ...verify, + columns: _columns + } + }, () => { + this.resetUniqueColumns() + }) + } } clearField = () => { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx index 9f4f640..2bcd93c 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/customscript/index.jsx @@ -95,9 +95,19 @@ _usefulFields.push(item.field) _usefulFields.push(item.datefield) _usefulFields.push(item.datefield + '1') - } else if (['dateweek', 'datemonth', 'daterange'].includes(item.type)) { + } else if (['dateweek', 'datemonth'].includes(item.type)) { _usefulFields.push(item.field) _usefulFields.push(item.field + '1') + } else if (item.type === 'daterange') { + let _skey = item.field + let _ekey = item.field + '1' + + if (/,/.test(item.field)) { + _skey = item.field.split(',')[0] + _ekey = item.field.split(',')[1] + } + _usefulFields.push(_skey) + _usefulFields.push(_ekey) } else if (item.type === 'date' && _usefulFields.includes(item.field)) { _usefulFields.push(item.field + '1') } else { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index ebce7e5..85e463d 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -3,7 +3,6 @@ import { fromJS } from 'immutable' import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Spin, Typography, Popconfirm } from 'antd' import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' -import moment from 'moment' import md5 from 'md5' import Api from '@/api' @@ -600,11 +599,25 @@ const { verify } = this.state let columns = fromJS(verify.columns).toJS() - let fields = columns.map(item => item.Column) + let _names = {} + let fields = columns.map(item => { + let key = item.Column.toLowerCase() + _names[key] = item.Text + + return key + }) + let names = {$up: false} config.columns.forEach(item => { - if (fields.includes(item.field) || !item.field) return - fields.push(item.field) + if (!item.field) return + let key = item.field.toLowerCase() + if (fields.includes(key)) { + if (_names[key] !== item.label) { + names.$up = true + names[key] = item.label + } + return + } let cell = { Column: item.field, @@ -627,8 +640,15 @@ if (config.subtype === 'dualdatacard') { config.subColumns.forEach(item => { - if (fields.includes(item.field) || !item.field) return - fields.push(item.field) + if (!item.field) return + let key = item.field.toLowerCase() + if (fields.includes(key)) { + if (_names[key] !== item.label) { + names.$up = true + names[key] = item.label + } + return + } let cell = { Column: item.field, @@ -650,9 +670,37 @@ }) } - this.setState({ - verify: {...verify, columns: columns} - }) + if (names.$up) { + const that = this + + confirm({ + content: '閮ㄥ垎瀛楁鍚嶇О涓庢樉绀哄垪涓嶄竴鑷达紝鏄惁鏇存柊锛�', + onOk() { + columns = columns.map(item => { + let key = item.Column.toLowerCase() + + if (names[key]) { + item.Text = names[key] + } + + return item + }) + + that.setState({ + verify: {...verify, columns: columns} + }) + }, + onCancel() { + that.setState({ + verify: {...verify, columns: columns} + }) + } + }) + } else { + this.setState({ + verify: {...verify, columns: columns} + }) + } } clearField = () => { @@ -836,8 +884,7 @@ return } - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, '2023-04-20 15:29:37') + let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils) let _debugId = md5(sql) @@ -846,17 +893,8 @@ return } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: sql - } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = timestamp - param.secretkey = Utils.encrypt('', timestamp) - - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({debugId: _debugId}) _resolve() } else { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index 0d8cbf7..939f64d 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -5,7 +5,7 @@ /** * @description 鐢熸垚椤甸潰鏌ヨ璇彞 */ - static getDebugSql (verify, scripts, searches, Utils, timestamp) { + static getDebugSql (verify, scripts, searches, Utils) { let sql = '' let _dataresource = verify.dataresource || '' let regoptions = this.getRegOptions(searches) @@ -52,9 +52,9 @@ _dataresource = '(' + _dataresource + ') tb' } - _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) - _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) - _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) + _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) + _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) + _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') _tailScript = _tailScript.replace(/@\$|\$@/ig, '') @@ -107,14 +107,13 @@ } if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${declare} + sql = `${declare} ${_customScript} ${_dataresource} ${_tailScript} 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 '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { sql = `${declare} @@ -122,16 +121,12 @@ ${_tailScript} 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 '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `/* sql 楠岃瘉 */ - ${declare} + sql = `${declare} ${_dataresource}` } - sql = sql.replace(/\n\s{8}/ig, '\n') - console.info(sql) - sql = sql.replace(/\n/g, ' ') return sql } @@ -220,12 +215,29 @@ value: '0' }) options.push(item) - } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { + } else if (['datemonth', 'dateweek'].includes(search.type)) { options.push(item) options.push({ key: item.key + '1', value: '0' }) + } else if (search.type === 'daterange') { + let _skey = search.field + let _ekey = search.field + '1' + + if (/,/.test(search.field)) { + _skey = search.field.split(',')[0] + _ekey = search.field.split(',')[1] + } + + options.push({ + key: _skey, + value: '0' + }) + options.push({ + key: _ekey, + value: '0' + }) } else if (search.type === 'text' || search.type === 'select') { item.key.split(',').forEach(field => { let cell = JSON.parse(JSON.stringify(item)) diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 3feecc6..494b38b 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -637,8 +637,7 @@ sqlverify = (_resolve, _reject, scripts) => { const { verify, declareSql, debugId } = this.state - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - let sql = SettingUtils.getDebugSql(verify.setting || {}, verify.columns, scripts, declareSql, '2023-04-20 15:29:37') + let sql = SettingUtils.getDebugSql(verify.setting || {}, verify.columns, scripts, declareSql) let _debugId = md5(sql) @@ -647,17 +646,8 @@ return } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: sql - } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = timestamp - param.secretkey = Utils.encrypt('', timestamp) - - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({debugId: _debugId}) _resolve() } else { diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx index 969fa63..6e3b387 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx @@ -1,6 +1,6 @@ export default class SettingUtils { - static getDebugSql (setting, columns, scripts, declareSql, timestamp) { + static getDebugSql (setting, columns, scripts, declareSql) { let sql = '' let _dataresource = setting.dataresource || '' @@ -33,9 +33,9 @@ _dataresource = '(' + _dataresource + ') tb' } - _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) - _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) - _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) + _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) + _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) + _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') _tailScript = _tailScript.replace(/@\$|\$@/ig, '') @@ -64,33 +64,27 @@ } if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} + sql = `${_customScript} ${_dataresource} ${_tailScript} 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 '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else if (_tailScript) { - sql = `/* sql 楠岃瘉 */ - 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 = `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 ='' ${declareSql} ${_dataresource} ${_tailScript} 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 '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `/* sql 楠岃瘉 */ - 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 = `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 ='' ${declareSql} ${_dataresource}` } - sql = sql.replace(/\n\s{8}/ig, '\n') - console.info(sql) - sql = sql.replace(/\n/g, ' ') return sql } diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index 6eb1a3b..4d077d4 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -2,10 +2,8 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Modal, notification, Switch } from 'antd' -import moment from 'moment' import Api from '@/api' -import Utils from '@/utils/utils.js' import { getSearchForm } from '@/templates/zshare/formconfig' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' @@ -211,25 +209,16 @@ sqlVerifing: true }) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: res.dataSource - } + let sql = res.dataSource + sql = sql.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) - + let rduri = '' if (window.GLOB.mainSystemApi && res.database === 'sso') { - param.rduri = window.GLOB.mainSystemApi + rduri = window.GLOB.mainSystemApi } - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql, rduri).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ sqlVerifing: false, searchlist: _searchlist, diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 34b71e8..400b7d9 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -257,6 +257,8 @@ if (type === 'text' || type === 'select') { reTooltip.field = '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛岃繘琛岀患鍚堟悳绱€��' + } else if (type === 'daterange') { + reTooltip.field = '瀛楁鍚嶅彲浠ヤ娇鐢ㄩ�楀彿鍒嗛殧锛屼緥濡俿tartTime,endTime銆�' } else if (type === 'group') { reTooltip.field = '鏌ヨ鏁版嵁鏃讹紙鑷畾涔夎剼鏈垨缁熻鏁版嵁婧愶級锛岀被鍨嬪瓧娈靛皢鐢ㄤ綔鏇挎崲鑴氭湰涓殑 @瀛楁@ 锛岀被鍨嬪瓧娈靛搴斿�间负锛氭棩 -> day锛涘懆 -> week锛涙湀 -> month锛涘 -> quarter锛涘勾 -> year锛涜嚜瀹氫箟 -> customized' reLabel.field = '绫诲瀷瀛楁' @@ -463,7 +465,7 @@ ] if (item.key === 'field' || item.key === 'datefield') { rules.push({ - pattern: (type === 'text' || type === 'select') ? formRule.field.multipattern : formRule.field.pattern, + pattern: (type === 'text' || type === 'select' || type === 'daterange') ? formRule.field.multipattern : formRule.field.pattern, message: formRule.field.message }, { max: formRule.field.max, @@ -619,6 +621,15 @@ this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { values.uuid = this.props.card.uuid + + if (/,/.test(values.field)) { + values.field = values.field.split(',').filter(Boolean) + if (values.type === 'daterange' && values.field.length > 2) { + values.field.length = 2 + } + values.field = values.field.join(',') + } + // 涓嬫媺鑿滃崟鎴栬仈鍔ㄨ彍鍗� if (['multiselect', 'select', 'link', 'radio'].includes(values.type)) { if (values.resourceType === '0') { diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 5e8df8d..c796d48 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -156,10 +156,27 @@ value: '0' }) options.push(item) - } else if (['datemonth', 'dateweek', 'daterange'].includes(search.type)) { + } else if (['datemonth', 'dateweek'].includes(search.type)) { options.push(item) options.push({ key: item.key + '1', + value: '0' + }) + } else if (search.type === 'daterange') { + let _skey = search.field + let _ekey = search.field + '1' + + if (/,/.test(search.field)) { + _skey = search.field.split(',')[0] + _ekey = search.field.split(',')[1] + } + + options.push({ + key: _skey, + value: '0' + }) + options.push({ + key: _ekey, value: '0' }) } else if (search.type === 'text' || search.type === 'select') { @@ -299,16 +316,7 @@ } else if (type === 'scripts' && _scripts.length === 0) { _resolve() } else { // type 涓� submit 銆� verify 锛屼互鍙婂叾浠栭渶瑕侀獙璇佺殑鍦烘櫙 - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - let r = SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search, timestamp) - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: r.sql - } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = timestamp - param.secretkey = Utils.encrypt('', timestamp) + let r = SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search) if (r.errors) { notification.warning({ @@ -317,35 +325,10 @@ duration: 5 }) } - - let sumParam = null - if (r.sumSql) { - sumParam = { - func: 's_debug_sql', - exec_type: 'y', - LText: r.sumSql - } - sumParam.LText = Utils.formatOptions(sumParam.LText) - sumParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - sumParam.secretkey = Utils.encrypt('', sumParam.timestamp) - } - Api.genericInterface(param).then(result => { - if (result.status) { - if (sumParam) { - Api.genericInterface(sumParam).then(res => { - if (res.status) { - _resolve() - } else { - _reject() - Modal.error({ - title: res.message - }) - } - }) - } else { - _resolve() - } + Api.sDebug(r.sql).then(result => { + if (result.status || result.ErrCode === '-2') { + _resolve() } else { _reject() Modal.error({ diff --git a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx index 4b274f6..42ee457 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/simplescript/index.jsx @@ -299,22 +299,12 @@ _scripts.push(values) } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: SettingUtils.getCustomDebugSql(_scripts, this.props.regoptions) - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - param.LText = param.LText.replace(/\n/g, ' ') - - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + let sql = SettingUtils.getCustomDebugSql(_scripts, this.props.regoptions) + sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) this.setState({loading: true}) - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql).then(result => { + if (result.status || result.ErrCode === '-2') { this.setState({ loading: false, scripts: _scripts, diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx index 54a957d..aca603b 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx @@ -7,7 +7,7 @@ * @return {Object} setting 椤甸潰璁剧疆 * @return {Array} regoptions 鎼滅储鏉′欢姝e垯鏇挎崲 */ - static getDebugSql (setting, scripts, arr_field, regoptions, search, timestamp) { + static getDebugSql (setting, scripts, arr_field, regoptions, search) { let sql = '' let _dataresource = setting.dataresource || '' let _customScript = '' @@ -35,8 +35,8 @@ }) } - _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(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'1949-10-01 15:00:00'`) + _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid)@/ig, `'1949-10-01 15:00:00'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') @@ -99,26 +99,6 @@ }) } - let sumSql = '' - - if (arr_field && _dataresource && /\/\*\$sum@/ig.test(_dataresource)) { - let _sql = _dataresource.replace(/\/\*\$sum@|@sum\$\*\//ig, '') - _sql = `/*system_query*/${_sql} ${_search}` - if (_customScript) { - sumSql = `/* sql sum楠岃瘉 */ - ${_customScript} - ${_sql} - aaa: - if @ErrorCode!='' - 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(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}` - } - } - // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (arr_field && _dataresource) { if (/\s/.test(_dataresource)) { @@ -129,21 +109,16 @@ } if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} + sql = `${_customScript} ${_dataresource} aaa: if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `/* sql 楠岃瘉 */ - 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 = `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 = [] @@ -163,14 +138,7 @@ }) } - if (sumSql) { - sumSql = sumSql.replace(/\n\s{10}/ig, '\n') - console.info(sumSql) - sumSql = sumSql.replace(/\n/g, ' ') - } - sql = sql.replace(/\n/g, ' ') - - return { sql, sumSql, errors: errors.join('锛�') } + return { sql, errors: errors.join('锛�') } } /** @@ -205,10 +173,6 @@ _customScript = _customScript.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@userName@|@fullName@/ig, `''`) - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) - } // 姝e垯鏇挎崲 if (regoptions) { @@ -224,15 +188,12 @@ } if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} + sql = `${_customScript} 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 '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } - sql = sql.replace(/\n\s{8}/ig, '\n') - console.info(sql) return sql } diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index 31c37e5..46b7486 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -2,10 +2,8 @@ import PropTypes from 'prop-types' import { fromJS } from 'immutable' import { Form, notification, Modal, Spin, Tabs } from 'antd' -import moment from 'moment' import Api from '@/api' -import Utils from '@/utils/utils.js' import SettingUtils from './utils.jsx' import DataSource from './datasource' import asyncComponent from '@/utils/asyncComponent' @@ -134,19 +132,10 @@ } else if (type === 'scripts' && _scripts.length === 0) { _resolve() } else { // type 涓� submit 銆� verify 锛屼互鍙婂叾浠栭渶瑕侀獙璇佺殑鍦烘櫙 - let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: SettingUtils.getDebugSql(setting, _scripts, timestamp) - } - param.LText = param.LText.replace(/\n/g, ' ') - param.LText = Utils.formatOptions(param.LText) - param.timestamp = timestamp - param.secretkey = Utils.encrypt('', timestamp) + let sql = SettingUtils.getDebugSql(setting, _scripts) - Api.genericInterface(param).then(result => { - if (result.status) { + Api.sDebug(sql).then(result => { + if (result.status || result.ErrCode === '-2') { _resolve() } else { _reject() diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx index 80e7bc0..6d3c3f2 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx @@ -5,7 +5,7 @@ * @return {String} scripts 鑷畾涔夎剼鏈� * @return {Object} setting 椤甸潰璁剧疆 */ - static getDebugSql (setting, scripts, timestamp) { + static getDebugSql (setting, scripts) { let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}` let sql = '' let _dataresource = setting.dataresource || '' @@ -35,16 +35,10 @@ }) } - _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)@/ig, `'1949-10-01 15:00:00'`) + _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') - - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) - _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) - } // 姝e垯鏇挎崲 let _regoptions = [ @@ -68,20 +62,16 @@ } if (_customScript) { - sql = `/* sql 楠岃瘉 */ - ${_customScript} + sql = `${_customScript} ${_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 '1949-10-01 15:00:00',@ErrorCode, @retmsg,'1949-10-01 15:00:00' ` } else { - sql = `/* sql 楠岃瘉 */ - 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 = `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) return sql } diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index db78cd8..15ef63d 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -1417,7 +1417,7 @@ type: refresh.length === 0 ? 'radio' : 'select', key: 'popClose', label: '鍏抽棴鍚�', - initVal: card.popClose || 'never', + initVal: card.popClose || 'grid', required: true, options: [{ value: 'never', diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index 3aaa932..42a2cb0 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -27,7 +27,7 @@ checkcard: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'span', 'labelwidth', 'display', 'tooltip', 'extra', 'place', 'width', 'multiple', 'splitline', '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', 'place', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom', 'pickerMode'], - fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], + fileupload: ['readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'miniSet', 'splitline', 'marginTop', 'marginBottom', 'maxSize'], switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'linkSubField', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'], check: ['initval', 'openVal', 'closeVal', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'checkTip'], date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'place', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'], diff --git a/src/templates/zshare/unattended/index.jsx b/src/templates/zshare/unattended/index.jsx index abb8018..5953c0c 100644 --- a/src/templates/zshare/unattended/index.jsx +++ b/src/templates/zshare/unattended/index.jsx @@ -65,7 +65,7 @@ const { visible, actions, autoMatic } = this.state return ( - <div style={{display: 'inline-block'}}> + <> <Button className="mk-border-purple" onClick={this.trigger}><UserOutlined/> 鏃犱汉鍊煎畧</Button> <Modal title="鏃犱汉鍊煎畧" @@ -79,7 +79,7 @@ > <SettingForm actions={actions} autoMatic={autoMatic} wrappedComponentRef={(inst) => this.settingRef = inst}/> </Modal> - </div> + </> ) } } diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx index c0750c8..8b6cf31 100644 --- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx +++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx @@ -2,7 +2,6 @@ import PropTypes from 'prop-types' import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' -import moment from 'moment' import Utils from '@/utils/utils.js' import Api from '@/api' @@ -129,38 +128,18 @@ } } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: this.props.initsql + _prevCustomScript + _backCustomScript + tail - } + let sql = this.props.initsql + _prevCustomScript + _backCustomScript + tail if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { window.GLOB.funcs.forEach(item => { let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - param.LText = param.LText.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) }) } // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/@\$|\$@/ig, '') - - // check - param.LText = param.LText.replace(/\$check@|@check\$/ig, '') - - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'${param.timestamp}'`) - - console.info(`/* sql 楠岃瘉 */\n${param.LText.replace(/\n\s{6,20}/ig, '\n')}`) - - param.LText = param.LText.replace(/\n/g, ' ') - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') + sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|typename)@/ig, `'1949-10-01 15:00:00'`) if (skip) { this.setState({ @@ -174,8 +153,8 @@ }) } else { this.setState({loading: true}) - Api.genericInterface(param).then(res => { - if (res.status) { + Api.sDebug(sql).then(res => { + if (res.status || res.ErrCode === '-2') { this.setState({ loading: false, editItem: null diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx index 2af2b05..f345f99 100644 --- a/src/templates/zshare/verifycard/customform/index.jsx +++ b/src/templates/zshare/verifycard/customform/index.jsx @@ -1,7 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Select, Button, notification, Modal, Tooltip } from 'antd' -import moment from 'moment' import Utils from '@/utils/utils.js' import Api from '@/api' @@ -110,12 +109,7 @@ return } - let param = { - func: 's_debug_sql', - exec_type: 'y', - } - - param.LText = `${this.props.initsql} + let sql = `${this.props.initsql} /* 鑷畾涔夐獙璇� */ select @tbid='', @ErrorCode='',@retmsg='' select top 1 @tbid='X' from (${values.sql}) a @@ -129,30 +123,17 @@ if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { window.GLOB.funcs.forEach(item => { let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - param.LText = param.LText.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) }) } // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/@\$|\$@/ig, '') - - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) - } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`) - - console.info(`/* sql 楠岃瘉 */\n${param.LText.replace(/\n\s{10}/ig, '\n')}`) - - param.LText = param.LText.replace(/\n/g, ' ') - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) + sql = sql.replace(/@\$|\$@/ig, '') + sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'1949-10-01 15:00:00'`) this.setState({loading: true}) - Api.genericInterface(param).then(res => { - if (res.status) { + Api.sDebug(sql).then(res => { + if (res.status || res.ErrCode === '-2') { this.setState({ loading: false, editItem: null diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index 5d49e8c..bf078be 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -2,7 +2,6 @@ import PropTypes from 'prop-types' import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' -import moment from 'moment' import Utils from '@/utils/utils.js' import Api from '@/api' @@ -45,7 +44,7 @@ } handleConfirm = () => { - const { type } = this.props + const { type, workFlow } = this.props const { editItem, skip } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { @@ -172,37 +171,29 @@ } } - let param = { - func: 's_debug_sql', - exec_type: 'y', - LText: this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail - } + let sql = this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { window.GLOB.funcs.forEach(item => { let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - param.LText = param.LText.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) }) } // 鏁版嵁鏉冮檺 - param.LText = param.LText.replace(/@\$|\$@/ig, '') - // check - param.LText = param.LText.replace(/\$check@|@check\$/ig, '') + sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') + sql = sql.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'1949-10-01 15:00:00'`) - // 澶栬仈鏁版嵁搴撴浛鎹� - if (window.GLOB.externalDatabase !== null) { - param.LText = param.LText.replace(/@db@/ig, window.GLOB.externalDatabase) + if (window.GLOB.process && workFlow === 'true') { + sql = sql.replace(/@works_flow_code@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@works_flow_name@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@works_flow_param@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@works_flow_detail_id@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@status@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@statusname@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@work_group@/ig, `'1949-10-01 15:00:00'`) + sql = sql.replace(/@work_grade@/ig, `'1949-10-01 15:00:00'`) } - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.LText = param.LText.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${param.timestamp}'`) - - console.info(`/* sql 楠岃瘉 */\n${param.LText.replace(/\n\s{6,20}/ig, '\n')}`) - - param.LText = param.LText.replace(/\n/g, ' ') - param.LText = Utils.formatOptions(param.LText) - param.secretkey = Utils.encrypt('', param.timestamp) if (skip) { this.setState({ @@ -216,8 +207,8 @@ }) } else { this.setState({loading: true}) - Api.genericInterface(param).then(res => { - if (res.status) { + Api.sDebug(sql).then(res => { + if (res.status || res.ErrCode === '-2') { this.setState({ loading: false, editItem: null @@ -251,7 +242,7 @@ } selectScript = (value, option) => { - // const { flowType } = this.props + const { flowType } = this.props if (!value || !option) return @@ -266,8 +257,19 @@ } if (value === 'flowSql') { - value = `insert into s_my_works_flow ( works_flow_id,works_flow_code,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) - select @ID@,'娴佺▼缂栫爜','涓嬩竴姝ヨ鐢ㄥ埌鐨勫弬鏁颁覆','鑱屽憳鍒嗙粍','娴佺▼鑺傜偣id','鑱屽憳绛夌骇',@bid@,@UserID@,@UserName,@FullName` + if (flowType === 'start') { + value = `insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) + select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName + insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade) + select @works_flow_id@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@` + } else { + value = `insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) + select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName + insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade) + select @works_flow_id@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@` + } + + value = value.replace(/\n\s{8}/g, '\n') } _sql = _sql.replace(/\s{6}$/, '') diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 477f98b..3103749 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -573,7 +573,7 @@ if (window.GLOB.process) { _verify.workFlow = _verify.workFlow || 'false' - _verify.flowType = _verify.flowType || 'approval' + _verify.flowType = _verify.flowType || (card.sqlType === 'insert' ? 'start' : 'approval') _verify.flowSql = _verify.flowSql || 'true' } else { delete _verify.workFlow diff --git a/src/utils/utils.js b/src/utils/utils.js index 247f4b3..86577d3 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -546,8 +546,16 @@ } } - newsearches[item.key] = _startval - newsearches[item.key + '1'] = _endval + let _skey = item.key + let _ekey = item.key + '1' + + if (/,/.test(item.key)) { + _skey = item.key.split(',')[0] + _ekey = item.key.split(',')[1] + } + + newsearches[_skey] = _startval + newsearches[_ekey] = _endval } else if (item.type === 'text' || item.type === 'select') { item.key.split(',').forEach(field => { // 缁煎悎鎼滅储锛屾墍瀛楁鎷兼帴 newsearches[field] = item.value @@ -638,7 +646,15 @@ _endval = val[1] + '.000' } - searchText.push('(' + item.key + ' >= \'' + _startval + '\' AND ' + item.key + ' < \'' + _endval + '\')') + let _skey = item.key + let _ekey = item.key + + if (/,/.test(item.key)) { + _skey = item.key.split(',')[0] + _ekey = item.key.split(',')[1] + } + + searchText.push('(' + _skey + ' >= \'' + _startval + '\' AND ' + _ekey + ' < \'' + _endval + '\')') } else if (item.type === 'range') { let val = item.value.split(',') @@ -854,7 +870,9 @@ sql = sql.replace(/@db@/ig, window.GLOB.externalDatabase) } + sql = sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) sql = sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + sql = sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) sql = sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) return { @@ -1539,6 +1557,8 @@ } columns.forEach(col => { + if (col.field === 'works_flow_param') return + if (col.type === 'colspan' || col.type === 'old_colspan') { col.subcols.forEach(cell => { setField(cell) @@ -2085,6 +2105,62 @@ ` } + if (btn.$process && verify.workFlow === 'true' && window.GLOB.UserCacheMap.has(btn.$flowId)) { + let flow = window.GLOB.UserCacheMap.get(btn.$flowId) + let node = null + let line = null + let target = null + let status = 0 + let statusName = '' + let detailId = '' + + if (verify.flowSql === 'true') { + if (verify.flowType === 'start') { + target = flow.cells.filter(cell => cell.mknode === 'start')[0] + + if (target) { + detailId = target.id + status = target.mkdata.status + statusName = target.mkdata.statusName + } + } else if (_data.works_flow_param) { + node = JSON.parse(window.decodeURIComponent(window.atob(_data.works_flow_param))) + + if (node) { + line = flow.cells.filter(cell => cell.shape === 'edge' && cell.source.cell === node.id)[0] + } + + if (line) { + target = flow.cells.filter(cell => cell.id === line.target.cell)[0] + } + } + + if (target) { + _sql += ` + /* 宸ヤ綔娴侀粯璁ql */ + insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff) + select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName + insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade) + select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@ + ` + } + } + + _sql = _sql.replace(/@works_flow_code@/ig, `'${flow.flow_code}'`) + _sql = _sql.replace(/@works_flow_name@/ig, `'${flow.flow_name}'`) + if (target) { + let msg = {...target.mkdata, id: target.id} + _sql = _sql.replace(/@works_flow_param@/ig, `'${window.btoa(window.encodeURIComponent(JSON.stringify(msg)))}'`) + } else { + _sql = _sql.replace(/@works_flow_param@/ig, `''`) + } + _sql = _sql.replace(/@works_flow_detail_id@/ig, `'${detailId}'`) + _sql = _sql.replace(/@status@/ig, `'${status}'`) + _sql = _sql.replace(/@statusname@/ig, `'${statusName}'`) + _sql = _sql.replace(/@work_group@/ig, `'${sessionStorage.getItem('work_group') || ''}'`) + _sql = _sql.replace(/@work_grade@/ig, `'${sessionStorage.getItem('work_grade') || 0}'`) + } + if (_backCustomScript) { _sql += _backCustomScript } @@ -2124,9 +2200,9 @@ _sql = _sql.replace(/@typename@/ig, `'admin'`) if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _sql = _sql.replace(/@datam@/ig, '\'Y\'') + _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, `'Y'`) } else { - _sql = _sql.replace(/@datam@/ig, '\'\'') + _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) } if (window.GLOB.debugger === true) { @@ -2135,20 +2211,6 @@ } if (retmsg) { - _callbacksql = _callbacksql.replace(/@ID@/ig, `'${primaryId || ''}'`) - _callbacksql = _callbacksql.replace(/@BID@/ig, `'${BID}'`) - _callbacksql = _callbacksql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) - _callbacksql = _callbacksql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) - _callbacksql = _callbacksql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) - _callbacksql = _callbacksql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) - _callbacksql = _callbacksql.replace(/@typename@/ig, `'admin'`) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - _callbacksql = _callbacksql.replace(/@datam@/ig, '\'Y\'') - } else { - _callbacksql = _callbacksql.replace(/@datam@/ig, '\'\'') - } - return { sql: _sql, callbacksql: _callbacksql diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 9ec20db..53a7629 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -36,6 +36,7 @@ const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +// const Debug = asyncComponent(() => import('@/menu/debug')) const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const Versions = asyncComponent(() => import('@/menu/versions')) const TableNodes = asyncComponent(() => import('@/menu/tablenodes')) @@ -1108,7 +1109,7 @@ return ( <ConfigProvider locale={_locale}> - <Header /> + <Header menuName={config ? config.MenuName : ''}/> <DndProvider backend={HTML5Backend}> {view !== 'popview' ? <div className={'pc-menu-view ' + (MenuType || '')}> <div className="menu-body"> @@ -1159,8 +1160,9 @@ </Collapse> </div> <div className={'menu-view' + (menuloading ? ' saving' : '') + (eyeopen ? ' eye-open' : '')}> - <Card title={config ? config.MenuName : ''} bordered={false} extra={ + <Card bordered={false} extra={ <div className="mk-opeartion-list"> + {/* <Debug config={config}/> */} <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 缁勪欢鍚�</Button> <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> <TableNodes config={config} /> diff --git a/src/views/menudesign/index.scss b/src/views/menudesign/index.scss index 2916916..3c97cf2 100644 --- a/src/views/menudesign/index.scss +++ b/src/views/menudesign/index.scss @@ -189,8 +189,8 @@ button { margin-left: 10px; } - >div >div >button, .style-control-button { - padding: 0px 7px; + .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { + padding: 0px 10px; } .ant-switch.big { min-width: 60px; diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index 3f11727..d8ca857 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -32,8 +32,10 @@ let values = event.newValue values = JSON.parse(values) - window.GLOB.mkThdMenus = values.mkThdMenus window.GLOB.mkActions = values.mkActions + values.mkThdMenus && values.mkThdMenus.forEach(item => { + window.GLOB.mkThdMenus.set(item.MenuID, item) + }) } else if (event.key === 'menuUpdate') { let vals = event.newValue.split(',') let MenuId = vals[1] diff --git a/src/views/mobdesign/index.scss b/src/views/mobdesign/index.scss index 2ef712e..3753c8f 100644 --- a/src/views/mobdesign/index.scss +++ b/src/views/mobdesign/index.scss @@ -323,7 +323,7 @@ } } .menu-control { - .back-view, .mk-view-paste, .quote-wrap, .mk-sys-interface, .set-home, .set-login, .mk-replace-field { + .quote-wrap, .set-home, .set-login { display: none!important; } } diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index ab31a4f..fd5c387 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -34,6 +34,7 @@ const BgController = asyncComponent(() => import('@/pc/bgcontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +// const Debug = asyncComponent(() => import('@/menu/debug')) const Versions = asyncComponent(() => import('@/menu/versions')) const Transfer = asyncComponent(() => import('@/menu/transfer')) const Unattended = asyncComponent(() => import('@/templates/zshare/unattended')) @@ -822,7 +823,7 @@ return ( <ConfigProvider locale={_locale}> - <Header /> + <Header menuName={config ? config.MenuName : ''}/> <DndProvider backend={HTML5Backend}> {view !== 'popview' ? <div className="pc-table-view"> <div className="menu-body"> @@ -869,10 +870,9 @@ </Collapse> </div> <div className={'menu-view' + (menuloading ? ' saving' : '')}> - <Card title={ - <div style={{paddingLeft: '15px'}}> {config && config.MenuName} </div> - } bordered={false} extra={ - <div> + <Card bordered={false} extra={ + <div className="mk-opeartion-list"> + {/* {config ? <Debug config={config}/> : null} */} {config ? <Transfer config={config}/> : null} {config ? <Unattended config={config} updateConfig={this.updateConfig}/> : null} <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> diff --git a/src/views/tabledesign/index.scss b/src/views/tabledesign/index.scss index 9a2c961..a3be304 100644 --- a/src/views/tabledesign/index.scss +++ b/src/views/tabledesign/index.scss @@ -148,8 +148,8 @@ button { margin-left: 15px; } - >div >div >button, .style-control-button { - padding: 0px 7px; + .mk-opeartion-list button:not(.ant-switch):not(:last-child):not(:nth-last-child(2)) { + padding: 0px 10px; } .ant-switch.big { min-width: 60px; -- Gitblit v1.8.0