From ae170a9d58b4f91a225eada1dc83ed4a116b8d50 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 25 八月 2024 00:57:37 +0800 Subject: [PATCH] 2024-08-25 --- src/mob/searchconfig/index.jsx | 18 src/tabviews/custom/components/editor/braft-editor/index.jsx | 8 src/menu/components/share/markcomponent/index.jsx | 6 src/views/basedesign/updateFormTab/index.jsx | 4 src/tabviews/custom/components/share/braftContent/index.scss | 18 src/menu/components/card/balcony/options.jsx | 1 src/tabviews/zshare/settingcomponent/index.jsx | 49 src/templates/zshare/verifycard/customscript/index.jsx | 35 src/tabviews/custom/popview/index.jsx | 7 src/mob/components/navbar/normal-navbar/menus/index.jsx | 12 src/templates/modalconfig/index.jsx | 18 src/mob/modalconfig/index.jsx | 14 public/README.txt | 4 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 6 src/tabviews/zshare/actionList/changeuserbutton/index.jsx | 8 src/menu/datasource/verifycard/index.jsx | 35 src/utils/sqlFormatter.js | 46 src/menu/components/carousel/data-card/options.jsx | 5 src/menu/components/card/cardcellcomponent/index.jsx | 6 src/menu/components/card/data-card/options.jsx | 9 src/menu/components/form/tab-form/index.jsx | 24 src/mob/components/menubar/normal-menubar/index.jsx | 6 src/tabviews/custom/components/table/normal-table/index.jsx | 130 src/menu/components/carousel/prop-card/index.jsx | 4 src/menu/components/search/main-search/dragsearch/card.jsx | 9 src/templates/subtableconfig/index.jsx | 4 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 22 src/tabviews/custom/components/editor/braft-editor/index.scss | 23 src/menu/components/share/actioncomponent/actionform/index.jsx | 10 src/tabviews/custom/index.jsx | 6 src/views/menudesign/index.scss | 5 src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx | 14 src/menu/components/card/prop-card/index.jsx | 4 src/menu/components/table/normal-table/columns/index.jsx | 16 src/templates/sharecomponent/treesettingcomponent/index.jsx | 22 src/menu/components/table/edit-table/columns/index.jsx | 16 src/menu/components/timeline/normal-timeline/options.jsx | 1 src/menu/datasource/verifycard/utils.jsx | 22 src/views/design/header/index.jsx | 113 src/views/menudesign/popview/index.jsx | 2 src/views/printTemplate/index.jsx | 6 src/templates/comtableconfig/index.jsx | 4 src/menu/components/tabs/table-tabs/index.jsx | 6 src/menu/components/form/simple-form/options.jsx | 1 src/menu/components/form/simple-form/index.jsx | 12 src/tabviews/custom/components/table/edit-table/index.jsx | 55 src/views/tabledesign/index.jsx | 16 src/api/index.js | 36 src/templates/sharecomponent/cardcomponent/index.jsx | 10 src/templates/sharecomponent/tabscomponent/index.jsx | 18 src/menu/components/carousel/data-card/index.jsx | 4 src/menu/components/form/step-form/index.jsx | 24 src/views/pcdesign/index.jsx | 4 src/menu/components/share/actioncomponent/index.jsx | 8 src/menu/urlfieldcomponent/index.jsx | 4 src/menu/components/search/main-search/index.jsx | 6 src/menu/components/table/edit-table/columns/tableIn/customscript/index.jsx | 4 src/menu/components/share/colsControl/index.jsx | 12 src/utils/utils-datamanage.js | 82 src/menu/picturecontroller/index.jsx | 8 src/templates/zshare/editTable/index.jsx | 6 src/menu/components/editor/braft-editor/options.jsx | 27 src/menu/components/card/table-card/index.jsx | 4 src/mob/components/tabs/antv-tabs/index.jsx | 6 src/menu/components/share/searchcomponent/index.jsx | 8 src/utils/utils-custom.js | 2620 +++++++++++++++++++++++++++ src/templates/comtableconfig/updatetable/index.jsx | 8 src/views/design/header/editfirstmenu/index.jsx | 4 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 8 src/templates/treepageconfig/index.jsx | 4 public/options.json | 2 src/menu/datasource/index.jsx | 105 src/tabviews/basetable/index.jsx | 20 src/views/billprint/index.jsx | 6 src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 22 src/menu/components/editor/braft-editor/index.scss | 23 src/tabviews/zshare/actionList/normalbutton/index.jsx | 102 src/views/mobdesign/index.jsx | 7 src/views/tabledesign/index.scss | 5 src/views/interface/history/index.jsx | 4 src/views/menudesign/index.jsx | 16 src/tabviews/custom/components/card/data-card/index.jsx | 165 src/menu/replaceField/settingform/index.jsx | 4 src/api/cacheutils.js | 6 src/tabviews/custom/components/module/voucher/index.jsx | 4 src/menu/components/card/double-data-card/index.jsx | 4 src/views/tabledesign/popview/index.scss | 5 src/menu/components/card/data-card/index.jsx | 4 src/menu/components/table/base-table/columns/index.jsx | 4 src/views/appmanage/index.jsx | 26 src/menu/debug/index.jsx | 352 +- src/menu/components/tabs/antv-tabs/index.jsx | 6 src/menu/components/group/normal-group/index.jsx | 6 src/tabviews/zshare/actionList/index.scss | 3 src/templates/sharecomponent/settingcomponent/index.jsx | 68 src/views/design/index.jsx | 4 src/tabviews/custom/components/table/base-table/index.jsx | 128 src/components/header/index.jsx | 4 src/tabviews/custom/components/card/double-data-card/index.jsx | 150 src/templates/zshare/verifycard/callbackcustomscript/index.jsx | 12 src/menu/transfer/index.jsx | 6 src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx | 36 src/templates/sharecomponent/searchcomponent/index.jsx | 8 src/views/rolemanage/index.jsx | 18 src/templates/sharecomponent/fieldscomponent/index.jsx | 24 src/views/billprint/index.scss | 3 src/templates/sharecomponent/columncomponent/index.jsx | 8 src/templates/zshare/verifycard/customform/index.jsx | 12 src/tabviews/custom/components/share/normalTable/index.jsx | 71 src/menu/components/form/step-form/options.jsx | 1 src/pc/components/navbar/normal-navbar/linksetting/linktable/index.jsx | 4 src/menu/components/search/main-search/index.scss | 4 src/templates/sharecomponent/settingcomponent/settingform/utils.jsx | 24 src/utils/utils.js | 113 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 4 src/index.js | 39 src/components/normalform/modalform/index.jsx | 6 src/templates/treepageconfig/updatetable/index.jsx | 8 src/menu/components/table/base-table/options.jsx | 13 src/templates/zshare/verifycard/index.jsx | 68 src/tabviews/zshare/actionList/printbutton/index.jsx | 12 src/templates/sharecomponent/actioncomponent/index.jsx | 8 src/menu/components/editor/braft-editor/index.jsx | 17 src/menu/modalconfig/index.jsx | 20 src/views/menudesign/popview/index.scss | 5 src/views/tabledesign/popview/index.jsx | 2 src/templates/sharecomponent/chartgroupcomponent/index.jsx | 10 127 files changed, 4,187 insertions(+), 1,401 deletions(-) diff --git a/public/README.txt b/public/README.txt index c277902..d1ff2b5 100644 --- a/public/README.txt +++ b/public/README.txt @@ -14,8 +14,8 @@ WXMerchID -- 浣跨敤寰俊鏀粯鏃讹紝缁戝畾鐨勫晢鎴稩D WXNotice -- 鏄惁寮�鍚槑绉戜簯鍏紬鍙锋秷鎭彁閱掞紝鍊间负 true 鏃跺紑鍚紝鍙�氳繃鏄庣浜戝彂閫佹ā鏉挎秷鎭� WXApps -- 瀛樺湪澶氫釜鍏紬鍙枫�佸皬绋嬪簭鎴栧晢鎴锋椂鍙娇鐢ㄥ井淇PP鍒楄〃锛屾敞鎰忓~鍐欓粯璁ゅ叕浼楀彿銆佸皬绋嬪簭涓庡晢鎴峰彿锛屾牸寮� [{"appId": "", "appName": "", "appType": "public/miniProgram/merchant"}] -debugger -- 鍊间负 true 鏃跺紑鍚皟璇曟ā寮忥紝寮�鍚悗绉诲姩绔瓙搴旂敤涓細鏈夋帶鍒跺彴 -devTools -- 鍊间负 false 鏃朵笉鍏佽浣跨敤璋冭瘯妯″紡 +debugger -- 鍊间负 true 鏃跺紑鍚皟璇曟ā寮忥紝寮�鍚悗绉诲姩绔瓙搴旂敤涓細鏈夋帶鍒跺彴锛屽�间负 forbid 鏃讹紝绂佹绯荤粺鎵撳嵃鑴氭湰 +systemRun -- 绯荤粺鎺ュ彛鐨勬墽琛屾柟寮忥紝鍊间负 backend 鏃讹紝鍦ㄥ悗绔繍琛� licenseKey -- 璁稿彲瀵嗛挜锛屽湪鍐呴儴缃戠粶涓娇鐢ㄧ郴缁熸椂锛屼細璺宠繃epc楠岃瘉 storeKey -- 鐢靛瓙妗f鏈湴鎺堟潈鐮侊紝浣跨敤鏈湴璁稿彲瀵嗛挜鏃舵湁鏁� probation -- 璇曠敤鏈燂紙YYYY-MM-DD锛夛紝鍦ㄦ寮忕郴缁熶腑锛岃瘯鐢ㄦ湡鍐呰皟鐢ㄧ郴缁熸帴鍙g殑鑴氭湰浼氳褰曚笅鏉� diff --git a/public/options.json b/public/options.json index 3886983..73a3d76 100644 --- a/public/options.json +++ b/public/options.json @@ -13,7 +13,7 @@ "WXMerchID": "", "WXNotice": "true", "debugger": true, - "devTools": true, + "systemRun": "backend", "licenseKey": "", "storeKey": "", "probation": "", diff --git a/src/api/cacheutils.js b/src/api/cacheutils.js index 3184290..b20d3f6 100644 --- a/src/api/cacheutils.js +++ b/src/api/cacheutils.js @@ -27,9 +27,9 @@ if (!window.GLOB.IndexDB.objectStoreNames.contains('caches')) { window.GLOB.IndexDB.createObjectStore('caches', { keyPath: 'menuid' }) } - if (!window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { - window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) - } + // if (!window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { + // window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) + // } } } catch (e) { console.warn('IndexedDB 鍒濆鍖栧け璐ワ紒') diff --git a/src/api/index.js b/src/api/index.js index 8a0eef2..c4e0369 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -527,26 +527,26 @@ /** * @description 鑾峰彇鎴栦慨鏀圭郴缁熼厤缃紝澧炲姞appkey */ - getSystemFuncs (time) { - let param = { - func: 's_get_func_base_sso', - update_date: time, - userid: sessionStorage.getItem('UserID') || '', - lang: sessionStorage.getItem('lang') || '', - SessionUid: localStorage.getItem('SessionUid') || '', - LoginUID: sessionStorage.getItem('LoginUID') || '', - appkey: window.GLOB.appkey - } + // getSystemFuncs (time) { + // let param = { + // func: 's_get_func_base_sso', + // update_date: time, + // userid: sessionStorage.getItem('UserID') || '', + // lang: sessionStorage.getItem('lang') || '', + // SessionUid: localStorage.getItem('SessionUid') || '', + // LoginUID: sessionStorage.getItem('LoginUID') || '', + // appkey: window.GLOB.appkey + // } - let url = window.GLOB.mainSystemApi || '/webapi/dostars' - param = this.encryptParam(param) + // let url = window.GLOB.mainSystemApi || '/webapi/dostars' + // param = this.encryptParam(param) - return axios({ - url: `${url}/${param.func}`, - method: 'post', - data: JSON.stringify(param) - }) - } + // return axios({ + // url: `${url}/${param.func}`, + // method: 'post', + // data: JSON.stringify(param) + // }) + // } /** * @description 鑾峰彇鎴栦慨鏀圭郴缁熼厤缃紝澧炲姞appkey diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 98aeee4..2edc3e1 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -117,7 +117,7 @@ logout = () => { const { dict } = this.state // 閫�鍑虹櫥褰� - let _this = this + let that = this confirm({ title: dict['logout_query'] || '鎮ㄧ‘瀹氳閫�鍑哄悧锛�', content: '', @@ -125,7 +125,7 @@ cancelText: dict['cancel'] || '鍙栨秷', onOk() { sessionStorage.clear() - _this.props.history.replace('/login') + that.props.history.replace('/login') window.location.reload() }, onCancel() {} diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index 544716e..0ab789f 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -135,10 +135,8 @@ cell.$ctrls = cell.$ctrls || [] cell.$ctrls.push(key) - if (cell.hidden) return - - if (cell.skip && supItem.forbid) { // 涓婄骇琛ㄥ崟绂佺敤鏃讹紝姝よ〃鍗曚笉鍙楁帶鍒� - + if (cell.hidden) { + } else if (supItem.hidden) { cell.hidden = true } else if (item.notNull) { diff --git a/src/index.js b/src/index.js index 0d9c020..8d0c45c 100644 --- a/src/index.js +++ b/src/index.js @@ -345,36 +345,21 @@ GLOB.memberLevel = 0 } - if (config.devTools === false) { + if (config.systemRun === 'backend') { + Object.defineProperty(window, 'backend', { + writable: false, + value: true + }) + } + if (config.debugger === 'forbid') { sessionStorage.removeItem('breakpoint') GLOB.debugger = false - let getVal = () => { - let _i = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight - let _h = window.outerHeight - _i - 200 - let _w = window.outerWidth - window.innerWidth - 100 - - return Math.max(_h, _w) - } - - if (getVal() > 0) { - document.body.innerHTML = '<div style="text-align: center; font-size: 30px; padding-top: 40vh;">鏈郴缁熺姝娇鐢ㄦ帶鍒跺彴锛岃鍏抽棴鎺у埗鍙伴噸鏂板埛鏂帮紒</div>' - return - } else { - let timer = null - window.addEventListener('resize', () => { - timer && clearTimeout(timer) - - if (getVal() > 0) { - timer = setTimeout(() => { - document.body.innerHTML = '<div style="text-align: center; font-size: 30px; padding-top: 40vh;">鏈郴缁熺姝娇鐢ㄦ帶鍒跺彴锛岃鍏抽棴鎺у埗鍙伴噸鏂板埛鏂帮紒</div>' - }, 100) - } - }) - } - } - - if (GLOB.sysType === 'cloud') { + Object.defineProperty(GLOB, 'debugger', { + writable: false, + value: GLOB.debugger + }) + } else if (GLOB.sysType === 'cloud') { Object.defineProperty(GLOB, 'debugger', { writable: false, value: GLOB.debugger diff --git a/src/menu/components/card/balcony/options.jsx b/src/menu/components/card/balcony/options.jsx index 3361862..519d5b1 100644 --- a/src/menu/components/card/balcony/options.jsx +++ b/src/menu/components/card/balcony/options.jsx @@ -170,7 +170,6 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 5f36a3a..d6fa1a5 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -566,17 +566,17 @@ */ deleteElement = (card) => { const { elements } = this.state - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍏冪礌鍚楋紵', onOk() { let _elements = elements.filter(item => item.uuid !== card.uuid) - _this.setState({ + that.setState({ elements: _elements }, () => { - _this.props.updateElement(_elements) + that.props.updateElement(_elements) }) }, onCancel() {} diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index 7bb0284..6e8d9fd 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -182,14 +182,14 @@ */ deleteCard = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx index 1e59f01..ad0ad59 100644 --- a/src/menu/components/card/data-card/options.jsx +++ b/src/menu/components/card/data-card/options.jsx @@ -161,7 +161,7 @@ {value: 'public', label: '鍏叡鏁版嵁婧�', priKeyType: 'static'}, ], linkFields: ['priKeyType'], - controlFields: [ + controlFields: subtype === 'propcard' ? [ {field: 'goback', values: ['dynamic', 'public']}, {field: 'empty', values: ['dynamic', 'public']}, {field: 'jump', values: ['dynamic', 'public']}, @@ -169,7 +169,7 @@ {field: 'supModule', values: ['static']}, {field: 'publicId', values: ['public']}, {field: 'emptyExec', values: ['dynamic', 'public']}, - ], + ] : null, forbid: subtype !== 'propcard' }, { @@ -440,9 +440,9 @@ {value: 'normal', label: '姝e父鏄剧ず'}, {value: 'hidden', label: '涓嶅彲瑙�'}, ], - controlFields: [ + controlFields: subtype === 'propcard' ? [ {field: 'empty', values: ['normal']}, - ], + ] : null, forbid: subtype !== 'propcard' }, { @@ -452,7 +452,6 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, diff --git a/src/menu/components/card/double-data-card/index.jsx b/src/menu/components/card/double-data-card/index.jsx index cedcc93..62a639f 100644 --- a/src/menu/components/card/double-data-card/index.jsx +++ b/src/menu/components/card/double-data-card/index.jsx @@ -176,14 +176,14 @@ */ deleteCard = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index 9f17c5f..85ce70f 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -161,14 +161,14 @@ */ deleteCard = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index 5672f99..0f61b77 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -164,14 +164,14 @@ */ deleteCard = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx index 2d4401d..27bd2fd 100644 --- a/src/menu/components/carousel/data-card/index.jsx +++ b/src/menu/components/carousel/data-card/index.jsx @@ -141,14 +141,14 @@ */ deleteCard = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/carousel/data-card/options.jsx b/src/menu/components/carousel/data-card/options.jsx index f7ba65c..cf5156a 100644 --- a/src/menu/components/carousel/data-card/options.jsx +++ b/src/menu/components/carousel/data-card/options.jsx @@ -54,9 +54,9 @@ {value: 'dynamic', label: '鍔ㄦ��'}, {value: 'static', label: '闈欐��'}, ], - controlFields: [ + controlFields: subtype === 'propcard' ? [ {field: 'empty', values: ['dynamic']}, - ], + ] : null, forbid: subtype !== 'propcard' }, { @@ -197,7 +197,6 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx index b1719c7..194fc41 100644 --- a/src/menu/components/carousel/prop-card/index.jsx +++ b/src/menu/components/carousel/prop-card/index.jsx @@ -140,14 +140,14 @@ */ deleteCard = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎鍗$墖鍚楋紵', onOk() { card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx index 6557e9c..ba933e2 100644 --- a/src/menu/components/editor/braft-editor/index.jsx +++ b/src/menu/components/editor/braft-editor/index.jsx @@ -55,8 +55,15 @@ this.updateComponent(_card) } else { + let _card = fromJS(card).toJS() + + if (_card.wrap.firstTr === 'light') { + _card.wrap.tbStyle = 'th-light' + delete _card.wrap.firstTr + } + this.setState({ - card: fromJS(card).toJS() + card: _card }) } } @@ -139,6 +146,10 @@ updateWrap = (res) => { const { card } = this.state + if (res.tbStyle) { + res.tbStyle = res.tbStyle.join(' ') + } + let _card = {...card, wrap: res} if (res.datatype === 'public') { @@ -173,11 +184,11 @@ let style = {...card.style} return ( - <div className={'menu-normal-editor-box ' + (card.wrap.firstTr || '')} style={style} onClick={this.clickComponent} id={card.uuid}> + <div className={'menu-normal-editor-box ' + (card.wrap.tbStyle || '')} style={style} onClick={this.clickComponent} id={card.uuid}> <NormalHeader hideSearch="true" config={card} updateComponent={this.updateComponent}/> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <NormalForm title="瀵屾枃鏈缃�" width={750} update={this.updateWrap} getForms={this.getWrapForms}> + <NormalForm title="瀵屾枃鏈缃�" width={850} update={this.updateWrap} getForms={this.getWrapForms}> <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <CopyComponent type="editor" card={card}/> diff --git a/src/menu/components/editor/braft-editor/index.scss b/src/menu/components/editor/braft-editor/index.scss index aa55923..6e533e8 100644 --- a/src/menu/components/editor/braft-editor/index.scss +++ b/src/menu/components/editor/braft-editor/index.scss @@ -25,15 +25,34 @@ color: #bcbcbc; } } -.menu-normal-editor-box.light { +.menu-normal-editor-box.th-light { .braft-content { table { tr:first-child { - background-color:#ffffff; + background-color:transparent; } } } } +.menu-normal-editor-box.no-border { + .braft-content { + table { + td, th { + border: none!important; + } + tr td:first-child { + padding-left: 0px; + } + } + } +} +.menu-normal-editor-box.tb-flex { + .braft-content { + table { + table-layout: fixed; + } + } +} .menu-normal-editor-box::after { display: block; content: ' '; diff --git a/src/menu/components/editor/braft-editor/options.jsx b/src/menu/components/editor/braft-editor/options.jsx index e0bb4a2..d3f260f 100644 --- a/src/menu/components/editor/braft-editor/options.jsx +++ b/src/menu/components/editor/braft-editor/options.jsx @@ -125,24 +125,35 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, ], }, { - type: 'radio', - field: 'firstTr', - label: '琛ㄦ牸棣栬', - initval: wrap.firstTr || 'deep', - tooltip: '瀵屾枃鏈腑table鐨勯琛岃儗鏅鑹层��', + type: 'checkbox', + field: 'tbStyle', + label: '琛ㄦ牸鏍峰紡', + initval: wrap.tbStyle ? wrap.tbStyle.split(' ') : [], required: false, options: [ - {value: 'deep', label: '娣辫壊'}, - {value: 'light', label: '娴呰壊'}, + {value: 'th-light', label: '琛ㄥご閫忔槑'}, + {value: 'no-border', label: '鏃犺竟妗�'}, + {value: 'tb-flex', label: '鍒楃瓑瀹�'}, ] }, + // { + // type: 'radio', + // field: 'firstTr', + // label: '琛ㄦ牸棣栬', + // initval: wrap.firstTr || 'deep', + // tooltip: '瀵屾枃鏈腑table鐨勯琛岃儗鏅鑹层��', + // required: false, + // options: [ + // {value: 'deep', label: '娣辫壊'}, + // {value: 'light', label: '娴呰壊'}, + // ] + // }, { type: 'radio', field: 'permission', diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx index a159f9b..60e1f9f 100644 --- a/src/menu/components/form/simple-form/index.jsx +++ b/src/menu/components/form/simple-form/index.jsx @@ -241,7 +241,7 @@ changecols = (type) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this card.subcards[0].fields = card.subcards[0].fields.map(item => { item.labelwidth = 33.3 @@ -267,7 +267,7 @@ confirm({ content: `纭畾鍒囨崲涓�${type}鍒楀悧锛焋, onOk() { - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) @@ -288,14 +288,14 @@ closeForm = (cell) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this card.subcards[0].fields = card.subcards[0].fields.filter(item => item.uuid !== cell.uuid) confirm({ content: `纭畾鍒犻櫎<<${cell.label}>>鍚楋紵`, onOk() { - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) @@ -503,14 +503,14 @@ clearGroup = () => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this card.subcards[0].fields = [] confirm({ content: `纭畾娓呯┖琛ㄥ崟鍚楋紵`, onOk() { - _this.updateComponent(card) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/form/simple-form/options.jsx b/src/menu/components/form/simple-form/options.jsx index a1a4dc4..ab8acc7 100644 --- a/src/menu/components/form/simple-form/options.jsx +++ b/src/menu/components/form/simple-form/options.jsx @@ -233,7 +233,6 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx index 4395d59..dd5790b 100644 --- a/src/menu/components/form/step-form/index.jsx +++ b/src/menu/components/form/step-form/index.jsx @@ -273,7 +273,7 @@ closeGroup = (cell) => { const { group } = this.state let card = fromJS(this.state.card).toJS() - const _this = this + const that = this confirm({ content: '纭畾鍒犻櫎鍒嗙粍鍚楋紵', @@ -285,8 +285,8 @@ _group = card.subcards[0] || null } - _this.setState({group: _group}) - _this.updateComponent(card) + that.setState({group: _group}) + that.updateComponent(card) }, onCancel() {} }) @@ -317,7 +317,7 @@ changecols = (type) => { let card = fromJS(this.state.card).toJS() let config = fromJS(this.state.group).toJS() - let _this = this + let that = this config.fields = config.fields.map(item => { item.labelwidth = 33.3 @@ -349,8 +349,8 @@ } return item }) - _this.setState({group: config}) - _this.updateComponent(card) + that.setState({group: config}) + that.updateComponent(card) }, onCancel() {} }) @@ -380,7 +380,7 @@ closeForm = (cell) => { let group = fromJS(this.state.group).toJS() let card = fromJS(this.state.card).toJS() - let _this = this + let that = this group.fields = group.fields.filter(item => item.uuid !== cell.uuid) @@ -394,8 +394,8 @@ confirm({ content: `纭畾鍒犻櫎<<${cell.label}>>鍚楋紵`, onOk() { - _this.setState({group}) - _this.updateComponent(card) + that.setState({group}) + that.updateComponent(card) }, onCancel() {} }) @@ -571,7 +571,7 @@ clearGroup = () => { let group = fromJS(this.state.group).toJS() let card = fromJS(this.state.card).toJS() - let _this = this + let that = this group.fields = [] @@ -585,8 +585,8 @@ confirm({ content: `纭畾娓呯┖琛ㄥ崟鍚楋紵`, onOk() { - _this.setState({group}) - _this.updateComponent(card) + that.setState({group}) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/form/step-form/options.jsx b/src/menu/components/form/step-form/options.jsx index aca8cd7..a580960 100644 --- a/src/menu/components/form/step-form/options.jsx +++ b/src/menu/components/form/step-form/options.jsx @@ -204,7 +204,6 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx index c895e37..1758d75 100644 --- a/src/menu/components/form/tab-form/index.jsx +++ b/src/menu/components/form/tab-form/index.jsx @@ -279,7 +279,7 @@ closeGroup = (cell) => { const { group } = this.state let card = fromJS(this.state.card).toJS() - const _this = this + const that = this confirm({ content: '纭畾鍒犻櫎鍒嗙粍鍚楋紵', @@ -291,8 +291,8 @@ _group = card.subcards[0] || null } - _this.setState({group: _group}) - _this.updateComponent(card) + that.setState({group: _group}) + that.updateComponent(card) }, onCancel() {} }) @@ -323,7 +323,7 @@ changecols = (type) => { let card = fromJS(this.state.card).toJS() let config = fromJS(this.state.group).toJS() - let _this = this + let that = this config.fields = config.fields.map(item => { item.labelwidth = 33.3 @@ -355,8 +355,8 @@ } return item }) - _this.setState({group: config}) - _this.updateComponent(card) + that.setState({group: config}) + that.updateComponent(card) }, onCancel() {} }) @@ -386,7 +386,7 @@ closeForm = (cell) => { let group = fromJS(this.state.group).toJS() let card = fromJS(this.state.card).toJS() - let _this = this + let that = this group.fields = group.fields.filter(item => item.uuid !== cell.uuid) @@ -400,8 +400,8 @@ confirm({ content: `纭畾鍒犻櫎<<${cell.label}>>鍚楋紵`, onOk() { - _this.setState({group}) - _this.updateComponent(card) + that.setState({group}) + that.updateComponent(card) }, onCancel() {} }) @@ -573,7 +573,7 @@ clearGroup = () => { let group = fromJS(this.state.group).toJS() let card = fromJS(this.state.card).toJS() - let _this = this + let that = this group.fields = [] @@ -587,8 +587,8 @@ confirm({ content: `纭畾娓呯┖琛ㄥ崟鍚楋紵`, onOk() { - _this.setState({group}) - _this.updateComponent(card) + that.setState({group}) + that.updateComponent(card) }, onCancel() {} }) diff --git a/src/menu/components/group/normal-group/index.jsx b/src/menu/components/group/normal-group/index.jsx index e26fb57..aa41f27 100644 --- a/src/menu/components/group/normal-group/index.jsx +++ b/src/menu/components/group/normal-group/index.jsx @@ -136,15 +136,15 @@ if (group.components.length === 0) return - const _this = this + const that = this confirm({ title: '纭畾閲婃斁鍒嗙粍鍏冪礌鍚楋紵', content: '', onOk() { - _this.props.unGroup(group.uuid) + that.props.unGroup(group.uuid) setTimeout(() => { - _this.updataGroup() + that.updataGroup() }, 10) }, onCancel() {} diff --git a/src/menu/components/search/main-search/dragsearch/card.jsx b/src/menu/components/search/main-search/dragsearch/card.jsx index 6e153b6..72462e7 100644 --- a/src/menu/components/search/main-search/dragsearch/card.jsx +++ b/src/menu/components/search/main-search/dragsearch/card.jsx @@ -132,6 +132,11 @@ </>) } + let labelwidth = card.labelwidth || 33.3 + if (card.labelShow === 'false') { + labelwidth = 0 + } + return ( <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -143,8 +148,8 @@ <div className={'page-card ' + (card.labelShow === 'false' ? 'label-hide ' : '') + card.type + (card.advanced === 'true' ? ' advanced' : '') + (card.query === 'false' ? ' no-query' : '')} style={{ opacity: opacity}}> <div ref={node => drag(drop(node))}> <Form.Item - labelCol={{xs: { span: 24 }, sm: { span: 8 }}} - wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} + labelCol={{style: {width: labelwidth + '%'}}} + wrapperCol={{style: {width: (100 - labelwidth) + '%'}}} label={card.labelShow !== 'false' ? card.label : ''} required={card.required === 'true'} help={card.field + (card.datefield ? ', ' + card.datefield : '') + (card.advanced === 'true' ? '锛堥珮绾ф悳绱級' : '')} diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index ef3e3c1..33814cc 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -289,15 +289,15 @@ * @description 鎼滅储鏉′欢鍒犻櫎 */ deleteElement = (cell) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${cell.label} 锛焋, onOk() { - let _card = fromJS(_this.state.card).toJS() + let _card = fromJS(that.state.card).toJS() _card.search = _card.search.filter(item => item.uuid !== cell.uuid) - _this.updateComponent(_card) + that.updateComponent(_card) }, onCancel() {} }) diff --git a/src/menu/components/search/main-search/index.scss b/src/menu/components/search/main-search/index.scss index 87b0e05..b5a03a5 100644 --- a/src/menu/components/search/main-search/index.scss +++ b/src/menu/components/search/main-search/index.scss @@ -44,7 +44,11 @@ .ant-form-item { position: relative; margin-bottom: 0px; + .ant-form-item-label { + float: left; + } .ant-form-item-control-wrapper { + float: left; .ant-select { width: 100%; margin-top: 4px; diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index d730f6e..dcf94bf 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -233,7 +233,7 @@ if (this.record.openmenu && this.record.openmenu !== 'goback') { shows.push('open') } - if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { + if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { shows.push('resetPageIndex') } @@ -305,7 +305,7 @@ if (this.record.execSuccess === 'goback') { shows.push('reload') } - if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { + if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { shows.push('resetPageIndex') } @@ -352,7 +352,7 @@ } else { shows.push('database') } - if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { + if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { shows.push('resetPageIndex') } } else if (openType === 'excelOut') { @@ -389,7 +389,7 @@ } else { shows.push('database') } - if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { + if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { shows.push('resetPageIndex') } if (this.record.Ot !== 'notRequired' && appType === 'mob') { @@ -485,7 +485,7 @@ shows.push('innerFunc', 'extraParam') reRequired.innerFunc = true } - if (this.record.execSuccess === 'grid' || this.record.execError === 'grid') { + if (['grid'].includes(this.record.execSuccess) || ['grid'].includes(this.record.execError)) { shows.push('resetPageIndex') } if (this.record.execMode === 'pop' || this.record.execMode === 'prompt') { diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 77d657a..c30f245 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -490,19 +490,19 @@ */ deleteElement = (card) => { const { config } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${card.label} 锛焋, onOk() { - let _actionlist = fromJS(_this.state.actionlist).toJS() + let _actionlist = fromJS(that.state.actionlist).toJS() _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) - _this.setState({ + that.setState({ actionlist: _actionlist }, () => { - _this.props.updateaction({...config, action: _actionlist}) + that.props.updateaction({...config, action: _actionlist}) }) }, onCancel() {} diff --git a/src/menu/components/share/colsControl/index.jsx b/src/menu/components/share/colsControl/index.jsx index 882c037..29a113c 100644 --- a/src/menu/components/share/colsControl/index.jsx +++ b/src/menu/components/share/colsControl/index.jsx @@ -245,7 +245,7 @@ _config.colsCtrls = colsCtrls if (this.customForm && this.customForm.state.editItem) { - const _this = this + const that = this let title = '瀛樺湪鏈繚瀛橀」锛岀‘瀹氬拷鐣ュ悧锛�' if (s.length > 0) { title = `瀛樺湪鏈繚瀛橀」锛屼笖绗� ${s.join('銆�')} 琛屼腑瀛楁鍦ㄦ悳绱㈡潯浠朵腑涓嶅瓨鍦紝纭畾蹇界暐鍚楋紵` @@ -253,18 +253,18 @@ confirm({ title: title, onOk() { - _this.setState({ visible: false }) - _this.props.onSubmit(_config) + that.setState({ visible: false }) + that.props.onSubmit(_config) }, onCancel() {} }) } else if (s.length > 0) { - const _this = this + const that = this confirm({ title: `绗� ${s.join('銆�')} 琛屼腑瀛楁鍦ㄦ悳绱㈡潯浠朵腑涓嶅瓨鍦紝纭畾蹇界暐鍚楋紵`, onOk() { - _this.setState({ visible: false }) - _this.props.onSubmit(_config) + that.setState({ visible: false }) + that.props.onSubmit(_config) }, onCancel() {} }) diff --git a/src/menu/components/share/markcomponent/index.jsx b/src/menu/components/share/markcomponent/index.jsx index 7185bea..160c1dd 100644 --- a/src/menu/components/share/markcomponent/index.jsx +++ b/src/menu/components/share/markcomponent/index.jsx @@ -399,12 +399,12 @@ }) this.props.onSubmit(marks) } else { - const _this = this + const that = this confirm({ title: '瀛樺湪鏈繚瀛樻爣璁帮紝纭畾蹇界暐鍚楋紵', onOk() { - _this.setState({ visible: false }) - _this.props.onSubmit(marks) + that.setState({ visible: false }) + that.props.onSubmit(marks) }, onCancel() {} }) diff --git a/src/menu/components/share/searchcomponent/index.jsx b/src/menu/components/share/searchcomponent/index.jsx index 62f1391..6eca698 100644 --- a/src/menu/components/share/searchcomponent/index.jsx +++ b/src/menu/components/share/searchcomponent/index.jsx @@ -247,19 +247,19 @@ */ deleteElement = (card) => { const { config } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${card.label} 锛焋, onOk() { - let _searchlist = fromJS(_this.state.searchlist).toJS() + let _searchlist = fromJS(that.state.searchlist).toJS() _searchlist = _searchlist.filter(item => item.uuid !== card.uuid) - _this.setState({ + that.setState({ searchlist: _searchlist }, () => { - _this.props.updatesearch({...config, search: _searchlist}) + that.props.updatesearch({...config, search: _searchlist}) }) }, onCancel() {} diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx index 63cf2fa..96d01c3 100644 --- a/src/menu/components/table/base-table/columns/index.jsx +++ b/src/menu/components/table/base-table/columns/index.jsx @@ -21,12 +21,12 @@ class HeaderCol extends Component { deleteCol = () => { - const _this = this + const that = this confirm({ content: '纭畾鍒犻櫎鏄剧ず鍒楀悧锛�', onOk() { - _this.props.deleteCol(_this.props.column) + that.props.deleteCol(that.props.column) }, onCancel() {} }) diff --git a/src/menu/components/table/base-table/options.jsx b/src/menu/components/table/base-table/options.jsx index d482819..8c3f5fa 100644 --- a/src/menu/components/table/base-table/options.jsx +++ b/src/menu/components/table/base-table/options.jsx @@ -88,19 +88,6 @@ {value: 'small', label: '灏�'}, ], }, - // { - // type: 'radio', - // field: 'selected', - // label: '棣栬閫変腑', - // initval: wrap.selected || 'false', - // tooltip: '褰撴寜閽墽琛屽畬鎴愬苟杩斿洖涓婚敭鍊兼椂锛岄粯璁ら�変腑涓婚敭鍊煎搴旇銆�', - // required: false, - // options: [ - // {value: 'false', label: '鏃�'}, - // {value: 'init', label: '鍒濆鍖�'}, - // {value: 'always', label: '鏁版嵁鍔犺浇'}, - // ] - // }, { type: 'radio', field: 'tableMode', diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx index 9deae06..fcf33b1 100644 --- a/src/menu/components/table/edit-table/columns/index.jsx +++ b/src/menu/components/table/edit-table/columns/index.jsx @@ -22,12 +22,12 @@ class HeaderCol extends Component { deleteCol = () => { - const _this = this + const that = this confirm({ content: '纭畾鍒犻櫎鏄剧ず鍒楀悧锛�', onOk() { - _this.props.deleteCol(_this.props.column) + that.props.deleteCol(that.props.column) }, onCancel() {} }) @@ -597,13 +597,13 @@ columns.push(cell) }) - const _this = this + const that = this confirm({ content: '纭畾鍚屾瀛楁闆嗗悧锛�', onOk() { - _this.setState({columns}, () => { - _this.props.updatecolumn({..._this.props.config, cols: columns}) + that.setState({columns}, () => { + that.props.updatecolumn({...that.props.config, cols: columns}) }) }, onCancel() {} @@ -611,13 +611,13 @@ } clear = () => { - const _this = this + const that = this confirm({ content: '纭畾娓呯┖鏄剧ず鍒楀悧锛�', onOk() { - _this.setState({columns: []}, () => { - _this.props.updatecolumn({..._this.props.config, cols: []}) + that.setState({columns: []}, () => { + that.props.updatecolumn({...that.props.config, cols: []}) }) }, onCancel() {} 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 77d5966..5468010 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 @@ -152,6 +152,8 @@ let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail sql = sql.replace(/@\$|\$@/ig, '') + sql = sql.replace(/@datam@/ig, `''`) + sql = sql.replace(/@typename@/ig, `'debug'`) if (skip) { this.setState({ @@ -271,7 +273,7 @@ </Col> : null} {!type ? <Col span={24} className="sqlfield"> <Form.Item label="鍙敤瀛楁"> - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, lang, time_id</span></Tooltip>, + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, lang, typename, datam, time_id</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, {usefulfields},data_type锛堟敞锛歫skey涓轰富閿�硷紝鏂板鏃跺墠绔敓鎴愶紱data_type涓烘搷浣滅被鍨嬶紝鏂板 - add銆佷慨鏀� - upt銆佸垹闄� - del锛� </Form.Item> diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index de7593e..e6af839 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -22,12 +22,12 @@ class HeaderCol extends Component { deleteCol = () => { - const _this = this + const that = this confirm({ content: '纭畾鍒犻櫎鏄剧ず鍒楀悧锛�', onOk() { - _this.props.deleteCol(_this.props.column) + that.props.deleteCol(that.props.column) }, onCancel() {} }) @@ -595,13 +595,13 @@ columns.push(cell) }) - const _this = this + const that = this confirm({ content: '纭畾鍚屾瀛楁闆嗗悧锛�', onOk() { - _this.setState({columns}, () => { - _this.props.updatecolumn({..._this.props.config, cols: columns}) + that.setState({columns}, () => { + that.props.updatecolumn({...that.props.config, cols: columns}) }) }, onCancel() {} @@ -609,13 +609,13 @@ } clear = () => { - const _this = this + const that = this confirm({ content: '纭畾娓呯┖鏄剧ず鍒楀悧锛�', onOk() { - _this.setState({columns: []}, () => { - _this.props.updatecolumn({..._this.props.config, cols: []}) + that.setState({columns: []}, () => { + that.props.updatecolumn({...that.props.config, cols: []}) }) }, onCancel() {} diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index 1aa31f6..145bcdc 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -147,7 +147,7 @@ delTab = (tab) => { let tabs = fromJS(this.state.tabs).toJS() - const _this = this + const that = this tabs.subtabs = tabs.subtabs.filter(t => t.uuid !== tab.uuid) @@ -155,8 +155,8 @@ title: '纭畾鍒犻櫎鏍囩锛�', content: '', onOk() { - _this.setState({tabs}) - _this.props.updateConfig(tabs) + that.setState({tabs}) + that.props.updateConfig(tabs) }, onCancel() {} }) diff --git a/src/menu/components/tabs/table-tabs/index.jsx b/src/menu/components/tabs/table-tabs/index.jsx index 293312c..8dc040e 100644 --- a/src/menu/components/tabs/table-tabs/index.jsx +++ b/src/menu/components/tabs/table-tabs/index.jsx @@ -72,7 +72,7 @@ delTab = (tab) => { let tabs = fromJS(this.state.tabs).toJS() - const _this = this + const that = this tabs.subtabs = tabs.subtabs.filter(t => t.uuid !== tab.uuid) @@ -80,8 +80,8 @@ title: '纭畾鍒犻櫎鏍囩锛�', content: '', onOk() { - _this.setState({tabs}) - _this.props.updateConfig(tabs) + that.setState({tabs}) + that.props.updateConfig(tabs) }, onCancel() {} }) diff --git a/src/menu/components/timeline/normal-timeline/options.jsx b/src/menu/components/timeline/normal-timeline/options.jsx index a1ea98b..ae0be4d 100644 --- a/src/menu/components/timeline/normal-timeline/options.jsx +++ b/src/menu/components/timeline/normal-timeline/options.jsx @@ -206,7 +206,6 @@ initval: wrap.empty || 'show', tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�', required: false, - skip: true, options: [ {value: 'show', label: '鍚�'}, {value: 'hidden', label: '鏄�'}, diff --git a/src/menu/datasource/index.jsx b/src/menu/datasource/index.jsx index 5d95704..f264a81 100644 --- a/src/menu/datasource/index.jsx +++ b/src/menu/datasource/index.jsx @@ -181,38 +181,89 @@ let maxScript = 0 let useExec = false - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') - if (res.setting.dataresource) { - res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + let sFields = [] + res.searches && res.searches.forEach(item => { + if (!item.key) return + + if (item.type === 'date') { + if (sFields.includes(item.key)) { + sFields.push(item.key + '1') + } else { + sFields.push(item.key) } - res.scripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - - if (item.status === 'false') return - - if (/exec\s/ig.test(item.sql)) { - useExec = true - maxScript = 1000 - } else if (item.sql.length > maxScript) { - maxScript = item.sql.length - } + } else if (item.type === 'dateweek' || item.type === 'range' || (item.type === 'datemonth' && item.match !== '=')) { + sFields.push(item.key) + sFields.push(item.key + '1') + } else if (item.type === 'daterange') { + if (/,/.test(item.key)) { + sFields.push(item.key.split(',')[0]) + sFields.push(item.key.split(',')[1]) + } else { + sFields.push(item.key) + sFields.push(item.key + '1') + } + } else if (item.type === 'text' || item.type === 'select') { + item.key.split(',').forEach(field => { + sFields.push(field) }) - }) - } else { - res.scripts.forEach(item => { - if (item.status === 'false') return + } else { + sFields.push(item.key) + } + }) + delete res.searches + sFields = sFields.join('|') - if (/exec\s/ig.test(item.sql)) { - useExec = true - maxScript = 1000 - } else if (item.sql.length > maxScript) { - maxScript = item.sql.length - } - }) + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') + // if (res.setting.dataresource) { + // res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // } + // res.scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + + // if (item.status === 'false') return + + // if (/exec\s/ig.test(item.sql)) { + // useExec = true + // maxScript = 1000 + // } else if (item.sql.length > maxScript) { + // maxScript = item.sql.length + // } + // }) + // }) + // } else { + // res.scripts.forEach(item => { + // if (item.status === 'false') return + + // if (/exec\s/ig.test(item.sql)) { + // useExec = true + // maxScript = 1000 + // } else if (item.sql.length > maxScript) { + // maxScript = item.sql.length + // } + // }) + // } + + if (res.setting.interType === 'system' && res.setting.dataresource && res.setting.execute !== 'false' && sFields) { + if (new RegExp(`@(${sFields})@`, 'ig').test(res.setting.dataresource)) { + maxScript = 1000 + } } + res.scripts.forEach(item => { + if (item.status === 'false') return + + if (/exec\s/ig.test(item.sql)) { + useExec = true + maxScript = 1000 + } else if (sFields && new RegExp(`@(${sFields})@`, 'ig').test(item.sql)) { + maxScript = 1000 + } else if (item.sql.length > maxScript) { + maxScript = item.sql.length + } + }) + res.setting.maxScript = maxScript if (useExec && res.setting.sync === 'true') { diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 0aedf66..c7c6806 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -200,17 +200,17 @@ let _setting = fromJS(config.setting).toJS() let scripts = config.scripts ? fromJS(config.scripts).toJS() : [] - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') - if (_setting.dataresource) { - _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) - } - scripts && scripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') + // if (_setting.dataresource) { + // _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) + // } + // scripts && scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) + // }) + // }) + // } let columns = config.columns ? fromJS(config.columns).toJS() : [] let subColumns = config.subColumns ? fromJS(config.subColumns).toJS() : [] @@ -553,7 +553,7 @@ submitDataSource = () => { const { config, mainSearch } = this.props - const { activeKey, setting, columns, subColumns, scripts, cols, median } = this.state + const { activeKey, setting, columns, subColumns, scripts, cols, median, searches } = this.state if (config.subtype === 'dualdatacard') { let arr = columns.map(col => col.field.toLowerCase()) @@ -618,12 +618,13 @@ if (res.useMSearch === 'true') { // 浣跨敤涓绘悳绱㈡潯浠� search = [...search, ...mainSearch] } + let _searches = formatSearch(search) this.setState({ - searches: formatSearch(search), + searches: _searches, setting: res }, () => { - this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols }) }, reject, 'submit') + this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols, searches: _searches }) }, reject, 'submit') }) }, () => { reject() @@ -638,7 +639,7 @@ reject() return } - this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') + this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') } else if (activeKey === 'subcolumns') { if (this.subdatasource && this.subdatasource.state.editingKey) { notification.warning({ @@ -649,9 +650,9 @@ reject() return } - this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') + this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') } else if (activeKey === 'scripts') { - this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols }) }, reject, 'submit') + this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') } }) } diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index da4c71d..cb79b71 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -42,13 +42,13 @@ _dataresource = '(' + _dataresource + ') tb' } - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(item => { - let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(item => { + // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') + // _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // }) + // } let regs = [ // {reg: /@time_id@/ig, value: `'${getuuid()}'`}, // 璁$畻md5鍚庢浛鎹� @@ -62,8 +62,8 @@ {reg: /@Appkey@/ig, value: `'${window.GLOB.appkey}'`}, {reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`}, {reg: /@\$|\$@/ig, value: ''}, - {reg: /@select\$|\$select@/ig, value: ''}, - {reg: /@sum\$|\$sum@/ig, value: ''}, + // {reg: /@select\$|\$select@/ig, value: ''}, + // {reg: /@sum\$|\$sum@/ig, value: ''}, ] if (window.GLOB.process && type !== 'invoice') { @@ -71,10 +71,10 @@ } if (hasExtend) { - regs.push({reg: /@mk_time@/ig, value: '2024-04-29 17:20:00'}) + regs.push({reg: /@mk_time@/ig, value: `'2024-04-29 17:20:00'`}) } if (type === 'calendar') { - regs.push({reg: /@mk_year@/ig, value: '2024'}) + regs.push({reg: /@mk_year@/ig, value: `'2024'`}) } if (window.GLOB.getLocation) { regs.push( diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx index 3b440ad..ab9eafd 100644 --- a/src/menu/debug/index.jsx +++ b/src/menu/debug/index.jsx @@ -90,18 +90,80 @@ if (process) { regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` }) } + + let _mainSearch = [] + + if (sessionStorage.getItem('appType') === 'mob') { + let search = [] + let ms = null + config.components.forEach(item => { + if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { + ms = item.search + } else if (item.type === 'search' && item.wrap.field) { + search.push({ + type: 'text', + label: item.wrap.label, + field: item.wrap.field, + match: item.wrap.match, + required: item.wrap.required, + value: item.wrap.initval || '' + }) + } + }) + + if (ms) { + if (ms.setting.type === 'search') { + search.push({ + type: 'text', + label: '鎼滅储鏍�', + field: ms.setting.field, + match: ms.setting.match, + required: ms.setting.required, + value: ms.setting.initval || '' + }) + } + search.push(...ms.fields) + + ms.groups.forEach(group => { + if (group.setting.type === 'search') { + search.push({ + type: 'text', + label: group.wrap.name, + field: group.setting.field, + match: group.setting.match, + required: group.setting.required, + value: group.setting.initval || '' + }) + } + search.push(...group.fields) + }) + } + + if (search.length > 0) { + _mainSearch = search + } + } else { + config.components.forEach(component => { + if (component.type !== 'search') return + + _mainSearch = component.search || [] + }) + } if (config.interfaces && config.interfaces.length > 0) { config.interfaces.forEach(m => { if (m.status !== 'true' || m.setting.interType !== 'system') return false - let sql = this.formatDataSource(m, regs) + m.setting.laypage = 'false' + m.setting.$top = true + + let sql = this.formatDataSource(m, regs, _mainSearch) this.sqlList.push({label: m.setting.name, children: [{label: '鏁版嵁婧�', sql: sql}]}) }) } - this.filterComponent(config.components, [], regs, process) + this.filterComponent(config.components, _mainSearch, regs, process) let sqls = [] let foreachSql = (list, name, tabName = '', supName = '') => { @@ -226,72 +288,23 @@ filterComponent = (components, mainSearch, regs, process, ispop = false) => { let appType = sessionStorage.getItem('appType') - let _mainSearch = mainSearch || [] - - if (appType === 'mob') { - let search = [] - let ms = null - components.forEach(item => { - if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { - ms = item.search - } else if (item.type === 'search' && item.wrap.field) { - search.push({ - type: 'text', - label: item.wrap.label, - field: item.wrap.field, - match: item.wrap.match, - required: item.wrap.required, - value: item.wrap.initval || '' - }) - } - }) - - if (ms) { - if (ms.setting.type === 'search') { - search.push({ - type: 'text', - label: '鎼滅储鏍�', - field: ms.setting.field, - match: ms.setting.match, - required: ms.setting.required, - value: ms.setting.initval || '' - }) - } - search.push(...ms.fields) - - ms.groups.forEach(group => { - if (group.setting.type === 'search') { - search.push({ - type: 'text', - label: group.wrap.name, - field: group.setting.field, - match: group.setting.match, - required: group.setting.required, - value: group.setting.initval || '' - }) - } - search.push(...group.fields) - }) - } - - if (search.length > 0) { - _mainSearch = search - } - } else { - components.forEach(component => { - if (component.type !== 'search') return - - _mainSearch = component.search || [] - }) - } components.forEach(item => { if (item.type === 'tabs') { item.subtabs.forEach(tab => { + let _mainSearch = mainSearch || [] + + if (appType !== 'mob') { + tab.components.forEach(com => { + if (com.type !== 'search') return + + _mainSearch = com.search || [] + }) + } this.filterComponent(tab.components, _mainSearch, regs, process) }) } else if (item.type === 'group') { - this.filterComponent(item.components, _mainSearch, regs, process) + this.filterComponent(item.components, mainSearch, regs, process) } else { let children = [] if (item.wrap && item.setting) { @@ -309,13 +322,18 @@ } if (item.setting && item.setting.interType === 'system') { - let sql = this.formatDataSource(item, regs, _mainSearch) + if (item.format === 'object') { + item.setting.laypage = 'false' + item.setting.$top = true + } + + let sql = this.formatDataSource(item, regs, mainSearch) children.push({label: '鏁版嵁婧�', sql: sql}) } else if (item.setting && item.setting.useMSearch === 'true') { let searches = item.search || [] - if (_mainSearch.length > 0) { - searches = [...searches, ..._mainSearch] + if (mainSearch.length > 0) { + searches = [...searches, ...mainSearch] } item.$searches = fromJS(searches).toJS() } @@ -559,7 +577,31 @@ if (process) { regs.push({ reg: /@works_flow_code@/ig, value: `'1949-10-01 15:00:00'` }) } - this.filterComponent(cell.config.components, [], regs, process, true) + + let _mainSearch = [] + + if (sessionStorage.getItem('appType') === 'mob') { + cell.config.components.forEach(item => { + if (item.type === 'search' && item.wrap.field) { + _mainSearch.push({ + type: 'text', + label: item.wrap.label, + field: item.wrap.field, + match: item.wrap.match, + required: item.wrap.required, + value: item.wrap.initval || '' + }) + } + }) + } else { + cell.config.components.forEach(component => { + if (component.type !== 'search') return + + _mainSearch = component.search || [] + }) + } + + this.filterComponent(cell.config.components, _mainSearch, regs, process, true) if (this.sqlPopList.length) { sql = fromJS(this.sqlPopList).toJS() @@ -590,7 +632,7 @@ } }) - if (!_prev) return '' + if (!_prev) return _back let tbs = [] _prev.replace(/\n|\r/g, ' ').split(/\sdeclare\s/ig).forEach(line => { @@ -656,8 +698,29 @@ let BID = Utils.getuuid() let verify = btn.verify || {} let _actionType = null - let setting = component.setting + let setting = component.setting || {} let columns = component.columns || [] + + if (verify.invalid === 'true') { + if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { + verify.invalid = 'false' + } else if (setting.maxScript && setting.maxScript >= 300) { + verify.invalid = 'false' + } else if (!setting.dataresource) { + verify.invalid = 'false' + } else if (btn.intertype !== 'system' && btn.procMode !== 'system') { + verify.invalid = 'false' + } else if (btn.sqlType === 'insert') { + verify.invalid = 'false' + } else if (btn.Ot === 'notRequired') { + verify.invalid = 'false' + } + } + if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce') { + if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { + verify.uniques = [] + } + } if (verify.default !== 'false') { // 鍒ゆ柇鏄惁浣跨敤榛樿sql _actionType = btn.sqlType @@ -820,8 +883,8 @@ }) // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) - if (btn.Ot !== 'notRequired' && columns && columns.length > 0) { - const setField = (col) => { + if (btn.Ot !== 'notRequired' && columns.length > 0) { + columns.forEach(col => { if (!col.field) return let _key = col.field.toLowerCase() @@ -839,35 +902,7 @@ if (!_vars.includes(_key)) { _vars.push(_key) - - if (col.datatype) { - _declarefields.push(`@${_key} ${col.datatype}`) - } else { - if (col.fieldlength && col.fieldlength > 4000) { - col.fieldlength = 'max' - } - - let _type = `nvarchar(${col.fieldlength || 50})` - - if (col.type === 'number') { - let _length = col.decimal ? col.decimal : 0 - _type = `decimal(18,${_length})` - } else if (col.type === 'picture' || col.type === 'textarea') { - _type = `nvarchar(${col.fieldlength || 512})` - } - - _declarefields.push(`@${_key} ${_type}`) - } - } - } - - columns.forEach(col => { - if (col.type === 'colspan' || col.type === 'old_colspan') { - col.subcols.forEach(cell => { - setField(cell) - }) - } else { - setField(col) + _declarefields.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) } }) } @@ -955,37 +990,31 @@ } // 澶辨晥楠岃瘉锛屾坊鍔犳暟鎹椂涓嶇敤 - if (btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && verify.invalid === 'true' && setting.dataresource) { + if (verify.invalid === 'true') { let datasource = setting.dataresource let customScript = setting.customScript || '' - let orderBy = setting.order + + let regoptions = [{ + reg: new RegExp('@userName@', 'ig'), + value: `'${userName}'` + }, { + reg: new RegExp('@fullName@', 'ig'), + value: `'${fullName}'` + }, { + reg: new RegExp('@orderBy@', 'ig'), + value: setting.order || primaryKey + }, { + reg: new RegExp('@pageSize@', 'ig'), + value: 1 + }, { + reg: new RegExp('@pageIndex@', 'ig'), + value: 1 + }] - if (setting.queryType === 'statistics' || customScript) { - let searches = formatSearch(component.$searches || []) - let regoptions = getSearchRegs(searches) - - regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: `'${userName}'` - }, { - reg: new RegExp('@fullName@', 'ig'), - value: `'${fullName}'` - }, { - reg: new RegExp('@orderBy@', 'ig'), - value: orderBy - }, { - reg: new RegExp('@pageSize@', 'ig'), - value: 999999 - }, { - reg: new RegExp('@pageIndex@', 'ig'), - value: 1 - }) - - regoptions.forEach(item => { - datasource = datasource.replace(item.reg, item.value) - customScript = customScript.replace(item.reg, item.value) - }) - } + regoptions.forEach(item => { + datasource = datasource.replace(item.reg, item.value) + customScript = customScript.replace(item.reg, item.value) + }) if (customScript) { _sql += ` @@ -1060,7 +1089,6 @@ if (!keys.includes(_key)) return // 琛ㄥ崟涓笉鍚崟鍙风敓鎴愬瓧娈� - let _ModularDetailCode = '' let _lpline = '' if (item.TypeCharOne === 'Lp') { if (_linkKey === 'bid' && BID) { // 鏇挎崲bid @@ -1068,33 +1096,22 @@ } else { _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` } - _ModularDetailCode = '@ModularDetailCode' } else if (item.TypeCharOne === 'BN') { - let _val = '' if (_linkKey === 'bid' && BID) { // 鏇挎崲bid - _val = BID + _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` } else { - _val = 0 + _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` } - _ModularDetailCode = `'${item.TypeCharOne + _val}'` } else { - _ModularDetailCode = `'${item.ModularDetailCode}'` - } - - let _declare = '' - - if (!_vars.includes(_key)) { - _declare = `Declare @${_key} nvarchar(50)` - _vars.push(_key) + _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` } _billcodesSql += ` /* 鍗曞彿鐢熸垚 */ - ${_declare} select @BillCode='', @${_key}='', @ModularDetailCode='' ${_lpline} exec s_get_BillCode - @ModularDetailCode=${_ModularDetailCode}, + @ModularDetailCode=@ModularDetailCode, @Type=${item.Type}, @TypeCharOne='${item.TypeCharOne}', @TypeCharTwo ='${item.TypeCharTwo}', @@ -1133,11 +1150,6 @@ _value.push(`${_labels[index] || ''}锛�${_val || ''}`) }) - let _verifyType = '' - if (item.verifyType === 'logic') { - _verifyType = ' and deleted=0' - } - if (!arr.includes(primaryKey.toLowerCase())) { _fieldValue.push(`${primaryKey} !='${primaryId}'`) } @@ -1145,7 +1157,7 @@ _sql += ` /* 鍞竴鎬ч獙璇� */ select @tbid='', @ErrorCode='',@retmsg='' - select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${_verifyType} + select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${item.verifyType === 'logic' ? ' and deleted=0' : ''} If @tbid!='' Begin select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 宸插瓨鍦�' @@ -1352,7 +1364,7 @@ if (columns && columns.length > 0 && btn.Ot !== 'notRequired') { let _index = 0 columns.forEach(col => { - if (!col.field || col.Hide === 'true' || _index >= 4) return + if (!col.field || col.Hide === 'true' || _index >= 4 || col.field === primaryKey) return _msg += col.label + '=0,' _index++ }) @@ -1437,13 +1449,7 @@ if (_backCustomScript) { _sql += _backCustomScript } - - _sql = _sql.replace(/@start_type@/ig, `'寮�濮�'`) - _sql = _sql.replace(/@check_type@/ig, `'瀹℃牳'`) - _sql = _sql.replace(/@notice_type@/ig, `'鎶勯��'`) - _sql = _sql.replace(/@check_userids@/ig, `''`) - _sql = _sql.replace(/@notice_userids@/ig, `''`) - _sql = _sql.replace(/@works_flow_sign@/ig, `''`) + _sql = _sql.replace(/@works_flow_code@/ig, `'mk'`) _sql = _sql.replace(/@works_flow_name@/ig, `'mk'`) _sql = _sql.replace(/@works_flow_param@/ig, `''`) @@ -1452,6 +1458,18 @@ _sql = _sql.replace(/@statusname@/ig, `'${statusName}'`) _sql = _sql.replace(/@work_group@/ig, `'mk'`) _sql = _sql.replace(/@work_grade@/ig, `'0'`) + + if (verify.flowType === 'start') { + _sql = _sql.replace(/@start_type@/ig, `'寮�濮�'`) + } else { + _sql = _sql.replace(/@check_type@/ig, `'瀹℃牳'`) + _sql = _sql.replace(/@notice_type@/ig, `'鎶勯��'`) + + _sql = _sql.replace(/@check_userids@/ig, `''`) + _sql = _sql.replace(/@notice_userids@/ig, `''`) + + _sql = _sql.replace(/@works_flow_sign@/ig, `''`) + } } else if (_backCustomScript) { _sql += _backCustomScript } @@ -2055,7 +2073,7 @@ formatDataSource = (item, regs, mainSearch = []) => { if (!item.setting || item.setting.interType !== 'system') return false - + let searches = item.search || [] if (item.setting.useMSearch === 'true' && mainSearch.length > 0) { searches = [...searches, ...mainSearch] @@ -2120,8 +2138,14 @@ _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` } else if (item.setting.laypage === 'true' && item.setting.order) { _dataresource = `/*system_query*/select top 10 ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${item.setting.order}) as rows from ${_dataresource} ${_search}) tmptable where rows > 0 order by tmptable.rows ` + } else if (item.setting.$top) { + if (item.setting.order) { + _dataresource = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by ${item.setting.order} ` + } else { + _dataresource = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} ` + } } else if (item.setting.order) { - _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${item.setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` + _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by ${item.setting.order} ` } else { _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` } @@ -2166,10 +2190,10 @@ ) if (item.hasExtend) { - regoptions.push({reg: /@mk_time@/ig, value: '2024-04-29 17:20:00'}) + regoptions.push({reg: /@mk_time@/ig, value: `'2024-04-29 17:20:00'`}) } if (item.type === 'calendar') { - regoptions.push({ reg: /@mk_year@/ig, value: '2024' }) + regoptions.push({ reg: /@mk_year@/ig, value: `'2024'` }) } if (window.GLOB.getLocation) { regoptions.push( @@ -2255,14 +2279,6 @@ destroyOnClose > <div className="mk-sql-wrap"> - {/* <div className="header"> - <div className="sql-item"> - <div className="sql-1">缁勪欢</div> - <div className="sql-2">妫�楠岄」</div> - <div className="sql-3">鍏朵粬</div> - <div className="sql-4">鐘舵��</div> - </div> - </div> */} <div className="body"> {sqlList.map(item => { let other = '' diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 6f40e02..e76889a 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -165,15 +165,15 @@ * @description 琛ㄥ崟鍒犻櫎骞跺埛鏂� */ closeForm = (card) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎${card.label ? `<<${card.label}>>` : ''}鍚楋紵`, onOk() { - let _config = fromJS(_this.state.config).toJS() + let _config = fromJS(that.state.config).toJS() _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) - _this.setState({ + that.setState({ config: _config, }) }, @@ -193,13 +193,13 @@ } clearConfig = () => { - const _this = this + const that = this let _config = {...this.state.config, fields: []} confirm({ content: '纭畾娓呯┖琛ㄥ崟鍚楋紵', onOk() { - _this.setState({ config: _config }) + that.setState({ config: _config }) }, onCancel() {} }) @@ -213,11 +213,11 @@ const { config, originConfig } = this.state if (!is(fromJS(config), fromJS(originConfig))) { - let _this = this + let that = this confirm({ content: '閰嶇疆淇℃伅鏈繚瀛橈紝纭畾杩斿洖鍚楋紵', onOk() { - _this.props.handleBack() + that.props.handleBack() }, onCancel() {} }) @@ -279,7 +279,7 @@ changecols = (type) => { let config = fromJS(this.state.config).toJS() - let _this = this + let that = this config.fields = config.fields.map(item => { item.labelwidth = 33.3 @@ -305,7 +305,7 @@ confirm({ content: `纭畾鍒囨崲涓�${type}鍒楀悧锛焋, onOk() { - _this.setState({config}) + that.setState({config}) }, onCancel() {} }) @@ -394,7 +394,7 @@ <div> <PasteForms type="toolbar" config={config} update={this.pasteFields}/> <Button type="primary" id="save-modal-config" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button> - <Button onClick={this.cancelConfig}>杩斿洖</Button> + <Button disabled={saving} onClick={this.cancelConfig}>杩斿洖</Button> </div> } style={{ width: '100%' }}> <SettingOutlined onClick={this.changeSetting} /> diff --git a/src/menu/picturecontroller/index.jsx b/src/menu/picturecontroller/index.jsx index 34ffe8a..a8633f1 100644 --- a/src/menu/picturecontroller/index.jsx +++ b/src/menu/picturecontroller/index.jsx @@ -161,7 +161,7 @@ } deleteSource = (item) => { - const _this = this + const that = this confirm({ title: '纭畾鍒犻櫎鍚楋紵', @@ -181,14 +181,14 @@ if (res.status) { if (item.typecharone === 'image') { window.GLOB.app_pictures = res.data || [] - _this.resetPicture(res.data || []) + that.resetPicture(res.data || []) } else if (item.typecharone === 'video') { window.GLOB.app_videos = res.data || [] - _this.resetVideo(res.data || []) + that.resetVideo(res.data || []) } else if (item.typecharone === 'color') { window.GLOB.app_colors = res.data || [] sessionStorage.setItem('app_colors', JSON.stringify(res.data || [])) - _this.resetColor(res.data || []) + that.resetColor(res.data || []) } } else { notification.warning({ diff --git a/src/menu/replaceField/settingform/index.jsx b/src/menu/replaceField/settingform/index.jsx index 941c3f3..91d3236 100644 --- a/src/menu/replaceField/settingform/index.jsx +++ b/src/menu/replaceField/settingform/index.jsx @@ -76,13 +76,13 @@ } clear = () => { - let _this = this + let that = this confirm({ title: '纭畾娓呴櫎鍘嗗彶璁板綍鍚楋紵', content: '', onOk() { localStorage.removeItem('replaceRecord') - _this.setState({fields: [], labels: []}) + that.setState({fields: [], labels: []}) }, onCancel() {} }) diff --git a/src/menu/transfer/index.jsx b/src/menu/transfer/index.jsx index 5e9c7d8..cdb834a 100644 --- a/src/menu/transfer/index.jsx +++ b/src/menu/transfer/index.jsx @@ -26,7 +26,7 @@ trigger = () => { const { config } = this.props - const _this = this + const that = this if (!config.enabled) { let tb = config.components[0] @@ -36,7 +36,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.execUpdate(resolve, true) + that.execUpdate(resolve, true) }) }, onCancel() {} @@ -58,7 +58,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.execUpdate(resolve) + that.execUpdate(resolve) }) }, onCancel() {} diff --git a/src/menu/urlfieldcomponent/index.jsx b/src/menu/urlfieldcomponent/index.jsx index a25488e..a6ff171 100644 --- a/src/menu/urlfieldcomponent/index.jsx +++ b/src/menu/urlfieldcomponent/index.jsx @@ -61,14 +61,14 @@ deleteField = (field) => { let config = JSON.stringify(this.props.config) - const _this = this + const that = this if (new RegExp('@' + field + '@', 'ig').test(config)) { confirm({ title: `閰嶇疆涓瓨鍦ˊ${field}@锛岀‘瀹氬垹闄ゅ悧锛焋, content: '', onOk() { - _this.execDelete(field) + that.execDelete(field) }, onCancel() {} }) diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx index 016fd2f..596f800 100644 --- a/src/mob/components/menubar/normal-menubar/index.jsx +++ b/src/mob/components/menubar/normal-menubar/index.jsx @@ -123,7 +123,7 @@ */ deleteCard = (cell, type) => { let card = fromJS(this.state.card).toJS() - let _this = this + let that = this if (type !== 'direct') { confirm({ @@ -131,8 +131,8 @@ onOk() { card.subMenus = card.subMenus.filter(item => item.uuid !== cell.uuid) - _this.setState({card}) - _this.props.updateConfig(card) + that.setState({card}) + that.props.updateConfig(card) }, onCancel() {} }) diff --git a/src/mob/components/navbar/normal-navbar/menus/index.jsx b/src/mob/components/navbar/normal-navbar/menus/index.jsx index 43e0e28..7ade24d 100644 --- a/src/mob/components/navbar/normal-navbar/menus/index.jsx +++ b/src/mob/components/navbar/normal-navbar/menus/index.jsx @@ -114,7 +114,7 @@ } if (editMenu.MenuID && editMenu.property === 'menu' && res.property !== 'menu') { - const _this = this + const that = this confirm({ content: '鑿滃崟灏嗚閲嶇疆锛岀‘瀹氫慨鏀瑰悧锛�', onOk() { @@ -124,8 +124,8 @@ } return item }) - _this.setState({menus: _menus, editMenu: null, visible: false}, () => { - _this.props.updateConfig(_menus) + that.setState({menus: _menus, editMenu: null, visible: false}, () => { + that.props.updateConfig(_menus) }) }, onCancel() {} @@ -143,17 +143,17 @@ */ deleteElement = (card) => { const { menus } = this.state - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎銆�${card.name}銆嬪悧锛焋, onOk() { let _menus = menus.filter(item => item.MenuID !== card.MenuID) - _this.setState({ + that.setState({ menus: _menus }, () => { - _this.props.updateConfig(_menus) + that.props.updateConfig(_menus) }) }, onCancel() {} diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx index 9653b81..4bb2be3 100644 --- a/src/mob/components/tabs/antv-tabs/index.jsx +++ b/src/mob/components/tabs/antv-tabs/index.jsx @@ -169,7 +169,7 @@ delTab = (tab) => { let tabs = fromJS(this.state.tabs).toJS() - const _this = this + const that = this tabs.subtabs = tabs.subtabs.filter(t => t.uuid !== tab.uuid) @@ -177,8 +177,8 @@ title: '纭畾鍒犻櫎鏍囩锛�', content: '', onOk() { - _this.setState({tabs}) - _this.props.updateConfig(tabs) + that.setState({tabs}) + that.props.updateConfig(tabs) }, onCancel() {} }) diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx index 8ef83d0..0f75a32 100644 --- a/src/mob/modalconfig/index.jsx +++ b/src/mob/modalconfig/index.jsx @@ -170,15 +170,15 @@ * @description 琛ㄥ崟鍒犻櫎骞跺埛鏂� */ closeForm = (card) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎${card.label ? `<<${card.label}>>` : ''}鍚楋紵`, onOk() { - let _config = fromJS(_this.state.config).toJS() + let _config = fromJS(that.state.config).toJS() _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) - _this.setState({ + that.setState({ config: _config, }) }, @@ -201,11 +201,11 @@ const { config, originConfig } = this.state if (!is(fromJS(config), fromJS(originConfig))) { - let _this = this + let that = this confirm({ content: '閰嶇疆淇℃伅鏈繚瀛橈紝纭畾杩斿洖鍚楋紵', onOk() { - _this.props.handleBack() + that.props.handleBack() }, onCancel() {} }) @@ -316,13 +316,13 @@ } clearConfig = () => { - const _this = this + const that = this let _config = {...this.state.config, fields: []} confirm({ content: '纭畾娓呯┖琛ㄥ崟鍚楋紵', onOk() { - _this.setState({ config: _config }) + that.setState({ config: _config }) }, onCancel() {} }) diff --git a/src/mob/searchconfig/index.jsx b/src/mob/searchconfig/index.jsx index ae16cb1..fbfc001 100644 --- a/src/mob/searchconfig/index.jsx +++ b/src/mob/searchconfig/index.jsx @@ -264,18 +264,18 @@ * @description 琛ㄥ崟鍒犻櫎骞跺埛鏂� */ closeForm = (card) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎${card.label ? `<<${card.label}>>` : ''}鍚楋紵`, onOk() { - let _group = fromJS(_this.state.group).toJS() + let _group = fromJS(that.state.group).toJS() _group.fields = _group.fields.filter(item => item.uuid !== card.uuid) - _this.setState({ + that.setState({ group: _group, }) - _this.resetConfig(_group) + that.resetConfig(_group) }, onCancel() {} }) @@ -296,11 +296,11 @@ const { config, originConfig } = this.state if (!is(fromJS(config), fromJS(originConfig))) { - let _this = this + let that = this confirm({ content: '閰嶇疆淇℃伅鏈繚瀛橈紝纭畾杩斿洖鍚楋紵', onOk() { - _this.props.handleBack() + that.props.handleBack() }, onCancel() {} }) @@ -446,15 +446,15 @@ } closeGroup = (g) => { - const _this = this + const that = this let _group = fromJS(this.state.group).toJS() _group.groups = _group.groups.filter(item => item.uuid !== g.uuid) confirm({ content: `纭畾鍒犻櫎鍒嗙粍銆�${g.wrap.name}銆嬪悧锛焋, onOk() { - _this.setState({ group: _group }) - _this.resetConfig(_group) + that.setState({ group: _group }) + that.resetConfig(_group) }, onCancel() {} }) diff --git a/src/pc/components/navbar/normal-navbar/linksetting/linktable/index.jsx b/src/pc/components/navbar/normal-navbar/linksetting/linktable/index.jsx index 6a2d85a..e6aa8f7 100644 --- a/src/pc/components/navbar/normal-navbar/linksetting/linktable/index.jsx +++ b/src/pc/components/navbar/normal-navbar/linksetting/linktable/index.jsx @@ -78,13 +78,13 @@ delMenu = (record) => { const { data } = this.state - const _this = this + const that = this confirm({ title: '纭畾鍒犻櫎鍚楋紵', content: '', onOk() { - _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) + that.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) }, onCancel() {} }) diff --git a/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx b/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx index 3ee2c9c..e0a85cf 100644 --- a/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx +++ b/src/pc/components/navbar/normal-navbar/menusetting/menutable/index.jsx @@ -88,15 +88,15 @@ delMenu = (record) => { const { menu } = this.props - const _this = this + const that = this confirm({ title: '纭畾鍒犻櫎鍚楋紵', content: '', onOk() { - let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) - _this.setState({data: _data}) - _this.props.menuUpdate({...menu, sublist: _data}) + let _data = that.state.data.filter(item => item.MenuID !== record.MenuID) + that.setState({data: _data}) + that.props.menuUpdate({...menu, sublist: _data}) }, onCancel() {} }) @@ -137,7 +137,7 @@ }) } if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') { - const _this = this + const that = this confirm({ content: '鑿滃崟灏嗚閲嶇疆锛岀‘瀹氫慨鏀瑰悧锛�', onOk() { @@ -147,8 +147,8 @@ } return item }) - _this.setState({data: _data, editMenu: null, visible: false}) - _this.props.menuUpdate({...menu, sublist: _data}) + that.setState({data: _data, editMenu: null, visible: false}) + that.props.menuUpdate({...menu, sublist: _data}) }, onCancel() {} }) @@ -271,15 +271,15 @@ delMenu = (record) => { const { menu } = this.props - const _this = this + const that = this confirm({ title: (record.property === 'classify' && record.sublist.length > 0 ? '鑿滃崟涓嬪惈鏈夊瓙鑿滃崟锛�' : '') + '纭畾鍒犻櫎鍚楋紵', content: '', onOk() { - let _data = _this.state.data.filter(item => item.MenuID !== record.MenuID) - _this.setState({data: _data}) - _this.props.menuUpdate({...menu, sublist: _data}) + let _data = that.state.data.filter(item => item.MenuID !== record.MenuID) + that.setState({data: _data}) + that.props.menuUpdate({...menu, sublist: _data}) }, onCancel() {} }) @@ -320,7 +320,7 @@ }) } if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') { - const _this = this + const that = this confirm({ content: '鑿滃崟灏嗚閲嶇疆锛岀‘瀹氫慨鏀瑰悧锛�', onOk() { @@ -330,8 +330,8 @@ } return item }) - _this.setState({data: _data, editMenu: null, visible: false}) - _this.props.menuUpdate({...menu, sublist: _data}) + that.setState({data: _data, editMenu: null, visible: false}) + that.props.menuUpdate({...menu, sublist: _data}) }, onCancel() {} }) @@ -466,13 +466,13 @@ delMenu = (record) => { const { data } = this.state - const _this = this + const that = this confirm({ title: (record.property === 'classify' && record.sublist.length > 0 ? '鑿滃崟涓嬪惈鏈夊瓙鑿滃崟锛�' : '') + '纭畾鍒犻櫎鍚楋紵', content: '', onOk() { - _this.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) + that.setState({data: data.filter(item => item.MenuID !== record.MenuID)}) }, onCancel() {} }) @@ -513,7 +513,7 @@ } if (editMenu.MenuID && editMenu.property === 'menu' && _menu.property !== 'menu') { - const _this = this + const that = this confirm({ content: '鑿滃崟灏嗚閲嶇疆锛岀‘瀹氫慨鏀瑰悧锛�', onOk() { @@ -523,7 +523,7 @@ } return item }) - _this.setState({data: _data, editMenu: null, visible: false}) + that.setState({data: _data, editMenu: null, visible: false}) }, onCancel() {} }) diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 49e94b0..3ef6c7c 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -174,6 +174,20 @@ window.GLOB.CacheData.set(MenuID, urlparam) + // if (window.backend && config.allSqls) { + // let keys = Object.keys(urlparam) + // config.allSqls.forEach(item => { + // if (item.type === 'datasource') { + // item.urlkeys = keys + // item.urlparam = urlparam + // if (config.flow_code) { + // item.works_flow_code = config.flow_code + // } + // } + // window.GLOB.CacheData.set('sql_' + item.uuid, item) + // }) + // } + let userName = sessionStorage.getItem('User_Name') || '' let fullName = sessionStorage.getItem('Full_Name') || '' @@ -510,9 +524,7 @@ if (cell.verify) { if (cell.verify.invalid === 'true') { - if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { - cell.verify.invalid = 'false' - } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { + if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { cell.verify.invalid = 'false' } else if (cell.intertype !== 'system' && cell.procMode !== 'system') { cell.verify.invalid = 'false' @@ -628,6 +640,8 @@ return component } + component.setting.uuid = component.uuid + let _customScript = '' let _tailScript = '' component.scripts && component.scripts.forEach(script => { diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 2748a02..2682bca 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -410,9 +410,7 @@ if (config.$searchId !== searchId) return - this.setState({pageIndex: 1}, () => { - this.loadData() - }) + this.reloadIndex() } /** @@ -426,6 +424,7 @@ if (config.uuid !== menuId) return + let _id = config.wrap.selected === 'always' ? id : '' if (config.supNodes) { if (['mainline', 'maingrid', 'popclose'].includes(position)) { let supNode = this.supModules[this.supModules.length - 1] @@ -439,43 +438,41 @@ }, i * 10) }) } else { - if ((position === 'line' || position === 'line_grid') && lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$uuid, position) + if (position === 'line' || position === 'line_grid') { + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(lines[0].$$uuid, 'repage') + } else { + this.loadLinedata(lines[0].$$uuid, position) + } + } else { + this.loadData(_id, 'repage') + } } else if (btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData(id) - }) + this.reloadIndex() } else { - this.loadData(id) + this.loadData(_id, 'repage') } } } else { let supModule = config.setting.supModule if (position === 'line' || position === 'line_grid') { - if (lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$uuid, position) - } else if (btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData(id) - }) + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(lines[0].$$uuid, 'repage') + } else { + this.loadLinedata(lines[0].$$uuid, position) + } } else { - this.loadData(id) + this.loadData(_id, 'repage') } } else if (['mainline', 'maingrid', 'popclose'].includes(position) && supModule) { MKEmitter.emit('reloadData', supModule, position === 'maingrid' ? '' : BID) } else if (btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData(id) - }) + this.reloadIndex() } else { - this.loadData(id) + this.loadData(_id, 'repage') } } } @@ -497,13 +494,21 @@ }) } + reloadIndex = () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData() + }) + } + prevCheck = (id) => { const { selected } = this.state if (selected === 'false' && !id) return setTimeout(() => { - this.checkTopLine(id) + this.checkTopLine(id, selected) }, 10) if (selected === 'init') { @@ -511,59 +516,39 @@ } } - checkTopLine = (id) => { - const { config, data, selected } = this.state + checkTopLine = (id, selected) => { + const { config, data } = this.state - if (data.length === 0) { - this.setState({ - activeKey: '', - selectKeys: [], - selectedData: [] - }) - - MKEmitter.emit('resetSelectLine', config.uuid, '', '') - if (config.setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', config.uuid, [], false) + let index = -1 + let keys = [] + let items = [] + + if (data.length > 0) { + if (id) { + index = data.findIndex(item => item.$$uuid === id && !item.$disabled) } - return - } - - if (selected === 'sign') { - let index = '' - let keys = [] - let items = [] - let last = '' - data.forEach((item, i) => { - if (!item.$disabled && item.selected === 'true') { - items.push(item) - keys.push(i) - index = i - last = item + + if (index !== -1) { + keys = [index] + items = [data[index]] + } else if (selected === 'sign') { + data.forEach((item, i) => { + if (!item.$disabled && item.selected === 'true') { + items.push(item) + keys.push(i) + index = i + } + }) + } else if (selected !== 'false') { + if (!data[0].$disabled) { + index = 0 + keys = [index] + items = [data[index]] } - }) - - this.setState({ - activeKey: index, - selectKeys: keys, - selectedData: items - }) - - MKEmitter.emit('resetSelectLine', config.uuid, last ? last.$$uuid : '', last) - if (config.setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', config.uuid, items, data.length === keys.length) - } - return - } - - let index = 0 - if (id) { - index = data.findIndex(item => item.$$uuid === id) - if (index === -1) { - index = 0 } } - if (data[index].$disabled) { + if (index === -1) { this.setState({ activeKey: '', selectKeys: [], @@ -576,16 +561,18 @@ } return } + + let item = items[items.length - 1] this.setState({ activeKey: index, - selectKeys: [index], - selectedData: [data[index]] + selectKeys: keys, + selectedData: items }) - MKEmitter.emit('resetSelectLine', config.uuid, data[index].$$uuid, data[index]) + MKEmitter.emit('resetSelectLine', config.uuid, item.$$uuid, item) if (config.setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', config.uuid, [data[index]], data.length === 1) + MKEmitter.emit('syncBalconyData', config.uuid, items, data.length === keys.length) } } @@ -683,7 +670,9 @@ if (config.uuid !== menuId) return if (!id) { - this.loadData() + this.reloadIndex() + } else if (config.forbidLine) { + this.loadData(id, 'repage') } else { this.loadLinedata(id) } @@ -806,6 +795,11 @@ if (result.status) { if (result.$requestId && this.requestId !== result.$requestId) return + if (type === 'repage' && result.data.length === 0 && pageIndex > 1) { + this.reloadIndex() + return + } + let start = 1 if (config.setting.laypage) { start = pageSize * (pageIndex - 1) + 1 @@ -816,7 +810,7 @@ Api.writeCacheConfig(config.uuid, result.data || [], BID) } - if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { + if (selected !== 'false' || id) { this.prevCheck(id) } else { MKEmitter.emit('resetSelectLine', config.uuid, '', '') @@ -904,15 +898,6 @@ async loadLinedata (id, position) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state - if (config.forbidLine) { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData() - }) - return - } - let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] @@ -934,7 +919,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (position === 'line_grid' && (!result.data || !result.data[0])) { - this.loadData() + this.reloadIndex() return } 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 0275d3b..8ee5097 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -358,9 +358,7 @@ if (config.$searchId !== searchId) return - this.setState({pageIndex: 1}, () => { - this.loadData() - }) + this.reloadIndex() } /** @@ -373,28 +371,23 @@ let supModule = config.setting.supModule + let _id = config.wrap.selected === 'always' ? id : '' if (position === 'line' || position === 'line_grid') { - if (lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position) - } else if (btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData(id) - }) + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(lines[0].$$parentId || lines[0].$$uuid, 'repage') + } else { + this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position) + } } else { - this.loadData(id) + this.loadData(_id, 'repage') } } else if (['mainline', 'maingrid', 'popclose'].includes(position) && supModule) { MKEmitter.emit('reloadData', supModule, position === 'maingrid' ? '' : BID) } else if (btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData(id) - }) + this.reloadIndex() } else { - this.loadData(id) + this.loadData(_id, 'repage') } } @@ -420,64 +413,40 @@ }) } - checkTopLine = (id) => { - const { config, data, selected, card } = this.state + checkTopLine = (id, selected) => { + const { config, data, card } = this.state let _opens = [...this.state.opens] - if (data.length === 0) { - this.setState({ - activeKey: '', - selectKeys: [], - selectedData: [] - }) - - MKEmitter.emit('resetSelectLine', config.uuid, '', '') - return - } + let index = -1 + let keys = [] + let items = [] - if (selected === 'sign') { - let index = '' - let keys = [] - let items = [] - let last = '' - - if (card.setting.display === 'collapse') { - _opens = [] + if (data.length > 0) { + if (id) { + index = data.findIndex(item => item.$$uuid === id && !item.$disabled) } - data.forEach((item, i) => { - if (!item.$disabled && item.selected === 'true') { - items.push(item) - keys.push(i) - index = i - last = item - - if (card.setting.display === 'collapse') { - _opens.push(i) + if (index !== -1) { + keys = [index] + items = [data[index]] + } else if (selected === 'sign') { + data.forEach((item, i) => { + if (!item.$disabled && item.selected === 'true') { + items.push(item) + keys.push(i) + index = i } + }) + } else if (selected !== 'false') { + if (!data[0].$disabled) { + index = 0 + keys = [index] + items = [data[index]] } - }) - - this.setState({ - opens: _opens, - activeKey: index, - selectKeys: keys, - selectedData: items - }) - - MKEmitter.emit('resetSelectLine', config.uuid, last ? last.$$uuid : '', last) - return - } - - let index = 0 - if (id) { - index = data.findIndex(item => item.$$uuid === id) - if (index === -1) { - index = 0 } } - if (data[index].$disabled) { + if (index === -1) { this.setState({ activeKey: '', selectKeys: [], @@ -489,17 +458,19 @@ } if (card.setting.display === 'collapse') { - _opens = [index] + _opens = keys } + + let item = items[items.length - 1] this.setState({ opens: _opens, activeKey: index, - selectKeys: [index], - selectedData: [data[index]] + selectKeys: keys, + selectedData: items }) - MKEmitter.emit('resetSelectLine', config.uuid, data[index].$$uuid, data[index]) + MKEmitter.emit('resetSelectLine', config.uuid, item.$$uuid, item) } checkAll = () => { @@ -547,7 +518,9 @@ if (config.uuid !== menuId) return if (!id) { - this.loadData() + this.reloadIndex() + } else if (config.forbidLine) { + this.loadData(id, 'repage') } else { this.loadLinedata(id) } @@ -643,6 +616,11 @@ if (result.status) { if (result.$requestId && this.requestId !== result.$requestId) return + if (type === 'repage' && result.data.length === 0 && pageIndex > 1) { + this.reloadIndex() + return + } + let start = 1 if (config.setting.laypage) { start = pageSize * (pageIndex - 1) + 1 @@ -653,13 +631,10 @@ Api.writeCacheConfig(config.uuid, result.data || [], BID) } - if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { + if (selected !== 'false' || id) { setTimeout(() => { - this.checkTopLine(id) + this.checkTopLine(id, selected) }, 10) - if (selected === 'init') { - this.setState({selected: 'false'}) - } } else { MKEmitter.emit('resetSelectLine', config.uuid, '', '') } @@ -769,6 +744,10 @@ loading: false }) + if (selected === 'init') { + this.setState({selected: 'false'}) + } + if (config.timer && config.clearField && result.data && result.data[0]) { let vals = (config.clearValue || '').split(',') if (vals.includes(result.data[0][config.clearField])) { @@ -793,15 +772,6 @@ async loadLinedata (id, position) { const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state - if (config.forbidLine) { - this.setState({ - pageIndex: 1 - }, () => { - this.loadData() - }) - return - } - let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] @@ -823,7 +793,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (position === 'line_grid' && (!result.data || !result.data[0])) { - this.loadData() + this.reloadIndex() return } @@ -946,6 +916,14 @@ } } + reloadIndex = () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData() + }) + } + loadMore = () => { const { total, pageIndex, pageSize, loading } = this.state diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx index 0b6db75..bac965b 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.jsx +++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx @@ -53,10 +53,16 @@ window.GLOB.SyncData.delete(_config.dataName) } + } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.has(_config.wrap.publicId)) { + _data = window.GLOB.CacheData.get(_config.wrap.publicId) + _data = fromJS(_data).toJS() } if (_config.wrap.minHeight) { _config.style.minHeight = _config.wrap.minHeight + } + if (_config.wrap.firstTr === 'light') { + _config.wrap.tbStyle = 'th-light' } this.setState({ @@ -228,7 +234,7 @@ if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null return ( - <div className={'custom-braft-editor-box ' + (config.wrap.firstTr || '')} id={'anchor' + config.uuid} style={config.style}> + <div className={'custom-braft-editor-box ' + (config.wrap.tbStyle || '')} id={'anchor' + config.uuid} style={config.style}> {loading ? <div className="loading-mask"> <div className="ant-spin-blur"></div> diff --git a/src/tabviews/custom/components/editor/braft-editor/index.scss b/src/tabviews/custom/components/editor/braft-editor/index.scss index 1829c88..e9e62b4 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.scss +++ b/src/tabviews/custom/components/editor/braft-editor/index.scss @@ -28,15 +28,34 @@ } } -.custom-braft-editor-box.light { +.custom-braft-editor-box.th-light { .braft-content { table { tr:first-child { - background-color:#ffffff; + background-color: transparent; } } } } +.custom-braft-editor-box.no-border { + .braft-content { + table { + td, th { + border: none!important; + } + tr td:first-child { + padding-left: 0px; + } + } + } +} +.custom-braft-editor-box.tb-flex { + .braft-content { + table { + table-layout: fixed; + } + } +} .custom-braft-editor-box::after { content: ' '; diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 89c8085..6e9f250 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -492,11 +492,11 @@ } if (tip) { - const _this = this + const that = this confirm({ content: tip + '纭瑕佷繚瀛樺悧锛�', onOk() { - _this.voucherSave(list, t) + that.voucherSave(list, t) }, onCancel() {} }) diff --git a/src/tabviews/custom/components/share/braftContent/index.scss b/src/tabviews/custom/components/share/braftContent/index.scss index f2f0d33..bf6b2f9 100644 --- a/src/tabviews/custom/components/share/braftContent/index.scss +++ b/src/tabviews/custom/components/share/braftContent/index.scss @@ -1,14 +1,32 @@ .braft-content { + padding: 15px; .media-wrap { max-width: 100%; } img { max-width: 100%; } + p { + margin-bottom: 0px!important; + min-height: 18px; + } + br { + content: ""; + display: block; + height: 18px; + } + hr { + height: 15px; + border-top: 1px solid rgba(0, 0, 0, 0.1); + margin-top: 15px; + } video { max-width: 100%; width: 100%; } + table + p, hr + p { + min-height: 0px; + } table { width: 100%; border-collapse: collapse; diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 9631dcc..b5b0dbb 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -811,15 +811,27 @@ this.props.refreshdata({pageIndex}) } - mkCheckTopLine = (menuId, id, type) => { + mkCheckTopLine = (menuId, id, selected) => { const { MenuID, data, setting } = this.props - if (MenuID !== menuId || !data || data.length === 0) return + if (MenuID !== menuId) return + if (!data || data.length === 0) { + MKEmitter.emit('resetSelectLine', menuId, '', '') + return + } - if (type === 'sign') { - let index = '' - let keys = [] - let items = [] + let index = -1 + let keys = [] + let items = [] + + if (id) { + index = data.findIndex(item => item.$$uuid === id && !item.$disabled) + } + + if (index !== -1) { + keys = [index] + items = [data[index]] + } else if (selected === 'sign') { data.forEach((item, i) => { if (!item.$disabled && item.selected === 'true') { items.push(item) @@ -827,33 +839,25 @@ index = i } }) - - this.changedata(index) - this.setState({ selectedRowKeys: keys, activeIndex: index }) - this.props.chgSelectData(items) - - if (setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', MenuID, items, data.length === keys.length) + } else if (selected !== 'false') { + if (!data[0].$disabled) { + index = 0 + keys = [index] + items = [data[index]] } + } + + if (index === -1) { + MKEmitter.emit('resetSelectLine', menuId, '', '') return } - let index = 0 - if (id) { - index = data.findIndex(item => item.$$uuid === id) - if (index === -1) { - index = 0 - } - } - - if (data[index].$disabled) return - this.changedata(index) - this.setState({ selectedRowKeys: [index], activeIndex: index }) - this.props.chgSelectData([data[index]]) + this.setState({ selectedRowKeys: keys, activeIndex: index }) + this.props.chgSelectData(items) if (setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', MenuID, [data[index]], data.length === 1) + MKEmitter.emit('syncBalconyData', MenuID, items, data.length === keys.length) } } @@ -1028,22 +1032,9 @@ if (setting.$hasSyncModule) { MKEmitter.emit('syncBalconyData', MenuID, selects, data.length === selects.length) } - } else if (type === 'false') { - this.setState({ - selectedRowKeys: [], - activeIndex: null, - pickup: false - }) - } else if (type === 'repage') { - this.setState({ - pageIndex: Index, - selectedRowKeys: [], - activeIndex: null, - pickup: false - }) } else { this.setState({ - pageIndex: 1, + pageIndex: type === 'false' ? this.state.pageIndex : 1, selectedRowKeys: [], activeIndex: null, pickup: false diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index b02d9ae..5b5f0f3 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -67,8 +67,6 @@ if (setting.selected !== 'always' && setting.selected !== 'init' && setting.selected !== 'sign') { setting.selected = 'false' - } else { - setting.orisel = true } _config.style = _config.style || {} @@ -85,7 +83,7 @@ }, () => { if (_config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata() + this.loadData() this.getStatFieldsValue() }, _config.setting.delay || 0) } @@ -94,10 +92,8 @@ /** * @description 涓昏〃鏁版嵁鍔犺浇 - * @param { Boolean } reset 琛ㄦ牸鏄惁閲嶇疆 - * @param { String } repage 琛ㄦ牸鏄惁閲嶇疆椤电爜 */ - async loadmaindata (reset, repage, id) { + async loadData (reset, repage, id) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -110,9 +106,6 @@ MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲 reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 鍒楄〃閲嶇疆 - // if (setting.$hasSyncModule) { - // MKEmitter.emit('syncBalconyData', config.uuid, [], false) - // } this.requestId = '' return @@ -147,38 +140,12 @@ if (result.status) { if (result.$requestId && this.requestId !== result.$requestId) return - if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { - let _pageIndex = Math.ceil(result.total / pageSize) - - if (_pageIndex < pageIndex) { - MKEmitter.emit('resetTable', config.uuid, 'repage', _pageIndex) - this.setState({ - pageIndex: _pageIndex, - data: [], - selectedData: [], - total: result.total - }, () => { - this.loadmaindata() - }) - return - } + if (repage === 'false' && result.data.length === 0 && pageIndex > 1) { + this.reloadIndex() + return } - if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { - setTimeout(() => { - MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) - }, 200) - if (setting.selected === 'init') { - this.setState({setting: {...setting, selected: 'false'}}) - } - } else { - MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲 - // if (setting.$hasSyncModule) { - // MKEmitter.emit('syncBalconyData', config.uuid, [], false) - // } - } - - reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆 + reset && MKEmitter.emit('resetTable', config.uuid, repage || '') // 鍒楄〃閲嶇疆 let start = 1 if (setting.laypage) { @@ -214,12 +181,24 @@ total = data[data.length - 1].mk_total || 0 } + if (data.length && (id || setting.selected !== 'false')) { + setTimeout(() => { + MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) + }, 200) + } else { + MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲 + } + this.setState({ data: data, selectedData: [], total: total, loading: false }) + + if (setting.selected === 'init') { + this.setState({setting: {...setting, selected: 'false'}}) + } if (config.autoMatic) { if (result.data && result.data.length > 0) { @@ -249,11 +228,6 @@ async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state - if (config.forbidLine) { - this.reloadtable() - return - } - let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] @@ -275,7 +249,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (position === 'line_grid' && (!result.data || !result.data[0])) { - this.loadmaindata(true, 'false') + this.reloadIndex() return } @@ -463,7 +437,7 @@ pageIndex: 1, search: searches }, () => { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') this.getStatFieldsValue() }) @@ -481,7 +455,7 @@ this.setState({ pageIndex: pagination.pageIndex }, () => { - this.loadmaindata() + this.loadData() }) } else { if (sorter.order) { @@ -497,25 +471,8 @@ pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' }, () => { - this.loadmaindata() + this.loadData() }) - } - } - - /** - * @description 琛ㄦ牸鍒锋柊 - */ - reloadtable = (btn, id) => { - if (!btn || btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadmaindata(true, 'true', id) - this.getStatFieldsValue() - }) - } else { - this.loadmaindata(true, 'false', id) - this.getStatFieldsValue() } } @@ -550,7 +507,10 @@ if (config.uuid !== menuId) return if (!id) { - this.reloadtable() + this.reloadIndex() + } else if (config.forbidLine) { + this.loadData(true, 'false', id) + this.getStatFieldsValue() } else { this.loadLinedata(id) } @@ -567,7 +527,7 @@ BData: data }, () => { if (!setting.checkBid) { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') this.getStatFieldsValue() } }) @@ -576,25 +536,32 @@ /** * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� - * @param {*} menuId // 鑿滃崟Id - * @param {*} position // 鍒锋柊浣嶇疆 - * @param {*} btn // 鎵ц鐨勬寜閽� */ refreshByButtonResult = (menuId, position, btn, id, lines) => { const { config, BID } = this.state if (config.uuid !== menuId) return + let _id = config.wrap.selected === 'always' ? (id || '') : '' if (position === 'line' || position === 'line_grid') { - if (lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$uuid, position) + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(true, 'false', lines[0].$$uuid) + this.getStatFieldsValue() + } else { + this.loadLinedata(lines[0].$$uuid, position) + } } else { - this.reloadtable(btn, id) + this.loadData(true, 'false', _id) + this.getStatFieldsValue() } } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) + } else if (btn.resetPageIndex !== 'false') { + this.reloadIndex() } else { - this.reloadtable(btn, id) + this.loadData(true, 'false', _id) + this.getStatFieldsValue() } } @@ -602,8 +569,17 @@ const { config } = this.state if (config.$searchId !== searchId) return - - this.reloadtable() + + this.reloadIndex() + } + + reloadIndex = () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData(true, 'true') + this.getStatFieldsValue() + }) } autoExec = (times) => { diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 30e10ab..c3cdecd 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -225,7 +225,7 @@ }, () => { if (_config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata() + this.loadData() }, _config.setting.delay || 0) } }) @@ -421,10 +421,8 @@ /** * @description 涓昏〃鏁版嵁鍔犺浇 - * @param { Boolean } reset 琛ㄦ牸鏄惁閲嶇疆 - * @param { String } repage 琛ㄦ牸鏄惁閲嶇疆椤电爜 */ - async loadmaindata (reset, repage) { + async loadData (reset, repage) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -530,11 +528,6 @@ */ async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state - - if (config.forbidLine) { - this.reloadtable() - return - } let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 @@ -557,7 +550,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (position === 'line_grid' && (!result.data || !result.data[0])) { - this.loadmaindata(true, 'false') + this.reloadIndex() return } @@ -652,7 +645,7 @@ pageIndex: 1, search: searches }, () => { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') }) } @@ -673,23 +666,19 @@ pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' }, () => { - this.loadmaindata() + this.loadData() }) } /** * @description 琛ㄦ牸鍒锋柊 */ - reloadtable = (btn) => { - if (!btn || btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadmaindata(true, 'true') - }) - } else { - this.loadmaindata(true, 'false') - } + reloadIndex = () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData(true, 'true') + }) } /** @@ -723,7 +712,9 @@ if (config.uuid !== menuId) return if (!id) { - this.reloadtable() + this.reloadIndex() + } else if (config.forbidLine) { + this.loadData(true, 'false') } else { this.loadLinedata(id) } @@ -745,7 +736,7 @@ }, () => { if (!setting.checkBid) { setTimeout(() => { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') }, setting.delay || 0) } }) @@ -764,15 +755,21 @@ if (config.uuid !== menuId) return if (position === 'line' || position === 'line_grid') { - if (lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$uuid, position) + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(true, 'false') + } else { + this.loadLinedata(lines[0].$$uuid, position) + } } else { - this.reloadtable(btn) + this.loadData(true, 'false') } } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) + } else if (btn.resetPageIndex !== 'false') { + this.reloadIndex() } else { - this.reloadtable(btn) + this.loadData(true, 'false') } } @@ -805,7 +802,7 @@ if (config.$searchId !== searchId) return - this.reloadtable() + this.reloadIndex() } shouldComponentUpdate (nextProps, nextState) { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 12f76e9..ae15927 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -79,8 +79,6 @@ if (setting.selected !== 'always' && setting.selected !== 'init' && setting.selected !== 'sign') { setting.selected = 'false' - } else { - setting.orisel = true } if (_config.setting.sync === 'true') { @@ -200,7 +198,7 @@ this.setState({ pageIndex: 1 }, () => { - this.loadmaindata(true, 'true', '', 'timer') + this.loadData(true, 'true', '', 'timer') }) }) } @@ -237,7 +235,7 @@ Api.getLCacheConfig(config.uuid, config.$time, BID).then(res => { if (!res.valid && config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata(false, 'true', '', 'init') + this.loadData(false, 'true', '', 'init') }, config.setting.delay || 0) } @@ -299,13 +297,13 @@ if (config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata(false, 'true', '', 'init') + this.loadData(false, 'true', '', 'init') }, config.setting.delay || 0) } } } else if (config.setting.onload === 'true') { setTimeout(() => { - this.loadmaindata() + this.loadData() }, config.setting.delay || 0) } } @@ -511,10 +509,8 @@ /** * @description 涓昏〃鏁版嵁鍔犺浇 - * @param { Boolean } reset 琛ㄦ牸鏄惁閲嶇疆 - * @param { String } repage 琛ㄦ牸鏄惁閲嶇疆椤电爜 */ - async loadmaindata (reset, repage, id, type) { + async loadData (reset, repage, id, type) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state if (setting.supModule && !BID && setting.supKey !== 'false') { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� @@ -575,35 +571,9 @@ Api.writeCacheConfig(config.uuid, result.data || [], BID) } - if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { - let _pageIndex = Math.ceil(result.total / pageSize) - - if (_pageIndex < pageIndex) { - MKEmitter.emit('resetTable', config.uuid, 'repage', _pageIndex) - this.setState({ - pageIndex: _pageIndex, - data: [], - selectedData: [], - total: result.total - }, () => { - this.loadmaindata() - }) - return - } - } - - if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { - setTimeout(() => { - MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) - }, 200) - if (setting.selected === 'init') { - this.setState({setting: {...setting, selected: 'false'}}) - } - } else { - MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲 - if (setting.$hasSyncModule) { - MKEmitter.emit('syncBalconyData', config.uuid, [], false) - } + if (repage === 'false' && result.data.length === 0 && pageIndex > 1) { + this.reloadIndex() + return } reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆 @@ -649,6 +619,17 @@ allSearch.push(...searches) } + if (data.length && (id || setting.selected !== 'false')) { + setTimeout(() => { + MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) + }, 200) + } else { + MKEmitter.emit('resetSelectLine', config.uuid, '', '') // 骞挎挱鏁版嵁鍒囨崲 + if (setting.$hasSyncModule) { + MKEmitter.emit('syncBalconyData', config.uuid, [], false) + } + } + this.setState({ data: data, selectedData: [], @@ -656,6 +637,10 @@ total: total, loading: false }) + + if (setting.selected === 'init') { + this.setState({setting: {...setting, selected: 'false'}}) + } if (config.$hasTopModule) { window.GLOB.CacheData.set(config.uuid + 'tb', data[0] || { $$empty: true, $$uuid: '' }) @@ -686,11 +671,6 @@ async loadLinedata (id, position) { const { setting, config, search, orderBy, BID, pageIndex, pageSize, BData } = this.state - if (config.forbidLine) { - this.reloadtable() - return - } - let searches = fromJS(search).toJS() if (config.setting.useMSearch) { // 涓昏〃鎼滅储鏉′欢 let mainSearch = window.GLOB.SearchBox.get(config.$searchId) || [] @@ -712,7 +692,7 @@ let result = await Api.genericInterface(param) if (result.status) { if (position === 'line_grid' && (!result.data || !result.data[0])) { - this.loadmaindata(true, 'false') + this.reloadIndex() return } @@ -836,7 +816,7 @@ pageIndex: 1, search: searches }, () => { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') }) } @@ -857,23 +837,19 @@ pageSize: pagination.pageSize, orderBy: (sorter.field && sorter.order) ? `${sorter.field} ${sorter.order}` : '' }, () => { - this.loadmaindata() + this.loadData() }) } /** * @description 琛ㄦ牸鍒锋柊 */ - reloadtable = (btn, id) => { - if (!btn || btn.resetPageIndex !== 'false') { - this.setState({ - pageIndex: 1 - }, () => { - this.loadmaindata(true, 'true', id) - }) - } else { - this.loadmaindata(true, 'false', id) - } + reloadIndex = () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData(true, 'true') + }) } /** @@ -907,7 +883,9 @@ if (config.uuid !== menuId) return if (!id) { - this.reloadtable() + this.reloadIndex() + } else if (config.forbidLine) { + this.loadData(true, 'false', id) } else { this.loadLinedata(id) } @@ -932,7 +910,7 @@ if (bid !== this.state.BID || bid !== '') { this.setState({ BID: bid, BData: _data, pageIndex: 1 }, () => { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') }) } } else { @@ -948,7 +926,7 @@ BData: data }, () => { if (!setting.checkBid) { - this.loadmaindata(true, 'true') + this.loadData(true, 'true') } }) } @@ -957,15 +935,13 @@ /** * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂� - * @param {*} menuId // 鑿滃崟Id - * @param {*} position // 鍒锋柊浣嶇疆 - * @param {*} btn // 鎵ц鐨勬寜閽� */ refreshByButtonResult = (menuId, position, btn, id, lines) => { const { config, BID } = this.state if (config.uuid !== menuId) return + let _id = config.wrap.selected === 'always' ? (id || '') : '' if (config.supNodes) { if (['mainline', 'maingrid', 'popclose'].includes(position)) { let supNode = this.supModules[this.supModules.length - 1] @@ -980,26 +956,38 @@ }) } else { if (position === 'line' || position === 'line_grid') { - if (lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$uuid, position) + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(true, 'false', lines[0].$$uuid) + } else { + this.loadLinedata(lines[0].$$uuid, position) + } } else { - this.reloadtable(btn, id) + this.loadData(true, 'false', _id) } + } else if (btn.resetPageIndex !== 'false') { + this.reloadIndex() } else { - this.reloadtable(btn, id) + this.loadData(true, 'false', _id) } } } else { if (position === 'line' || position === 'line_grid') { - if (lines && lines.length === 1 && !config.forbidLine) { - this.loadLinedata(lines[0].$$uuid, position) + if (lines && lines.length === 1) { + if (config.forbidLine) { + this.loadData(true, 'false', lines[0].$$uuid) + } else { + this.loadLinedata(lines[0].$$uuid, position) + } } else { - this.reloadtable(btn, id) + this.loadData(true, 'false', _id) } } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) + } else if (btn.resetPageIndex !== 'false') { + this.reloadIndex() } else { - this.reloadtable(btn, id) + this.loadData(true, 'false', _id) } } } @@ -1033,7 +1021,7 @@ if (config.$searchId !== searchId) return - this.reloadtable() + this.reloadIndex() } render() { diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index b16ea86..23526d4 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -965,8 +965,9 @@ } if (cell.verify) { + let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') if (cell.verify.invalid === 'true') { - if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { + if (isStatic) { cell.verify.invalid = 'false' } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { cell.verify.invalid = 'false' @@ -978,6 +979,9 @@ cell.verify.invalid = 'false' } } + if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) { + cell.verify.uniques = [] + } if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { cell.returnValue = 'true' diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 9fbcb3a..338eb38 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -672,8 +672,9 @@ } if (cell.verify) { + let isStatic = item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public') if (cell.verify.invalid === 'true') { - if (item.wrap && (item.wrap.datatype === 'static' || item.wrap.datatype === 'public')) { + if (isStatic) { cell.verify.invalid = 'false' } else if (item.setting && item.setting.maxScript && item.setting.maxScript >= 300) { cell.verify.invalid = 'false' @@ -686,6 +687,10 @@ } } + if (cell.verify.uniques && cell.verify.uniques.length > 0 && cell.Ot === 'requiredOnce' && isStatic) { + cell.verify.uniques = [] + } + if (cell.verify.linkEnable === 'true' && /@/.test(cell.verify.linkUrl)) { cell.returnValue = 'true' } diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx index 90fd522..509bce4 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx @@ -142,7 +142,7 @@ */ changeUser = (primaryId) => { const { setting, btn } = this.props - let _this = this + let that = this let param = { func: 'webapi_ChangeUser', @@ -203,16 +203,16 @@ message: res.message || '鎵ц澶辫触锛�', duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 }) - _this.setState({loading: false}) + that.setState({loading: false}) } }, () => { resolve() - _this.setState({loading: false}) + that.setState({loading: false}) }) }) }, onCancel() { - _this.setState({loading: false}) + that.setState({loading: false}) } }) } diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 9310404..c8d24bc 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -404,7 +404,7 @@ if (res.status) { this.execSuccess(res) } else if (res.ErrCode === 'C') { - const _this = this + const that = this confirm({ title: window.GLOB.dict['exec_sure'] || '璇风‘璁�', content: res.message, @@ -414,16 +414,16 @@ return new Promise(resolve => { Api.genericInterface(unCheckParam).then(result => { if (result.status) { - _this.execSuccess(result) + that.execSuccess(result) } else { - _this.execError(result) + that.execError(result) } resolve() }) }) }, onCancel() { - _this.execError(res) + that.execError(res) } }) } else { diff --git a/src/tabviews/zshare/actionList/index.scss b/src/tabviews/zshare/actionList/index.scss index 700f589..3419db2 100644 --- a/src/tabviews/zshare/actionList/index.scss +++ b/src/tabviews/zshare/actionList/index.scss @@ -16,6 +16,9 @@ width: auto; padding: 0 15px; } + .ant-btn.ant-btn-link { + border-color: #d9d9d9; + } .ant-btn.mk-btn-hover-bg:not([disabled]):hover { opacity: 1!important; diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 1315430..47e76c9 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -48,7 +48,6 @@ dict: window.GLOB.dict } - moduleParams = null preCallback = null UNSAFE_componentWillMount () { @@ -225,7 +224,7 @@ this.setState({autoMatic: type === 'autoMatic'}) - let _this = this + let that = this let data = record || selectedData || [] let valid = this.checkBtnData(data) @@ -248,11 +247,11 @@ cancelText: dict['cancel'] || '鍙栨秷', onOk() { return new Promise(resolve => { - _this.execSubmit(data, resolve) + that.execSubmit(data, resolve) }) }, onCancel() { - _this.setState({loading: false}) + that.setState({loading: false}) } }) } else if (btn.OpenType === 'exec') { @@ -332,7 +331,7 @@ return } - let _this = this + let that = this let data = selectedData || [] let valid = this.checkBtnData(data) @@ -360,12 +359,12 @@ cancelText: dict['cancel'] || '鍙栨秷', onOk() { return new Promise(resolve => { - _this.execSubmit(data, resolve) + that.execSubmit(data, resolve) }) }, onCancel() { callback() - _this.setState({loading: false}) + that.setState({loading: false}) } }) } else if (btn.OpenType === 'exec') { @@ -469,11 +468,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -505,11 +504,11 @@ param.ID = primaryId || Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -531,11 +530,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -597,11 +596,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -637,11 +636,11 @@ param.ID = Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -663,11 +662,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -1006,53 +1005,10 @@ * @description 鎸夐挳鎻愪氦鎵ц */ execSubmit = (data, _resolve, formdata, force) => { - const { setting, btn } = this.props - this.moduleParams = null + const { btn } = this.props if (btn.preButton && !force) { this.trigger(btn.preButton, data, _resolve, formdata, 0) - } else if (btn.verify && btn.verify.invalid === 'true' && setting.dataresource) { - MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => { - let datasource = setting.dataresource - let customScript = setting.customScript || '' - let allSearch = Utils.getAllSearchOptions(param.search) - - let regoptions = allSearch.map(item => { - return { - reg: new RegExp('@' + item.key + '@', 'ig'), - value: `'${item.value}'` - } - }) - - regoptions.push({ - reg: new RegExp('@userName@', 'ig'), - value: `'${sessionStorage.getItem('User_Name') || ''}'` - }, { - reg: new RegExp('@fullName@', 'ig'), - value: `'${sessionStorage.getItem('Full_Name') || ''}'` - }, { - reg: new RegExp('@orderBy@', 'ig'), - value: setting.order - }, { - reg: new RegExp('@pageSize@', 'ig'), - value: 10 - }, { - reg: new RegExp('@pageIndex@', 'ig'), - value: 1 - }) - - regoptions.forEach(item => { - datasource = datasource.replace(item.reg, item.value) - customScript = customScript.replace(item.reg, item.value) - }) - - this.moduleParams = { - datasource, - customScript - } - - this.execRealSubmit(data, _resolve, formdata) - }) } else { this.execRealSubmit(data, _resolve, formdata) } @@ -1833,7 +1789,7 @@ msg = msg.replace(/\n|\r/ig, '<br/>') msg = <span dangerouslySetInnerHTML={{__html: msg}}></span> } - const _this = this + const that = this confirm({ title: window.GLOB.dict['exec_sure'] || '璇风‘璁�', content: msg, @@ -1843,16 +1799,16 @@ return new Promise(resolve => { Api.genericInterface(unCheckParam).then(result => { if (result.status) { - _this.triggerNote(result, param.ID) // 娑堟伅 + that.triggerNote(result, param.ID) // 娑堟伅 if (params.length === 0) { - _this.execSuccess(result) + that.execSuccess(result) _resolve() } else { - _this.checkLoopRequest(params, _resolve) + that.checkLoopRequest(params, _resolve) } } else { - _this.execError(result) + that.execError(result) _resolve() } resolve() @@ -1860,7 +1816,7 @@ }) }, onCancel() { - _this.execError(res) + that.execError(res) _resolve() } }) @@ -3301,7 +3257,7 @@ modelconfirm = () => { const { BID } = this.props const { btnconfig, selines, dict } = this.state - let _this = this + let that = this let result = [] let _data = {} @@ -3449,12 +3405,12 @@ cancelText: dict['cancel'] || '鍙栨秷', onOk() { return new Promise(resolve => { - _this.execSubmit(selines, resolve, result) + that.execSubmit(selines, resolve, result) }) }, onCancel() { - _this.preCallback && _this.preCallback() - _this.setState({ loading: false }) + that.preCallback && that.preCallback() + that.setState({ loading: false }) } }) } diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 34e1669..e106de1 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -150,7 +150,7 @@ this.setState({autoMatic: type === 'autoMatic'}) - let _this = this + let that = this let data = record || selectedData || [] if (btn.Ot !== 'notRequired' && data.length === 0) { @@ -194,10 +194,10 @@ okText: dict['ok'] || '纭畾', cancelText: dict['cancel'] || '鍙栨秷', onOk() { - _this.triggerPrint(data) + that.triggerPrint(data) }, onCancel() { - _this.setState({ loading: false }) + that.setState({ loading: false }) } }) } else { @@ -2113,7 +2113,7 @@ modelconfirm = () => { const { btnconfig, selines, dict } = this.state - let _this = this + let that = this let result = [] let _data = {} let BData = {} @@ -2259,10 +2259,10 @@ okText: dict['ok'] || '纭畾', cancelText: dict['cancel'] || '鍙栨秷', onOk() { - _this.triggerPrint(selines, result) + that.triggerPrint(selines, result) }, onCancel() { - _this.setState({ loading: false }) + that.setState({ loading: false }) } }) } diff --git a/src/tabviews/zshare/settingcomponent/index.jsx b/src/tabviews/zshare/settingcomponent/index.jsx index 77e2230..dd87d2c 100644 --- a/src/tabviews/zshare/settingcomponent/index.jsx +++ b/src/tabviews/zshare/settingcomponent/index.jsx @@ -316,9 +316,14 @@ }) } else if (!links.includes(item.verify.linkUrl)) { links.push(item.verify.linkUrl) + } + }) - let socket = null - socket = new WebSocket('ws://' + item.verify.linkUrl) + if (links.length === 0) return + + let defers = links.map(link => { + return new Promise((resolve) => { + let socket = new WebSocket('ws://' + link) // 鎵撳紑Socket socket.onopen = () =>{ let request = { @@ -360,29 +365,39 @@ }) } - window.GLOB.UserCacheMap.set(item.verify.linkUrl, _printers) - } else if (data && data.cmd === 'getPrinters') { - notification.warning({ - top: 92, - message: data.message, - duration: 5 - }) + resolve({status: true, printers: _printers}) + } else if (data && data.cmd === 'getPrinters' && data.message) { + resolve({status: false, printers: null, message: data.message}) } } socket.onerror = () => { - let tool = item.verify.linkUrl - if (item.verify.linkUrl === '127.0.0.1:13529') { + let tool = link + + if (link === '127.0.0.1:13529') { tool = '鏄庣閫氳缁勪欢' - } else if (item.verify.linkUrl === '127.0.0.1:13528') { + } else if (link === '127.0.0.1:13528') { tool = 'CAINIAO鎵撳嵃缁勪欢' } - notification.warning({ - top: 92, - message: '鏃犳硶杩炴帴鍒�: ' + tool, - duration: 5 - }) + + resolve({status: false, printers: null, message: '鏃犳硶杩炴帴鍒�: ' + tool}) + } + }) + }) + + Promise.all(defers).then(results => { + let res = results.filter(item => item.status)[0] + if (res) { + links.forEach(link => { + window.GLOB.UserCacheMap.set(link, res.printers) + }) + } else { + notification.warning({ + top: 92, + message: results[0].message, + duration: 5 + }) } }) } diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index fc3b441..4768e78 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -689,13 +689,13 @@ cancelConfig = () => { // const { config, originMenu } = this.state - // let _this = this + // let that = this // if (config.isAdd) { // confirm({ // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', // onOk() { - // _this.props.handleView() + // that.props.handleView() // }, // onCancel() {} // }) diff --git a/src/templates/comtableconfig/updatetable/index.jsx b/src/templates/comtableconfig/updatetable/index.jsx index c1a3d21..f61593a 100644 --- a/src/templates/comtableconfig/updatetable/index.jsx +++ b/src/templates/comtableconfig/updatetable/index.jsx @@ -29,7 +29,7 @@ trigger = () => { const { config } = this.props - const _this = this + const that = this if (!config.enabled) { notification.warning({ @@ -45,7 +45,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.execUpdate(resolve) + that.execUpdate(resolve) }) }, onCancel() {} @@ -611,7 +611,7 @@ saveConfig = (_resolve, _config, errors) => { let err = errors.join('锛�') - let _this = this + let that = this if (err) { _resolve() @@ -620,7 +620,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.saveNewMenu(resolve, _config) + that.saveNewMenu(resolve, _config) }) }, onCancel() {} diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index cabfc7d..bbe3611 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -280,15 +280,15 @@ * @description 琛ㄥ崟鍒犻櫎骞跺埛鏂� */ closeForm = (card) => { - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎${card.label ? `<<${card.label}>>` : ''}鍚楋紵`, onOk() { - let _config = fromJS(_this.state.config).toJS() + let _config = fromJS(that.state.config).toJS() _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid)) - _this.setState({ + that.setState({ config: _config, }) }, @@ -379,14 +379,14 @@ cancelConfig = () => { // const { config, originConfig } = this.state - // let _this = this + // let that = this // let isOrigin = config.fields.filter(item => item.origin).length > 0 // if (isOrigin) { // confirm({ // content: '灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', // onOk() { - // _this.handleViewBack() + // that.handleViewBack() // }, // onCancel() {} // }) @@ -455,7 +455,7 @@ changecols = (type) => { let config = fromJS(this.state.config).toJS() - let _this = this + let that = this config.fields = config.fields.map(item => { item.labelwidth = 33.3 @@ -481,7 +481,7 @@ confirm({ content: `纭畾鍒囨崲涓�${type}鍒楀悧锛焋, onOk() { - _this.setState({config}) + that.setState({config}) }, onCancel() {} }) @@ -557,13 +557,13 @@ } clearConfig = () => { - const _this = this + const that = this let _config = {...this.state.config, fields: []} confirm({ content: '纭畾娓呯┖琛ㄥ崟鍚楋紵', onOk() { - _this.setState({ config: _config }) + that.setState({ config: _config }) }, onCancel() {} }) diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx index 96961c4..62be8b1 100644 --- a/src/templates/sharecomponent/actioncomponent/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/index.jsx @@ -280,12 +280,12 @@ */ deleteElement = (card) => { const { config } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${card.label} 锛焋, onOk() { - let _actionlist = fromJS(_this.state.actionlist).toJS() + let _actionlist = fromJS(that.state.actionlist).toJS() _actionlist = _actionlist.filter(item => item.uuid !== card.uuid) @@ -313,10 +313,10 @@ card: card } - _this.setState({ + that.setState({ actionlist: _actionlist }, () => { - _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard) + that.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard) }) }, onCancel() {} diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index be7041f..f22a3ef 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -596,18 +596,18 @@ clearField = () => { const { verify } = this.state - const _this = this + const that = this confirm({ content: `纭畾娓呯┖Excel鍒楀悧锛焋, onOk() { - _this.setState({ + that.setState({ verify: { ...verify, columns: [] } }, () => { - _this.resetUniqueColumns() + that.resetUniqueColumns() }) }, onCancel() {} diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index 7b23dda..502137b 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -810,12 +810,12 @@ clearField = () => { const { verify } = this.state - const _this = this + const that = this confirm({ content: `纭畾娓呯┖Excel鍒楀悧锛焋, onOk() { - _this.setState({ + that.setState({ verify: { ...verify, columns: [] diff --git a/src/templates/sharecomponent/cardcomponent/index.jsx b/src/templates/sharecomponent/cardcomponent/index.jsx index 795eb4c..aab7e55 100644 --- a/src/templates/sharecomponent/cardcomponent/index.jsx +++ b/src/templates/sharecomponent/cardcomponent/index.jsx @@ -270,7 +270,7 @@ deletedetail = (cell) => { const { card } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${cell.content} 锛焋, @@ -279,22 +279,22 @@ _details = _details.filter(item => item.uuid !== cell.uuid) - _this.plotChange({details: _details}) + that.plotChange({details: _details}) }, onCancel() {} }) } deleteElem = (type) => { - let _this = this + let that = this confirm({ content: '纭畾鍒犻櫎锛�', onOk() { - let _subelement = fromJS(_this.props.card.subelement).toJS() + let _subelement = fromJS(that.props.card.subelement).toJS() _subelement = _subelement.filter(_type => _type !== type) - _this.plotChange({subelement: _subelement}) + that.plotChange({subelement: _subelement}) }, onCancel() {} }) diff --git a/src/templates/sharecomponent/chartgroupcomponent/index.jsx b/src/templates/sharecomponent/chartgroupcomponent/index.jsx index 4c90686..2c18248 100644 --- a/src/templates/sharecomponent/chartgroupcomponent/index.jsx +++ b/src/templates/sharecomponent/chartgroupcomponent/index.jsx @@ -203,13 +203,13 @@ */ deletechart = (plot) => { const { config } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 ${plot.title} 锛焋, onOk() { - let _chartlist = fromJS(_this.state.chartlist).toJS() - let _chartview = _this.state.chartview + let _chartlist = fromJS(that.state.chartlist).toJS() + let _chartview = that.state.chartview _chartlist = _chartlist.filter(item => item.uuid !== plot.uuid) @@ -217,11 +217,11 @@ _chartview = _chartlist[0].uuid } - _this.setState({ + that.setState({ chartlist: _chartlist, chartview: _chartview }) - _this.props.updatechartgroup({...config, charts: _chartlist}, _chartview) + that.props.updatechartgroup({...config, charts: _chartlist}, _chartview) }, onCancel() {} }) diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx index f390b59..e488a3d 100644 --- a/src/templates/sharecomponent/columncomponent/index.jsx +++ b/src/templates/sharecomponent/columncomponent/index.jsx @@ -280,12 +280,12 @@ */ deleteElement = (card) => { const { config } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${card.label} 锛焋, onOk() { - let _columnlist = fromJS(_this.state.columnlist).toJS() + let _columnlist = fromJS(that.state.columnlist).toJS() _columnlist = _columnlist.filter(item => item.uuid !== card.uuid) @@ -351,10 +351,10 @@ } } - _this.setState({ + that.setState({ columnlist: _columnlist }, ()=> { - _this.props.updatecolumn({...config, columns: _columnlist}) + that.props.updatecolumn({...config, columns: _columnlist}) }) }, onCancel() {} diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index 52d7eb1..550b5f6 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -146,9 +146,20 @@ if (type === 'search') { // 娣诲姞鎼滅储鏉′欢锛屽瓧娈甸泦涓瓨鍦ㄦ悳绱㈡潯浠跺瓧娈碉紝浣跨敤鎼滅储鏉′欢瀵硅薄鏇挎崲瀛楁闆嗭紝璁剧疆鏁版嵁绫诲瀷 config.search.forEach(item => { - if (item.field && columns.has(item.field.toLowerCase())) { - let _datatype = columns.get(item.field.toLowerCase()).datatype - columns.set(item.field.toLowerCase(), {...item, origin: true, datatype: _datatype}) + if (item.field) { + if (/,/.test(item.field)) { + item.field.split(',').forEach(n => { + if (columns.has(n.toLowerCase())) { + let _datatype = columns.get(n.toLowerCase()).datatype + columns.set(n.toLowerCase(), {...item, field: n, origin: true, datatype: _datatype}) + } + }) + } else { + if (columns.has(item.field.toLowerCase())) { + let _datatype = columns.get(item.field.toLowerCase()).datatype + columns.set(item.field.toLowerCase(), {...item, origin: true, datatype: _datatype}) + } + } } }) } else if (type === 'columns') { @@ -192,13 +203,6 @@ } let config = fromJS(this.props.config).toJS() - - // 鑾峰彇宸查�夊瓧娈甸泦鍚� - let cards = selectCards - let columnsMap = new Map() - cards.forEach(card => { - columnsMap.set(card.field.toLowerCase(), card) - }) let items = [] let keys = [] diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index 37498c6..c861729 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -247,19 +247,19 @@ */ deleteElement = (card) => { const { config } = this.props - let _this = this + let that = this confirm({ content: `纭畾鍒犻櫎 - ${card.label} 锛焋, onOk() { - let _searchlist = fromJS(_this.state.searchlist).toJS() + let _searchlist = fromJS(that.state.searchlist).toJS() _searchlist = _searchlist.filter(item => item.uuid !== card.uuid) - _this.setState({ + that.setState({ searchlist: _searchlist }, () => { - _this.props.updatesearch({...config, search: _searchlist}) + that.props.updatesearch({...config, search: _searchlist}) }) }, onCancel() {} diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx index 6d9bb70..8657cbe 100644 --- a/src/templates/sharecomponent/settingcomponent/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/index.jsx @@ -93,7 +93,7 @@ resetSetting = (s, ori) => { let setting = fromJS(s).toJS() - let maxScript = 0 + // let maxScript = 0 setting.show = ori.show || 'true' setting.advanceType = ori.advanceType || 'modal' @@ -103,43 +103,43 @@ setting.searchLwidth = ori.searchLwidth !== undefined ? ori.searchLwidth : 33.3 setting.resetContrl = ori.resetContrl || 'init' - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') - setting.scripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') + // setting.scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - if (item.status === 'false') return + // if (item.status === 'false') return - if (/exec\s/ig.test(item.sql)) { - maxScript = 1000 - } else if (item.sql.length > maxScript) { - maxScript = item.sql.length - } - }) - setting.preScripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - setting.cbScripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - if (setting.dataresource) { - setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - } - }) - } else { - setting.scripts.forEach(item => { - if (item.status === 'false') return + // if (/exec\s/ig.test(item.sql)) { + // maxScript = 1000 + // } else if (item.sql.length > maxScript) { + // maxScript = item.sql.length + // } + // }) + // setting.preScripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // }) + // setting.cbScripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // }) + // if (setting.dataresource) { + // setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // } + // }) + // } else { + // setting.scripts.forEach(item => { + // if (item.status === 'false') return - if (/exec\s/ig.test(item.sql)) { - maxScript = 1000 - } else if (item.sql.length > maxScript) { - maxScript = item.sql.length - } - }) - } + // if (/exec\s/ig.test(item.sql)) { + // maxScript = 1000 + // } else if (item.sql.length > maxScript) { + // maxScript = item.sql.length + // } + // }) + // } - setting.maxScript = maxScript + // setting.maxScript = maxScript return setting } diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 8c0ab17..ff665b9 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -79,17 +79,17 @@ let status = fromJS(_setting).toJS() - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') - _scripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - if (_setting.dataresource) { - _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) - } - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') + // _scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) + // }) + // if (_setting.dataresource) { + // _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) + // } + // }) + // } this.setState({ setting: _setting, diff --git a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx index 846ae2f..74025d2 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/utils.jsx @@ -26,25 +26,25 @@ _dataresource = '' } - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(item => { - let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(item => { + // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') + // _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // }) + // } _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, '') - _customScript = _customScript.replace(/@select\$|\$select@/ig, '') + // _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') + // _customScript = _customScript.replace(/@select\$|\$select@/ig, '') // _dataresource = _dataresource.replace(/@sum\$|\$sum@/ig, '') - _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') + // _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') - _dataresource = _dataresource.replace(/\$sum@/ig, '/*$sum@') - _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') + // _dataresource = _dataresource.replace(/\$sum@/ig, '/*$sum@') + // _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { diff --git a/src/templates/sharecomponent/tabscomponent/index.jsx b/src/templates/sharecomponent/tabscomponent/index.jsx index a95725d..73c4dba 100644 --- a/src/templates/sharecomponent/tabscomponent/index.jsx +++ b/src/templates/sharecomponent/tabscomponent/index.jsx @@ -219,7 +219,7 @@ */ deleteElement = (card, group) => { const { config } = this.props - let _this = this + let that = this let tabgroups = fromJS(this.state.tabgroups).toJS() confirm({ @@ -243,10 +243,10 @@ return _group }) - _this.setState({ + that.setState({ tabgroups: tabgroups }, () => { - _this.props.updatetabs({...config, tabgroups: tabgroups}) + that.props.updatetabs({...config, tabgroups: tabgroups}) }) }, onCancel() {} @@ -258,7 +258,7 @@ */ addTabGroup = () => { const { config } = this.props - let _this = this + let that = this let _tabgroups = fromJS(this.state.tabgroups).toJS() confirm({ @@ -275,10 +275,10 @@ sublist:[] }) - _this.setState({ + that.setState({ tabgroups: _tabgroups }, () => { - _this.props.updatetabs({...config, tabgroups: _tabgroups}) + that.props.updatetabs({...config, tabgroups: _tabgroups}) }) }, onCancel() {} @@ -290,7 +290,7 @@ */ delTabGroup = (group) => { const { config } = this.props - let _this = this + let that = this let _tabgroups = fromJS(this.state.tabgroups).toJS() confirm({ @@ -298,10 +298,10 @@ onOk() { _tabgroups = _tabgroups.filter(_group => _group.uuid !== group.uuid) - _this.setState({ + that.setState({ tabgroups: _tabgroups }, () => { - _this.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist) + that.props.updatetabs({...config, tabgroups: _tabgroups}, group.sublist) }) }, onCancel() {} diff --git a/src/templates/sharecomponent/treesettingcomponent/index.jsx b/src/templates/sharecomponent/treesettingcomponent/index.jsx index 055a295..51faa23 100644 --- a/src/templates/sharecomponent/treesettingcomponent/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/index.jsx @@ -43,17 +43,17 @@ loading: true }) this.settingRef.handleConfirm().then(res => { - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') - res.scripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - if (res.dataresource) { - res.dataresource = res.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - } - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') + // res.scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // }) + // if (res.dataresource) { + // res.dataresource = res.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // } + // }) + // } this.setState({ visible: false, loading: false diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index 46b7486..ba10535 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -32,17 +32,17 @@ let _setting = fromJS(config.setting).toJS() let _scripts = _setting.scripts || [] - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') - _scripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - if (_setting.dataresource) { - _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) - } - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') + // _scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) + // }) + // if (_setting.dataresource) { + // _setting.dataresource = _setting.dataresource.replace(reg, `$ex@${m.func_code}@ex$`) + // } + // }) + // } this.setState({ setting: _setting, diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx index 7d91a7c..a540544 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/utils.jsx @@ -27,13 +27,13 @@ _dataresource = '' } - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(item => { - let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(item => { + // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') + // _dataresource = _dataresource.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // _customScript = _customScript.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // }) + // } _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'`) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 8e48352..ceb6a74 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -588,13 +588,13 @@ cancelConfig = () => { // const { config, originConfig } = this.state - // let _this = this + // let that = this // if (originConfig.isAdd) { // confirm({ // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', // onOk() { - // _this.handleViewBack() + // that.handleViewBack() // }, // onCancel() {} // }) diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx index af0d67b..f6df00d 100644 --- a/src/templates/treepageconfig/index.jsx +++ b/src/templates/treepageconfig/index.jsx @@ -444,13 +444,13 @@ */ cancelConfig = () => { // const { config, originMenu } = this.state - // let _this = this + // let that = this // if (config.isAdd) { // confirm({ // content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', // onOk() { - // _this.props.handleView() + // that.props.handleView() // }, // onCancel() {} // }) diff --git a/src/templates/treepageconfig/updatetable/index.jsx b/src/templates/treepageconfig/updatetable/index.jsx index 8de0cea..35b911b 100644 --- a/src/templates/treepageconfig/updatetable/index.jsx +++ b/src/templates/treepageconfig/updatetable/index.jsx @@ -29,7 +29,7 @@ trigger = () => { const { config } = this.props - const _this = this + const that = this if (!config.enabled) { notification.warning({ @@ -45,7 +45,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.execUpdate(resolve) + that.execUpdate(resolve) }) }, onCancel() {} @@ -637,7 +637,7 @@ saveConfig = (_resolve, _config, errors) => { let err = errors.join('锛�') - let _this = this + let that = this if (err) { _resolve() @@ -646,7 +646,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.saveNewMenu(resolve, _config) + that.saveNewMenu(resolve, _config) }) }, onCancel() {} diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx index b14d57a..777fb99 100644 --- a/src/templates/zshare/editTable/index.jsx +++ b/src/templates/zshare/editTable/index.jsx @@ -385,14 +385,14 @@ } clear = () => { - const _this = this + const that = this confirm({ title: '纭畾娓呯┖鍒楄〃鍚楋紵', content: '', onOk() { - _this.setState({ data: [], editingKey: '' }, () => { - _this.props.onChange([]) + that.setState({ data: [], editingKey: '' }, () => { + that.props.onChange([]) }) }, onCancel() {} diff --git a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx index 9105198..7a33ed3 100644 --- a/src/templates/zshare/verifycard/callbackcustomscript/index.jsx +++ b/src/templates/zshare/verifycard/callbackcustomscript/index.jsx @@ -116,12 +116,12 @@ 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') - sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(item => { + // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') + // sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // }) + // } // 鏁版嵁鏉冮檺 sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx index 345b9f6..efca89b 100644 --- a/src/templates/zshare/verifycard/customform/index.jsx +++ b/src/templates/zshare/verifycard/customform/index.jsx @@ -76,12 +76,12 @@ end aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(item => { - let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') - sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(item => { + // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') + // sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // }) + // } // 鏁版嵁鏉冮檺 sql = sql.replace(/@\$|\$@/ig, '') diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index eb193a5..d371c52 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -183,12 +183,12 @@ sql += _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') - sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(item => { + // let reg = new RegExp('\\$ex@' + item.func_code + '@ex\\$', 'ig') + // sql = sql.replace(reg, `/*$ex@${item.func_code}-begin*/\n${item.key_sql}\n/*@ex$-end*/`) + // }) + // } // 鏁版嵁鏉冮檺 sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '') @@ -204,14 +204,19 @@ sql = sql.replace(/@statusname@/ig, `'寮�濮�'`) sql = sql.replace(/@work_group@/ig, `'work_group'`) sql = sql.replace(/@work_grade@/ig, '0') - sql = sql.replace(/@start_type@/ig, `'寮�濮�'`) - sql = sql.replace(/@check_type@/ig, `'瀹℃牳'`) - sql = sql.replace(/@notice_type@/ig, `'鎶勯��'`) - - sql = sql.replace(/@check_userids@/ig, `''`) - sql = sql.replace(/@notice_userids@/ig, `''`) - sql = sql.replace(/@works_flow_sign@/ig, `''`) + + if (flowType === 'start') { + sql = sql.replace(/@start_type@/ig, `'寮�濮�'`) + } else { + sql = sql.replace(/@check_type@/ig, `'瀹℃牳'`) + sql = sql.replace(/@notice_type@/ig, `'鎶勯��'`) + + sql = sql.replace(/@check_userids@/ig, `''`) + sql = sql.replace(/@notice_userids@/ig, `''`) + + sql = sql.replace(/@works_flow_sign@/ig, `''`) + } } if (skip) { @@ -328,7 +333,7 @@ } render() { - const { formfields, colfields, systemScripts, btn, type, workFlow } = this.props + const { formfields, colfields, systemScripts, btn, type, workFlow, flowType } = this.props const { getFieldDecorator } = this.props.form const { editItem, skip } = this.state const formItemLayout = { @@ -360,7 +365,7 @@ {!_type ? <Col span={24} className="sqlfield"> <Form.Item label={'鍙敤瀛楁'}> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�"><span style={{color: '#1890ff'}}>BID, ID, LoginUID, SessionUid, UserID, Appkey, lang, time_id, typename, datam</span></Tooltip>, - {window.GLOB.process && workFlow === 'true' ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="宸ヤ綔娴佸彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤锛寃orks_flow_sign 涓哄垎鏀惎鐢ㄩ珮绾ц缃椂鐨勬爣璁板�笺��"><span style={{color: '#26C281'}}>works_flow_code, works_flow_name, works_flow_param, works_flow_detail_id, status, statusname, work_group, work_grade, start_type, check_type, notice_type, check_userids, notice_userids, works_flow_sign, </span></Tooltip> : null} + {window.GLOB.process && workFlow === 'true' ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={`宸ヤ綔娴佸彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤${flowType !== 'start' ? '锛寃orks_flow_sign 涓哄垎鏀惎鐢ㄩ珮绾ц缃椂鐨勬爣璁板��' : ''}銆俙}><span style={{color: '#26C281'}}>works_flow_code, works_flow_name, works_flow_param, works_flow_detail_id, status, statusname, work_group, work_grade, {flowType === 'start' ? 'start_type,' : 'check_type, notice_type, check_userids, notice_userids, works_flow_sign,'} </span></Tooltip> : null} <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��"><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address, mk_deleted</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞跺湪鍗曞彿鐢熸垚鎴栧垱寤哄嚟璇佹椂浣跨敤銆�"><span style={{color: '#13c2c2'}}>BillCode, BVoucher, FIBVoucherDate, FiYear, ModularDetailCode</span></Tooltip> {formfields ? <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title="琛ㄥ崟鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��">, <span style={{color: '#8E44AD'}}>{formfields}</span></Tooltip> : ''} diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 0e90c0c..9113732 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -663,20 +663,20 @@ _verify.printTempId = '' } - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') - _verify.customverifys.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - _verify.scripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - _verify.cbScripts.forEach(item => { - item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) - }) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig') + // _verify.customverifys.forEach(item => { + // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) + // }) + // _verify.scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) + // }) + // _verify.cbScripts.forEach(item => { + // item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`) + // }) + // }) + // } _verify.customverifys.forEach((item, i) => { item.$index = i + 1 @@ -1167,7 +1167,6 @@ } orderSql = (record) => { - let _ModularDetailCode = '' let _lpline = '' if (record.TypeCharOne === 'Lp') { if (record.linkField.toLowerCase() === 'bid') { @@ -1175,17 +1174,20 @@ } else { _lpline = `set @ModularDetailCode= 'Lp'+ right('${record.mark || this.props.card.uuid}'+@${record.linkField.toLowerCase()},48)` } - _ModularDetailCode = '@ModularDetailCode' } else if (record.TypeCharOne === 'BN') { - _ModularDetailCode = `'${record.TypeCharOne}'` + if (record.linkField.toLowerCase() === 'bid') { + _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` + } else { + _lpline = `set @ModularDetailCode= 'BN'+ right(@${record.linkField.toLowerCase()},48)` + } } else { - _ModularDetailCode = `'${record.ModularDetailCode}'` + _lpline = `set @ModularDetailCode= right('${record.ModularDetailCode}',50)` } let sql = `select @BillCode='', @${record.field}='', @ModularDetailCode='' ${_lpline} exec s_get_BillCode - @ModularDetailCode=${_ModularDetailCode}, + @ModularDetailCode=@ModularDetailCode, @Type=${record.Type}, @TypeCharOne='${record.TypeCharOne}', @TypeCharTwo ='${record.TypeCharTwo}', @@ -1593,20 +1595,20 @@ msg = '鑷畾涔夎剼鏈�' } - if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { - window.GLOB.funcs.forEach(m => { - let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') - verify.customverifys.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - verify.scripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - verify.cbScripts.forEach(item => { - item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) - }) - }) - } + // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { + // window.GLOB.funcs.forEach(m => { + // let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') + // verify.customverifys.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // }) + // verify.scripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // }) + // verify.cbScripts.forEach(item => { + // item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) + // }) + // }) + // } delete verify.limitInvalid delete verify.limitText diff --git a/src/utils/sqlFormatter.js b/src/utils/sqlFormatter.js index 0dd99e8..e14e46b 100644 --- a/src/utils/sqlFormatter.js +++ b/src/utils/sqlFormatter.js @@ -247,43 +247,43 @@ }; Formatter.prototype.getFormattedQueryFromTokens = function getFormattedQueryFromTokens() { - var _this = this; + var that = this; var formattedQuery = ""; this.tokens.forEach(function (token, index) { - _this.index = index; + that.index = index; if (token.type === _tokenTypes2["default"].WHITESPACE) { // ignore (we do our own whitespace formatting) } else if (token.type === _tokenTypes2["default"].LINE_COMMENT) { - formattedQuery = _this.formatLineComment(token, formattedQuery); + formattedQuery = that.formatLineComment(token, formattedQuery); } else if (token.type === _tokenTypes2["default"].BLOCK_COMMENT) { - formattedQuery = _this.formatBlockComment(token, formattedQuery); + formattedQuery = that.formatBlockComment(token, formattedQuery); } else if (token.type === _tokenTypes2["default"].RESERVED_TOPLEVEL) { - formattedQuery = _this.formatToplevelReservedWord(token, formattedQuery); - _this.previousReservedWord = token; + formattedQuery = that.formatToplevelReservedWord(token, formattedQuery); + that.previousReservedWord = token; } else if (token.type === _tokenTypes2["default"].RESERVED_NEWLINE) { - formattedQuery = _this.formatNewlineReservedWord(token, formattedQuery); - _this.previousReservedWord = token; + formattedQuery = that.formatNewlineReservedWord(token, formattedQuery); + that.previousReservedWord = token; }else if (token.type === _tokenTypes2["default"].RESERVED) { - formattedQuery = _this.formatWithSpaces(token, formattedQuery); - _this.previousReservedWord = token; + formattedQuery = that.formatWithSpaces(token, formattedQuery); + that.previousReservedWord = token; } else if (token.type === _tokenTypes2["default"].OPEN_PAREN) { - formattedQuery = _this.formatOpeningParentheses(token, formattedQuery); + formattedQuery = that.formatOpeningParentheses(token, formattedQuery); } else if (token.type === _tokenTypes2["default"].CLOSE_PAREN) { - formattedQuery = _this.formatClosingParentheses(token, formattedQuery); + formattedQuery = that.formatClosingParentheses(token, formattedQuery); } else if (token.type === _tokenTypes2["default"].PLACEHOLDER) { - formattedQuery = _this.formatPlaceholder(token, formattedQuery); + formattedQuery = that.formatPlaceholder(token, formattedQuery); } else if (token.value === '$') { - formattedQuery = _this.formatNewWithSpaces(token, formattedQuery); + formattedQuery = that.formatNewWithSpaces(token, formattedQuery); } else if (token.value === ",") { - formattedQuery = _this.formatComma(token, formattedQuery); + formattedQuery = that.formatComma(token, formattedQuery); } else if (token.value === ":") { - formattedQuery = _this.formatWithSpaceAfter(token, formattedQuery); + formattedQuery = that.formatWithSpaceAfter(token, formattedQuery); } else if (token.value === ".") { - formattedQuery = _this.formatWithoutSpaces(token, formattedQuery); + formattedQuery = that.formatWithoutSpaces(token, formattedQuery); } else if (token.value === ";") { - formattedQuery = _this.formatQuerySeparator(token, formattedQuery); + formattedQuery = that.formatQuerySeparator(token, formattedQuery); } else { - formattedQuery = _this.formatWithSpaces(token, formattedQuery); + formattedQuery = that.formatWithSpaces(token, formattedQuery); } }); return formattedQuery; @@ -545,10 +545,10 @@ }; Tokenizer.prototype.createParenRegex = function createParenRegex(parens) { - var _this = this; + var that = this; return new RegExp("^(" + parens.map(function (p) { - return _this.escapeParen(p); + return that.escapeParen(p); }).join("|") + ")", "i"); }; @@ -669,13 +669,13 @@ }; Tokenizer.prototype.getStringNamedPlaceholderToken = function getStringNamedPlaceholderToken(input) { - var _this2 = this; + var that2 = this; return this.getPlaceholderTokenWithKey({ input: input, regex: this.STRING_NAMED_PLACEHOLDER_REGEX, parseKey: function parseKey(v) { - return _this2.getEscapedPlaceholderKey({ key: v.slice(2, -1), quoteChar: v.slice(-1) }); + return that2.getEscapedPlaceholderKey({ key: v.slice(2, -1), quoteChar: v.slice(-1) }); } }); }; diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index c64fdea..6556d9f 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1,4 +1,5 @@ import md5 from 'md5' +import { fromJS } from 'immutable' import { notification } from 'antd' export default class MenuUtils { @@ -2074,7 +2075,7 @@ list.forEach(str => { str = str.replace(/^\s/, '') let strs = str.match(/(\s|=)[a-z0-9_]+\./ig) - if (strs.length === 2 && (strs[0].replace(/\s|\./g, '') === strs[1].replace(/\s|\./g, ''))) { + if (strs.length === 2 && (strs[0].replace(/\s|\.|=/g, '') === strs[1].replace(/\s|\.|=/g, ''))) { errors.push(str) } }) @@ -2849,4 +2850,2621 @@ } traversal(config.components) +} + +/** + * @description 鑾峰彇鎵ц鑴氭湰 + */ +export function getAllSqls (conf) { + let config = fromJS(conf).toJS() + + let sqls = [] + let urlFields = config.urlFields + let appType = sessionStorage.getItem('appType') + let process = config.process === 'true' + + if (urlFields) { + urlFields = urlFields.map(n => n.toLowerCase()) + } + + let filterComponent = (components, mainSearch) => { + components.forEach(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + let _mainSearch = mainSearch || [] + + if (appType !== 'mob') { + tab.components.forEach(com => { + if (com.type !== 'search') return + + _mainSearch = com.search || [] + }) + } + filterComponent(tab.components, _mainSearch) + }) + } else if (item.type === 'group') { + filterComponent(item.components, mainSearch) + } else { + if (item.wrap && item.setting) { + if (item.wrap.datatype === 'public' || item.wrap.datatype === 'static') { + item.setting.interType = 'other' + } + } + + if (appType === 'mob' && item.type !== 'search' && item.type !== 'topbar' && item.search && item.search.length > 0) { + item.search = [] + } + if (appType !== 'mob' && item.search && item.search.length > 0) { + item.search.forEach(cell => { + if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { + let msg = getFormSql(cell) + + sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) + } + }) + } + + if (item.subtype === 'tablecard') { // 鍏煎 + item.type = 'card' + } + + if (item.setting && item.setting.interType === 'system') { + if (item.format === 'object') { + item.setting.laypage = 'false' + item.setting.$top = true + } + + let msg = getDataSource(item, mainSearch) + + sqls.push({uuid: item.uuid, type: 'datasource', ...msg}) + } else if (item.setting && item.setting.useMSearch === 'true') { + let searches = item.search || [] + if (mainSearch.length > 0) { + searches = [...searches, ...mainSearch] + } + item.$searches = fromJS(searches).toJS() + } + + item.action && item.action.forEach(cell => { + if (cell.hidden === 'true') return false + + resetButton(item, cell) + }) + + if (item.type === 'table') { + let getCols = (cols) => { + cols.forEach(col => { + if (col.type === 'action') { + col.type = 'custom' + } + if (col.type === 'colspan') { + getCols(col.subcols || []) + } else if (col.type === 'custom') { + col.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true') return + + resetButton(item, cell) + }) + } else if (item.subtype === 'editable' && col.editable === 'true') { + if (col.editType === 'select' && col.resourceType === '1') { + let msg = getFormSql(col) + + sqls.push({uuid: col.uuid, type: 'tbForm', ...msg}) + } else if (col.editType === 'popSelect') { + if (col.pops) { + col.pops.forEach(n => { + let msg = getPopSelectSql(n) + + sqls.push({uuid: n.uuid, type: 'popSource', ...msg}) + }) + } else { + let msg = getPopSelectSql(col) + + sqls.push({uuid: col.uuid, type: 'popSource', ...msg}) + } + } + } + }) + } + + getCols(item.cols) + + if (item.subtype === 'editable' && item.submit.intertype === 'system') { + let msg = getEditTableSql(item.submit, item.cols, item.columns) + + sqls.push({uuid: 'submit_' + item.uuid, type: 'editable', ...msg}) + } + } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { + item.subcards && item.subcards.forEach(card => { + card.elements && card.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true') return + + resetButton(item, cell) + }) + + if (!card.backElements || card.backElements.length === 0) return + + card.backElements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true') return + + resetButton(item, cell, true) + }) + }) + } else if (item.type === 'balcony') { + item.elements.forEach(cell => { + if (cell.eleType !== 'button' || cell.hidden === 'true') return + + resetButton(item, cell) + }) + } else if (item.type === 'form') { + item.subcards.forEach(group => { + group.subButton.OpenType = 'formSubmit' + if (!group.subButton.Ot) { + group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' + } + group.subButton.uuid = group.uuid + group.subButton.modal = { + fields: group.fields + } + + resetButton(item, group.subButton) + }) + } + } + }) + } + + let resetButton = (item, cell, isback) => { + if (['exec', 'prompt', 'pop', 'form', 'formSubmit'].includes(cell.OpenType)) { + if (cell.intertype === 'system' || cell.procMode === 'system') { // 绯荤粺鎺ュ彛 + if (item.subtype === 'dualdatacard' && isback) { + let _item = fromJS(item).toJS() + _item.columns = _item.subColumns || [] + _item.setting.primaryKey = _item.setting.subKey + + let msg = getSysDefaultSql(cell, _item) + + sqls.push({uuid: cell.uuid, type: 'button', ...msg}) + } else { + let msg = getSysDefaultSql(cell, item) + + sqls.push({uuid: cell.uuid, type: 'button', ...msg}) + } + } + if (cell.callbackType === 'script' && cell.verify && cell.verify.cbScripts) { + if (item.subtype === 'dualdatacard' && isback) { + let _item = fromJS(item).toJS() + _item.columns = _item.subColumns || [] + + let msg = getSysBackSql(cell, _item) + + sqls.push({uuid: 'back_' + cell.uuid, type: 'btnCallBack', ...msg}) + } else { + let msg = getSysBackSql(cell, item) + + sqls.push({uuid: 'back_' + cell.uuid, type: 'btnCallBack', ...msg}) + } + } + if (['pop', 'formSubmit'].includes(cell.OpenType) && cell.modal && cell.modal.fields) { + cell.modal.fields.forEach(form => { + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� + if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { + let msg = getFormSql(form) + + sqls.push({uuid: form.uuid, type: 'form', ...msg}) + } else if (form.type === 'popSelect') { + let msg = getPopSelectSql(form) + + sqls.push({uuid: form.uuid, type: 'popSource', ...msg}) + } + }) + } + } else if (cell.OpenType === 'excelIn') { + if (cell.intertype === 'system') { + let msg = getExcelInSql(cell) + + sqls.push({uuid: cell.uuid, type: 'excelIn', ...msg}) + } + } else if (cell.OpenType === 'excelOut') { + if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { + let msg = getExcelOutSql(cell, item) + + sqls.push({uuid: cell.uuid, type: 'excelOut', ...msg}) + } + } else if (cell.OpenType === 'funcbutton') { + if (cell.funcType === 'print') { + if (cell.intertype === 'system' && cell.verify && cell.verify.dataType === 'custom') { + let msg = getPrintSql(cell) + + sqls.push({uuid: cell.uuid, type: 'print', ...msg}) + } + if (cell.execMode === 'pop' && cell.modal && cell.modal.fields) { + cell.modal.fields.forEach(form => { + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� + if (['select', 'link', 'multiselect', 'radio', 'checkbox', 'checkcard'].includes(form.type) && form.resourceType === '1') { + let msg = getFormSql(form) + + sqls.push({uuid: form.uuid, type: 'form', ...msg}) + } else if (form.type === 'popSelect') { + let msg = getPopSelectSql(form) + + sqls.push({uuid: form.uuid, type: 'popSource', ...msg}) + } + }) + } + } else if ((cell.funcType === 'refund' || cell.funcType === 'pay') && cell.payMode === 'system') { + let msg = getPaySql(cell, item) + + sqls.push({uuid: cell.uuid, type: 'pay', ...msg}) + } + } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') { + if (cell.pageTemplate === 'pay' && cell.payMode === 'system') { + let msg = getPaySql(cell, item) + + sqls.push({uuid: cell.uuid, type: 'pay', ...msg}) + } + } else if (cell.OpenType === 'popview') { + if (cell.config && cell.config.components) { + let _mainSearch = [] + + if (appType === 'mob') { + cell.config.components.forEach(item => { + if (item.type === 'search' && item.wrap.field) { + _mainSearch.push({ + type: 'text', + label: item.wrap.label, + field: item.wrap.field, + match: item.wrap.match, + required: item.wrap.required, + value: item.wrap.initval || '' + }) + } + }) + } else { + cell.config.components.forEach(component => { + if (component.type !== 'search') return + + _mainSearch = component.search || [] + }) + } + + filterComponent(cell.config.components, _mainSearch) + } + } + } + + let getSearches = (searches) => { + let sFields = [] + let query = false + searches.forEach(item => { + if (!item.field) return + + if (item.type === 'group') { + sFields.push(item.field) + sFields.push(item.datefield) + sFields.push(item.datefield + '1') + } else if (item.type === 'date') { + if (sFields.includes(item.field)) { + sFields.push(item.field + '1') + } else { + sFields.push(item.field) + } + } else if (item.type === 'dateweek') { + sFields.push(item.field) + sFields.push(item.field + '1') + } else if (item.type === 'range') { + sFields.push(item.field) + sFields.push(item.field + '1') + } else if (item.type === 'datemonth') { + if (item.match === '=') { + sFields.push(item.field) + } else { + sFields.push(item.field) + sFields.push(item.field + '1') + } + } else if (item.type === 'daterange') { + if (/,/.test(item.field)) { + sFields.push(item.field.split(',')[0]) + sFields.push(item.field.split(',')[1]) + } else { + sFields.push(item.field) + sFields.push(item.field + '1') + } + } else if (item.type === 'text' || item.type === 'select') { + item.field.split(',').forEach(field => { + sFields.push(field) + }) + } else { + sFields.push(item.field) + } + + if (query) return + + query = item.query !== 'false' + }) + + return { sFields, query } + } + + let getSysDefaultSql = (btn, component) => { + let primaryId = '@ID@' + let BID = '@BID@' + let verify = btn.verify || {} + let _actionType = null + let setting = component.setting || {} + let columns = component.columns || [] + let primaryKey = setting.primaryKey || 'id' + let colreps = [] // 寰呮浛鎹㈠彉閲忛泦 + + if (verify.invalid === 'true') { + if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { + verify.invalid = 'false' + } else if (setting.maxScript && setting.maxScript >= 300) { + verify.invalid = 'false' + } else if (!setting.dataresource) { + verify.invalid = 'false' + } else if (btn.intertype !== 'system' && btn.procMode !== 'system') { + verify.invalid = 'false' + } else if (btn.sqlType === 'insert') { + verify.invalid = 'false' + } else if (btn.Ot === 'notRequired') { + verify.invalid = 'false' + } + } + if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce') { + if (component.wrap && (component.wrap.datatype === 'static' || component.wrap.datatype === 'public')) { + verify.uniques = [] + } + } + + if (verify.default !== 'false') { // 鍒ゆ柇鏄惁浣跨敤榛樿sql + _actionType = btn.sqlType + } + + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� + + verify.scripts && verify.scripts.forEach(item => { + if (item.status === 'false') return + + if (item.position === 'init') { + _initCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${item.sql} + ` + } else if (item.position === 'front') { + _prevCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${item.sql} + ` + } else { + _backCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${item.sql} + ` + } + }) + + // 闇�瑕佸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'] + + let _sql = '' + + let _initFormfields = [] + let _declares = [] + + let formdata = null + let formkeys = [] + if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { + formdata = [] + if (btn.modal && btn.modal.fields) { + btn.modal.fields.forEach(item => { + if (!item.field) return + + let _item = { + key: item.field, + fieldlen: item.fieldlength || 50, + writein: item.writein !== 'false', + type: item.type, + isconst: item.constant === 'true' + } + + if (_item.type === 'datemonth') { + _item.type = 'text' + } else if (_item.type === 'number' || _item.type === 'rate') { + _item.fieldlen = item.decimal || 0 + } else if (_item.type === 'date') { + _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' + } else if (_item.type === 'datetime') { + _item.type = 'date' + } else if (item.declare === 'decimal') { + _item.type = 'number' + _item.fieldlen = item.decimal || 0 + } + + formdata.push(_item) + }) + } + } else if (btn.OpenType === 'form') { + formdata = [] + + let item = { + type: 'text', + readin: true, + writein: true, + fieldlen: 50, + key: btn.field + } + if (btn.formType === 'counter') { + item.type = 'number' + item.fieldlen = 0 + } else if (btn.formType === 'switch' || btn.formType === 'radio') { + if (typeof(btn.openVal) === 'number') { + item.type = 'number' + item.fieldlen = 0 + } + } + formdata.push(item) + } + + // 鑾峰彇瀛楁閿�煎 + formdata && formdata.forEach(form => { + let _key = form.key.toLowerCase() + + if (!formkeys.includes(_key)) { + formkeys.push(_key) + if (form.type === 'number' || form.type === 'rate') { + _initFormfields.push(`@${_key}=@mk_${_key}_mk@`) + } else if (form.type === 'date') { + _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) + } else if (form.type === 'select' || form.type === 'link' || form.type === 'radio') { + _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) + } else if (form.isconst) { + _initFormfields.push(`@${_key}=N'@mk_${_key}_mk@'`) + } else { + _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) + } + } + + if (!_vars.includes(_key)) { + _vars.push(_key) + + if (form.fieldlen && form.fieldlen > 4000) { + form.fieldlen = 'max' + } + + let _type = `nvarchar(${form.fieldlen})` + + if (form.type.match(/date/ig)) { + _type = 'datetime' + } else if (form.type === 'number') { + _type = `decimal(18,${form.fieldlen})` + } else if (form.type === 'rate') { + _type = `decimal(18,2)` + } + + _declares.push(`@${_key} ${_type}`) + } + }) + + // 琛ㄥ崟鍙橀噺璧嬪�� + if (_initFormfields.length > 0) { + _sql += ` + /* 琛ㄥ崟鍙橀噺璧嬪�� */ + select ${_initFormfields.join(',')} + ` + } + if (btn.Ot !== 'notRequired' && columns.length > 0) { + _sql += '@mk_cols_values@' + } + + // 鍘婚櫎绂佺敤鐨勯獙璇� + if (verify.contrasts) { + verify.contrasts = verify.contrasts.filter(item => item.status !== 'false') + } + if (verify.uniques) { + verify.uniques = verify.uniques.filter(item => item.status !== 'false') + } + if (verify.customverifys) { + verify.customverifys = verify.customverifys.filter(item => item.status !== 'false') + } + if (verify.billcodes) { + verify.billcodes = verify.billcodes.filter(item => item.status !== 'false') + } + + if (_initCustomScript) { + _sql += _initCustomScript + } + + // 鍚敤璐︽湡楠岃瘉 + if (verify.accountdate === 'true') { + let orgcode = `''` + let date = `''` + if (verify.accountfield) { + orgcode = '@' + verify.accountfield + } + if (verify.voucherdate) { + date = '@' + verify.voucherdate + } + + _sql += ` + /* 璐︽湡楠岃瘉 */ + exec s_FIBVoucherDateCheck @OrgCode=${orgcode},@FIBVoucherDate=${date},@ErrorCode=@ErrorCode OUTPUT,@retmsg=@retmsg OUTPUT + if @ErrorCode!='' + GOTO aaa + ` + } + + // 澶辨晥楠岃瘉锛屾坊鍔犳暟鎹椂涓嶇敤 + if (verify.invalid === 'true') { + let datasource = setting.dataresource + let customScript = setting.customScript || '' + + let regoptions = [{ + reg: new RegExp('@orderBy@', 'ig'), + value: setting.order || primaryKey + }, { + reg: new RegExp('@pageSize@', 'ig'), + value: 1 + }, { + reg: new RegExp('@pageIndex@', 'ig'), + value: 1 + }] + + regoptions.forEach(item => { + datasource = datasource.replace(item.reg, item.value) + customScript = customScript.replace(item.reg, item.value) + }) + + if (customScript) { + _sql += ` + /* 鏁版嵁婧愯嚜瀹氫箟鑴氭湰锛岃娉ㄦ剰鍙橀噺瀹氫箟鏄惁閲嶅 */ + ${customScript} + ` + } + + if (btn.Ot === 'requiredOnce') { + _sql += ` + /* 澶辨晥楠岃瘉 */ + select @tbid='', @ErrorCode='',@retmsg='' + select @tbid='X' from ${datasource} right join (select ID from dbo.SplitComma(@ID@)) sp + on tb.${primaryKey} =sp.id where tb.${primaryKey} is null + + If @tbid!='' + Begin + select @ErrorCode='E',@retmsg='鏁版嵁宸插け鏁�' + goto aaa + end + ` + } else { + _sql += ` + /* 澶辨晥楠岃瘉 */ + select @tbid='', @ErrorCode='',@retmsg='' + select @tbid=${primaryKey} from ${datasource} where ${primaryKey}=@ID@ + If @tbid='' + Begin + select @ErrorCode='E',@retmsg='鏁版嵁宸插け鏁�' + goto aaa + end + ` + } + } + + // 姣旇緝楠岃瘉 + if (verify.contrasts && verify.contrasts.length > 0) { + verify.contrasts.forEach(item => { + _sql += ` + /* 姣旇緝楠岃瘉 */ + If ${item.frontfield} ${item.operator} ${item.backfield} + Begin + select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' + goto aaa + end + ` + }) + } + + // 鑷畾涔夐獙璇� + verify.customverifys && verify.customverifys.forEach(item => { + _sql += ` + /* 鑷畾涔夐獙璇� */ + select @tbid='', @ErrorCode='',@retmsg='' + select top 1 @tbid='X' from (${item.sql}) a + If @tbid ${item.result === 'true' ? '!=' : '='}'' + Begin + select @ErrorCode='${item.errorCode}',@retmsg='${item.errmsg}' + goto aaa + end + ` + }) + + // 鍗曞彿鐢熸垚锛屼娇鐢ㄤ笂绾d锛圔ID锛夋垨鍒楄〃鏁版嵁锛屽0鏄庡彉閲忥紙妫�楠岋級 + let _billcodesSql = '' + if (formdata && verify.billcodes && verify.billcodes.length > 0) { + verify.billcodes.forEach(item => { + let _key = item.field.toLowerCase() + let _linkKey = item.linkField ? item.linkField.toLowerCase() : '' + + if (!formkeys.includes(_key)) return // 琛ㄥ崟涓笉鍚崟鍙风敓鎴愬瓧娈� + + let _lpline = '' + if (item.TypeCharOne === 'Lp') { + if (_linkKey === 'bid' && BID) { // 鏇挎崲bid + _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@BID@,48)` + } else { + _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` + } + } else if (item.TypeCharOne === 'BN') { + if (_linkKey === 'bid' && BID) { // 鏇挎崲bid + _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` + } else { + _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` + } + } else { + _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` + } + + _billcodesSql += ` + /* 鍗曞彿鐢熸垚 */ + select @BillCode='', @${_key}='', @ModularDetailCode='' + ${_lpline} + exec s_get_BillCode + @ModularDetailCode=@ModularDetailCode, + @Type=${item.Type}, + @TypeCharOne='${item.TypeCharOne}', + @TypeCharTwo ='${item.TypeCharTwo}', + @BillCode =@BillCode output, + @ErrorCode =@ErrorCode output, + @retmsg=@retmsg output + if @ErrorCode!='' + goto aaa + set @${_key}=@BillCode + ` + }) + + if (_actionType !== 'insertOrUpdate') { + _sql += _billcodesSql + } + } + + // 鍞竴鎬ч獙璇侊紝蹇呴』瀛樺湪琛ㄥ崟锛堣〃鍗曞瓨鍦ㄦ椂锛屼富閿潎涓哄崟鍊硷級,蹇呴』濉啓鏁版嵁婧愶紝澶氳鎷兼帴鏃朵笉鍙敤 + if (formdata && verify.uniques && verify.uniques.length > 0 && btn.Ot !== 'requiredOnce') { + verify.uniques.forEach(item => { + let _fieldValue = [] // 琛ㄥ崟閿�煎field=value + let _value = [] // 琛ㄥ崟鍊硷紝鐢ㄤ簬閿欒鎻愮ず + let _labels = item.fieldlabel.split(',') // 琛ㄥ崟鎻愮ず鏂囧瓧 + let arr = [] // 楠岃瘉涓婚敭 + + item.field.split(',').forEach((_field, index) => { + let _key = _field.toLowerCase() + let _val = '' + + arr.push(_key) + if (_key === 'bid') { // 琛ㄥ崟涓病鏈塨id鍒欎娇鐢ㄧ郴缁焍id鍙橀噺 + _val = BID + } else { + _val = `'@mk_${_key}_mk@'` + } + + _fieldValue.push(`${_key}=${_val}`) + _value.push(`${_labels[index] || ''}锛�${_val || ''}`) + }) + + if (!arr.includes(primaryKey.toLowerCase())) { + _fieldValue.push(`${primaryKey} !=${primaryId}`) + } + + _sql += ` + /* 鍞竴鎬ч獙璇� */ + select @tbid='', @ErrorCode='',@retmsg='' + select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${item.verifyType === 'logic' ? ' and deleted=0' : ''} + If @tbid!='' + Begin + select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 宸插瓨鍦�' + goto aaa + end + ` + }) + } else if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce' && setting.dataresource) { + let datasource = setting.dataresource + if (/\s/.test(datasource)) { // 鎷兼帴鍒悕 + if (!/tb$/.test(datasource)) { + datasource = '(' + datasource + ') tb' + } + } else { + datasource = datasource + ' tb' + } + + if (setting.customScript) { + _sql += ` + /* 鏁版嵁婧愯嚜瀹氫箟鑴氭湰锛岃娉ㄦ剰鍙橀噺瀹氫箟鏄惁閲嶅 */ + ${setting.customScript} + ` + } + + verify.uniques.forEach(item => { + _sql += ` + /* 鍚岀被鏁版嵁楠岃瘉 */ + Set @tbid='' + + Select top 1 @tbid='X' from (select distinct ${item.field},1 as n from ${datasource} inner join (select ID from dbo.SplitComma(@ID@)) sp on tb.${primaryKey}=sp.ID ) a having sum(n)>1 + + If @tbid!='' + Begin + Set @ErrorCode='E' Set @retmsg='${item.fieldlabel} 鍊间笉鍞竴' + goto aaa + end + ` + }) + } + + let hasvoucher = false + + // 鍑瘉-鏄剧ず鍒椾腑閫夊彇,蹇呴』閫夎 + if (verify.voucher && verify.voucher.enabled && btn.Ot !== 'requiredOnce') { + let _voucher = verify.voucher + + hasvoucher = true + + _sql += ` + /* 鍒涘缓鍑瘉 */ + exec s_BVoucher_Create + @Bill ='0', + @BVoucherType ='${_voucher.BVoucherType}', + @VoucherTypeOne ='${_voucher.VoucherTypeOne}', + @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', + @Type =${_voucher.Type}, + @UserID=@UserID@, + @Username=@Username, + @FullName=@FullName, + @BVoucher =@BVoucher OUTPUT , + @FIBVoucherDate =@FIBVoucherDate OUTPUT , + @FiYear =@FiYear OUTPUT , + @ErrorCode =@ErrorCode OUTPUT, + @retmsg=@retmsg OUTPUT + if @ErrorCode!='' + GOTO aaa + ` + } + + let _insertsql = '' + if (_actionType === 'insert' || _actionType === 'insertOrUpdate') { // 娣诲姞璇彞 + let keys = [] + let values = [] + + formdata.forEach(item => { + if (item.writein === false) return + let _key = item.key.toLowerCase() + + keys.push(_key) + values.push('@mk_' + _key + '_mk@') + }) + + if (!keys.includes(primaryKey.toLowerCase())) { + keys.push(primaryKey.toLowerCase()) + values.push(primaryId) + } + if (!keys.includes('createuserid')) { + keys.push('createuserid') + values.push('@userid@') + } + if (!keys.includes('createuser')) { + keys.push('createuser') + values.push('@username') + } + if (!keys.includes('createstaff')) { + keys.push('createstaff') + values.push('@fullname') + } + if (!keys.includes('bid')) { + keys.push('bid') + values.push('@BID@') + } + + if (!keys.includes('typename')) { + keys.push('typename') + values.push('@typename@') + } + + keys = keys.join(',') + values = values.join(',') + _insertsql = `insert into ${btn.sql} (${keys}) select ${values};` + } + + let _updatesql = '' + if (_actionType === 'update' || _actionType === 'audit' || _actionType === 'insertOrUpdate') { // 淇敼璇彞 + let _form = [] + let _arr = [] + + formdata.forEach(item => { + if (item.writein === false) return + let _key = item.key.toLowerCase() + + _arr.push(_key) + _form.push(_key + '=@mk_' + _key + '_mk@') + }) + + if (_actionType === 'audit') { + if (!_arr.includes('submitdate')) { + _form.push('submitdate=getdate()') + } + if (!_arr.includes('submituser')) { + _form.push('submituser=@username') + } + if (!_arr.includes('submitstaff')) { + _form.push('submitstaff=@fullname') + } + if (!_arr.includes('submituserid')) { + _form.push('submituserid=@userid@') + } + } else { + if (!_arr.includes('modifydate')) { + _form.push('modifydate=getdate()') + } + if (!_arr.includes('modifyuser')) { + _form.push('modifyuser=@username') + } + if (!_arr.includes('modifystaff')) { + _form.push('modifystaff=@fullname') + } + if (!_arr.includes('modifyuserid')) { + _form.push('modifyuserid=@userid@') + } + } + + if (hasvoucher) { + if (!_arr.includes('bvoucher')) { + _form.push('BVoucher=@BVoucher') + } + if (!_arr.includes('fibvoucherdate')) { + _form.push('FIBVoucherDate=@FIBVoucherDate') + } + if (!_arr.includes('fiyear')) { + _form.push('FiYear=@FiYear') + } + } + if (!_arr.includes('typename')) { + _form.push('typename=@typename@') + } + _form = _form.join(',') + + let _ID = '=@ID@' + if (btn.Ot === 'requiredOnce') { + _ID = ' in (select ID from dbo.SplitComma(@ID@))' + } + + _updatesql = `update ${btn.sql} set ${_form} where ${primaryKey}${_ID};` + } + + if (_prevCustomScript) { + _sql += _prevCustomScript + } + + // 娣诲姞銆佷慨鏀广�侀�昏緫鍒犻櫎銆佺墿鐞嗗垹闄� + if (_actionType === 'insert') { + _sql += ` + /* 榛樿sql */ + ${_insertsql}` + } else if (_actionType === 'update' || _actionType === 'audit') { + _sql += ` + /* 榛樿sql */ + ${_updatesql}` + } else if (_actionType === 'LogicDelete') { // 閫昏緫鍒犻櫎 + let _ID = '=@ID@' + if (btn.Ot === 'requiredOnce') { + _ID = ' in (select ID from dbo.SplitComma(@ID@))' + } + + _sql += ` + /* 榛樿sql */ + update ${btn.sql} set deleted=@mk_deleted,modifydate=getdate(),modifyuser=@username,modifystaff=@fullname,modifyuserid=@userid@ where ${primaryKey}${_ID};` + + } else if (_actionType === 'delete') { // 鐗╃悊鍒犻櫎 + let _msg = '' + if (columns && columns.length > 0 && btn.Ot !== 'notRequired') { + let _index = 0 + columns.forEach(col => { + if (_index >= 4 || col.field === primaryKey) return + + colreps.push(col.field) + + _msg += col.label + `=@mk_${col.field}_mk@,` + _index++ + }) + } + + let _ID = '=@ID@' + if (btn.Ot === 'requiredOnce') { + _ID = ' in (select ID from dbo.SplitComma(@ID@))' + } + + _sql += ` + /* 榛樿sql */ + insert into snote (remark,createuserid,CreateUser,CreateStaff,typename) select left('鍒犻櫎琛�:${btn.sql} 鏁版嵁: ${_msg}${primaryKey}='+@ID@,200),@userid@,@username,@fullname,@typename@ + delete ${btn.sql} where ${primaryKey}${_ID};` + } else if (_actionType === 'insertOrUpdate') { + _sql += ` + /* 榛樿sql */ + select @tbid='' + select @tbid='X' from ${btn.sql} where ${primaryKey}=@ID@ + if @tbid='' + begin + ${_billcodesSql} + ${_insertsql} + end + else + begin + ${_updatesql} + end + ` + } + + if (verify.workFlow === 'true' && verify.flowSql === 'true' && process) { + if (verify.flowType === 'start') { + _sql += ` + /* 宸ヤ綔娴佸紓甯竤ql */ + if @works_flow_error@ != '' + select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa + + /* 宸ヤ綔娴侀粯璁ql */ + insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ + 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,bid,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ + insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@ + insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid,typecharone) + select @ID@,@works_flow_code@,@userid@,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@,'begin' + ` + } else { + let field = '@works_flow_sign_field@' + let label = '@works_flow_sign_label@' + + _sql += ` + /* 宸ヤ綔娴佸紓甯竤ql */ + if @works_flow_error@ != '' + select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa + + if @works_flow_countersign@ = 'Y' + begin + /* 宸ヤ綔娴侀粯璁ql锛堜細绛撅級 */ + declare @works_flow_statuscharone nvarchar(50),@works_flow_statuschartwo nvarchar(50),@works_flow_statuscharthree nvarchar(50),@works_flow_statuscharfour nvarchar(50),@works_flow_statuscharfive nvarchar(50),@works_flow_key_id nvarchar(50),@works_flow_key_status nvarchar(20),@s_my_works_flow_log_param nvarchar(max),@s_my_works_flow_log_status int,@s_my_works_flow_log_statusname nvarchar(50),@s_my_works_flow_log_detail_id nvarchar(50) + select @works_flow_statuscharone='',@works_flow_statuschartwo='',@works_flow_statuscharthree='',@works_flow_statuscharfour='',@works_flow_statuscharfive='',@works_flow_key_id='',@works_flow_key_status ='',@s_my_works_flow_log_param='',@s_my_works_flow_log_status=0,@s_my_works_flow_log_statusname='',@s_my_works_flow_log_detail_id='' + + select @works_flow_statuscharone=statuscharone,@works_flow_statuschartwo=statuschartwo,@works_flow_statuscharthree=statuscharthree,@works_flow_statuscharfour=statuscharfour,@works_flow_statuscharfive=statuscharfive,@works_flow_key_id=id,@s_my_works_flow_log_param=works_flow_param,@s_my_works_flow_log_status=status,@s_my_works_flow_log_statusname=statusname,@s_my_works_flow_log_detail_id=works_flow_detail_id + from s_my_works_flow where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 + + if @works_flow_statuscharone + @works_flow_statuschartwo + @works_flow_statuscharthree + @works_flow_statuscharfour + @works_flow_statuscharfive = @works_flow_sign_values@ + begin + set @works_flow_key_status='Y' + end + + if @works_flow_key_status='Y' + begin + update s_my_works_flow set ${field}=${label},status=@status@,statusname=@statusname@,works_flow_param=@works_flow_param@,works_flow_detail_id=@works_flow_detail_id@,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname${verify.flowRemark ? ',remark=@' + verify.flowRemark : ''} + where id=@works_flow_key_id + + 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,bid,createuserid,CreateUser,CreateStaff,upid${verify.flowRemark ? ',remark' : ''},${field}) + select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@${verify.flowRemark ? ',@' + verify.flowRemark : ''},${label} + + update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname + where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 + + if @check_userids@ != '' + begin + insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) + insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@check_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) + end + if @notice_userids@ != '' + begin + update n + set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname + from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n + inner join (select ID from dbo.SplitComma(@notice_userids@)) s + on n.userid = s.id + insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@notice_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@notice_userids@) + end + end + else + begin + update s_my_works_flow set ${field}=${label},modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname${verify.flowRemark ? ',remark=@' + verify.flowRemark : ''} + where id =@works_flow_key_id + + 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,bid,createuserid,CreateUser,CreateStaff,upid${verify.flowRemark ? ',remark' : ''},${field}) + select @ID@,@works_flow_code@,@works_flow_name@ ,@s_my_works_flow_log_param,@s_my_works_flow_log_status,@s_my_works_flow_log_statusname,@s_my_works_flow_log_detail_id,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@${verify.flowRemark ? ',@' + verify.flowRemark : ''},${label} + + update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname + where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 and userid =@userid@ + end + end + else + begin + /* 宸ヤ綔娴侀粯璁ql锛堟垨绛撅級 */ + set @retmsg ='' + select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 and userid =@userid@ + + if @retmsg ='' + begin + select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and userid=@userid@ + + if @retmsg !='' + begin + select @ErrorCode='E', @retmsg='褰撳墠鍗曟嵁宸插鏍革紝璇峰埛鏂板悗閲嶈瘯' + goto aaa + end + + if @dataM@ !='' + begin + set @retmsg ='' + select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 + + if @retmsg != '' + begin + goto goto_mk + end + end + + select @retmsg='椤甸潰鏁版嵁宸叉洿鏂帮紝鎴栨病鏈夊綋鍓嶅崟鎹殑瀹℃壒鏉冮檺' + goto aaa + end + + goto_mk: + + set @retmsg='' + + update s_my_works_flow set status=@status@,statusname=@statusname@,works_flow_param=@works_flow_param@,works_flow_detail_id=@works_flow_detail_id@,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname${verify.flowRemark ? ',remark=@' + verify.flowRemark : ''} + where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 + 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,bid,createuserid,CreateUser,CreateStaff,upid${verify.flowRemark ? ',remark' : ''}) + select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@${verify.flowRemark ? ',@' + verify.flowRemark : ''} + + if @works_begin_branch@ = 'Y' + begin + update s_my_works_flow_role set deleted=0,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname + where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and typecharone='begin' + end + else + begin + update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname + where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 + end + + if @check_userids@ != '' + begin + insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) + insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@check_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@) + end + if @notice_userids@ != '' + begin + update n + set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname + from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n + inner join (select ID from dbo.SplitComma(@notice_userids@)) s + on n.userid = s.id + insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) + select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@notice_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@notice_userids@) + end + end + ` + } + + if (_backCustomScript) { + _sql += _backCustomScript + } + } else if (_backCustomScript) { + _sql += _backCustomScript + } + + if (verify.workFlow === 'true' && process) { + if (verify.flowType === 'start') { + // works_flow_error 娴佺▼閿欒 + let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] + worksReFields.forEach(n => { + _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + } else { + // works_flow_error 娴佺▼閿欒 + // works_flow_countersign 浼氱/鎴栫鏍囪 浼氱涓� Y + // works_begin_branch 椹冲洖鑷冲紑濮嬪垎鏀紙line.mknode === 'startEdge'锛� + // works_flow_sign_field 浼氱 鏍囪瀛楁 statuscharone/statuschartwo/statuscharthree/statuscharfour/statuscharfive + // works_flow_sign_label 浼氱 鏍囪鍊� ***/***/宸插鏍� + // works_flow_sign_values 浼氱鏍囪鎷兼帴鍊硷紙闄ゆ湰浜哄锛� + let worksReFields = ['works_flow_error', 'works_flow_countersign', 'works_flow_sign_values', 'works_begin_branch', 'works_flow_sign_label', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'check_type', 'notice_type', 'check_userids', 'notice_userids', 'works_flow_sign'] + worksReFields.forEach(n => { + _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + } + } + + if (btn.procMode === 'system') { + _sql += ` + aaa: if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@` + } else if (btn.output) { + _sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` + } else { + _sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } + + let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] + + // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) + if (btn.Ot !== 'notRequired' && columns.length > 0) { + let _initColfields = [] + columns.forEach(col => { + let _key = col.field.toLowerCase() + + if (formkeys.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(_sql)) return + if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(_sql)) return + + colreps.push(col.field) + + if (col.type === 'number') { + _initColfields.push(`@${_key}=@mk_${_key}_mk@`) + } else { + _initColfields.push(`@${_key}='@mk_${_key}_mk@'`) + } + + if (!_vars.includes(_key)) { + _declares.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) + } + }) + + // 鏄剧ず鍒楀彉閲忚祴鍊� + if (_initColfields.length > 0) { + _sql = _sql.replace('@mk_cols_values@', ` + /* 鏄剧ず鍒楀彉閲忚祴鍊� */ + select ${_initColfields.join(',')} + `) + } else { + _sql = _sql.replace('@mk_cols_values@', '') + } + } + + let reps = [] + let decSql = [`@tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50),@mk_deleted int,@bid nvarchar(50)`] + let secSql = [`@ErrorCode='',@retmsg='', @BillCode='',@BVoucher='',@FIBVoucherDate='',@FiYear='',@ModularDetailCode='', @mk_deleted=1, @bid=@BID@`] + + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { + if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else if (['mk_address'].includes(s)) { + decSql.push(`@mk_address nvarchar(100)`) + } else { + decSql.push(`@${s} nvarchar(50)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + decSql = [...decSql, ..._declares] + + _sql = `Declare ${decSql.join(',')} + /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */ + select ${secSql.join(',')} + ${_sql} + ` + _sql = _sql.replace(/\n\s{8,10}/g, '\n') + _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) + + let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(_sql)) { + reps.push(s) + } + }) + + reps.forEach(n => { + _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + + if (/\$@/ig.test(_sql)) { + _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + + if (/\$check@|@check\$/ig.test(_sql)) { + _sql = _sql.replace(/\$check@/ig, '@mk_check_begin@').replace(/@check\$/ig, '@mk_check_end@') + reps.push('mk_check_begin', 'mk_check_end') + } + if (/@db@/ig.test(_sql)) { + reps.push('db') + } + + reps = Array.from(new Set([...reps, ...colreps])) + + return { LText: _sql, reps } + } + + let getSysBackSql = (btn, component) => { + let verify = btn.verify || {} + let columns = component.columns || [] + let colreps = [] // 寰呮浛鎹㈠彉閲忛泦 + let _prev = '' + let _back = '' + let tables = [] + let reps = [] + + verify.cbScripts.forEach(script => { + if (script.status === 'false') return + + if (/\s#[a-z0-9_]+(\s|\()/ig.test(script.sql)) { + tables.push(...script.sql.match(/\s#[a-z0-9_]+(\s|\()/ig)) + } + + if (script.position === 'front') { + _prev += ` + /* 鑷畾涔夎剼鏈� */ + ${script.sql} + ` + } else { + _back += ` + /* 鑷畾涔夎剼鏈� */ + ${script.sql} + ` + } + }) + + tables = tables.map(tb => tb.replace(/\s|\(/g, '')) + + // 闇�瑕佸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'] + + let _sql = '' + + let _initFormfields = [] + let _declares = [] + + let formdata = null + let formkeys = [] + if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit') { + formdata = [] + if (btn.modal && btn.modal.fields) { + btn.modal.fields.forEach(item => { + if (!item.field) return + + let _item = { + key: item.field, + fieldlen: item.fieldlength || 50, + writein: item.writein !== 'false', + type: item.type, + isconst: item.constant === 'true' + } + + if (_item.type === 'datemonth') { + _item.type = 'text' + } else if (_item.type === 'number' || _item.type === 'rate') { + _item.fieldlen = item.decimal || 0 + } else if (_item.type === 'date') { + _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date' + } else if (_item.type === 'datetime') { + _item.type = 'date' + } else if (item.declare === 'decimal') { + _item.type = 'number' + _item.fieldlen = item.decimal || 0 + } + + formdata.push(_item) + }) + } + } else if (btn.OpenType === 'form') { + formdata = [] + + let item = { + type: 'text', + readin: true, + writein: true, + fieldlen: 50, + key: btn.field + } + if (btn.formType === 'counter') { + item.type = 'number' + item.fieldlen = 0 + } else if (btn.formType === 'switch' || btn.formType === 'radio') { + if (typeof(btn.openVal) === 'number') { + item.type = 'number' + item.fieldlen = 0 + } + } + formdata.push(item) + } + + // 鑾峰彇瀛楁閿�煎 + formdata && formdata.forEach(form => { + let _key = form.key.toLowerCase() + + if (!formkeys.includes(_key)) { + formkeys.push(_key) + if (form.type === 'number' || form.type === 'rate') { + _initFormfields.push(`@${_key}=@mk_${_key}_mk@`) + } else if (form.type === 'date') { + _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) + } else if (form.type === 'select' || form.type === 'link' || form.type === 'radio') { + _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) + } else if (form.isconst) { + _initFormfields.push(`@${_key}=N'@mk_${_key}_mk@'`) + } else { + _initFormfields.push(`@${_key}='@mk_${_key}_mk@'`) + } + } + + if (!_vars.includes(_key)) { + _vars.push(_key) + + if (form.fieldlen && form.fieldlen > 4000) { + form.fieldlen = 'max' + } + + let _type = `nvarchar(${form.fieldlen})` + + if (form.type.match(/date/ig)) { + _type = 'datetime' + } else if (form.type === 'number') { + _type = `decimal(18,${form.fieldlen})` + } else if (form.type === 'rate') { + _type = `decimal(18,2)` + } + + _declares.push(`@${_key} ${_type}`) + } + }) + + // 琛ㄥ崟鍙橀噺璧嬪�� + if (_initFormfields.length > 0) { + _sql += ` + /* 琛ㄥ崟鍙橀噺璧嬪�� */ + select ${_initFormfields.join(',')} + ` + } + + let testSql = _prev + _back + + // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) + if (btn.Ot !== 'notRequired' && columns.length > 0) { + let _initColfields = [] + columns.forEach(col => { + let _key = col.field.toLowerCase() + + if (formkeys.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(testSql)) return + if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(testSql)) return + + colreps.push(col.field) + + if (col.type === 'number') { + _initColfields.push(`@${_key}=@mk_${_key}_mk@`) + } else { + _initColfields.push(`@${_key}='@mk_${_key}_mk@'`) + } + + if (!_vars.includes(_key)) { + _declares.push(`@${_key} ${col.datatype || 'nvarchar(50)'}`) + } + }) + + // 鏄剧ず鍒楀彉閲忚祴鍊� + if (_initColfields.length > 0) { + _sql += ` + /* 鏄剧ず鍒楀彉閲忚祴鍊� */ + select ${_initColfields.join(',')} + ` + } + } + + _sql += ` + ${_prev} + /* 澶栭儴鎺ュ彛鍏ュ弬 */ + @mk_outer_params@ + ${_back} + ` + + if (btn.output) { + _sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` + } else { + _sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } + + let syses = ['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode', 'mk_deleted', 'bid', 'UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] + let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] + let secSql = [`@ErrorCode='',@retmsg=''`] + + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { + if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else if (['mk_address'].includes(s)) { + decSql.push(`@mk_address nvarchar(100)`) + } else if (['mk_deleted'].includes(s)) { + secSql.push(`@mk_deleted int`) + } else { + decSql.push(`@${s} nvarchar(50)`) + } + if (['tbid', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode'].includes(s)) { + secSql.push(`@${s}=''`) + } else if (['mk_deleted'].includes(s)) { + secSql.push(`@mk_deleted=1`) + } else if (['bid'].includes(s)) { + secSql.push(`@bid=@BID@`) + } else { + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + } + }) + + decSql = [...decSql, ..._declares] + + _sql = `Declare ${decSql.join(',')} + /* 鍒濆鍖栬祴鍊� */ + select ${secSql.join(',')} + ${_sql} + ` + + _sql = _sql.replace(/\n\s{8,10}/g, '\n') + _sql = _sql.replace(/\n\s+\/\*/g, `\n/*`) + + let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(_sql)) { + reps.push(s) + } + }) + + reps.forEach(n => { + _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + + if (/\$@/ig.test(_sql)) { + _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(_sql)) { + reps.push('db') + } + + reps = Array.from(new Set([...reps, ...colreps])) + + return { LText: _sql, reps, tbs: tables } + } + + let getDataSource = (item, mainSearch = []) => { + if (!item.setting || item.setting.interType !== 'system') return + + let searches = item.search || [] + if (item.setting.useMSearch === 'true' && mainSearch.length > 0) { + searches = [...searches, ...mainSearch] + } + item.$searches = fromJS(searches).toJS() + let { sFields, query } = getSearches(searches) + + let _columns = [] + if (item.subtype === 'dualdatacard') { + _columns = [...item.columns, ...item.subColumns] + } else if (item.columns) { + _columns = [...item.columns] + } + + let arr_field = _columns.map(col => col.field).join(',') + + let _customScript = '' + let _tailScript = '' + let _dataresource = '' + item.scripts && item.scripts.forEach(script => { + if (script.status === 'false') return + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } + }) + + if (item.setting.execute !== 'false') { + _dataresource = item.setting.dataresource || '' + } + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } + + item.setting.dataresource = _dataresource + item.setting.customScript = _customScript + + let _search = '@search@' + if (item.setting.queryType === 'statistics' || !query) { + _search = '' + } + + let testSql = _dataresource + _customScript + _tailScript + + let decSql = [`@ErrorCode nvarchar(50),@retmsg nvarchar(4000)`] + let secSql = [`@ErrorCode='',@retmsg =''`] + + let reps = [] + if (_customScript || _tailScript) { + reps.push('UserID', 'time_id') + } + + let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(testSql)) { + if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else if (['mk_address'].includes(s)) { + decSql.push(`@mk_address nvarchar(100)`) + } else { + decSql.push(`@${s} nvarchar(50)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + decSql = `declare ${decSql.join(',')} + select ${secSql.join(',')}` + + // 涓嶉渶瑕佸崟寮曞彿锛歰rderBy銆乸ageSize銆乸ageIndex銆乨b + let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'datam', 'typename'] + + if (item.hasExtend) { + regs.push('mk_time') + } + if (item.type === 'calendar') { + regs.push('mk_year') + } + if (window.GLOB.getLocation) { + regs.push('mk_longitude', 'mk_latitude') + } + if (urlFields) { + regs.push(...urlFields) + } + if (process) { + regs.push('works_flow_code') + } + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(testSql)) { + reps.push(s) + } + }) + + let LText = '' + let DateCount = '' + if (_dataresource) { + if (/@pageSize@|@orderBy@|@mk_total/i.test(testSql)) { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + } else if (item.setting.laypage === 'true' && item.setting.order) { + LText = `/*system_query*/select top @pageSize@ ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${_dataresource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` + reps.push('pageSize', 'orderBy', 'pageIndex') + if (item.subtype === 'dualdatacard') { + DateCount = `/*system_query*/select count(1) as total from (select distinct ${item.setting.primaryKey || 'ID'} from ${_dataresource} ${_search})a` + } else { + DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` + } + } else if (item.setting.$top) { + if (item.setting.order) { + LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` + reps.push('orderBy') + } else { + LText = `/*system_query*/select top 1 ${arr_field} from ${_dataresource} ${_search} ` + } + } else if (item.setting.order) { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} order by @orderBy@ ` + reps.push('orderBy') + } else { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + } + } + + if (_customScript) { + _customScript = `${decSql} + ${_customScript} + ` + if (DateCount) { + DateCount = `${DateCount} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode,@retmsg,@UserID@ + ` + } else if (LText) { + LText = `${LText} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode,@retmsg,@UserID@ + ` + } else { + _customScript = `${_customScript} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` + } + } else if (_tailScript && DateCount) { + LText = `${decSql} + ${LText} + ` + DateCount = `${DateCount} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` + } else if (_tailScript) { + LText = `${decSql} + ${LText} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` + } else { + LText = `${decSql} + ${LText} + ` + } + + reps = Array.from(new Set(reps)) + + // LText = LText.replace(/\n\s{6,8}/g, '\n') + // DateCount = DateCount.replace(/\n\s{6,8}/g, '\n') + // _customScript = _customScript.replace(/\n\s{6,8}/g, '\n') + // LText = LText.replace(/\n\s+\/\*/g, `\n/*`) + // DateCount = DateCount.replace(/\n\s+\/\*/g, `\n/*`) + // _customScript = _customScript.replace(/\n\s+\/\*/g, `\n/*`) + + reps.forEach(n => { + if (['orderBy', 'pageSize', 'pageIndex'].includes(n)) return + + LText = LText.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + DateCount = DateCount.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + _customScript = _customScript.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + if (/\$@/ig.test(testSql)) { + LText = LText.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + DateCount = DateCount.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + _customScript = _customScript.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(testSql)) { + reps.push('db') + } + + // let sql = '' + // let sub_name = '' + // let tabid = '' + // let parid = '' + // let sub_field = '' + + // if (item.subtype === 'dualdatacard') { + // arr_field = item.columns.map(col => col.field).join(',') + // sub_name = item.setting.subdata + // tabid = item.setting.primaryKey || '' + // parid = item.setting.subBID || '' + // sub_field = item.subColumns.map(col => col.field).join(',') + // } + + // sql += ` + // SELECT obj_name='data',prm_field='',str_field='', + // arr_field='${arr_field}',tabid='${tabid}',parid='${parid}',sub_name='${sub_name}',sub_field='${sub_field}' + // ` + + // if (DateCount) { + // sql += `UNION ALL + // SELECT obj_name='DateCount',prm_field='total',str_field='', + // arr_field='',tabid='',parid='',sub_name='',sub_field='' + // ` + // } + + return {LText, DateCount, customScript: _customScript, reps} + } + + let getExcelInSql = (item) => { + let btn = item.verify + let sheet = item.sheet.replace(/@db@/ig, '') + let database = '' + if (/@db@/ig.test(item.sheet)) { + database = '@db@' + } + + let sql = '' + + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� + let _regs = [ + {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: ` #${sheet} `}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: ` #${sheet}(`}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: ` #${sheet})`}, + ] + + btn.scripts && btn.scripts.forEach(script => { + if (script.status === 'false') return + + let _sql = script.sql + + _regs.forEach(item => { + _sql = _sql.replace(item.reg, item.value) + }) + + if (script.position === 'init') { + _initCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else if (script.position === 'front') { + _prevCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else { + _backCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } + }) + + let _uniquesql = '' + if (btn.uniques && btn.uniques.length > 0) { + let textFields = [] + let numberFields = [] + let dateFields = [] + btn.columns.forEach((col) => { + if (/Nvarchar/ig.test(col.type)) { + textFields.push(col.Column) + } else if (/Decimal|int/ig.test(col.type)) { + numberFields.push(col.Column) + } else if (/date/ig.test(col.type)) { + dateFields.push(col.Column) + } + }) + btn.uniques.forEach(unique => { + if (unique.status === 'false' || !unique.verifyType) return + + let _fields = unique.field.split(',') + let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) + _fields_ = _fields_.join(' and ') + + let _where = [] + _fields.forEach(f => { + if (textFields.includes(f)) { + _where.push(`${f}!=''`) + } else if (numberFields.includes(f)) { + _where.push(`${f}!=0`) + } else if (dateFields.includes(f)) { + _where.push(`${f}>'1949-10-01'`) + } + }) + _where = _where.length ? `where ${_where.join(' and ')} ` : '' + + if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { + _fields_ += ' and b.deleted=0' + } + + let _afields = [] + _fields = _fields.map(f => { + if (numberFields.includes(f)) { + _afields.push(`cast(a.${f} as nvarchar(50))`) + return `cast(${f} as nvarchar(50))` + } else if (dateFields.includes(f)) { + _afields.push(`CONVERT(nvarchar(50), a.${f}, 21)`) + return `CONVERT(nvarchar(50), ${f}, 21)` + } + _afields.push(`a.${f}`) + + return f + }) + + _uniquesql += ` + /* 閲嶅鎬ч獙璇� */ + Set @tbid='' + Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from #${sheet} ) a group by ${unique.field} having sum(n)>1 + + If @tbid!='' + Begin + select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 閲嶅' + goto aaa + end + + ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' + Select top 1 @tbid=${_afields.join('+\' \'+')} from ${_where ? `(select * from #${sheet} ${_where})` : `#${sheet}`} a Inner join ${sheet} b on ${_fields_} + + If @tbid!='' + Begin + select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�' + goto aaa + end` : ''} + ` + }) + } + + let declarefields = [] + let fields = [] + + btn.columns.forEach(col => { + if (col.import === 'false') return + + if (col.type === 'date') { + declarefields.push(`${col.Column} Nvarchar(50)`) + } else { + declarefields.push(`${col.Column} ${col.type}`) + } + fields.push(col.Column) + }) + + fields = fields.join(',') + + let _insert = '' + if (btn.default !== 'false') { + _insert = ` + /* 榛樿sql */ + Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) + Select ${fields},@UserID@,@username,@fullname,@BID@ From #${sheet} + ` + } + + sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),BID nvarchar(50)) + Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ + + Select @ErrorCode='',@retmsg=''@mk_init_select@ + ${_initCustomScript} + + Insert into #${sheet} (${fields},jskey,BID) + + /* excel鏁版嵁*/ + @mk_excel_data@ + + ${_uniquesql} + ${_prevCustomScript} + ${_insert}` + + if (btn.workFlow === 'true' && process) { + if (btn.flowSql === 'true') { + sql += ` + /* 宸ヤ綔娴佸紓甯竤ql */ + if @works_flow_error@ != '' + select @ErrorCode='E',@retmsg=@works_flow_error@ goto aaa + + /* 宸ヤ綔娴侀粯璁ql */ + insert into s_my_works_flow (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,work_group,works_flow_detail_id,work_grade,bid,createuserid,CreateUser,CreateStaff,upid) + select jskey,@works_flow_code@,@works_flow_name@,@works_flow_param@,@status@,@statusname@,@work_group@,@works_flow_detail_id@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ + from #${sheet} + + 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,bid,createuserid,CreateUser,CreateStaff,upid) + select jskey,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@bid@,@UserID@,@UserName,@FullName,@time_id@ + from #${sheet} + + insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid) + select jskey,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@ + from #${sheet} + + insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid,typecharone) + select jskey,@works_flow_code@,@userid@,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@,'begin' + from #${sheet} + ` + } + + sql += ` + ${_backCustomScript} + + drop table #${sheet} + + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + + // works_flow_error 娴佺▼閿欒 + let worksReFields = ['works_flow_error', 'works_flow_code', 'works_flow_name', 'works_flow_param', 'works_flow_detail_id', 'status', 'statusname', 'work_group', 'work_grade', 'start_type'] + worksReFields.forEach(n => { + sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + } else { + sql += ` + ${_backCustomScript} + + drop table #${sheet} + + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } + + let reps = [] + let decSql = [] + let secSql = [] + + let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { + if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else if (['mk_address'].includes(s)) { + decSql.push(`@mk_address nvarchar(100)`) + } else { + decSql.push(`@${s} nvarchar(50)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + decSql = decSql.length ? `,${decSql.join(',')}` : '' + secSql = secSql.length ? `,${secSql.join(',')}` : '' + + sql = sql.replace(/@mk_init_declare@/ig, decSql) + sql = sql.replace(/@mk_init_select@/ig, secSql) + + let regs = ['ID', 'BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(sql)) { + reps.push(s) + } + }) + + reps.forEach(n => { + sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + + sql = sql.replace(/\n\s{6,10}/g, '\n') + sql = sql.replace(/\n\s+\/\*/g, `\n/*`) + + if (/\$@/ig.test(sql)) { + sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(sql)) { + reps.push('db') + } + + return {LText: sql, reps} + } + + let getEditTableSql = (btn, cols, columns) => { + let sheet = btn.sheet.replace(/@db@/ig, '') + let database = '' + if (/@db@/ig.test(btn.sheet)) { + database = '@db@' + } + + let forms = [] + let _fields = {} + + columns.forEach(col => { + _fields[col.field] = col.datatype + }) + + let getColumns = (cols) => { + cols.forEach(item => { + if (item.type === 'colspan') { + getColumns(item.subcols) + } else if (item.editable === 'true') { + forms.push({ + field: item.field, + type: item.type, + datatype: _fields[item.field] || 'nvarchar(50)' + }) + } + }) + } + + getColumns(cols) + + let sql = '' + + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� + let _regs = [ + {reg: new RegExp('(^|\\s)@' + sheet + '(\\s|$)', 'ig'), value: ` #${sheet} `}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\(', 'ig'), value: ` #${sheet}(`}, + {reg: new RegExp('(^|\\s)@' + sheet + '\\)', 'ig'), value: ` #${sheet})`}, + ] + + btn.scripts && btn.scripts.forEach(script => { + if (script.status === 'false') return + + let _sql = script.sql + + _regs.forEach(item => { + _sql = _sql.replace(item.reg, item.value) + }) + + if (script.position === 'init') { + _initCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else if (script.position === 'front') { + _prevCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } else { + _backCustomScript += ` + /* 鑷畾涔夎剼鏈� */ + ${_sql} + ` + } + }) + + let _uniquesql = '' + if (btn.uniques && btn.uniques.length > 0) { + let textFields = [] + let numberFields = [] + let dateFields = [] + columns.forEach((col) => { + if (/Nvarchar/ig.test(col.datatype)) { + textFields.push(col.field) + } else if (/Decimal|int/ig.test(col.datatype)) { + numberFields.push(col.field) + } else if (/date/ig.test(col.datatype)) { + dateFields.push(col.field) + } + }) + btn.uniques.forEach(unique => { + if (unique.status === 'false' || !unique.verifyType) return + + let _fields = unique.field.split(',') + let _fields_ = _fields.map(_field => `a.${_field}=b.${_field}`) + _fields_ = _fields_.join(' and ') + + let _where = [] + _fields.forEach(f => { + if (textFields.includes(f)) { + _where.push(`${f}!=''`) + } else if (numberFields.includes(f)) { + _where.push(`${f}!=0`) + } else if (dateFields.includes(f)) { + _where.push(`${f}>'1949-10-01'`) + } + }) + _where = _where.length ? `where ${_where.join(' and ')} ` : '' + + if (unique.verifyType === 'logic' || unique.verifyType === 'logic_temp') { + _fields_ += ' and b.deleted=0' + } + + let _afields = [] + _fields = _fields.map(f => { + if (numberFields.includes(f)) { + _afields.push(`cast(a.${f} as nvarchar(50))`) + return `cast(${f} as nvarchar(50))` + } else if (dateFields.includes(f)) { + _afields.push(`CONVERT(nvarchar(50), a.${f}, 21)`) + return `CONVERT(nvarchar(50), ${f}, 21)` + } + _afields.push(`a.${f}`) + + return f + }) + + _uniquesql += ` + /* 閲嶅鎬ч獙璇� */ + Set @tbid='' + Select top 1 @tbid=${_fields.join('+\' \'+')} from (select 1 as n,${unique.field} from #${sheet} ) a group by ${unique.field} having sum(n)>1 + + If @tbid!='' + Begin + select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 閲嶅' + goto aaa + end + + ${unique.verifyType.indexOf('temp') === -1 ? `Set @tbid='' + Select top 1 @tbid=${_afields.join('+\' \'+')} from ${_where ? `(select * from #${sheet} ${_where})` : `#${sheet}`} a Inner join ${sheet} b on ${_fields_} + + If @tbid!='' + Begin + select @ErrorCode='${unique.errorCode}',@retmsg=@tbid+' 涓庡凡鏈夋暟鎹噸澶�' + goto aaa + end` : ''} + ` + }) + } + + let declarefields = [] + let fields = [] + + forms.forEach(col => { + let key = col.field.toLowerCase() + if (key === 'jskey' || key === 'bid' || key === 'data_type') return + + declarefields.push(`${col.field} ${col.datatype}`) + fields.push(col.field) + }) + + fields = fields.join(',') + + let _insert = '' + if (btn.default !== 'false') { + _insert = ` + /* 榛樿sql */ + Insert into ${database}${sheet} (${fields},createuserid,createuser,createstaff,bid) + Select ${fields},@UserID@,@username,@fullname,@BID@ From #${sheet} + ` + } + + sql = `create table #${sheet} (${declarefields.join(',')},jskey nvarchar(50),data_type nvarchar(50),BID nvarchar(256)) + Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid Nvarchar(512)@mk_init_declare@ + Select @ErrorCode='',@retmsg=''@mk_init_select@ + + ${_initCustomScript} + Insert into #${sheet} (${fields},jskey,data_type,BID) + + /* table鏁版嵁*/ + @mk_excel_data@ + + ${_uniquesql} + ${_prevCustomScript} + ${_insert} + ${_backCustomScript} + + drop table #${sheet} + + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + + let reps = [] + let decSql = [] + let secSql = [] + + let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address'] + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { + if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else if (['mk_address'].includes(s)) { + decSql.push(`@mk_address nvarchar(100)`) + } else { + decSql.push(`@${s} nvarchar(50)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + decSql = decSql.length ? `,${decSql.join(',')}` : '' + secSql = secSql.length ? `,${secSql.join(',')}` : '' + + sql = sql.replace(/@mk_init_declare@/ig, decSql) + sql = sql.replace(/@mk_init_select@/ig, secSql) + + let regs = ['BID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(sql)) { + reps.push(s) + } + }) + + reps.forEach(n => { + sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + + sql = sql.replace(/\n\s{6,10}/g, '\n') + sql = sql.replace(/\n\s+\/\*/g, `\n/*`) + + if (/\$@/ig.test(sql)) { + sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(sql)) { + reps.push('db') + } + + return {LText: sql, reps} + } + + let getExcelOutSql = (btn, component) => { + let item = {setting: {}, columns: [], search: [], useMSearch: 'false'} + + btn.verify.columns.forEach(col => { + if (col.output === 'false' || !col.Column || col.Column === '$Index') return + item.columns.push({ + field: col.Column + }) + }) + + if (btn.verify.useSearch !== 'false') { + item.search = component.$searches + } + + item.setting.interType = 'system' + item.setting.execute = btn.verify.defaultSql || 'true' + item.setting.dataresource = btn.verify.dataresource || '' + item.setting.queryType = btn.verify.queryType + item.setting.laypage = btn.pagination + item.setting.order = btn.verify.order || '' + + if (btn.Ot === 'requiredOnce') { + item.setting.primaryKey = btn.verify.primaryKey || component.setting.primaryKey || 'ID' + } + + item.scripts = btn.verify.scripts || [] + + let msg = getDataSource(item, []) + + return msg + } + + let getPrintSql = (btn) => { + let item = {setting: {}, columns: btn.verify.columns || [], search: [], useMSearch: 'false'} + + item.setting.interType = 'system' + item.setting.execute = btn.verify.setting.defaultSql || 'true' + item.setting.dataresource = btn.verify.setting.dataresource || '' + item.setting.queryType = btn.verify.setting.queryType + item.setting.laypage = 'false' + item.setting.order = btn.verify.setting.order || '' + + item.scripts = btn.verify.scripts || [] + + let msg = getDataSource(item, []) + + return msg + } + + let getPaySql = (btn, component) => { + let _sql = `Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@tbid nvarchar(50)@mk_init_declare@ + Select @ErrorCode='',@retmsg=''@mk_init_select@ + ` + + btn.verify.scripts.forEach(item => { + if (item.status === 'false') return + + _sql += ` + ${item.sql} + ` + }) + + if (btn.output) { + _sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` + } else { + _sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } + + let reps = [] + let decSql = [] + let secSql = [] + + let syses = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'BID'] + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(_sql)) { + if (['RoleID', 'mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else if (['mk_address'].includes(s)) { + decSql.push(`@mk_address nvarchar(100)`) + } else { + decSql.push(`@${s} nvarchar(50)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + let regs = ['ID', 'time_id', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'typename'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(_sql)) { + reps.push(s) + } + }) + + syses = syses.map(n => n.toLowerCase()) + syses.push('tbid') + + let colreps = [] + component.columns.forEach(col => { + let _key = col.field.toLowerCase() + + if (syses.includes(_key) || !new RegExp('@' + _key + '[^0-9a-z_]', 'ig').test(_sql)) return + if (_key === 'id' && !/@id[^0-9a-z_@]/ig.test(_sql)) return + + colreps.push(col.field) + + decSql.push(`@${col.field} ${col.datatype || 'nvarchar(50)'}`) + + if (col.type === 'number') { + secSql.push(`@${col.field}=@mk_${col.field}_mk@`) + } else { + secSql.push(`@${col.field}='@mk_${col.field}_mk@'`) + } + }) + + decSql = decSql.length ? `,${decSql.join(',')}` : '' + secSql = secSql.length ? `,${secSql.join(',')}` : '' + + _sql = _sql.replace(/@mk_init_declare@/ig, decSql) + _sql = _sql.replace(/@mk_init_select@/ig, secSql) + + reps.forEach(n => { + _sql = _sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + + reps = [...reps, ...colreps] + + _sql = _sql.replace(/\n\s{6,8}/g, '\n') + + if (/\$@/ig.test(_sql)) { + _sql = _sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(_sql)) { + reps.push('db') + } + + return {LText: _sql, reps} + } + + let getFormSql = (item) => { + let arrfield = [item.valueField, item.valueText] + + if (item.type === 'checkcard') { + arrfield = item.fields ? item.fields.map(f => f.field) : [] + arrfield.push(item.cardValField) + if (item.urlField) { + arrfield.push(item.urlField) + } else if (item.colorField) { + arrfield.push(item.colorField) + } else if (item.parentField) { + arrfield.push(item.parentField) + } + } + + if (item.linkField) { + arrfield.push(item.linkField) + } + if (['select', 'radio', 'link', 'checkcard'].includes(item.type) && item.linkSubField && item.linkSubField.length > 0) { + arrfield.push(...item.linkSubField) + } else if (item.type === 'text' && item.editType === 'select' && item.linkSubField && item.linkSubField.length > 0) { // 鍙紪杈戣〃 + arrfield.push(...item.linkSubField) + } + if (item.disableField) { + arrfield.push(item.disableField) + } + + arrfield = Array.from(new Set(arrfield)) + + let _datasource = item.dataSource + let sql = '' + + if (/\s/.test(_datasource)) { // 鎷兼帴鍒悕 + _datasource = '(' + _datasource + ') tb' + } + + arrfield = arrfield.join(',') + + if (item.orderBy) { + sql = `select distinct ${arrfield},${item.orderBy} as orderfield from ${_datasource} order by orderfield ${item.orderType}` + } else { + sql = `select distinct ${arrfield} from ${_datasource}` + } + + let reps = [] + + let decSql = [] + let secSql = [] + + let syses = ['mk_departmentcode', 'mk_organization', 'mk_user_type'] + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { + if (['mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else { + decSql.push(`@${s} nvarchar(20)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + decSql = decSql.join(',') + secSql = secSql.join(',') + + if (decSql) { + sql = `Declare ${decSql} select ${secSql} + ${sql} + ` + } + + let regs = ['ID', 'BID', 'datam', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(sql)) { + reps.push(s) + } + }) + + reps.forEach(n => { + sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + + if (/\$@/ig.test(sql)) { + sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(sql)) { + reps.push('db') + } + + return {LText: sql, reps} + } + + let getPopSelectSql = (item) => { + let arrfield = item.columns.map(f => f.field) + + if (item.linkSubField && item.linkSubField.length > 0) { + item.linkSubField.forEach(n => { + if (!arrfield.includes(n)) { + arrfield.push(n) + } + }) + } + + arrfield = arrfield.join(',') + if (/\s/.test(item.dataSource)) { // 鎷兼帴鍒悕 + item.dataSource = '(' + item.dataSource + ') tb' + } + + let sql = '' + let DateCount = '' + let _search = '' + let reps = [] + let sFields = [] + + if (item.searchKey) { + _search = '@search@' + sFields = item.searchKey.split(',') + } + + // 涓嶉渶瑕佸崟寮曞彿锛歰rderBy銆乸ageSize銆乸ageIndex銆乨b + let regs = [...sFields, 'orderBy', 'pageSize', 'pageIndex', 'ID', 'BID', 'time_id', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'lang', 'datam'] + + regs.forEach(s => { + if (new RegExp('@' + s + '@', 'ig').test(item.dataSource)) { + reps.push(s) + } + }) + + if (item.laypage === 'true') { + sql = `/*system_query*/select top @pageSize@ ${arrfield} from (select ${arrfield} ,ROW_NUMBER() over(order by @orderBy@) as rows from ${item.dataSource} ${_search}) tmptable where rows > @pageSize@ * (@pageIndex@ - 1) order by tmptable.rows ` + DateCount = `/*system_query*/select count(1) as total from ${item.dataSource} ${_search}` + + reps.push('pageSize', 'orderBy', 'pageIndex') + } else { + sql = `/*system_query*/select ${arrfield} from ${item.dataSource} ${_search} order by @orderBy@ ` + reps.push('orderBy') + } + + let decSql = [] + let secSql = [] + + let syses = ['mk_departmentcode', 'mk_organization', 'mk_user_type'] + syses.forEach(s => { + if (new RegExp('@' + s + '[^0-9a-z_]', 'ig').test(sql)) { + if (['mk_departmentcode', 'mk_organization'].includes(s)) { + decSql.push(`@${s} nvarchar(512)`) + } else { + decSql.push(`@${s} nvarchar(20)`) + } + secSql.push(`@${s}=@${s}@`) + reps.push(s) + } + }) + + decSql = decSql.join(',') + secSql = secSql.join(',') + + if (decSql) { + sql = `Declare ${decSql} select ${secSql} + ${sql} + ` + } + + reps.forEach(n => { + if (['orderBy', 'pageSize', 'pageIndex'].includes(n)) return + + sql = sql.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + DateCount = DateCount.replace(new RegExp('@' + n + '@', 'ig'), `'@${n}@'`) + }) + if (/\$@/ig.test(sql)) { + sql = sql.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + DateCount = DateCount.replace(/\$@/ig, '@datam_begin@').replace(/@\$/ig, '@datam_end@') + reps.push('datam_begin', 'datam_end') + } + if (/@db@/ig.test(sql)) { + reps.push('db') + } + + return {LText: sql, DateCount, reps} + } + + let _mainSearch = [] + + if (appType === 'mob') { + let search = [] + let ms = null + config.components.forEach(item => { + if (item.type === 'topbar' && item.wrap.type !== 'navbar' && item.search) { + ms = item.search + } else if (item.type === 'search' && item.wrap.field) { + search.push({ + type: 'text', + field: item.wrap.field, + }) + } + }) + + if (ms) { + if (ms.setting.type === 'search') { + search.push({ + type: 'text', + field: ms.setting.field, + }) + } + search.push(...ms.fields) + + ms.groups.forEach(group => { + if (group.setting.type === 'search') { + search.push({ + type: 'text', + field: group.setting.field, + }) + } + search.push(...group.fields) + }) + + if (search.length > 0) { + search.forEach(cell => { + if (['select', 'link', 'multiselect', 'checkcard', 'radio'].includes(cell.type) && cell.resourceType === '1' && cell.dataSource) { + let msg = getFormSql(cell) + + sqls.push({uuid: cell.uuid, type: 'sForm', ...msg}) + } + }) + } + } + + if (search.length > 0) { + _mainSearch = search + } + } else { + config.components.forEach(component => { + if (component.type !== 'search') return + + _mainSearch = component.search || [] + }) + } + + if (config.interfaces && config.interfaces.length > 0) { + config.interfaces.forEach(m => { + if (m.status !== 'true' || m.setting.interType !== 'system') return false + + m.setting.laypage = 'false' + m.setting.$top = true + + let msg = getDataSource(m, _mainSearch) + + sqls.push({uuid: m.uuid, type: 'interface', ...msg}) + }) + } + + filterComponent(config.components, _mainSearch) + + return sqls } \ No newline at end of file diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 26f08c9..4e96051 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -142,9 +142,9 @@ { reg: /@orderBy@/ig, value: orderBy }, { reg: /@pageSize@/ig, value: setting.laypage ? pageSize : '9999' }, { reg: /@pageIndex@/ig, value: pageIndex}, - { reg: /@select\$|\$select@/ig, value: ''}, - { reg: /\$sum@/ig, value: '/*'}, - { reg: /@sum\$/ig, value: '*/'}, + // { reg: /@select\$|\$select@/ig, value: ''}, + // { reg: /\$sum@/ig, value: '/*'}, + // { reg: /@sum\$/ig, value: '*/'}, { reg: /@ID@/ig, value: `'${id || ''}'`}, { reg: /@BID@/ig, value: `'${BID || ''}'`}, { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, @@ -156,10 +156,10 @@ ) if (setting.hasExtend) { - regoptions.push({ reg: /@mk_time@/ig, value: setting.extendTime }) + regoptions.push({ reg: /@mk_time@/ig, value: `'${setting.extendTime}'` }) } if (setting.$re_year) { - regoptions.push({ reg: /@mk_year@/ig, value: year }) + regoptions.push({ reg: /@mk_year@/ig, value: `'${year}'` }) } regoptions.forEach(item => { @@ -289,6 +289,72 @@ param.menuname = setting.$name } + // if (window.backend && window.GLOB.CacheData.has('sql_' + setting.uuid)) { + // let item = window.GLOB.CacheData.get('sql_' + setting.uuid) + + // let values = { + // userid: sessionStorage.getItem('UserID') || '', + // time_id: Utils.getguid(), + // username: userName, + // fullname: fullName, + // roleid: RoleID, + // mk_departmentcode: departmentcode, + // mk_organization: organization, + // mk_user_type: mk_user_type, + // mk_nation: nation, + // mk_province: province, + // mk_city: city, + // mk_district: district, + // mk_address: address, + // orderby: orderBy, + // pagesize: setting.laypage ? pageSize : '9999', + // pageindex: pageIndex, + // id: id || '', + // bid: BID || '', + // loginuid: sessionStorage.getItem('LoginUID') || '', + // sessionuid: localStorage.getItem('SessionUid') || '', + // appkey: window.GLOB.appkey || '', + // lang: sessionStorage.getItem('lang'), + // typename: 'admin', + // datam: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + // datam_begin: sessionStorage.getItem('dataM') === 'true' ? '/*' : '', + // datam_end: sessionStorage.getItem('dataM') === 'true' ? '*/' : '', + // } + + // if (setting.hasExtend) { + // values.mk_time = setting.extendTime + // } + // if (setting.$re_year) { + // values.mk_year = year + // } + // if (window.GLOB.externalDatabase !== null) { + // values.db = window.GLOB.externalDatabase + // } + // if (item.works_flow_code) { + // values.works_flow_code = item.works_flow_code + // } + // item.urlkeys.forEach(key => { + // values[key] = item.urlparam[key] + // }) + + // let Ltext = item.LText + // let DateCount = item.DateCount + // let customScript = item.customScript + + // item.reps.forEach(n => { + // let key = n.toLowerCase() + // if (values.hasOwnProperty(key)) { + // Ltext = Ltext.replace(new RegExp('@' + key + '@', 'ig'), values[key]) + // DateCount = DateCount.replace(new RegExp('@' + key + '@', 'ig'), values[key]) + // customScript = customScript.replace(new RegExp('@' + key + '@', 'ig'), values[key]) + // } + // }) + + // if (search.length) { + + // } + // } + param.custom_script = Utils.formatOptions(_customScript, param.exec_type) param.LText = Utils.formatOptions(LText, param.exec_type) param.DateCount = Utils.formatOptions(DateCount, param.exec_type) @@ -375,9 +441,9 @@ { reg: /@orderBy@/ig, value: orderBy }, { reg: /@pageSize@/ig, value: 999999 }, { reg: /@pageIndex@/ig, value: 1}, - { reg: /\$select@/ig, value: '/*'}, - { reg: /@select\$/ig, value: '*/'}, - { reg: /@sum\$|\$sum@/ig, value: ''}, + // { reg: /\$select@/ig, value: '/*'}, + // { reg: /@select\$/ig, value: '*/'}, + // { reg: /@sum\$|\$sum@/ig, value: ''}, { reg: /@ID@/ig, value: `''`}, { reg: /@BID@/ig, value: `'${BID || ''}'`}, { reg: /@LoginUID@/ig, value: `'${sessionStorage.getItem('LoginUID') || ''}'`}, diff --git a/src/utils/utils.js b/src/utils/utils.js index 35fb3a8..ac418a1 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1615,7 +1615,7 @@ * @return {Array} columns 鏄剧ず鍒� * @return {Boolean} retmsg 鏄惁闇�瑕佹暟鎹繑鍥� */ -export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false, moduleParams) { +export function getSysDefaultSql (btn, setting, formdata, param, data, columns, retmsg = false) { let primaryId = param.ID let BID = param.BID || '' let verify = btn.verify || {} @@ -1864,9 +1864,31 @@ } // 澶辨晥楠岃瘉锛屾坊鍔犳暟鎹椂涓嶇敤 - if (verify.invalid === 'true' && moduleParams && moduleParams.dataresource) { - let datasource = moduleParams.dataresource - let customScript = moduleParams.customScript || '' + if (verify.invalid === 'true' && setting.dataresource) { + let datasource = setting.dataresource + let customScript = setting.customScript || '' + + let regoptions = [{ + reg: new RegExp('@userName@', 'ig'), + value: `'${sessionStorage.getItem('User_Name') || ''}'` + }, { + reg: new RegExp('@fullName@', 'ig'), + value: `'${sessionStorage.getItem('Full_Name') || ''}'` + }, { + reg: new RegExp('@orderBy@', 'ig'), + value: setting.order || primaryKey + }, { + reg: new RegExp('@pageSize@', 'ig'), + value: 1 + }, { + reg: new RegExp('@pageIndex@', 'ig'), + value: 1 + }] + + regoptions.forEach(item => { + datasource = datasource.replace(item.reg, item.value) + customScript = customScript.replace(item.reg, item.value) + }) if (customScript) { _sql += ` @@ -1941,7 +1963,6 @@ if (!keys.includes(_key)) return // 琛ㄥ崟涓笉鍚崟鍙风敓鎴愬瓧娈� - let _ModularDetailCode = '' let _lpline = '' if (item.TypeCharOne === 'Lp') { if (_linkKey === 'bid' && BID) { // 鏇挎崲bid @@ -1949,33 +1970,29 @@ } else { _lpline = `set @ModularDetailCode= 'Lp'+ right('${item.mark || btn.uuid}'+@${_linkKey},48)` } - _ModularDetailCode = '@ModularDetailCode' } else if (item.TypeCharOne === 'BN') { - let _val = '' if (_linkKey === 'bid' && BID) { // 鏇挎崲bid - _val = BID - } else if (_data.hasOwnProperty(_linkKey)) { - _val = _data[_linkKey] + _lpline = `set @ModularDetailCode= 'BN'+ right(@BID@,48)` + } else { + _lpline = `set @ModularDetailCode= 'BN'+ right(@${_linkKey},48)` } - _ModularDetailCode = `'${item.TypeCharOne + _val}'` } else { - _ModularDetailCode = `'${item.ModularDetailCode}'` + _lpline = `set @ModularDetailCode= right('${item.ModularDetailCode}',50)` } - let _declare = '' + // let _declare = '' - if (!_vars.includes(_key)) { - _declare = `Declare @${_key} nvarchar(50)` - _vars.push(_key) - } + // if (!_vars.includes(_key)) { + // _declare = `Declare @${_key} nvarchar(50)` + // _vars.push(_key) + // } _billcodesSql += ` /* 鍗曞彿鐢熸垚 */ - ${_declare} select @BillCode='', @${_key}='', @ModularDetailCode='' ${_lpline} exec s_get_BillCode - @ModularDetailCode=${_ModularDetailCode}, + @ModularDetailCode=@ModularDetailCode, @Type=${item.Type}, @TypeCharOne='${item.TypeCharOne}', @TypeCharTwo ='${item.TypeCharTwo}', @@ -2014,11 +2031,6 @@ _value.push(`${_labels[index] || ''}锛�${_val || ''}`) }) - let _verifyType = '' - if (item.verifyType === 'logic') { - _verifyType = ' and deleted=0' - } - if (!arr.includes(primaryKey.toLowerCase())) { _fieldValue.push(`${primaryKey} !='${primaryId}'`) } @@ -2026,7 +2038,7 @@ _sql += ` /* 鍞竴鎬ч獙璇� */ select @tbid='', @ErrorCode='',@retmsg='' - select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${_verifyType} + select @tbid='X' from ${btn.sql} where ${_fieldValue.join(' and ')}${item.verifyType === 'logic' ? ' and deleted=0' : ''} If @tbid!='' Begin select @ErrorCode='${item.errorCode}',@retmsg='${_value.join(', ')} 宸插瓨鍦�' @@ -2233,7 +2245,7 @@ if (data && columns && columns.length > 0 && btn.Ot !== 'notRequired') { let _index = 0 columns.forEach(col => { - if (!col.field || col.Hide === 'true' || _index >= 4) return + if (!col.field || col.Hide === 'true' || _index >= 4 || col.field === primaryKey) return _msg += col.label + '=' + data[col.field] + ',' _index++ }) @@ -2627,14 +2639,17 @@ _sql += _backCustomScript } - _sql = _sql.replace(/@works_flow_sign@/ig, `'${sign}'`) + if (verify.flowType === 'start') { + _sql = _sql.replace(/@start_type@/ig, `'寮�濮�'`) + } else { + _sql = _sql.replace(/@works_flow_sign@/ig, `'${sign}'`) - _sql = _sql.replace(/@check_userids@/ig, `'${checkIds.join(',')}'`) - _sql = _sql.replace(/@notice_userids@/ig, `'${noticeIds.join(',')}'`) + _sql = _sql.replace(/@check_type@/ig, verify.flowType === 'reject' ? `'椹冲洖'` : `'瀹℃牳'`) + _sql = _sql.replace(/@notice_type@/ig, `'鎶勯��'`) - _sql = _sql.replace(/@start_type@/ig, `'寮�濮�'`) - _sql = _sql.replace(/@check_type@/ig, verify.flowType === 'reject' ? `'椹冲洖'` : `'瀹℃牳'`) - _sql = _sql.replace(/@notice_type@/ig, `'鎶勯��'`) + _sql = _sql.replace(/@check_userids@/ig, `'${checkIds.join(',')}'`) + _sql = _sql.replace(/@notice_userids@/ig, `'${noticeIds.join(',')}'`) + } _sql = _sql.replace(/@works_flow_code@/ig, `'${flow.flow_code}'`) _sql = _sql.replace(/@works_flow_name@/ig, `'${flow.flow_name}'`) @@ -2799,23 +2814,23 @@ /** * @description 鐢熸垚鏇挎崲鍑芥暟鍒楄〃 */ -export function setGLOBFuncs () { - window.GLOB.funcs = [] - if (!window.GLOB.IndexDB) { - return - } +// export function setGLOBFuncs () { +// window.GLOB.funcs = [] +// if (!window.GLOB.IndexDB) { +// return +// } - let objectStore = window.GLOB.IndexDB.transaction('funcs').objectStore('funcs') +// let objectStore = window.GLOB.IndexDB.transaction('funcs').objectStore('funcs') - objectStore.openCursor().onsuccess = (event) => { - let cursor = event.target.result +// objectStore.openCursor().onsuccess = (event) => { +// let cursor = event.target.result - if (cursor) { - window.GLOB.funcs.push({ - func_code: cursor.value.func_code, - key_sql: window.decodeURIComponent(window.atob(cursor.value.key_sql)) - }) - cursor.continue() - } - } -} \ No newline at end of file +// if (cursor) { +// window.GLOB.funcs.push({ +// func_code: cursor.value.func_code, +// key_sql: window.decodeURIComponent(window.atob(cursor.value.key_sql)) +// }) +// cursor.continue() +// } +// } +// } \ No newline at end of file diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index 92426bc..c352ad1 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -377,7 +377,7 @@ } deleteTran = (record) => { - const _this = this + const that = this let param = { func: 's_sVersion_del', @@ -395,7 +395,7 @@ message: '鎿嶄綔鎴愬姛锛�', duration: 3 }) - _this.getTransList() + that.getTransList() } else { notification.warning({ top: 92, @@ -414,7 +414,7 @@ } enableTran = (record) => { - const _this = this + const that = this let param = { func: 's_sVersion_sub', @@ -432,7 +432,7 @@ message: '鎿嶄綔鎴愬姛锛�', duration: 3 }) - _this.getTransList() + that.getTransList() } else { Modal.error({ title: result.message, @@ -601,7 +601,7 @@ } deleteApp = (record) => { - const _this = this + const that = this confirm({ content: '纭畾鍒犻櫎銆�' + record.remark + '銆嬪悧锛�', @@ -621,12 +621,12 @@ duration: 5 }) - _this.setState({ + that.setState({ selectApp: null, selectSubApp: null, loading: true }) - _this.getAppList() + that.getAppList() } else { if (result.message.indexOf('kei_no宸茶鑿滃崟浣跨敤锛屼笉鍙垹闄�') > -1) { result.message = 'kei_no宸茶鑿滃崟浣跨敤锛屼笉鍙垹闄�' @@ -649,7 +649,7 @@ deleteSubApp = (record) => { const { selectApp } = this.state - const _this = this + const that = this let param = { func: 's_kei_addupt', @@ -696,11 +696,11 @@ duration: 5 }) - _this.setState({ + that.setState({ selectSubApp: null, loading: true }) - _this.getAppList() + that.getAppList() } else { notification.warning({ top: 92, @@ -821,7 +821,7 @@ } }) - const _this = this + const that = this confirm({ content: '纭畾瑕佹墽琛屽悧锛�', @@ -857,10 +857,10 @@ message: '鎵ц鎴愬姛銆�', duration: 3 }) - _this.setState({ + that.setState({ scriptIndex: 1 }, () => { - _this.getScriptList() + that.getScriptList() }) } resolve() diff --git a/src/views/basedesign/updateFormTab/index.jsx b/src/views/basedesign/updateFormTab/index.jsx index d17db4b..a70d45b 100644 --- a/src/views/basedesign/updateFormTab/index.jsx +++ b/src/views/basedesign/updateFormTab/index.jsx @@ -28,7 +28,7 @@ trigger = () => { const { config, menu, btnTab } = this.props - const _this = this + const that = this if (!config || !menu || !menu.LongParam) { notification.warning({ @@ -78,7 +78,7 @@ content: '', onOk() { return new Promise(resolve => { - _this.execUpdate(resolve, _config) + that.execUpdate(resolve, _config) }) }, onCancel() {} diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 1969680..112e0b5 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -90,7 +90,7 @@ } componentDidMount() { - const _this = this + const that = this if (window.GLOB.sysType !== 'cloud') { Object.defineProperty(window, 'debugger', { @@ -118,7 +118,7 @@ window.GLOB.breakpoint = value + '' sessionStorage.setItem('breakpoint', value) } - _this.debugChange() + that.debugChange() } }) } @@ -144,7 +144,7 @@ window.GLOB.breakpoint = false sessionStorage.removeItem('breakpoint') - _this.debugChange() + that.debugChange() } } } diff --git a/src/views/billprint/index.scss b/src/views/billprint/index.scss index 3ad6384..9616d80 100644 --- a/src/views/billprint/index.scss +++ b/src/views/billprint/index.scss @@ -57,6 +57,9 @@ display: none!important; } } + .braft-content p { + margin: 0px!important; + } .ant-table-thead > tr > th { color: rgba(0,0,0,1); background: transparent!important; diff --git a/src/views/design/header/editfirstmenu/index.jsx b/src/views/design/header/editfirstmenu/index.jsx index 4d1b286..add92a2 100644 --- a/src/views/design/header/editfirstmenu/index.jsx +++ b/src/views/design/header/editfirstmenu/index.jsx @@ -92,7 +92,7 @@ return } - let _this = this + let that = this confirm({ title: `纭畾鍒犻櫎鑿滃崟銆�${item.MenuName}銆嬪悧锛焋, content: '', @@ -103,7 +103,7 @@ } return Api.getCloudConfig(param).then(res => { if (res.status) { - _this.props.reload() + that.props.reload() } else { notification.warning({ top: 92, diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 1f934d5..5687095 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -33,13 +33,13 @@ logout = () => { // 閫�鍑虹櫥褰� - let _this = this + let that = this confirm({ title: '鎮ㄧ‘瀹氳閫�鍑哄悧?', content: '', onOk() { sessionStorage.clear() - _this.props.history.replace('/login') + that.props.history.replace('/login') window.location.reload() }, onCancel() {} @@ -233,69 +233,69 @@ }, () => {}) } - setSystemFuncs = () => { - if (!window.GLOB.IndexDB) { - return - } - this.getfuncTime().then(res => { - Api.getSystemFuncs(res.createDate).then(result => { - if (!result.status) { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } else if (result.func_detail && result.func_detail.length > 0) { - this.writeFuncs(result.func_detail) - } - }) - }) - } + // setSystemFuncs = () => { + // if (!window.GLOB.IndexDB) { + // return + // } + // this.getfuncTime().then(res => { + // Api.getSystemFuncs(res.createDate).then(result => { + // if (!result.status) { + // notification.error({ + // top: 92, + // message: result.message, + // duration: 10 + // }) + // } else if (result.func_detail && result.func_detail.length > 0) { + // this.writeFuncs(result.func_detail) + // } + // }) + // }) + // } - writeFuncs = (funcs) => { - let shim = +sessionStorage.getItem('sys_time_shim') - let timestamp = moment().add(shim, 'seconds').format('YYYY-MM-DD HH:mm:ss') + // writeFuncs = (funcs) => { + // let shim = +sessionStorage.getItem('sys_time_shim') + // let timestamp = moment().add(shim, 'seconds').format('YYYY-MM-DD HH:mm:ss') - let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') + // let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs') - objectStore.clear() + // objectStore.clear() - funcs.forEach(item => { - if (!item.key_sql) return - item.id = item.func_code - objectStore.add(item) - }) + // funcs.forEach(item => { + // if (!item.key_sql) return + // item.id = item.func_code + // objectStore.add(item) + // }) - let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) - } + // let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + // funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp}) + // } - getfuncTime = () => { - return new Promise((resolve, reject) => { - let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') - let request = objectStore.get('funcs') + // getfuncTime = () => { + // return new Promise((resolve, reject) => { + // let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version') + // let request = objectStore.get('funcs') - request.onerror = (event) => { - console.warn(event) - reject() - } + // request.onerror = (event) => { + // console.warn(event) + // reject() + // } - request.onsuccess = () => { - if (request.result) { - resolve(request.result) - } else { - let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + // request.onsuccess = () => { + // if (request.result) { + // resolve(request.result) + // } else { + // let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - add.onerror = () => { - reject() - } - add.onsuccess = () => { - resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) - } - } - } - }) - } + // add.onerror = () => { + // reject() + // } + // add.onsuccess = () => { + // resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'}) + // } + // } + // } + // }) + // } getSmStemp = () => { if (!sessionStorage.getItem('msgTemplate')) { @@ -381,7 +381,6 @@ }, 100) setTimeout(() => { - // positecgroup // this.setSystemFuncs() this.getSmStemp() }, 500) diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index f965c69..080b267 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -6,7 +6,7 @@ import Header from './header' import Sidemenu from './sidemenu' -import { setGLOBFuncs } from '@/utils/utils.js' +// import { setGLOBFuncs } from '@/utils/utils.js' import '@/assets/css/design.scss' import './index.scss' @@ -34,7 +34,7 @@ window.GLOB.breakpoint = false window.GLOB.designView = true sessionStorage.removeItem('breakpoint') - setGLOBFuncs() + // setGLOBFuncs() } } diff --git a/src/views/interface/history/index.jsx b/src/views/interface/history/index.jsx index 2b3bdb6..4d313e6 100644 --- a/src/views/interface/history/index.jsx +++ b/src/views/interface/history/index.jsx @@ -43,13 +43,13 @@ } clear = () => { - const _this = this + const that = this confirm({ content: 'Are you sure you want to clear all your history requests?', onOk() { Api.clearInterfaces() - _this.setState({list: [], historys: []}) + that.setState({list: [], historys: []}) }, onCancel() {} }) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 703e194..494b40e 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -10,7 +10,7 @@ import md5 from 'md5' import Api from '@/api' -import Utils, { setGLOBFuncs } from '@/utils/utils.js' +import Utils from '@/utils/utils.js' import { langs } from '@/store/options' import MKEmitter from '@/utils/events.js' import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' @@ -133,7 +133,7 @@ MKEmitter.addListener('changeEditMenu', this.changeEditMenu) setTimeout(() => { this.getRoleFields() - setGLOBFuncs() + // setGLOBFuncs() }, 1000) document.onkeydown = (event) => { @@ -780,6 +780,8 @@ } else if (this.checklog()) { if (sessionStorage.getItem('langList') && !config.trans) { + // } else if (window.backend && config.enabled && !config.allSqls) { + } else { notification.success({ top: 92, @@ -805,6 +807,14 @@ config.enabled = true delete config.force } + + // let sqls = [] + // delete config.allSqls + // if (window.backend && config.enabled) { + // sqls = getAllSqls(config) + + // config.allSqls = sqls + // } if (config.cacheUseful !== 'true') { config.components = this.resetSyncQuery(config.components) @@ -1277,7 +1287,7 @@ <PasteController insert={this.insert} /> {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" id="save-config" className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> - <Button type="default" onClick={this.closeView}>鍏抽棴</Button> + <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : <Spin className="loading-config" size="large" />} diff --git a/src/views/menudesign/index.scss b/src/views/menudesign/index.scss index 74d1cf2..dd386c7 100644 --- a/src/views/menudesign/index.scss +++ b/src/views/menudesign/index.scss @@ -179,7 +179,10 @@ > .ant-card { >.ant-card-head { margin-bottom: 0px; - position: relative; + position: sticky; + top: 0px; + z-index: 10; + background: #ffffff; .ant-card-head-title { color: #1890ff; padding: 5px 0; diff --git a/src/views/menudesign/popview/index.jsx b/src/views/menudesign/popview/index.jsx index 394ca23..496f116 100644 --- a/src/views/menudesign/popview/index.jsx +++ b/src/views/menudesign/popview/index.jsx @@ -284,7 +284,7 @@ <PasteController insert={this.insert} /> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" id="save-pop-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> - <Button type="default" onClick={this.closeView}>杩斿洖</Button> + <Button type="default" disabled={menuloading} onClick={this.closeView}>杩斿洖</Button> </div> } style={{ width: '100%' }}> {!comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} diff --git a/src/views/menudesign/popview/index.scss b/src/views/menudesign/popview/index.scss index 2ea36fa..02b8796 100644 --- a/src/views/menudesign/popview/index.scss +++ b/src/views/menudesign/popview/index.scss @@ -123,7 +123,10 @@ > .ant-card { >.ant-card-head { margin-bottom: 0px; - position: relative; + position: sticky; + top: 0px; + z-index: 10; + background: #ffffff; .ant-card-head-title { color: #1890ff; padding: 5px 0; diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index e466da9..95a7773 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -9,7 +9,7 @@ import md5 from 'md5' import Api from '@/api' -import Utils, { setGLOBFuncs } from '@/utils/utils.js' +import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import MenuUtils, { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' import asyncComponent from '@/utils/asyncComponent' @@ -203,7 +203,7 @@ setTimeout(() => { this.getRoleFields() - setGLOBFuncs() + // setGLOBFuncs() }, 1000) document.onkeydown = (event) => { @@ -1350,6 +1350,9 @@ } else if (item.type === 'group') { item.components = traversal(item.components) } else if (['card', 'carousel', 'timeline'].includes(item.type)) { + if (item.wrap.display === 'hidden') { + item.miniStyle += 'display:none;' + } item.subcards.forEach(card => { card.miniStyle = this.transferStyle(card.style) card.elements = card.elements.map(cell => { diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 658b6bc..db2af66 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -9,7 +9,7 @@ import md5 from 'md5' import Api from '@/api' -import Utils, { setGLOBFuncs } from '@/utils/utils.js' +import Utils from '@/utils/utils.js' import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' @@ -183,7 +183,7 @@ setTimeout(() => { this.getRoleFields() - setGLOBFuncs() + // setGLOBFuncs() }, 1000) document.onkeydown = (event) => { diff --git a/src/views/printTemplate/index.jsx b/src/views/printTemplate/index.jsx index 75783b8..8374dff 100644 --- a/src/views/printTemplate/index.jsx +++ b/src/views/printTemplate/index.jsx @@ -767,7 +767,7 @@ } deleteItem = () => { - const _this = this + const that = this const { editItemId, config } = this.state confirm({ @@ -777,13 +777,13 @@ onOk() { config.elements = config.elements.filter(item => item.uuid !== editItemId) - _this.setState({ + that.setState({ config: config, editItemId: config.uuid, editItemType: config.type, formlist: getpageform(config) }, () => { - _this.resetview() + that.resetview() }) }, onCancel() {} diff --git a/src/views/rolemanage/index.jsx b/src/views/rolemanage/index.jsx index 83168c8..3697b06 100644 --- a/src/views/rolemanage/index.jsx +++ b/src/views/rolemanage/index.jsx @@ -409,7 +409,7 @@ deleteMenu = (record) => { const { app, appViewList } = this.state - const _this = this + const that = this let param = { func: 'sPC_MainMenu_Del', @@ -450,7 +450,7 @@ message: '鎿嶄綔鎴愬姛锛�', duration: 3 }) - _this.getMenuList(true) + that.getMenuList(true) if (_param) { Api.getCloudConfig(_param).then(res => { @@ -461,7 +461,7 @@ duration: 5 }) } else { - _this.setState({appViewList: _appViewList}) + that.setState({appViewList: _appViewList}) } }) } @@ -682,12 +682,12 @@ } initTree = () => { - const _this = this + const that = this confirm({ content: '鏉冮檺鏍戜細閲嶆柊鐢熸垚锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.getMenuList(true, resolve) + that.getMenuList(true, resolve) }) }, onCancel() {} @@ -695,13 +695,13 @@ } syncTree = () => { - const _this = this + const that = this confirm({ content: '鍚屾浼氭牴鎹彍鍗曞垹闄ゆ垨鏂板鑺傜偣锛岀‘瀹氭墽琛屽悧锛�', onOk() { return new Promise(resolve => { - _this.syncMenutree(resolve) + that.syncMenutree(resolve) }) }, onCancel() {} @@ -710,7 +710,7 @@ saveTree = () => { // const { trees } = this.state - const _this = this + const that = this // if (!trees || trees.length === 0) { // notification.warning({ @@ -725,7 +725,7 @@ content: '纭畾鎵ц鍚楋紵', onOk() { return new Promise(resolve => { - _this.execSave(resolve) + that.execSave(resolve) }) }, onCancel() {} diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 3fae1b5..8b998c2 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -9,7 +9,7 @@ import md5 from 'md5' import Api from '@/api' -import Utils, { setGLOBFuncs } from '@/utils/utils.js' +import Utils from '@/utils/utils.js' import { langs } from '@/store/options' import MKEmitter from '@/utils/events.js' import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' @@ -121,7 +121,7 @@ MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) setTimeout(() => { this.getRoleFields() - setGLOBFuncs() + // setGLOBFuncs() }, 1000) document.onkeydown = (event) => { @@ -540,6 +540,8 @@ } else if (this.checklog()) { if (sessionStorage.getItem('langList') && !config.trans) { + // } else if (window.backend && config.enabled && !config.allSqls) { + } else { notification.success({ top: 92, @@ -565,6 +567,14 @@ config.enabled = true delete config.force } + + // let sqls = [] + // delete config.allSqls + // if (window.backend && config.enabled) { + // sqls = getAllSqls(config) + + // config.allSqls = sqls + // } let tbs = [] let btns = this.getMenuMessage(tbs) @@ -934,7 +944,7 @@ <PasteBaseTable type="page" insert={this.insert}/> {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> - <Button type="default" onClick={this.closeView}>鍏抽棴</Button> + <Button type="default" disabled={menuloading} onClick={this.closeView}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} diff --git a/src/views/tabledesign/index.scss b/src/views/tabledesign/index.scss index a3be304..84954ae 100644 --- a/src/views/tabledesign/index.scss +++ b/src/views/tabledesign/index.scss @@ -138,7 +138,10 @@ > .ant-card { >.ant-card-head { margin-bottom: 0px; - position: relative; + position: sticky; + top: 0px; + z-index: 10; + background: #ffffff; .ant-card-head-title { color: #1890ff; padding: 5px 0; diff --git a/src/views/tabledesign/popview/index.jsx b/src/views/tabledesign/popview/index.jsx index 05a7425..dbac3df 100644 --- a/src/views/tabledesign/popview/index.jsx +++ b/src/views/tabledesign/popview/index.jsx @@ -219,7 +219,7 @@ <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> <Button type="primary" id="save-pop-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> - <Button type="default" onClick={this.closeView}>杩斿洖</Button> + <Button type="default" disabled={menuloading} onClick={this.closeView}>杩斿洖</Button> </div> } style={{ width: '100%' }}> {!comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : null} diff --git a/src/views/tabledesign/popview/index.scss b/src/views/tabledesign/popview/index.scss index 2ea36fa..02b8796 100644 --- a/src/views/tabledesign/popview/index.scss +++ b/src/views/tabledesign/popview/index.scss @@ -123,7 +123,10 @@ > .ant-card { >.ant-card-head { margin-bottom: 0px; - position: relative; + position: sticky; + top: 0px; + z-index: 10; + background: #ffffff; .ant-card-head-title { color: #1890ff; padding: 5px 0; -- Gitblit v1.8.0