From 866db6d8afa6980fd485570acda6b5fcebda4da3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 01 七月 2024 16:08:27 +0800 Subject: [PATCH] 2024-07-01 --- src/mob/header/index.jsx | 4 src/tabviews/zshare/actionList/funcbutton/index.jsx | 187 ++++ src/views/appmanage/transmenu/index.jsx | 2 src/utils/utils-custom.js | 18 src/menu/components/card/cardcellcomponent/dragaction/action.jsx | 2 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 18 src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.jsx | 224 +++++ src/templates/sharecomponent/actioncomponent/verifypay/index.scss | 84 + src/views/mkiframe/index.jsx | 2 src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.scss | 0 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 27 src/views/design/header/transmenu/index.jsx | 4 public/options.json | 1 src/menu/tablenodes/index.jsx | 11 src/tabviews/custom/components/module/invoice/index.jsx | 4 src/tabviews/zshare/actionList/newpagebutton/index.jsx | 296 ++++++ src/tabviews/zshare/actionList/normalbutton/index.jsx | 54 public/README.txt | 3 src/views/mobdesign/index.jsx | 11 src/tabviews/zshare/actionList/changeuserbutton/index.jsx | 2 src/views/menudesign/index.jsx | 4 src/tabviews/custom/components/card/cardcellList/index.jsx | 28 src/tabviews/custom/components/module/voucher/index.jsx | 4 src/menu/components/card/cardcellcomponent/index.jsx | 7 src/menu/components/share/actioncomponent/formconfig.jsx | 300 ++++-- src/views/pay/index.jsx | 100 +- src/menu/components/share/actioncomponent/actionform/index.jsx | 82 + src/mob/header/index.scss | 7 src/views/appmanage/index.jsx | 80 + src/menu/debug/index.jsx | 54 + src/views/appmanage/submutilform/index.jsx | 63 + src/views/design/sidemenu/thdmenuplus/index.jsx | 2 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 2 src/views/design/header/index.jsx | 4 src/views/appcheck/index.jsx | 10 src/components/header/index.jsx | 1 src/menu/components/share/actioncomponent/dragaction/card.jsx | 2 src/menu/transfer/index.jsx | 3 src/templates/zshare/verifycard/fullScripts/index.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 27 src/views/tabledesign/index.jsx | 6 src/tabviews/zshare/actionList/index.jsx | 2 src/api/index.js | 65 src/index.js | 8 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 2 public/manifest.json | 2 src/views/pcdesign/index.jsx | 8 src/templates/zshare/verifycard/index.jsx | 12 src/menu/components/share/actioncomponent/index.jsx | 9 src/setupProxy.js | 6 src/menu/components/card/cardcellcomponent/formconfig.jsx | 20 src/templates/sharecomponent/actioncomponent/verifypay/index.jsx | 516 ++++++++++++ src/templates/zshare/verifycard/baseform/index.jsx | 186 +++- 53 files changed, 2,212 insertions(+), 366 deletions(-) diff --git a/public/README.txt b/public/README.txt index 6cbdae7..e4607b2 100644 --- a/public/README.txt +++ b/public/README.txt @@ -11,6 +11,9 @@ defaultLang -- 鎵撳紑鐨勫瓙搴旂敤璇█绫诲瀷锛岄粯璁や负zh-CN WXAppID -- 浣跨敤鍏紬鍙锋椂锛岀粦瀹氱殑鍏紬鍙稩D WXminiAppID -- 浣跨敤寰俊灏忕▼搴忔椂锛岀粦瀹氱殑灏忕▼搴廔D +WXMerchID -- 浣跨敤寰俊鏀粯鏃讹紝缁戝畾鐨勫晢鎴稩D +WXNotice -- 鏄惁寮�鍚槑绉戜簯鍏紬鍙锋秷鎭彁閱掞紝鍊间负 true 鏃跺紑鍚紝鍙�氳繃鏄庣浜戝彂閫佹ā鏉挎秷鎭� +WXApps -- 瀛樺湪澶氫釜鍏紬鍙枫�佸皬绋嬪簭鎴栧晢鎴锋椂鍙娇鐢ㄥ井淇PP鍒楄〃锛屾敞鎰忓~鍐欓粯璁ゅ叕浼楀彿銆佸皬绋嬪簭涓庡晢鎴峰彿锛屾牸寮� [{"appId": "", "appName": "", "appType": "public/miniProgram/merchant"}] nginx -- 鏄惁寮�鍚簡nginx鏈嶅姟锛屽�间负 true 鏃跺紑鍚紝濡傞渶浣跨敤寰俊妯℃澘娑堟伅绛夋湇鍔★紝璇峰厛璁剧疆nginx鏈嶅姟骞跺紑鍚閰嶇疆 debugger -- 鍊间负 true 鏃跺紑鍚皟璇曟ā寮忥紝寮�鍚悗绉诲姩绔瓙搴旂敤涓細鏈夋帶鍒跺彴 licenseKey -- 璁稿彲瀵嗛挜锛屽湪鍐呴儴缃戠粶涓娇鐢ㄧ郴缁熸椂锛屼細璺宠繃epc楠岃瘉 diff --git a/public/manifest.json b/public/manifest.json index 61ef54c..425eba5 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -6,5 +6,5 @@ "display": "standalone", "theme_color": "#000000", "background_color": "#ffffff", - "mk_version": "20240601" + "mk_version": "20240701" } diff --git a/public/options.json b/public/options.json index c7ddb32..d9f2fe6 100644 --- a/public/options.json +++ b/public/options.json @@ -10,6 +10,7 @@ "defaultLang": "zh-CN", "WXAppID": "wx4d8a34c8d4494872", "WXminiAppID": "", + "WXMerchID": "", "WXNotice": "true", "nginx": "true", "debugger": true, diff --git a/src/api/index.js b/src/api/index.js index d9766a6..aab9485 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -100,29 +100,22 @@ /** * @description 寰俊涓氬姟璇锋眰 鍘熸帴鍙� 'wxpay/getaccesstoken' */ - wxAccessToken (domain = '') { - let _url = domain || window.GLOB.baseurl - - if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { - _url = _url.replace('http://qingqiumarket.cn', 'http://qingqiumarket.cn:8080') - _url = _url.replace('http://cloud.mk9h.cn', 'http://cloud.mk9h.cn:8080') - _url = _url.replace('https://qingqiumarket.cn', 'https://qingqiumarket.cn:8443') - _url = _url.replace('https://cloud.mk9h.cn', 'https://cloud.mk9h.cn:8443') - } + wxAccessToken (appId, domain = '') { + let _url = domain || window.GLOB.baseurl return new Promise(resolve => { - if (window.GLOB.accessToken.domain === domain && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { + if (window.GLOB.accessToken.appId === appId && window.GLOB.accessToken.accessTime && (parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.accessTime < 30)) { resolve(window.GLOB.accessToken) } else { - window.GLOB.accessToken = {domain} + window.GLOB.accessToken = {appId} axios({ - url: _url + 'wxpay/getaccesstoken', - method: 'get' + url: _url + 'wechat/getaccesstoken', + method: 'post', + data: JSON.stringify({app_id: appId}) }).then(res => { - if (res.oa_access_token) { + if (res.access_token) { window.GLOB.accessToken.accessTime = parseInt(new Date().getTime() / 1000) - window.GLOB.accessToken.oa_access_token = res.oa_access_token - // window.GLOB.accessToken.mini_access_token = res.mini_access_token + window.GLOB.accessToken.access_token = res.access_token } resolve(res) }) @@ -142,12 +135,12 @@ if (process.env.NODE_ENV === 'production') { _url = document.location.origin + '/' + url } - if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { - _url = _url.replace('http://qingqiumarket.cn', 'http://qingqiumarket.cn:8080') - _url = _url.replace('http://cloud.mk9h.cn', 'http://cloud.mk9h.cn:8080') - _url = _url.replace('https://qingqiumarket.cn', 'https://qingqiumarket.cn:8443') - _url = _url.replace('https://cloud.mk9h.cn', 'https://cloud.mk9h.cn:8443') - } + } + if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { + _url = _url.replace('http://qingqiumarket.cn/', 'http://qingqiumarket.cn:8080/') + _url = _url.replace('http://cloud.mk9h.cn/', 'http://cloud.mk9h.cn:8080/') + _url = _url.replace('https://qingqiumarket.cn/', 'https://qingqiumarket.cn:8443/') + _url = _url.replace('https://cloud.mk9h.cn/', 'https://cloud.mk9h.cn:8443/') } if (param) { @@ -1064,10 +1057,10 @@ _url = document.location.origin + '/file/oss/upload' } if (/qingqiumarket.cn|cloud.mk9h.cn/.test(_url)) { - _url = _url.replace('http://qingqiumarket.cn', 'http://qingqiumarket.cn:8080') - _url = _url.replace('http://cloud.mk9h.cn', 'http://cloud.mk9h.cn:8080') - _url = _url.replace('https://qingqiumarket.cn', 'https://qingqiumarket.cn:8443') - _url = _url.replace('https://cloud.mk9h.cn', 'https://cloud.mk9h.cn:8443') + _url = _url.replace('http://qingqiumarket.cn/', 'http://qingqiumarket.cn:8080/') + _url = _url.replace('http://cloud.mk9h.cn/', 'http://cloud.mk9h.cn:8080/') + _url = _url.replace('https://qingqiumarket.cn/', 'https://qingqiumarket.cn:8443/') + _url = _url.replace('https://cloud.mk9h.cn/', 'https://cloud.mk9h.cn:8443/') } return axios({ @@ -1079,30 +1072,24 @@ } /** - * @description 鑾峰彇寰俊鏀粯浜岀淮鐮� + * @description 鑾峰彇寰俊鏀粯浜岀淮鐮� 鍘熸帴鍙xpay/wxNativePay */ getWxNativePay (param) { - let _url = window.GLOB.baseurl + 'wxpay/wxNativePay' - return axios({ - url: _url, + url: window.GLOB.baseurl + 'wechat/native', method: 'post', - data: qs.stringify(param) + data: JSON.stringify(param) }) } /** - * @description 寰俊鏀粯閫�娆� + * @description 寰俊鏀粯閫�娆� 鍘熸帴鍙xpay/wxRefund */ - setRefund (orderId) { - let _param = new FormData() - _param.append('out_biz_no', orderId) - + setRefund (param) { return axios({ - url: '/wxpay/wxRefund', - headers: { 'Content-Type': 'multipart/form-data' }, + url: window.GLOB.baseurl + 'wechat/wxRefund', method: 'post', - data: _param + data: JSON.stringify(param) }) } diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 307b07e..98aeee4 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -109,6 +109,7 @@ setTimeout(() => { sessionStorage.clear() this.props.history.replace('/login') + window.location.reload() }, 2000) }) } diff --git a/src/index.js b/src/index.js index aecaa7f..d0f3e4e 100644 --- a/src/index.js +++ b/src/index.js @@ -48,6 +48,7 @@ GLOB.nginx = config.nginx + '' === 'true' GLOB.WXAppID = config.WXAppID || '' GLOB.WXminiAppID = config.WXminiAppID || '' + GLOB.WXMerchID = config.WXMerchID || '' GLOB.WXNotice = config.WXNotice + '' === 'true' GLOB.execType = config.execType === 'x' ? 'x' : '' GLOB.accessToken = {} @@ -59,6 +60,13 @@ GLOB.style = 'bg_black_style_blue' GLOB.defLang = '' + if (config.WXApps) { + config.WXApps = config.WXApps.filter(app => app.appId && app.appName && ['public', 'miniProgram', 'merchant'].includes(app.appType)) + if (config.WXApps.length) { + GLOB.WXApps = config.WXApps + } + } + if (langs[config.defaultLang]) { GLOB.defLang = config.defaultLang } diff --git a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx index 4db573b..44c1b19 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx @@ -48,6 +48,8 @@ hasProfile = true } else if (card.OpenType === 'innerpage' && !card.pageTemplate) { warning = <WarningOutlined style={{color: 'orange', marginLeft: '5px'}}/> + } else if (card.payMode === 'system') { + hasProfile = true } let btnElement = null diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 0b03681..1435179 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -233,6 +233,24 @@ if (this.record.eval === 'true') { _options.push('decimal') } + if (this.record.eval !== 'func') { + _options.push('link') + } + if (this.record.link && this.record.eval !== 'func') { + _options.push('linkType') + if (this.record.linkType === 'linkmenu') { + _options.push('open') + if (this.record.link === 'static') { + _options.push('linkmenu') + } else { + _options.push('linkurl') + } + } else if (this.record.linkType === 'other') { + _options.push('linkurl', 'open') + } else { + _options.push('linkurl') + } + } } if (_options.includes('fixStyle') && this.record.fixStyle === 'alone') { _options.push('fixSize', 'fixColor', 'fixLeft', 'fixRight') diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index 32da945..99d6305 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -608,6 +608,16 @@ ] }, { + type: 'codemirror', + key: 'formula', + label: '鍏紡', + initVal: card.formula || '', + tooltip: '鎵ц鏃朵細浣跨敤鏌ヨ鍒扮殑鏁版嵁鏇挎崲鐩稿簲鐨勫瓧娈碉紝灞曠ず鑾峰緱鐨勭粨鏋滐紝鍦ㄤ笉浣跨敤瑙f瀽鏃舵崲琛岀鎴栫┖鏍间細鏇挎崲涓洪〉闈㈠厓绱犮�傚彲浣跨敤JS鐨勪竴浜涜娉曪紝濡傦細涓夊厓琛ㄨ揪寮� @field1@ > @field2@ ? 0 : 1锛汳ath瀵硅薄锛屽彇缁濆鍊� Math.abs(@field@)銆佸洓鑸嶄簲鍏� Math.round(@field@)绛夈�傛敞锛氫細鏇挎崲鍏紡涓殑@username@銆丂fullName@銆丂bid@銆�', + toolWidth: 450, + placeholder: '渚嬪锛欯price@ * @number@', + required: true + }, + { type: 'radio', key: 'link', label: '閾炬帴', @@ -683,16 +693,6 @@ {value: 'blank', text: appType !== 'mob' ? '鏂扮獥鍙�' : '鏂伴〉闈�'}, {value: 'self', text: appType !== 'mob' ? '褰撳墠绐楀彛' : '褰撳墠椤甸潰'}, ] - }, - { - type: 'codemirror', - key: 'formula', - label: '鍏紡', - initVal: card.formula || '', - tooltip: '鎵ц鏃朵細浣跨敤鏌ヨ鍒扮殑鏁版嵁鏇挎崲鐩稿簲鐨勫瓧娈碉紝灞曠ず鑾峰緱鐨勭粨鏋滐紝鍦ㄤ笉浣跨敤瑙f瀽鏃舵崲琛岀鎴栫┖鏍间細鏇挎崲涓洪〉闈㈠厓绱犮�傚彲浣跨敤JS鐨勪竴浜涜娉曪紝濡傦細涓夊厓琛ㄨ揪寮� @field1@ > @field2@ ? 0 : 1锛汳ath瀵硅薄锛屽彇缁濆鍊� Math.abs(@field@)銆佸洓鑸嶄簲鍏� Math.round(@field@)绛夈�傛敞锛氫細鏇挎崲鍏紡涓殑@username@銆丂fullName@銆丂bid@銆�', - toolWidth: 450, - placeholder: '渚嬪锛欯price@ * @number@', - required: true }, { type: 'checkbox', diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 50386cc..693f87a 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -21,6 +21,7 @@ const VerifyPrint = asyncComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyprint')) const VerifyExcelIn = asyncComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelin')) const VerifyExcelOut = asyncComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelout')) +const VerifyPay = asyncComponent(() => import('@/templates/sharecomponent/actioncomponent/verifypay')) class CardCellComponent extends Component { static propTpyes = { @@ -806,6 +807,12 @@ columns={side === 'sub' ? cards.subColumns : cards.columns} wrappedComponentRef={(inst) => this.verifyRef = inst} /> + } else if (card.payMode === 'system') { + return <VerifyPay + card={card} + columns={side === 'sub' ? cards.subColumns : cards.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> } } diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index 104c448..0d1897c 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -18,8 +18,8 @@ pop: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'hoverTitle', 'hidden', 'preButton'], prompt: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'position', 'tipTitle', 'hoverTitle', 'hidden', 'preButton'], exec: ['label', 'OpenType', 'intertype', 'Ot', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'anchors', 'width', 'openmenu', 'refreshTab', 'hoverTitle', 'hidden', 'preButton'], - excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'hover', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden'], - excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'hover', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden'], + excelIn: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'hover', 'icon', 'class', 'color', 'sheet', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'width', 'hidden', 'refreshTab'], + excelOut: ['label', 'Ot', 'OpenType', 'intertype', 'show', 'hover', 'icon', 'class', 'color', 'execSuccess', 'execError', 'syncComponent', 'switchTab', 'pagination', 'search', 'width', 'hidden', 'refreshTab'], popview: ['label', 'Ot', 'OpenType', 'show', 'hover', 'icon', 'class', 'color', 'popClose', 'width', 'display', 'ratio', 'syncComponent', 'clickouter', 'maskStyle', 'closeButton', 'hidden'], tab: ['label', 'Ot', 'OpenType', 'show', 'hover', 'icon', 'class', 'color', 'linkmenu', 'width', 'hidden', 'openTab'], innerpage: ['label', 'Ot', 'OpenType', 'pageTemplate', 'show', 'hover', 'swipe', 'icon', 'class', 'color', 'width', 'hidden'], @@ -443,6 +443,15 @@ reOptions.Ot = requireOptions } else if (this.record.pageTemplate === 'pay') { reOptions.Ot = requireOptions.filter(op => op.value === 'requiredSgl') + + shows.push('payMode', 'wxApp', 'wxMerch') + if (this.record.payMode === 'inner') { + reRequired.innerFunc = true + shows.push('innerFunc') + } + if (this.record.payMode !== 'none') { + shows.push('output') + } } } else if (openType === 'funcbutton') { reOptions.intertype = this.state.interTypeOptions.filter(op => op.value !== 'custom') @@ -511,14 +520,31 @@ shows.push('innerFunc', 'Ot', 'execSuccess', 'execError', 'urlkey') } else if (_funcType === 'pay') { - shows.push('payType', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') + shows.push('payType', 'wxApp', 'wxMerch', 'Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu') if (this.record.openmenu && this.record.openmenu !== 'goback') { shows.push('open') } reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) + shows.push('payMode') + if (this.record.payMode === 'inner') { + reRequired.innerFunc = true + shows.push('innerFunc') + } + if (this.record.payMode !== 'none') { + shows.push('output') + } } else if (_funcType === 'refund') { shows.push('Ot', 'execSuccess', 'execError', 'syncComponent', 'openmenu', 'tipTitle') reOptions.Ot = requireOptions.filter(op => ['requiredSgl'].includes(op.value)) + + shows.push('payMode') + if (this.record.payMode === 'inner') { + reRequired.innerFunc = true + shows.push('innerFunc') + } + if (this.record.payMode !== 'none') { + shows.push('output') + } } else if (_funcType === 'shareLink') { shows.push('shortUrl', 'shareUrl', 'shareProUrl', 'shareTip') // } else if (_funcType === 'expPdf') { @@ -856,22 +882,42 @@ { max: 512, message: '鏈�澶�512涓瓧绗�' } ) } else if (item.key === 'output') { - if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { - rules = [{ - pattern: /^@[0-9a-zA-Z_]+@?$/, - message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' - }, { - max: 100, - message: '鏈�澶�100涓瓧绗︺��' - }] + if (['pop', 'prompt', 'exec'].includes(this.record.OpenType)) { + if (this.record.intertype === 'system' || ((this.record.intertype === 'outer' || this.record.intertype === 'custom') && this.record.callbackType === 'script')) { + rules = [{ + pattern: /^@[0-9a-zA-Z_]+@?$/, + message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] + } else { + rules = [{ + pattern: /^[0-9a-zA-Z_]*$/, + message: '瀛楁鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] + } } else { - rules = [{ - pattern: /^[0-9a-zA-Z_]*$/, - message: '瀛楁鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' - }, { - max: 100, - message: '鏈�澶�100涓瓧绗︺��' - }] + if (this.record.payMode === 'system') { + rules = [{ + pattern: /^@[0-9a-zA-Z_]+@?$/, + message: '鍙橀噺浠绗﹀紑澶达紝鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] + } else { + rules = [{ + pattern: /^[0-9a-zA-Z_]*$/, + message: '瀛楁鍙娇鐢ㄥ瓧姣嶃�佹暟瀛椾互鍙奯' + }, { + max: 100, + message: '鏈�澶�100涓瓧绗︺��' + }] + } } } else { rules.push({ max: formRule.input.max, message: formRule.input.message }) diff --git a/src/menu/components/share/actioncomponent/dragaction/card.jsx b/src/menu/components/share/actioncomponent/dragaction/card.jsx index a90472c..5955f56 100644 --- a/src/menu/components/share/actioncomponent/dragaction/card.jsx +++ b/src/menu/components/share/actioncomponent/dragaction/card.jsx @@ -46,6 +46,8 @@ hasProfile = true } else if (card.funcType === 'megvii') { hasProfile = true + } else if (card.payMode === 'system') { + hasProfile = true } let btnElement = null diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 1106bec..4d90ee7 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -222,6 +222,7 @@ opentypes = opentypes.filter(item => item.value !== 'tab') funTypes = [ { value: 'print', text: '鏍囩鎵撳嵃' }, + { value: 'refund', text: '閫�娆�' }, ] pageTemps = [ { value: 'linkpage', text: '鍏宠仈鑿滃崟' }, @@ -330,9 +331,21 @@ extraParam.push('dataM') } + let apps = [] + let merchs = [] if (!appType) { if (typeof(card.openmenu) === 'string') { card.openmenu = [] + } + + if (window.GLOB.WXApps) { + window.GLOB.WXApps.forEach(item => { + if (item.appType === 'merchant') { + merchs.push({value: item.appId, text: item.appName}) + } else { + apps.push({value: item.appId, text: item.appName}) + } + }) } } else { if (typeof(card.openmenu) !== 'string') { @@ -421,20 +434,20 @@ required: true, options: [] }, - { - type: 'checkbox', - key: 'payType', - label: '鏀粯鏂瑰紡', - initVal: card.payType || [], - required: true, - options: [{ - value: 'wxpay', - text: '寰俊' - // }, { - // value: 'alipay', - // text: '鏀粯瀹�' - }] - }, + // { + // type: 'checkbox', + // key: 'payType', + // label: '鏀粯鏂瑰紡', + // initVal: card.payType || [], + // required: true, + // options: [{ + // value: 'wxpay', + // text: '寰俊' + // // }, { + // // value: 'alipay', + // // text: '鏀粯瀹�' + // }] + // }, { type: 'radio', key: 'procMode', @@ -470,15 +483,6 @@ }, { type: 'text', - key: 'innerFunc', - label: '鍐呴儴鍑芥暟', - initVal: card.innerFunc || '', - tooltip: functip, - fields: usefulFields, - required: false, - }, - { - type: 'text', key: 'urlkey', label: '鍦板潃瀛楁', initVal: card.urlkey || '', @@ -493,6 +497,53 @@ initVal: card.pageTemplate || '', required: true, options: pageTemps + }, + { + type: 'radio', + key: 'payMode', + label: '鍙傛暟澶勭悊', + initVal: card.payMode || 'none', + tooltip: '鏀粯锛堟垨閫�娆撅級鍗曞彿鐨勯澶勭悊鏂瑰紡銆�', + required: true, + options: [{ + value: 'system', + text: '绯荤粺鍑芥暟' + }, { + value: 'inner', + text: '鍐呴儴鍑芥暟' + }, { + value: 'none', + text: '鏃�' + }] + }, + { + type: 'select', + key: 'wxApp', + label: '鍏宠仈搴旂敤', + initVal: card.wxApp || '', + tooltip: '璇峰叧鑱旀敮浠樼殑鍏紬鍙锋垨灏忕▼搴忋��', + required: true, + forbid: apps.length === 0, + options: apps + }, + { + type: 'select', + key: 'wxMerch', + label: '鍏宠仈鍟嗘埛', + initVal: card.wxMerch || '', + tooltip: '璇峰叧鑱旀敮浠樼殑鍟嗘埛鍙枫��', + required: true, + forbid: merchs.length === 0, + options: merchs + }, + { + type: 'text', + key: 'innerFunc', + label: '鍐呴儴鍑芥暟', + initVal: card.innerFunc || '', + tooltip: functip, + fields: usefulFields, + required: false, }, { type: 'printTemps', @@ -984,37 +1035,6 @@ options: modules.length ? [...modules, {value: 'multiComponent', label: '澶氱粍浠�'}] : [] }, { - type: 'radio', - key: 'pagination', - label: '鍒嗛〉', - initVal: card.pagination || 'false', - tooltip: '瀵煎嚭鏁版嵁閲忚緝澶ф椂锛�1000+锛夛紝鍙缃垎椤佃姹傛暟鎹��', - required: false, - options: [{ - value: 'true', - text: '鏄�' - }, { - value: 'false', - text: '鍚�' - }], - forbid: appType === 'mob' - }, - { - type: 'radio', - key: 'search', - label: '鎼滅储鏉′欢', - initVal: card.search || 'false', - required: false, - options: [{ - value: 'true', - text: '蹇呭~' - }, { - value: 'false', - text: '闈炲繀濉�' - }], - forbid: appType === 'mob' - }, - { type: 'cascader', key: 'refreshTab', label: '鍒锋柊鑿滃崟', @@ -1054,6 +1074,37 @@ tooltip: '鎵ц鎴愬姛鍚庯紝闇�瑕佽烦杞殑閿氱偣銆�' + (appType === 'mob' ? '娉細灏忕▼搴忎腑鏃犳晥' : ''), required: false, options: anchors + }, + { + type: 'radio', + key: 'pagination', + label: '鍒嗛〉', + initVal: card.pagination || 'false', + tooltip: '瀵煎嚭鏁版嵁閲忚緝澶ф椂锛�1000+锛夛紝鍙缃垎椤佃姹傛暟鎹��', + required: false, + options: [{ + value: 'true', + text: '鏄�' + }, { + value: 'false', + text: '鍚�' + }], + forbid: appType === 'mob' + }, + { + type: 'radio', + key: 'search', + label: '鎼滅储鏉′欢', + initVal: card.search || 'false', + required: false, + options: [{ + value: 'true', + text: '蹇呭~' + }, { + value: 'false', + text: '闈炲繀濉�' + }], + forbid: appType === 'mob' }, { type: 'select', @@ -1735,6 +1786,19 @@ extraParam.push('dataM') } + let apps = [] + let merchs = [] + + if (window.GLOB.WXApps) { + window.GLOB.WXApps.forEach(item => { + if (item.appType === 'merchant') { + merchs.push({value: item.appId, text: item.appName}) + } else { + apps.push({value: item.appId, text: item.appName}) + } + }) + } + let forms = [ { type: 'select', @@ -1795,20 +1859,20 @@ required: true, options: [] }, - { - type: 'checkbox', - key: 'payType', - label: '鏀粯鏂瑰紡', - initVal: card.payType || [], - required: true, - options: [{ - value: 'wxpay', - text: '寰俊' - // }, { - // value: 'alipay', - // text: '鏀粯瀹�' - }] - }, + // { + // type: 'checkbox', + // key: 'payType', + // label: '鏀粯鏂瑰紡', + // initVal: card.payType || [], + // required: true, + // options: [{ + // value: 'wxpay', + // text: '寰俊' + // // }, { + // // value: 'alipay', + // // text: '鏀粯瀹�' + // }] + // }, { type: 'radio', key: 'procMode', @@ -1844,15 +1908,6 @@ }, { type: 'text', - key: 'innerFunc', - label: '鍐呴儴鍑芥暟', - initVal: card.innerFunc || '', - tooltip: functip, - fields: usefulFields, - required: false, - }, - { - type: 'text', key: 'urlkey', label: '鍦板潃瀛楁', initVal: card.urlkey || '', @@ -1867,6 +1922,53 @@ initVal: card.pageTemplate || '', required: true, options: pageTemps + }, + { + type: 'radio', + key: 'payMode', + label: '鍙傛暟澶勭悊', + initVal: card.payMode || 'none', + tooltip: '鏀粯锛堟垨閫�娆撅級鍗曞彿鐨勯澶勭悊鏂瑰紡銆�', + required: true, + options: [{ + value: 'system', + text: '绯荤粺鍑芥暟' + }, { + value: 'inner', + text: '鍐呴儴鍑芥暟' + }, { + value: 'none', + text: '鏃�' + }] + }, + { + type: 'select', + key: 'wxApp', + label: '鍏宠仈搴旂敤', + initVal: card.wxApp || '', + tooltip: '璇峰叧鑱旀敮浠樼殑鍏紬鍙锋垨灏忕▼搴忋��', + required: true, + forbid: apps.length === 0, + options: apps + }, + { + type: 'select', + key: 'wxMerch', + label: '鍏宠仈鍟嗘埛', + initVal: card.wxMerch || '', + tooltip: '璇峰叧鑱旀敮浠樼殑鍟嗘埛鍙枫��', + required: true, + forbid: merchs.length === 0, + options: merchs + }, + { + type: 'text', + key: 'innerFunc', + label: '鍐呴儴鍑芥暟', + initVal: card.innerFunc || '', + tooltip: functip, + fields: usefulFields, + required: false, }, { type: 'printTemps', @@ -2298,6 +2400,28 @@ options: modules.length ? [...modules, {value: 'multiComponent', label: '澶氱粍浠�'}] : [] }, { + type: 'cascader', + key: 'refreshTab', + label: '鍒锋柊鑿滃崟', + initVal: card.refreshTab || [], + tooltip: '鎵ц鎴愬姛鍚庯紙鎴栨墽琛屽け璐ヤ笖瀛樺湪鍒锋柊椤规椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟', + required: false, + forbid: viewType === 'popview', + options: menulist + }, + { + type: 'cascader', + key: 'openmenu', + label: '鎵撳紑鑿滃崟', + tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��', + initVal: card.openmenu || [], + extendName: 'MenuNo', + required: false, + allowClear: true, + options: menulist, + forbid: viewType === 'popview' + }, + { type: 'radio', key: 'pagination', label: '鍒嗛〉', @@ -2325,28 +2449,6 @@ value: 'false', text: '闈炲繀濉�' }] - }, - { - type: 'cascader', - key: 'refreshTab', - label: '鍒锋柊鑿滃崟', - initVal: card.refreshTab || [], - tooltip: '鎵ц鎴愬姛鍚庯紙鎴栨墽琛屽け璐ヤ笖瀛樺湪鍒锋柊椤规椂锛夛紝闇�瑕佸悓姝ュ埛鏂扮殑鑿滃崟', - required: false, - forbid: viewType === 'popview', - options: menulist - }, - { - type: 'cascader', - key: 'openmenu', - label: '鎵撳紑鑿滃崟', - tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��', - initVal: card.openmenu || [], - extendName: 'MenuNo', - required: false, - allowClear: true, - options: menulist, - forbid: viewType === 'popview' }, { type: 'text', diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index 27bde39..77d657a 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -20,6 +20,7 @@ const VerifyExcelIn = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelin')) const VerifyExcelOut = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifyexcelout')) const VerifyMegvii = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifymegvii')) +const VerifyPay = asyncSpinComponent(() => import('@/templates/sharecomponent/actioncomponent/verifypay')) class ActionComponent extends Component { static propTpyes = { @@ -524,7 +525,7 @@ verifySubmit = () => { const { config } = this.props const { card } = this.state - + this.verifyRef.handleConfirm().then(res => { let _actionlist = fromJS(this.state.actionlist).toJS() _actionlist = _actionlist.filter(item => !item.origin || item.uuid === card.uuid) @@ -698,6 +699,12 @@ columns={config.columns} wrappedComponentRef={(inst) => this.verifyRef = inst} /> + } else if (card.payMode === 'system') { + return <VerifyPay + card={card} + columns={config.columns} + wrappedComponentRef={(inst) => this.verifyRef = inst} + /> } } diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx index 737fd3e..6cf383d 100644 --- a/src/menu/debug/index.jsx +++ b/src/menu/debug/index.jsx @@ -439,6 +439,12 @@ } else if (cell.OpenType === 'funcbutton') { if (cell.funcType === 'print') { + } else if ((cell.funcType === 'refund' || cell.funcType === 'pay') && cell.payMode === 'system') { + sql = this.getPaySql(cell, item) + } + } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') { + if (cell.pageTemplate === 'pay' && cell.payMode === 'system') { + sql = this.getPaySql(cell, item) } } else if (cell.OpenType === 'popview') { if (cell.config && cell.config.components) { @@ -1896,6 +1902,54 @@ return sql } + getPaySql = (btn, component) => { + let sysfields = ['username', 'fullname', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'tbid', 'bid'] + let _declare = [] + let _select = [] + + component.columns.forEach(_f => { + if (sysfields.includes(_f.field.toLowerCase())) return + + if (/decimal|int/ig.test(_f.datatype)) { + _select.push(`@${_f.field}=1`) + } else if (/date/ig.test(_f.datatype)) { + _select.push(`@${_f.field}='1949-10-01'`) + } else { + _select.push(`@${_f.field}=''`) + } + + _declare.push(`@${_f.field} ${_f.datatype}`) + }) + + _declare = _declare.join(', ') + _select = _select.join(', ') + + let _sql = `Declare @UserName nvarchar(50), @FullName nvarchar(50), @RoleID nvarchar(512), @mk_departmentcode nvarchar(512), @mk_organization nvarchar(512), @mk_user_type nvarchar(20), @mk_nation nvarchar(50), @mk_province nvarchar(50), @mk_city nvarchar(50), @mk_district nvarchar(50), @mk_address nvarchar(100), @ErrorCode nvarchar(50), @retmsg nvarchar(4000), @bid nvarchar(50), @tbid nvarchar(50), ${_declare} + Select @UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address='', @ErrorCode='', @retmsg='', @bid='', ${_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` + } + + _sql = _sql.replace(/@typename@/ig, `'typename'`) + _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) + + return _sql + } + formatDataSource = (item, regs, mainSearch = []) => { if (!item.setting || item.setting.interType !== 'system') return false diff --git a/src/menu/tablenodes/index.jsx b/src/menu/tablenodes/index.jsx index 12951c2..4174e4d 100644 --- a/src/menu/tablenodes/index.jsx +++ b/src/menu/tablenodes/index.jsx @@ -485,9 +485,12 @@ if (m.debug_url) { let _param = JSON.parse(window.decodeURIComponent(window.atob(m.debug_url))) let label = _param.MenuName + _param.lang = _param.lang || 'zh-CN' if (_param && _param.type === 'app') { - label += ` (${_param.kei_no} | ${_param.typename}${param.lang !== 'zh-CN' ? ' | ' + param.lang : ''})` + label += ` (${_param.kei_no} | ${_param.typename}${_param.lang !== 'zh-CN' ? ' | ' + _param.lang : ''})` + } else if (_param && _param.lang && _param.lang !== 'zh-CN') { + label += ` (${_param.lang})` } cell.children.push({ @@ -534,7 +537,7 @@ }, 50) } else if (menu.param) { if (menu.param.type === 'admin') { - if (menu.param.MenuType === 'custom') { + if (['custom', 'home', 'billPrint'].includes(menu.param.MenuType)) { let _param = {...menu.param} delete _param.type _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) @@ -548,11 +551,11 @@ } } else if (menu.param.type === 'app') { if (menu.param.typename !== 'pc') { - let _param = {...menu.param, lang: sessionStorage.getItem('lang')} + let _param = {...menu.param} _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) window.open(`#/mobdesign/${_param}`) } else { - let _param = {...menu.param, lang: sessionStorage.getItem('lang')} + let _param = {...menu.param} _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param))) window.open(`#/pcdesign/${_param}`) } diff --git a/src/menu/transfer/index.jsx b/src/menu/transfer/index.jsx index 1919b20..f4fa0e0 100644 --- a/src/menu/transfer/index.jsx +++ b/src/menu/transfer/index.jsx @@ -218,7 +218,8 @@ type: 'admin', OpenType: _config.OpenType, PageParam: {Template: 'CustomPage', OpenType: 'newtab', hidden: _config.hidden}, - MenuType: 'custom' + MenuType: 'custom', + lang: sessionStorage.getItem('lang') } let url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) diff --git a/src/mob/header/index.jsx b/src/mob/header/index.jsx index 6d61f1f..7d372fb 100644 --- a/src/mob/header/index.jsx +++ b/src/mob/header/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' +import { langs } from '@/store/options.js' import avatar from '@/assets/img/avatar.jpg' import MainLogo from '@/assets/img/main-logo.png' import './index.scss' @@ -13,10 +14,13 @@ render () { const { logo } = this.state + let lang = sessionStorage.getItem('lang') + lang = lang !== 'zh-CN' ? langs[lang] || '' : '' return ( <header className="mob-header-container"> <div className="header-logo"><img src={logo} alt=""/></div> + <span className="lang">{lang}</span> <div className="header-user"> <img src={this.state.avatar} alt=""/> <span> diff --git a/src/mob/header/index.scss b/src/mob/header/index.scss index b4009e2..2f9cd6e 100644 --- a/src/mob/header/index.scss +++ b/src/mob/header/index.scss @@ -9,6 +9,13 @@ background: #001529; border-bottom: 1px solid #000; + .lang { + position: absolute; + font-size: 18px; + left: calc(50% - 12px); + top: 10px; + color: #ffffff; + } .header-logo { float: left; width: 180px; diff --git a/src/setupProxy.js b/src/setupProxy.js index c82ef96..4d69c53 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -36,12 +36,6 @@ changeOrigin: true })) - app.use(proxy('/wechat', { - target: `${options.host}/${options.service}`, - secure: false, - changeOrigin: true - })) - // app.use(proxy('/trans', { // target: `${host}/${service}`, // secure: false, diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 15881fe..9cf1af3 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -1033,14 +1033,26 @@ className = mark.signType } - contents.push( - <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> - <div style={_style}> - {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : - <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} + if (card.link && !data.$disabled) { + _style.cursor = 'pointer' + contents.push( + <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> + <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> + {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : + <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} + </div> </div> - </div> - ) + ) + } else { + contents.push( + <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> + <div style={_style}> + {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : + <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} + </div> + </div> + ) + } } else if (card.eleType === 'tag') { let vals = '' @@ -1222,6 +1234,7 @@ name={name} BID={data.$$BID} LID={lid} + columns={cards.columns} BData={data.$$BData || ''} disabled={_disabled} selectedData={_data} @@ -1284,6 +1297,7 @@ disabled={_disabled} LID={lid} btn={card} + columns={cards.columns} selectedData={_data} /> } diff --git a/src/tabviews/custom/components/module/invoice/index.jsx b/src/tabviews/custom/components/module/invoice/index.jsx index 5733915..1575193 100644 --- a/src/tabviews/custom/components/module/invoice/index.jsx +++ b/src/tabviews/custom/components/module/invoice/index.jsx @@ -510,7 +510,7 @@ }) if (res.status) { if (config.billSaveBtn.reTabId) { - MKEmitter.emit('reloadMenuView', config.billSaveBtn.reTabId, 'table') + MKEmitter.emit('reloadMenuView', config.billSaveBtn.reTabId) } if (config.billSaveBtn.syncComId) { MKEmitter.emit('reloadData', config.billSaveBtn.syncComId) @@ -988,7 +988,7 @@ }) if (res.status) { if (config.billOutBtn.reTabId) { - MKEmitter.emit('reloadMenuView', config.billOutBtn.reTabId, 'table') + MKEmitter.emit('reloadMenuView', config.billOutBtn.reTabId) } if (config.billOutBtn.syncComId) { MKEmitter.emit('reloadData', config.billOutBtn.syncComId) diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 0fd7ac5..89c8085 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -700,7 +700,7 @@ } if (tabId) { - MKEmitter.emit('reloadMenuView', tabId, 'table') + MKEmitter.emit('reloadMenuView', tabId) } }) } @@ -953,7 +953,7 @@ } if (tabId) { - MKEmitter.emit('reloadMenuView', tabId, 'table') + MKEmitter.emit('reloadMenuView', tabId) } }) } diff --git a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx index 76bfb7c..90fd522 100644 --- a/src/tabviews/zshare/actionList/changeuserbutton/index.jsx +++ b/src/tabviews/zshare/actionList/changeuserbutton/index.jsx @@ -114,7 +114,7 @@ MKEmitter.emit('closeTabView', MenuID || btn.$MenuID) if (btn.refreshTab && btn.refreshTab.length > 0) { - MKEmitter.emit('reloadMenuView', btn.refreshTab[btn.refreshTab.length - 1], 'table') + MKEmitter.emit('reloadMenuView', btn.refreshTab[btn.refreshTab.length - 1]) } return } diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 1be21b1..9310404 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -180,6 +180,16 @@ loading: false }) + let tabId = '' + if (btn.refreshTab && btn.refreshTab.length > 0) { + tabId = btn.refreshTab[btn.refreshTab.length - 1] + } + + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 + MKEmitter.emit('reloadMenuView', tabId) + return + } + if (btn.execSuccess === 'closepoptab') { MKEmitter.emit('popclose') } else if (btn.execSuccess !== 'never') { @@ -202,6 +212,10 @@ } else { MKEmitter.emit('reloadData', btn.syncComponentId) } + } + + if (tabId) { + MKEmitter.emit('reloadMenuView', tabId) } if (btn.switchTab && btn.switchTab.length > 0) { @@ -258,6 +272,15 @@ if (btn.execError === 'closepoptab') { MKEmitter.emit('popclose') } else if (btn.execError !== 'never') { + let tabId = '' + if (btn.refreshTab && btn.refreshTab.length > 0) { + tabId = btn.refreshTab[btn.refreshTab.length - 1] + } + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 + MKEmitter.emit('reloadMenuView', tabId, 'table') + return + } + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) if (btn.syncComponentId) { @@ -277,6 +300,10 @@ MKEmitter.emit('reloadData', btn.syncComponentId) } } + + if (tabId) { + MKEmitter.emit('reloadMenuView', tabId) + } } if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index cd40165..2a87051 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -986,6 +986,16 @@ loading: false }) + let tabId = '' + if (btn.refreshTab && btn.refreshTab.length > 0) { + tabId = btn.refreshTab[btn.refreshTab.length - 1] + } + + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 + MKEmitter.emit('reloadMenuView', tabId) + return + } + if (btn.execSuccess === 'closepoptab') { MKEmitter.emit('popclose') } else if (btn.execSuccess !== 'never') { @@ -1008,6 +1018,10 @@ } else { MKEmitter.emit('reloadData', btn.syncComponentId) } + } + + if (tabId) { + MKEmitter.emit('reloadMenuView', tabId) } if (btn.switchTab && btn.switchTab.length > 0) { @@ -1064,6 +1078,15 @@ if (btn.execError === 'closepoptab') { MKEmitter.emit('popclose') } else if (btn.execError !== 'never') { + let tabId = '' + if (btn.refreshTab && btn.refreshTab.length > 0) { + tabId = btn.refreshTab[btn.refreshTab.length - 1] + } + if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 + MKEmitter.emit('reloadMenuView', tabId) + return + } + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', []) if (btn.syncComponentId) { @@ -1083,6 +1106,10 @@ MKEmitter.emit('reloadData', btn.syncComponentId) } } + + if (tabId) { + MKEmitter.emit('reloadMenuView', tabId) + } } if (btn.execError === 'popclose' && btn.$tabId) { // 鏍囩鍏抽棴鍒锋柊 diff --git a/src/tabviews/zshare/actionList/funcbutton/index.jsx b/src/tabviews/zshare/actionList/funcbutton/index.jsx index 10786db..53fc63a 100644 --- a/src/tabviews/zshare/actionList/funcbutton/index.jsx +++ b/src/tabviews/zshare/actionList/funcbutton/index.jsx @@ -2,9 +2,11 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Button, notification, message, Modal } from 'antd' +import moment from 'moment' import md5 from 'md5' import Api from '@/api' +import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' @@ -165,21 +167,192 @@ okText: dict['ok'] || '纭畾', cancelText: dict['cancel'] || '鍙栨秷', onOk() { - that.execRefund(orderId) + that.execRefund(orderId, data[0]) }, onCancel() {} }) } } - execRefund = (orderId) => { - Api.setRefund(orderId).then(res => { - if (!res.status) { - this.execError({ErrCode: 'E', message: window.GLOB.dict['exc_fail'] || '鎵ц澶辫触锛�', ...res}) - } else { - this.execSuccess({ErrCode: 'S', ...res}) + execRefund = (orderId, data) => { + const { btn, BID } = this.props + + let param = null + if (btn.payMode === 'inner') { + param = { + func: btn.innerFunc || '', + BID: BID || '', + username: sessionStorage.getItem('User_Name') || '', + fullname: sessionStorage.getItem('Full_Name') || '', + dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + ID: orderId } + } else if (btn.payMode === 'system') { + let sql = this.getSysDeclareSql(orderId, data) + + param = { + func: 'sPC_TableData_InUpDe', + BID: BID || '', + exec_type: window.GLOB.execType || 'y', + timestamp: moment().format('YYYY-MM-DD HH:mm:ss') + } + + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(sql, param.exec_type) + + if (btn.output) { + param.key_back_type = 'Y' + } + + if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + } + + param.menuname = btn.logLabel + + if (window.GLOB.probation) { + param.s_debug_type = 'Y' + } + } + + this.setState({loading: true}) + + if (param) { + Api.genericInterface(param).then(res => { + if (res.status) { + let id = orderId + if (btn.output) { + id = res.mk_b_id || res[btn.output] || orderId + } + + Api.setRefund({out_biz_no: id}).then(res => { + if (!res.status) { + this.execError({ErrCode: 'E', message: res.message || window.GLOB.dict['exc_fail'] || '鎵ц澶辫触锛�', ...res}) + } else { + this.execSuccess({ErrCode: 'S', ...res}) + } + }) + } else { + this.execError(res) + } + }) + } else { + Api.setRefund({out_biz_no: orderId}).then(res => { + if (!res.status) { + this.execError({ErrCode: 'E', message: res.message || window.GLOB.dict['exc_fail'] || '鎵ц澶辫触锛�', ...res}) + } else { + this.execSuccess({ErrCode: 'S', ...res}) + } + }) + } + } + + getSysDeclareSql = (ID, data) => { + const { columns, btn, BID } = this.props + + // 绯荤粺鍙橀噺 + let _vars = ['tbid', 'errorcode', 'retmsg', 'username', 'fullname', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid'] + let _declare = [] + let _initVal = [] + + let _data = {} + Object.keys(data).forEach(key => { + _data[key.toLowerCase()] = data[key] }) + + columns.forEach(col => { + let _key = col.field.toLowerCase() + + if (_vars.includes(_key)) return + + _declare.push(`@${_key} ${col.datatype}`) + + let _val = _data.hasOwnProperty(_key) ? _data[_key] : '' + + if (/^date/ig.test(col.datatype) && !_val) { + _val = '1949-10-01' + } + + if (/'/.test(_val)) { + _val = _val.replace(/'/ig, '"') + } + + _initVal.push(`@${_key}='${_val}'`) + }) + + // 鍙橀噺澹版槑 + _declare = _declare.join(',') + if (_declare) { + _declare = ',' + _declare + } + + let _sql = `/* 绯荤粺鐢熸垚 */ + Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50),@tbid nvarchar(50)${_declare} + ` + + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + let RoleID = sessionStorage.getItem('role_id') || '' + let departmentcode = sessionStorage.getItem('departmentcode') || '' + let organization = sessionStorage.getItem('organization') || '' + let mk_user_type = sessionStorage.getItem('mk_user_type') || '' + let nation = sessionStorage.getItem('nation') || '' + let province = sessionStorage.getItem('province') || '' + let city = sessionStorage.getItem('city') || '' + let district = sessionStorage.getItem('district') || '' + let address = sessionStorage.getItem('address') || '' + + // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 + _sql += ` + /* 鐢ㄦ埛淇℃伅鍒濆鍖栬祴鍊� */ + select @ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @bid='${BID}' + ` + _sql += ` + /* 鏄剧ず鍒楀彉閲忚祴鍊� */ + select ${_initVal.join(',')} + ` + + 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` + } + + _sql = _sql.replace(/@ID@/ig, `'${ID || ''}'`) + _sql = _sql.replace(/@BID@/ig, `'${BID || ''}'`) + _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + _sql = _sql.replace(/@lang@/ig, `'${sessionStorage.getItem('lang')}'`) + _sql = _sql.replace(/@typename@/ig, `'admin'`) + + if (window.GLOB.externalDatabase !== null) { + _sql = _sql.replace(/@db@/ig, window.GLOB.externalDatabase) + } + + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, `'Y'`) + } else { + _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) + } + + if (window.GLOB.debugger === true) { + console.info('%c' + btn.logLabel, 'color: blue') + console.info(_sql) + } + + return _sql } getShortUrl = (url) => { diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index d0a7bd4..8948d0c 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -134,6 +134,7 @@ BID={BID} btn={item} BData={BData} + columns={columns} selectedData={selectedData} /> ) @@ -213,6 +214,7 @@ key={item.uuid} BID={BID} btn={item} + columns={columns} selectedData={selectedData} /> ) diff --git a/src/tabviews/zshare/actionList/newpagebutton/index.jsx b/src/tabviews/zshare/actionList/newpagebutton/index.jsx index 55bdf19..a3ca370 100644 --- a/src/tabviews/zshare/actionList/newpagebutton/index.jsx +++ b/src/tabviews/zshare/actionList/newpagebutton/index.jsx @@ -1,8 +1,11 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Button, notification, Modal } from 'antd' +import { Button, notification, Modal, message } from 'antd' +import moment from 'moment' +import Api from '@/api' +import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import MkIcon from '@/components/mk-icon' import './index.scss' @@ -21,8 +24,10 @@ state = { disabled: false, + loading: false, hidden: false, - visible: false + visible: false, + dict: window.GLOB.dict } UNSAFE_componentWillMount () { @@ -102,7 +107,7 @@ */ actionTrigger = (triggerId, record, type, lid) => { const { btn, selectedData, BID, LID } = this.props - const { disabled } = this.state + const { disabled, dict } = this.state if (disabled) return if (triggerId && btn.uuid !== triggerId) return @@ -114,7 +119,7 @@ // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� notification.warning({ top: 92, - message: window.GLOB.dict['select_row'] || '璇烽�夋嫨琛岋紒', + message: dict['select_row'] || '璇烽�夋嫨琛岋紒', duration: 5 }) return @@ -122,14 +127,14 @@ // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁 notification.warning({ top: 92, - message: window.GLOB.dict['select_single_row'] || '璇烽�夋嫨鍗曡鏁版嵁锛�', + message: dict['select_single_row'] || '璇烽�夋嫨鍗曡鏁版嵁锛�', duration: 5 }) return } else if (btn.pageTemplate === 'custom' && window.GLOB.systemType === 'production' && !btn.proUrl) { notification.warning({ top: 92, - message: window.GLOB.dict['no_prod_link'] || '灏氭湭璁剧疆姝e紡绯荤粺閾炬帴鍦板潃锛�', + message: dict['no_prod_link'] || '灏氭湭璁剧疆姝e紡绯荤粺閾炬帴鍦板潃锛�', duration: 5 }) return @@ -234,25 +239,54 @@ let src = '#/print/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: Id, lang }))) window.open(src) } else if (btn.pageTemplate === 'pay') { - let _p = `ID=${Id}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID')}&logo=${window.GLOB.doclogo}&name=${sessionStorage.getItem('Full_Name')}&icp=${window.GLOB.ICP}©Right=${window.GLOB.copyRight}` - let url = '#/pay/' + window.btoa(window.encodeURIComponent(_p)) _name = '鏀粯' - - confirm({ - title: '璇峰湪浠樻椤甸潰瀹屾垚璁㈠崟鏀粯銆�', - content: '', - className: 'pay-query', - okText: '鏀粯鎴愬姛', - cancelText: '鏀粯閬囧埌闂', - onOk() { - // 鏀粯鍚庡埛鏂扮晫闈� - MKEmitter.emit('reloadMenuView', btn.$MenuID) - }, - onCancel() { - MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'grid', btn) - }, - }) - window.open(url) + + let appId = '' + let merchId = '' + + if (btn.wxApp) { + appId = btn.wxApp + if (!window.GLOB.WXApps || window.GLOB.WXApps.findIndex(item => item.appId === btn.wxApp) === -1) { + notification.warning({ + top: 92, + message: '鎸夐挳鍏宠仈搴旂敤涓嶅湪鍙敤鍒楄〃涓紝璇烽噸鏂颁繚瀛樻寜閽厤缃紒', + duration: 5 + }) + return + } + } + if (btn.wxMerch) { + merchId = btn.wxMerch + if (!window.GLOB.WXApps || window.GLOB.WXApps.findIndex(item => item.appId === btn.wxMerch) === -1) { + notification.warning({ + top: 92, + message: '鎸夐挳鍏宠仈鍟嗘埛涓嶅湪鍙敤鍒楄〃涓紝璇烽噸鏂颁繚瀛樻寜閽厤缃紒', + duration: 5 + }) + return + } + } + + if (btn.payMode === 'system' || btn.payMode === 'inner') { + this.prequest(Id, data[0] || {}, appId, merchId) + } else { + confirm({ + title: '璇峰湪浠樻椤甸潰瀹屾垚璁㈠崟鏀粯銆�', + content: '', + className: 'pay-query', + okText: '鏀粯鎴愬姛', + cancelText: '鏀粯閬囧埌闂', + onOk() { + // 鏀粯鍚庡埛鏂扮晫闈� + MKEmitter.emit('reloadMenuView', btn.$MenuID) + }, + onCancel() { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'grid', btn) + }, + }) + + window.open('#/pay/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: Id, appId, merchId })))) + } } else if (btn.pageTemplate === 'custom') { let url = btn.url if (window.GLOB.systemType === 'production') { @@ -309,9 +343,220 @@ } } + prequest = (ID, data, appId, merchId) => { + const { btn, BID } = this.props + + let param = null + if (btn.payMode === 'inner') { + param = { + func: btn.innerFunc || '', + BID: BID || '', + username: sessionStorage.getItem('User_Name') || '', + fullname: sessionStorage.getItem('Full_Name') || '', + dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '', + ID: ID + } + } else { + let sql = this.getSysDeclareSql(ID, data) + + param = { + func: 'sPC_TableData_InUpDe', + BID: BID || '', + exec_type: window.GLOB.execType || 'y', + timestamp: moment().format('YYYY-MM-DD HH:mm:ss') + } + + param.secretkey = Utils.encrypt('', param.timestamp) + param.LText = Utils.formatOptions(sql, param.exec_type) + + if (btn.output) { + param.key_back_type = 'Y' + } + + if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + } + + param.menuname = btn.logLabel + + if (window.GLOB.probation) { + param.s_debug_type = 'Y' + } + } + + this.setState({loading: true}) + Api.genericInterface(param).then(res => { + this.setState({loading: false}) + if (res.status) { + let id = ID + if (btn.output) { + id = res.mk_b_id || res[btn.output] || ID + } + + confirm({ + title: '璇峰湪浠樻椤甸潰瀹屾垚璁㈠崟鏀粯銆�', + content: '', + className: 'pay-query', + okText: '鏀粯鎴愬姛', + cancelText: '鏀粯閬囧埌闂', + onOk() { + // 鏀粯鍚庡埛鏂扮晫闈� + MKEmitter.emit('reloadMenuView', btn.$MenuID) + }, + onCancel() { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, 'grid', btn) + }, + }) + + window.open('#/pay/' + window.btoa(window.encodeURIComponent(JSON.stringify({ ID: id, appId, merchId })))) + } else { + this.execError(res) + } + }) + } + + getSysDeclareSql = (ID, data) => { + const { columns, btn, BID } = this.props + + // 绯荤粺鍙橀噺 + let _vars = ['tbid', 'errorcode', 'retmsg', 'username', 'fullname', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid'] + let _declare = [] + let _initVal = [] + + let _data = {} + Object.keys(data).forEach(key => { + _data[key.toLowerCase()] = data[key] + }) + + columns.forEach(col => { + let _key = col.field.toLowerCase() + + if (_vars.includes(_key)) return + + _declare.push(`@${_key} ${col.datatype}`) + + let _val = _data.hasOwnProperty(_key) ? _data[_key] : '' + + if (/^date/ig.test(col.datatype) && !_val) { + _val = '1949-10-01' + } + + if (/'/.test(_val)) { + _val = _val.replace(/'/ig, '"') + } + + _initVal.push(`@${_key}='${_val}'`) + }) + + // 鍙橀噺澹版槑 + _declare = _declare.join(',') + if (_declare) { + _declare = ',' + _declare + } + + let _sql = `/* 绯荤粺鐢熸垚 */ + Declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@bid nvarchar(50),@tbid nvarchar(50)${_declare} + ` + + let userName = sessionStorage.getItem('User_Name') || '' + let fullName = sessionStorage.getItem('Full_Name') || '' + let RoleID = sessionStorage.getItem('role_id') || '' + let departmentcode = sessionStorage.getItem('departmentcode') || '' + let organization = sessionStorage.getItem('organization') || '' + let mk_user_type = sessionStorage.getItem('mk_user_type') || '' + let nation = sessionStorage.getItem('nation') || '' + let province = sessionStorage.getItem('province') || '' + let city = sessionStorage.getItem('city') || '' + let district = sessionStorage.getItem('district') || '' + let address = sessionStorage.getItem('address') || '' + + // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 + _sql += ` + /* 鐢ㄦ埛淇℃伅鍒濆鍖栬祴鍊� */ + select @ErrorCode='',@retmsg='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}', @bid='${BID}' + ` + _sql += ` + /* 鏄剧ず鍒楀彉閲忚祴鍊� */ + select ${_initVal.join(',')} + ` + + 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` + } + + _sql = _sql.replace(/@ID@/ig, `'${ID || ''}'`) + _sql = _sql.replace(/@BID@/ig, `'${BID || ''}'`) + _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + _sql = _sql.replace(/@lang@/ig, `'${sessionStorage.getItem('lang')}'`) + _sql = _sql.replace(/@typename@/ig, `'admin'`) + + if (window.GLOB.externalDatabase !== null) { + _sql = _sql.replace(/@db@/ig, window.GLOB.externalDatabase) + } + + if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 + _sql = _sql.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, `'Y'`) + } else { + _sql = _sql.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, `''`) + } + + if (window.GLOB.debugger === true) { + console.info('%c' + btn.logLabel, 'color: blue') + console.info(_sql) + } + + return _sql + } + + execError = (res) => { + const { btn } = this.props + const { dict } = this.state + + if (!['LoginError', 'C', '-2', 'E', 'N', 'F', 'NM'].includes(res.ErrCode)) { + res.ErrCode = 'E' + } + + if (res.ErrCode === 'E') { + Modal.error({ + title: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�', + okText: dict['got_it'] || '鐭ラ亾浜�' + }) + } else if (res.ErrCode === 'N') { + notification.error({ + top: 92, + message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�', + duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10 + }) + } else if (res.ErrCode === 'F') { + notification.error({ + className: 'notification-custom-error', + top: 92, + message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�', + duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10 + }) + } else if (res.ErrCode === 'NM') { + message.error(res.message || dict['exc_fail'] || '鎵ц澶辫触锛�') + } + } + render() { const { btn, name } = this.props - const { disabled, hidden } = this.state + const { disabled, hidden, loading } = this.state if (hidden) return null @@ -331,6 +576,7 @@ id={'button' + btn.uuid} title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')} style={btn.style || null} + loading={loading} disabled={disabled} className={btn.hover || ''} onClick={(e) => {e.stopPropagation(); this.actionTrigger()}} diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 8f0c450..9c00d6e 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -2359,12 +2359,8 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } - // if (btn.formCache === 'clear') { // 娓呴櫎琛ㄥ崟缂撳瓨 - // window.GLOB.CacheMap = new Map() - // } - if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 - MKEmitter.emit('reloadMenuView', tabId, 'table') + MKEmitter.emit('reloadMenuView', tabId) return } @@ -2406,7 +2402,7 @@ } if (tabId) { - MKEmitter.emit('reloadMenuView', tabId, 'table') + MKEmitter.emit('reloadMenuView', tabId) } if (btn.switchTab && btn.switchTab.length > 0) { @@ -2552,10 +2548,37 @@ } sendWxMessage = (verify, id) => { - if (!window.GLOB.nginx) { + let domain = '' + let appId = window.GLOB.WXAppID || '' + + if (verify.wxAppId && verify.wxAppId !== appId) { + appId = verify.wxAppId + if (!window.GLOB.WXApps || window.GLOB.WXApps.findIndex(item => item.appId === verify.wxAppId) === -1) { + notification.warning({ + top: 92, + message: '鎸夐挳鍏宠仈鍏紬鍙蜂笉鍦ㄥ彲鐢ㄥ垪琛ㄤ腑锛岃閲嶆柊淇濆瓨鎸夐挳閰嶇疆锛�', + duration: 5 + }) + return + } + } + + if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && window.GLOB.sysType !== 'cloud') { + domain = 'https://cloud.mk9h.cn/' + appId = 'wx4d8a34c8d4494872' + } + + if (!window.GLOB.nginx && !domain) { notification.warning({ top: 92, message: 'nginx鏈嶅姟灏氭湭寮�鍚紝涓嶅彲鍙戦�佹ā鏉挎秷鎭��', + duration: 5 + }) + return + } else if (!appId) { + notification.warning({ + top: 92, + message: '灏氭湭娣诲姞鍏紬鍙稩D锛屼笉鍙彂閫佹ā鏉挎秷鎭��', duration: 5 }) return @@ -2569,13 +2592,6 @@ param.LText = Utils.getuuid() param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - let domain1 = '' - let domain2 = '' - if (['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok'].includes(verify.wxTemplateId) && window.GLOB.sysType !== 'cloud') { - domain1 = 'https://cloud.mk9h.cn/' - domain2 = 'https://cloud.mk9h.cn:8443/' - } Api.genericInterface(param).then(res => { // res.send_data = [{openid: 'o2E7gvoSFvQRG7I8_gZxf4y3ONkQ', send_id: Utils.getuuid(), p1: '010000000001', p2: '鏄庣', p3: 'dddd', p4: '椤洪', p5: '鎴愬姛'}] @@ -2639,11 +2655,11 @@ return m }) - Api.wxAccessToken(domain1).then(res => { - if (!res.oa_access_token) return + Api.wxAccessToken(appId, domain).then(res => { + if (!res.access_token) return params.forEach(n => { - Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', JSON.stringify(n)).then(re => { + Api.wxNginxRequest(`${domain}cgi-bin/message/template/send?access_token=${res.access_token}`, 'post', JSON.stringify(n)).then(re => { if (verify.wxNoteCallback === 'true') { let msg = re.errmsg || '' @@ -3091,7 +3107,7 @@ tabId = btn.refreshTab[btn.refreshTab.length - 1] } if (tabId && btn.$MenuID === tabId) { // 鍒锋柊褰撳墠鑿滃崟鏃讹紝鍋滄鍏朵粬鎿嶄綔 - MKEmitter.emit('reloadMenuView', tabId, 'table') + MKEmitter.emit('reloadMenuView', tabId) return } @@ -3123,7 +3139,7 @@ } if (tabId) { - MKEmitter.emit('reloadMenuView', tabId, 'table') + MKEmitter.emit('reloadMenuView', tabId) } } diff --git a/src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.jsx new file mode 100644 index 0000000..0ec027b --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.jsx @@ -0,0 +1,224 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { fromJS } from 'immutable' +import { Form, Row, Col, Button, notification, Tooltip, Select, Switch } from 'antd' + +import Utils from '@/utils/utils.js' +import { checkSQL } from '@/utils/utils-custom.js' +import CodeMirror from '@/templates/zshare/codemirror' +// import './index.scss' + +class CustomForm extends Component { + static propTpyes = { + scripts: PropTypes.array, + columns: PropTypes.any, + systemScripts: PropTypes.array, + scriptsChange: PropTypes.func + } + + state = { + editItem: null, + usefulfields: null, + loading: false, + skip: false + } + + UNSAFE_componentWillMount () { + this.resetfield() + } + + resetfield = () => { + const { columns } = this.props + let fields = columns.map(item => item.field) + + this.setState({ + usefulfields: fields.join(', ') + }) + } + + edit = (record) => { + this.setState({ + editItem: record + }) + + this.props.form.setFieldsValue({ + sql: record.sql + }) + } + + handleConfirm = () => { + const { type, scripts } = this.props + const { editItem, skip } = this.state + + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + this.props.form.validateFieldsAndScroll((err, values) => { + if (err) return + + if (!values.sql || /^[\s\n]+$/.test(values.sql)) { + notification.warning({ + top: 92, + message: '璇疯緭鍏ql!', + duration: 5 + }) + return + } + + values.uuid = editItem ? editItem.uuid : '' + + if (type === 'fullscreen' && editItem) { + values.status = editItem.status || 'true' + } + + let pass = checkSQL(values.sql, 'customscript') + + if (!pass) return + + let _scripts = fromJS(scripts).toJS() + + if (values.uuid) { + _scripts = _scripts.map(item => { + if (values.uuid === item.uuid) { + return values + } + return item + }) + } else { + values.uuid = Utils.getuuid() + + _scripts.push(values) + } + + if (skip) { + this.setState({ + skip: false, + editItem: null + }) + this.props.scriptsChange(_scripts, null, null, values) + this.props.form.setFieldsValue({ + sql: '' + }) + } else { + this.setState({loading: true}) + this.props.scriptsChange(_scripts, () => { + this.setState({ + loading: false, + editItem: null + }) + + this.props.form.setFieldsValue({ + sql: '' + }) + }, () => { + this.setState({loading: false}) + }, values) + } + }) + } + + handleCancel = () => { + this.setState({ + editItem: null + }) + + this.props.form.setFieldsValue({ + sql: '' + }) + } + + selectScript = (value, option) => { + let _sql = this.props.form.getFieldValue('sql') + if (/^\s+$/.test(_sql)) { + _sql = '' + } + if (_sql) { + _sql = _sql + ` + + ` + } + + _sql = _sql.replace(/\s{6}$/, '') + _sql = _sql + `/*${option.props.children}*/ + ` + _sql = _sql.replace(/\s{4}$/, '') + _sql = _sql + value + + this.props.form.setFieldsValue({ + sql: _sql + }) + } + + render() { + const { systemScripts, type } = this.props + const { usefulfields, editItem, skip } = this.state + const { getFieldDecorator } = this.props.form + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <Form {...formItemLayout} className="verify-form" id="verify-excelin-custom-scripts"> + <Row gutter={24}> + {!type ? <Col span={8}> + <Form.Item label="鎶ラ敊瀛楁" style={{margin: 0, whiteSpace: 'nowrap'}}> + errorcode锛堝鍔犲悗缂�NT琛ㄧず鏁版嵁涓嶅洖婊氾紝濡侲NT銆丯NT銆丗NT銆丯MNT銆丆NT銆�-2NT锛�, retmsg + </Form.Item> + </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, typename</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} + </Form.Item> + </Col> : null} + {!type ? <Col span={8}> + <Form.Item style={{marginBottom: 0}} label="蹇嵎娣诲姞"> + <Select + showSearch + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + onSelect={this.selectScript} + getPopupContainer={() => document.getElementById('verify-excelin-custom-scripts')} + > + <Select.Option key="debugger" value={`z_debug: select @ErrorCode='E',@retmsg='娴嬭瘯鏂偣' goto aaa`}> + 娴嬭瘯鏂偣 + </Select.Option> + {systemScripts.map((option, i) => + <Select.Option key={i} value={option.value}> + {option.name} + </Select.Option> + )} + </Select> + </Form.Item> + </Col> : null} + <Col span={5} className="add" style={{paddingTop: '2px', whiteSpace: 'nowrap'}}> + <Button onClick={this.handleConfirm} loading={this.state.loading} className="mk-green" style={{marginBottom: 15, marginLeft: 40}}> + {type === 'fullscreen' && !editItem ? '娣诲姞' : '淇濆瓨'} + </Button> + <Button onClick={this.handleCancel} style={{marginBottom: 15, marginLeft: 10}}> + 鍙栨秷 + </Button> + </Col> + <Col span={3} className="forced" style={{paddingTop: '12px', fontSize: '12px', whiteSpace: 'nowrap'}}> + 寮哄埗淇濆瓨锛� + <Switch checked={skip} size="small" onChange={() => this.setState({skip: !skip})}/> + </Col> + <Col span={24} className="sql"> + <Form.Item label="sql" required> + {getFieldDecorator('sql', { + initialValue: '' + })(<CodeMirror />)} + </Form.Item> + </Col> + </Row> + </Form> + ) + } +} + +export default Form.create()(CustomForm) \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.scss b/src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/verifypay/customscript/index.scss diff --git a/src/templates/sharecomponent/actioncomponent/verifypay/index.jsx b/src/templates/sharecomponent/actioncomponent/verifypay/index.jsx new file mode 100644 index 0000000..0aab183 --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/verifypay/index.jsx @@ -0,0 +1,516 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Form, Tabs, Row, Col, Button, Popconfirm, notification, Modal, message, InputNumber, Typography } from 'antd' +import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' +import moment from 'moment' + +import Api from '@/api' +import Utils from '@/utils/utils.js' + +import CustomScript from './customscript' +import asyncComponent from '@/utils/asyncComponent' +import MKEmitter from '@/utils/events.js' +import './index.scss' + +const { TabPane } = Tabs +const { confirm } = Modal +const { Paragraph } = Typography + +const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) +const FullScripts = asyncComponent(() => import('@/templates/zshare/verifycard/fullScripts')) + +class VerifyPay extends Component { + static propTpyes = { + columns: PropTypes.array, // 鏄剧ず鍒� + card: PropTypes.object, + } + + state = { + verify: null, + oriVerify: null, + defaultSql: '', + systemScripts: [], + scriptsColumns: [ + { + title: 'SQL', + dataIndex: 'sql', + width: '60%', + render: (text) => { + let title = text.match(/^\s*\/\*.+\*\//) + title = title && title[0] ? title[0] : '' + let _text = title ? text.replace(title, '') : text + + return ( + <div> + {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null} + <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph> + </div> + ) + } + }, + { + title: '鐘舵��', + dataIndex: 'status', + width: '10%', + render: (text, record) => record.status === 'false' ? + ( + <div style={{color: '#ff4d4f'}}> + 绂佺敤 + <StopOutlined style={{marginLeft: '5px'}} /> + </div> + ) : + ( + <div style={{color: '#26C281'}}> + 鍚敤 + <CheckCircleOutlined style={{marginLeft: '5px'}}/> + </div> + ) + }, + { + title: '鎿嶄綔', + align: 'center', + width: '140px', + dataIndex: 'operation', + render: (text, record) => + (<div style={{textAlign: 'center'}}> + <span className="operation-btn" title="缂栬緫" onClick={() => this.handleEdit(record)} style={{color: '#1890ff'}}><EditOutlined /></span> + <span className="operation-btn" title="鐘舵�佸垏鎹�" onClick={() => this.handleStatus(record)} style={{color: '#8E44AD'}}><SwapOutlined /></span> + <Popconfirm + overlayClassName="popover-confirm" + title="纭畾鍒犻櫎鍚�?" + onConfirm={() => this.handleDelete(record) + }> + <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span> + </Popconfirm> + </div>) + } + ] + } + + UNSAFE_componentWillMount() { + const { card, columns } = this.props + let _verify = fromJS(card.verify || {}).toJS() + + _verify.scripts = _verify.scripts || [] + + let sysfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'tbid', 'bid'] + let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(512)', '@mk_organization nvarchar(512)', '@mk_user_type nvarchar(20)', '@mk_nation nvarchar(50)', '@mk_province nvarchar(50)', '@mk_city nvarchar(50)', '@mk_district nvarchar(50)', '@mk_address nvarchar(100)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@bid nvarchar(50)', '@tbid nvarchar(50)'] + let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@mk_user_type=\'\'', '@mk_nation=\'\'', '@mk_province=\'\'', '@mk_city=\'\'', '@mk_district=\'\'', '@mk_address=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@bid=\'\''] + + sysfields = sysfields.map(field => field.toLowerCase()) + columns.forEach(_f => { + if (sysfields.includes(_f.field.toLowerCase())) return + + if (/decimal|int/ig.test(_f.datatype)) { + _select.push(`@${_f.field}=1`) + } else if (/date/ig.test(_f.datatype)) { + _select.push(`@${_f.field}='1949-10-01'`) + } else { + _select.push(`@${_f.field}=''`) + } + + _declare.push(`@${_f.field} ${_f.datatype}`) + }) + + let _sql = `Declare ${_declare.join(', ')} + Select ${_select.join(', ')} + ` + + this.setState({ + defaultSql: _sql, + verify: _verify, + oriVerify: fromJS(_verify).toJS() + }) + } + + componentDidMount () { + this.getsysScript() + } + + getsysScript = () => { + if (sessionStorage.getItem('mk_sys_scripts')) { + this.setState({ + systemScripts: JSON.parse(sessionStorage.getItem('mk_sys_scripts')) + }) + return + } + + let _scriptSql = `Select distinct func+Remark as funcname,longparam, s.Sort from聽 s_custom_script s inner join (select OpenID from sapp where ID=@Appkey@) p on s.openid = case when s.appkey='' then s.openid else p.OpenID end order by s.Sort` + + _scriptSql = Utils.formatOptions(_scriptSql, 'x') + + let _sParam = { + func: 'sPC_Get_SelectedList', + LText: _scriptSql, + obj_name: 'data', + arr_field: 'funcname,longparam', + exec_type: 'x' + } + + _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + _sParam.secretkey = Utils.encrypt('', _sParam.timestamp) + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getCloudConfig(_sParam).then(res => { + if (res.status) { + let _scripts = res.data.map(item => { + return { + name: item.funcname, + value: window.decodeURIComponent(window.atob(item.longparam)) + } + }) + + sessionStorage.setItem('mk_sys_scripts', JSON.stringify(_scripts)) + + this.setState({ + systemScripts: _scripts + }) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + }) + } + + scriptsChange = (scripts, resolve, reject, values) => { + const { card } = this.props + const { defaultSql } = this.state + + let verify = fromJS(this.state.verify).toJS() + verify.scripts = scripts + + let sql = defaultSql + + scripts.forEach(item => { + if (item.status === 'false') return + + sql += ` + ${item.sql} + ` + }) + + if (card.output) { + sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${card.output} as mk_b_id` + } else { + sql += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } + + sql = sql.replace(/@\$|\$@/ig, '') + sql = sql.replace(/@datam@/ig, `''`) + sql = sql.replace(/@typename@/ig, `'debug'`) + + if (resolve) { + Api.sDebug(sql).then(res => { + if (res.status || res.ErrCode === '-2') { + resolve() + values && MKEmitter.emit('editLineId', values.uuid) + + this.setState({ verify }) + } else { + reject() + + Modal.error({ + title: res.message + }) + } + }) + } else { + values && MKEmitter.emit('editLineId', values.uuid) + + this.setState({ verify }) + } + } + + handleDelete = (record) => { + const { verify } = this.state + + verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid) + + this.setState({ verify: verify }) + } + + handleEdit = (record) => { + this.scriptsForm.edit(record) + let node = document.getElementById('mk-pay-script') + + if (node && node.scrollTop) { + let inter = Math.ceil(node.scrollTop / 10) + + let timer = setInterval(() => { + if (node.scrollTop - inter > 0) { + node.scrollTop = node.scrollTop - inter + } else { + node.scrollTop = 0 + clearInterval(timer) + } + }, 10) + } + } + + handleStatus = (record) => { + let verify = fromJS(this.state.verify).toJS() + record.status = record.status === 'false' ? 'true' : 'false' + + verify.scripts = verify.scripts.map(item => { + if (item.uuid === record.uuid) { + return record + } else { + return item + } + }) + + this.setState({ + verify: verify + }) + } + + handleConfirm = () => { + const { verify } = this.state + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + if (verify.scripts.length === 0) { + notification.warning({ + top: 92, + message: '浣跨敤绯荤粺鍑芥暟锛岄渶瑕佹坊鍔犺嚜瀹氫箟鑴氭湰锛�', + duration: 5 + }) + return + } + + let _loading = false + if (this.scriptsForm && this.scriptsForm.state.editItem) { + _loading = true + } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) { + _loading = true + } + + if (_loading) { + confirm({ + content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋, + onOk() { + resolve(verify) + }, + onCancel() {} + }) + } else { + resolve(verify) + } + }) + } + + handleCancel = () => { + const { verify, oriVerify } = this.state + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + if (!is(fromJS(verify), fromJS(oriVerify))) { + confirm({ + content: '楠岃瘉淇℃伅宸蹭慨鏀癸紝纭畾鍙栨秷鍚楋紵', + onOk() { + resolve() + }, + onCancel() {} + }) + } else { + resolve() + } + }) + } + + showError = (errorType) => { + if (errorType === 'S') { + notification.success({ + top: 92, + message: '鎵ц鎴愬姛锛�', + duration: 2 + }) + } else if (errorType === 'Y') { + Modal.success({ + title: '鎵ц鎴愬姛锛�' + }) + } else if (errorType === 'F') { + notification.error({ + className: 'notification-custom-error', + top: 92, + message: '鎵ц澶辫触锛�', + duration: 10 + }) + } else if (errorType === 'N') { + notification.error({ + top: 92, + message: '鎵ц澶辫触锛�', + duration: 10 + }) + } else if (errorType === 'E') { + Modal.error({ + title: '鎵ц澶辫触锛�' + }) + } else if (errorType === 'NM') { + message.error('鎵ц澶辫触锛�') + } + } + + timeChange = (val, type) => { + const { verify } = this.state + + this.setState({ + verify: {...verify, [type]: val} + }) + } + + render() { + const { card, columns } = this.props + const { verify, scriptsColumns } = this.state + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <div> + {card.label ? <div className="mk-com-name">{card.label} - 楠岃瘉淇℃伅</div> : null} + <Tabs className="pay-verify-card-box"> + <TabPane tab={ + <span> + 鑷畾涔夎剼鏈� + {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null} + </span> + } key="scripts" id="mk-pay-script"> + <FullScripts + scripts={verify.scripts} + getScriptsFullForm={() => this.scriptsFullForm} + getScriptsForm={() => this.scriptsForm} + handleStatus={this.handleStatus} + handleDelete={this.handleDelete} + > + <CustomScript + type="fullscreen" + columns={columns} + scripts={verify.scripts} + systemScripts={this.state.systemScripts} + scriptsChange={this.scriptsChange} + wrappedComponentRef={(inst) => this.scriptsFullForm = inst} + /> + </FullScripts> + <CustomScript + columns={columns} + scripts={verify.scripts} + systemScripts={this.state.systemScripts} + scriptsChange={this.scriptsChange} + wrappedComponentRef={(inst) => this.scriptsForm = inst} + /> + <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/> + </TabPane> + <TabPane tab="淇℃伅鎻愮ず" key="tip"> + <Form {...formItemLayout}> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> S </span> + <Button onClick={() => {this.showError('S')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label="鍋滅暀鏃堕棿"> + <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> Y </span> + <Button onClick={() => {this.showError('Y')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> -1 </span> + 鎵ц鎴愬姛鏃犳彁绀恒�� + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> N </span> + <Button onClick={() => {this.showError('N')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label="鍋滅暀鏃堕棿"> + <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> F </span> + <Button onClick={() => {this.showError('F')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + <Col span={8}> + <Form.Item label="鍋滅暀鏃堕棿"> + <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} /> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> E </span> + <Button onClick={() => {this.showError('E')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> NM </span> + <Button onClick={() => {this.showError('NM')}} type="primary" size="small"> + 鏌ョ湅 + </Button> + </Form.Item> + </Col> + </Row> + <Row gutter={24}> + <Col offset={6} span={6}> + <Form.Item label="鎻愮ず缂栫爜"> + <span className="errorval"> -2 </span> + 鎵ц澶辫触鏃犳彁绀� + </Form.Item> + </Col> + </Row> + </Form> + </TabPane> + </Tabs> + </div> + ) + } +} + +export default Form.create()(VerifyPay) \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/verifypay/index.scss b/src/templates/sharecomponent/actioncomponent/verifypay/index.scss new file mode 100644 index 0000000..ad27818 --- /dev/null +++ b/src/templates/sharecomponent/actioncomponent/verifypay/index.scss @@ -0,0 +1,84 @@ +.pay-verify-card-box { + .ant-tabs-nav-scroll { + text-align: center; + } + .ant-tabs-content { + min-height: 40vh; + } + table tr td { + word-wrap: break-word; + word-break: break-word; + } + .count-tip { + position: absolute; + top: 0px; + color: #1890ff; + font-size: 12px; + } + .verify-form { + .sql { + .ant-col-sm-8 { + width: 10.5%; + } + .ant-col-sm-16 { + width: 89.5%; + padding-top: 4px; + } + .CodeMirror { + height: 350px; + } + } + .sqlfield { + .ant-form-item { + margin-bottom: 5px; + } + .ant-form-item-control { + line-height: 24px; + } + .ant-form-item-label { + line-height: 25px; + } + .ant-form-item-children { + line-height: 22px; + } + .ant-col-sm-8 { + width: 10.5%; + } + .ant-col-sm-16 { + width: 89.5%; + } + } + .ant-form-explain { + white-space: nowrap; + } + } + .errorval { + display: inline-block; + width: 30px; + } + .operation-btn { + display: inline-block; + font-size: 16px; + padding: 0 5px; + cursor: pointer; + } + .ant-tabs-tabpane { + position: relative; + .excel-col-add { + position: relative; + float: right; + right: -9px; + margin-right: 10px; + top: 10px; + z-index: 1; + } + } + .full-scripts { + position: absolute; + right: 24px; + top: 0px; + font-size: 16px; + color: #1890ff; + z-index: 1; + } +} \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 5e80f9d..c4af547 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -247,6 +247,8 @@ if (/decimal|int/ig.test(_f.datatype)) { _select.push(`@${_f.field}=1`) + } else if (/date/ig.test(_f.datatype)) { + _select.push(`@${_f.field}='1949-10-01'`) } else { _select.push(`@${_f.field}=''`) } diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 0979803..f093777 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -692,7 +692,7 @@ fields.push( <Col span={span} key={index}> <Form.Item className={className} extra={extra} label={item.tooltip ? - <Tooltip placement="topLeft" title={item.tooltip}> + <Tooltip placement="topLeft" title={<div onClick={(e) => e.stopPropagation()}>{item.tooltip}</div>}> <QuestionCircleOutlined className="mk-form-tip" /> {item.label} </Tooltip> : item.label diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx index d67515e..395564c 100644 --- a/src/templates/zshare/verifycard/baseform/index.jsx +++ b/src/templates/zshare/verifycard/baseform/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { fromJS } from 'immutable' -import { Form, Row, Col, Select, Radio, Tooltip, Input } from 'antd' +import { Form, Row, Col, Select, Radio, Tooltip, Input, message } from 'antd' import { QuestionCircleOutlined } from '@ant-design/icons' import Api from '@/api' @@ -25,61 +25,68 @@ state = { wxTemps: [], selectTemp: null, - miniTemps: [] + WXApps: null } componentDidMount() { - let wxTemps = sessionStorage.getItem('wxTemplates') + const { appType, verify } = this.props - if (window.GLOB.WXAppID && window.GLOB.nginx && !wxTemps) { - Api.wxAccessToken().then(res => { - let wxtoken = res.oa_access_token || '' - // let minitoken = res.mini_access_token || '' - - if (wxtoken) { - Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${wxtoken}`, 'get').then(res => { - let temps = [] - if (res.template_list) { - temps = res.template_list.filter(item => { - if (!item.primary_industry || sysTempsIds.includes(item.template_id)) return false - if (item.content) { - item.content = item.content.replace('{{first.DATA}}\n', '').replace('\n{{remark.DATA}}', '') - } + let appId = window.GLOB.WXAppID || '' - return true - }) - } - - sessionStorage.setItem('wxTemplates', JSON.stringify(temps)) - localStorage.setItem('wxTemplates', JSON.stringify(temps)) + if (window.GLOB.WXApps && !appType) { + let apps = window.GLOB.WXApps.filter(app => app.appType === 'public') - localStorage.removeItem('wxTemplates') + if (apps.length > 0) { + this.setState({WXApps: apps}) + } - this.resetTemps(temps) - }) - } else { - sessionStorage.setItem('wxTemplates', JSON.stringify([])) - localStorage.setItem('wxTemplates', JSON.stringify([])) + if (verify.wxAppId && apps.findIndex(item => item.appId === verify.wxAppId) > -1) { + appId = verify.wxAppId + } + } - localStorage.removeItem('wxTemplates') - } - // if (minitoken) { - // Api.wxNginxRequest(`wxaapi/newtmpl/gettemplate?access_token=${minitoken}`, 'get').then(res => { - // if (res.errmsg === 'ok' && res.data) { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify(res.data)) - // } else { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) - // } - // }) - // } else { - // sessionStorage.setItem('wxMiniTemplates', JSON.stringify([])) - // } - }) + let wxTemps = sessionStorage.getItem('wxTemplates' + appId) + + if (appId && window.GLOB.nginx && !wxTemps) { + if (verify.wxNote === 'true') { + this.getTemps(appId) + } } else if (wxTemps) { wxTemps = JSON.parse(wxTemps) this.resetTemps(wxTemps) + } else { + this.resetTemps([]) } + } + + getTemps = (appId) => { + Api.wxAccessToken(appId).then(res => { + if (res.status && res.access_token) { + Api.wxNginxRequest(`cgi-bin/template/get_all_private_template?access_token=${res.access_token}`, 'get').then(res => { + let temps = [] + if (res.template_list) { + temps = res.template_list.filter(item => { + if (!item.primary_industry || sysTempsIds.includes(item.template_id)) return false + if (item.content) { + item.content = item.content.replace('{{first.DATA}}\n', '').replace('\n{{remark.DATA}}', '') + } + + return true + }) + } else if (res.errcode && res.errmsg) { + message.warning(res.errcode + ': ' + res.errmsg) + } + + sessionStorage.setItem('wxTemplates' + appId, JSON.stringify(temps)) + + this.resetTemps(temps) + }) + } else { + message.warning(res.message || '寰俊鎺堟潈澶辫触锛�') + sessionStorage.setItem('wxTemplates' + appId, JSON.stringify([])) + } + }) } resetTemps = (wxTemps) => { @@ -102,14 +109,14 @@ content: '璁㈠崟绫诲瀷锛歿{keyword1.DATA}}\n璁㈠崟鍙凤細{{keyword2.DATA}}\n璁㈠崟鐘舵�侊細{{keyword3.DATA}}', example: '璁㈠崟绫诲瀷锛氶��绉熺敵璇穃r\n璁㈠崟鍙凤細TZ16101909\r\n璁㈠崟鐘舵�侊細寰呭彇璐�' }, - { - template_id: 'mk_category_temp', - title: '绫荤洰妯℃澘', - primary_industry: '', - deputy_industry: '', - content: '', - example: '' - } + // { + // template_id: 'mk_category_temp', + // title: '绫荤洰妯℃澘', + // primary_industry: '', + // deputy_industry: '', + // content: '', + // example: '' + // } ] let _wxTemps = [...wxTemps, ...sysTemps] @@ -181,6 +188,7 @@ delete _verify.pre_func } if (_verify.wxNote !== 'true') { + delete _verify.wxAppId delete _verify.wxTemplateId delete _verify.wxNoteLink delete _verify.wxNoteLinkUrl @@ -197,6 +205,18 @@ } this.props.onChange(_verify) + + if (key === 'wxNote' && value === 'true' && window.GLOB.WXAppID && window.GLOB.nginx) { + let wxTemps = sessionStorage.getItem('wxTemplates' + window.GLOB.WXAppID) + + if (wxTemps) { + wxTemps = JSON.parse(wxTemps) + + this.resetTemps(wxTemps) + } else { + this.getTemps(window.GLOB.WXAppID) + } + } } onNoteCodeChange = (val, option) => { @@ -262,6 +282,50 @@ this.props.onChange(_verify) } + onWxAppChange = (val) => { + const { verify } = this.props + + let _verify = {...verify, wxAppId: val, wxNote: 'false'} + + delete _verify.wxTemplateId + delete _verify.wxNoteLink + delete _verify.wxNoteLinkUrl + delete _verify.wxNoteMiniId + delete _verify.wxNoteLinkMenuId + delete _verify.wxNoteCallback + delete _verify.wxCustomTempId + + _verify.wxNoteKeys = null + + if (this.state.selectTemp) { + this.setState({selectTemp: null}) + } + + let _verify_ = fromJS(_verify).toJS() + _verify_.wxNote = 'true' + + this.props.onChange(_verify) + + setTimeout(() => { + this.props.onChange(_verify_) + + if (!window.GLOB.nginx) { + message.warning('nginx鏈嶅姟灏氭湭寮�鍚紝璇锋鏌ラ厤缃枃浠跺苟鍦ㄦ湇鍔″櫒涓畬鎴恘ginx璁剧疆銆�') + return + } + + let wxTemps = sessionStorage.getItem('wxTemplates' + val) + + if (wxTemps) { + wxTemps = JSON.parse(wxTemps) + + this.resetTemps(wxTemps) + } else { + this.getTemps(val) + } + }, 20) + } + onWxNoteKeyChange = (key, val) => { let _verify = fromJS(this.props.verify).toJS() @@ -300,7 +364,7 @@ render() { const { unionFields, verify, notes, emailCodes, card, appType, columns, fields } = this.props - const { wxTemps, selectTemp } = this.state + const { wxTemps, selectTemp, WXApps } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -636,7 +700,7 @@ <Col span={24}></Col> <Col span={8}> <Form.Item label={ - <Tooltip placement="bottomLeft" title={'璇峰湪鏈嶅姟鍣ㄥ畬鎴愬叕浼楀彿閰嶇疆銆�'}> + <Tooltip placement="bottomLeft" title="璇峰湪鏈嶅姟鍣ㄥ畬鎴愬叕浼楀彿閰嶇疆銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 鍏紬鍙锋秷鎭� </Tooltip> @@ -647,6 +711,22 @@ </Radio.Group> </Form.Item> </Col> + {verify.wxNote === 'true' && WXApps ? <Col span={8}> + <Form.Item label={ + <Tooltip placement="bottomLeft" title="璇烽�夋嫨鍙戦�佹秷鎭殑鍏紬鍙枫��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍏紬鍙� + </Tooltip> + } required> + <Select value={verify.wxAppId || window.GLOB.WXAppID} onSelect={this.onWxAppChange}> + {WXApps.map(option => + <Select.Option key={option.appId} value={option.appId}> + {option.appName} + </Select.Option> + )} + </Select> + </Form.Item> + </Col> : null} {verify.wxNote === 'true' ? <Col span={8}> <Form.Item label="娑堟伅妯℃澘" required> <Select value={verify.wxTemplateId} onSelect={this.onWxTemplateChange}> diff --git a/src/templates/zshare/verifycard/fullScripts/index.jsx b/src/templates/zshare/verifycard/fullScripts/index.jsx index 0fee3ee..b5433c1 100644 --- a/src/templates/zshare/verifycard/fullScripts/index.jsx +++ b/src/templates/zshare/verifycard/fullScripts/index.jsx @@ -69,7 +69,7 @@ position = <span style={{color: 'orange'}}>鍒濆鍖�</span> } else if (item.position === 'front') { position = <span style={{color: '#26C281'}}>sql鍓�</span> - } else { + } else if (item.position === 'back') { position = <span style={{color: '#1890ff'}}>sql鍚�</span> } diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 9e50ea7..0e90c0c 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -695,11 +695,19 @@ activeKey = 'cbScripts' } + let oriVerify = fromJS(_verify).toJS() + + if (_verify.wxAppId) { + if (!window.GLOB.WXApps || window.GLOB.WXApps.filter(app => app.appType === 'public').length === 0) { + delete _verify.wxAppId + } + } + this.setState({ activeKey: activeKey, verifyInter: verifyInter, verify: _verify, - oriVerify: fromJS(_verify).toJS() + oriVerify: oriVerify }) if (card.intertype === 'inner') return @@ -817,6 +825,8 @@ if (_f.datatype) { // 鑷畾涔夊瓧娈� if (/decimal|int/ig.test(_f.datatype)) { _select.push(`@${_f.field}=1`) + } else if (/date/ig.test(_f.datatype)) { + _select.push(`@${_f.field}='1949-10-01'`) } else { _select.push(`@${_f.field}=''`) } diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js index 1141a14..e546ebe 100644 --- a/src/utils/utils-custom.js +++ b/src/utils/utils-custom.js @@ -1842,21 +1842,27 @@ errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`}) } } else if (cell.intertype === 'custom' || cell.intertype === 'outer') { - if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || !cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { + if (cell.callbackType === 'script' && (!cell.verify || !cell.verify.cbScripts || cell.verify.cbScripts.filter(item => item.status !== 'false').length === 0)) { errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夎剼鏈洖璋冿紝鍥炶皟鑴氭湰涓嶅彲涓虹┖锛乣}) } else if (cell.procMode === 'system' && cell.Ot === 'notRequired' && cell.verify && cell.verify.voucher && cell.verify.voucher.enabled) { errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒`}) } } - } else if (cell.OpenType === 'funcbutton' && cell.funcType === 'print') { - if (!cell.verify || !cell.verify.printMode) { - errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濊瀹屽杽楠岃瘉淇℃伅锛乣}) - } else if (cell.intertype === 'system' && cell.verify.dataType === 'custom' && (!cell.verify.setting || cell.verify.columns.length === 0)) { - errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夋墦鍗版暟鎹紝璇疯缃暟鎹簮锛乣}) + } else if (cell.OpenType === 'funcbutton') { + if (cell.funcType === 'print') { + if (!cell.verify || !cell.verify.printMode) { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濊瀹屽杽楠岃瘉淇℃伅锛乣}) + } else if (cell.intertype === 'system' && cell.verify.dataType === 'custom' && (!cell.verify.setting || cell.verify.columns.length === 0)) { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅娇鐢ㄤ簡鑷畾涔夋墦鍗版暟鎹紝璇疯缃暟鎹簮锛乣}) + } + } else if ((cell.funcType === 'refund' || cell.funcType === 'pay') && cell.payMode === 'system' && (!cell.verify || !cell.verify.scripts || cell.verify.scripts.filter(item => item.status !== 'false').length === 0)) { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濋渶娣诲姞鑷畾涔夎剼鏈紒`}) } } else if (cell.OpenType === 'innerpage' || cell.OpenType === 'outerpage') { if (!cell.pageTemplate) { errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濋〉闈㈢被鍨嬭缃敊璇紒`}) + } else if (cell.pageTemplate === 'pay' && cell.payMode === 'system' && (!cell.verify || !cell.verify.scripts || cell.verify.scripts.filter(item => item.status !== 'false').length === 0)) { + errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濋渶娣诲姞鑷畾涔夎剼鏈紒`}) } } } diff --git a/src/views/appcheck/index.jsx b/src/views/appcheck/index.jsx index 3154996..0351a5a 100644 --- a/src/views/appcheck/index.jsx +++ b/src/views/appcheck/index.jsx @@ -84,6 +84,10 @@ } cell.copyright = _param.copyright || '' cell.logo = _param.logo || '' + cell.wxAppId = _param.wxAppId || '' + cell.wxAppName = _param.wxAppName || '' + cell.wxMerchId = _param.wxMerchId || '' + cell.wxMerchName = _param.wxMerchName || '' } return cell @@ -193,6 +197,10 @@ </Col> <Col span={12}> <div className="app-item"> + {item.wxAppName || item.wxMerchName ? <> + <div className="label">鍏宠仈搴旂敤:</div> + <div className="content">{`${item.wxAppName}${item.wxAppName && item.wxMerchName ? ' / ' + item.wxMerchName : item.wxMerchName || ''}`}</div> + </> : null} </div> </Col> <Col span={12}> @@ -238,7 +246,7 @@ </Col> </Row> <div className="action"> - <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> + <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}${item.wxAppId ? '/' + item.wxAppId : ''}` }}></Paragraph> </div> </div> ) diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index 21ccb4b..4cfee37 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -485,6 +485,10 @@ cell.share_des = _param.share_des || '' // 鍒嗕韩鎻忚堪 cell.share_url = _param.share_url || '' // 鍒嗕韩鍥剧墖 cell.share_link = _param.share_link || '' // 鍒嗕韩閾炬帴 + cell.wxAppId = _param.wxAppId || '' + cell.wxAppName = _param.wxAppName || '' + cell.wxMerchId = _param.wxMerchId || '' + cell.wxMerchName = _param.wxMerchName || '' if (cell.adapter && (cell.adapter === 'true' || cell.adapter === 'false')) { cell.adapter = '' @@ -672,7 +676,11 @@ }) // 瀛愬簲鐢↖D銆乼ypename銆佸簲鐢↖D銆丆loudUserID銆乤ppkey銆乴ogin_types(鏄惁闇�瑕佺櫥褰曪紝宸插純鐢�)銆乴ink_type(鏄惁浣跨敤鐭繛鎺ワ紝宸插純鐢�)銆乺ole_type(鏄惁浣跨敤瑙掕壊绠$悊)銆乴ang銆乧ss(鐨偆)銆乼itle(鏍囬)銆乫avicon(鍥炬爣)銆乽ser_binding(鐢ㄦ埛缁戝畾)銆乻ms_id(鐭俊妯℃澘ID)銆佽嚜瀹氫箟 - param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', topHeight: item.topHeight || '', sysBgColor: item.sysBgColor || '#ffffff', direction: item.direction || 'vertical', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`) + param.LText = sublist.map(item => { + let _par = this.getCusParam(item) + + return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}'` + }) param.LText = param.LText.join(' union all ') param.LText = Utils.formatOptions(param.LText, 'x') @@ -948,7 +956,11 @@ return item }) - param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', topHeight: item.topHeight || '', sysBgColor: item.sysBgColor || '#ffffff', direction: item.direction || 'vertical', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`) + param.LText = selectApp.sublist.map(item => { + let _par = this.getCusParam(item) + + return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}'` + }) param.LText = param.LText.join(' union all ') param.LText = Utils.formatOptions(param.LText, 'x') } @@ -985,6 +997,56 @@ }) }) }) + } + + getCusParam = (item) => { + let _par = { + sysBgColor: item.sysBgColor || '#ffffff' + } + if (item.userbind) { + _par.userbind = item.userbind + } + if (item.instantMessage) { + _par.instantMessage = item.instantMessage + } + if (item.apptype) { + _par.apptype = item.apptype + } + if (item.topHeight) { + _par.topHeight = item.topHeight + } + if (item.typename === 'pad') { + _par.direction = item.direction || 'vertical' + } + if (item.typename !== 'pc') { + _par.statusBarColor = item.statusBarColor || 'black' + _par.delay = item.delay || 0 + } + if (item.adapter) { + _par.adapter = item.adapter + } + if (item.share) { + _par.share = item.share + } + if (item.share_des) { + _par.share_des = item.share_des + } + if (item.share_url) { + _par.share_url = item.share_url + } + if (item.share_link) { + _par.share_link = item.share_link + } + if (item.wxAppId) { + _par.wxAppId = item.wxAppId + _par.wxAppName = item.wxAppName || item.wxAppId + } + if (item.wxMerchId) { + _par.wxMerchId = item.wxMerchId + _par.wxMerchName = item.wxMerchName || item.wxMerchId + } + + return _par } submitSubCard = () => { @@ -1041,7 +1103,11 @@ return item }) - param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify({userbind: item.userbind || '', instantMessage: item.instantMessage || '', apptype: item.apptype || '', delay: item.delay || 0, statusBarColor: item.statusBarColor || 'black', topHeight: item.topHeight || '', sysBgColor: item.sysBgColor || '#ffffff', direction: item.direction || 'vertical', adapter: item.adapter || '', share: item.share || '', share_des: item.share_des || '', share_url: item.share_url || '', share_link: item.share_link || ''})))}'`) + param.LText = sublist.map(item => { + let _par = this.getCusParam(item) + + return `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || 'false'}','','${window.btoa(window.encodeURIComponent(JSON.stringify(_par)))}'` + }) param.LText = param.LText.join(' union all ') param.LText = Utils.formatOptions(param.LText, 'x') @@ -1188,8 +1254,10 @@ </Col> <Col span={12}> <div className="app-item"> - {/* <div className="label">鐨偆:</div> - <div className="content" style={{color: color}}>{css}</div> */} + {item.wxAppName || item.wxMerchName ? <> + <div className="label">鍏宠仈搴旂敤:</div> + <div className="content">{`${item.wxAppName}${item.wxAppName && item.wxMerchName ? ' / ' + item.wxMerchName : item.wxMerchName || ''}`}</div> + </> : null} </div> </Col> <Col span={12}> @@ -1234,7 +1302,7 @@ <Button type="link" onClick={() => this.setState({ selectSubApp: item, subVisible: 'edit' })} style={{color: '#8E44AD'}}>淇敼</Button> <Button type="link" onClick={() => this.deleteSubApp(item)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button> <Button type="link" onClick={() => this.jumpApp(item)}>缂栬緫搴旂敤</Button> - <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}` }}></Paragraph> + <Paragraph style={{display: 'inline-block', margin: 0}} copyable={{ text: `${window.GLOB.baseurl}${item.typename === 'pad' ? 'mob' : item.typename}/index.html#/index/${this.state.selectApp.kei_no}/${item.typename !== 'pc' ? item.typename + '/' : ''}${item.lang}${item.wxAppId ? '/' + item.wxAppId : ''}` }}></Paragraph> </div> </div> ) diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx index de2a0a2..cef73e2 100644 --- a/src/views/appmanage/submutilform/index.jsx +++ b/src/views/appmanage/submutilform/index.jsx @@ -20,7 +20,9 @@ state = { typename: 'mob', adapters: [], - exts: [] + exts: [], + WXApps: null, + WXMerchs: null } UNSAFE_componentWillMount() { @@ -47,7 +49,22 @@ } } - this.setState({typename, adapters, exts, langs: _langs}) + let WXApps = null + let WXMerchs = null + if (window.GLOB.WXApps) { + WXApps = window.GLOB.WXApps.filter(app => app.appType === 'public') + + if (WXApps.length === 0) { + WXApps = null + } + WXMerchs = window.GLOB.WXApps.filter(app => app.appType === 'merchant') + + if (WXMerchs.length === 0) { + WXMerchs = null + } + } + + this.setState({typename, adapters, exts, langs: _langs, WXApps, WXMerchs}) } /** @@ -63,6 +80,14 @@ values.user_binding = values.exts.includes('user_binding') ? 'true' : 'false' values.share = values.exts.includes('share') ? 'true' : 'false' delete values.exts + } + if (values.wxAppId) { + let app = window.GLOB.WXApps.filter(app => app.appType === 'public' && values.wxAppId === app.appId)[0] + values.wxAppName = app ? app.appName : values.wxAppId + } + if (values.wxMerchId) { + let app = window.GLOB.WXApps.filter(app => app.appType === 'merchant' && values.wxMerchId === app.appId)[0] + values.wxMerchName = app ? app.appName : values.wxMerchId } resolve(values) @@ -89,7 +114,7 @@ render() { const { card, type } = this.props const { getFieldDecorator } = this.props.form - const { typename, adapters, exts, langs } = this.state + const { typename, adapters, exts, langs, WXApps, WXMerchs } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -178,6 +203,38 @@ )} </Form.Item> </Col> : null} + {WXApps ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ叕浼楀彿杩涜鏀粯銆侀��娆俱�佹巿鏉冪櫥褰曘��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍏宠仈搴旂敤 + </Tooltip> + }> + {getFieldDecorator('wxAppId', { + initialValue: card ? card.wxAppId : '' + })( + <Select allowClear> + {WXApps.map(item => <Select.Option key={item.appId} value={item.appId}>{item.appName}</Select.Option>)} + </Select> + )} + </Form.Item> + </Col> : null} + {WXMerchs ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鐢ㄦ埛鍙�氳繃姝ゅ晢鎴峰彿杩涜鏀粯鍙婇��娆俱��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鍏宠仈鍟嗘埛 + </Tooltip> + }> + {getFieldDecorator('wxMerchId', { + initialValue: card ? card.wxMerchId : '' + })( + <Select allowClear> + {WXMerchs.map(item => <Select.Option key={item.appId} value={item.appId}>{item.appName}</Select.Option>)} + </Select> + )} + </Form.Item> + </Col> : null} {typename !== 'pc' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={12}> <Form.Item label={ <Tooltip placement="topLeft" title="鍦ㄥ叕浼楀彿鎴栧皬绋嬪簭涓紝鍙坊鍔犵粦瀹氱郴缁熺敤鎴枫�佽嚜瀹氫箟鍒嗕韩绛夊姛鑳斤紝鑷畾涔夊垎浜缃悗锛屽綋鍓嶅瓙搴旂敤灏嗛粯璁や娇鐢ㄦ鍒嗕韩閾炬帴銆�"> diff --git a/src/views/appmanage/transmenu/index.jsx b/src/views/appmanage/transmenu/index.jsx index 101ddeb..52f0433 100644 --- a/src/views/appmanage/transmenu/index.jsx +++ b/src/views/appmanage/transmenu/index.jsx @@ -313,6 +313,8 @@ } } + delete config.tbkey + config.uuid = values.slice(0, 24) + tail config.MenuID = config.uuid config.open_edition = '' diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index e509575..1f934d5 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -344,10 +344,6 @@ window.addEventListener('storage', (e) => { if (e.key === 'menuUpdate') { this.reload() - } else if (e.key === 'wxTemplates') { - if (e.newValue) { - sessionStorage.setItem('wxTemplates', e.newValue) - } } }) MKEmitter.addListener('mkUpdateMenuList', this.reload) diff --git a/src/views/design/header/transmenu/index.jsx b/src/views/design/header/transmenu/index.jsx index 4a278f6..805f411 100644 --- a/src/views/design/header/transmenu/index.jsx +++ b/src/views/design/header/transmenu/index.jsx @@ -422,6 +422,8 @@ config.style = config.style || {} } + delete config.tbkey + config.enabled = false config.MenuName = menu.label config.fstMenuId = menu.fstMenuId || '' @@ -677,6 +679,8 @@ config.style = config.style || {} } + delete config.tbkey + config.enabled = false config.MenuNo = temp.PrintTempNO || '' config.MenuName = temp.PrintTempName || '' diff --git a/src/views/design/sidemenu/thdmenuplus/index.jsx b/src/views/design/sidemenu/thdmenuplus/index.jsx index a159c98..e657796 100644 --- a/src/views/design/sidemenu/thdmenuplus/index.jsx +++ b/src/views/design/sidemenu/thdmenuplus/index.jsx @@ -246,6 +246,8 @@ config.components = MenuUtils.resetConfig(config.components, commonId) config.enabled = false + + delete config.tbkey param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(config))) } diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index f453d28..703e194 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -98,7 +98,7 @@ sessionStorage.setItem('MenuType', param.MenuType || 'custom') - if (param.MenuType === 'billPrint' && param.lang) { + if (param.lang) { sessionStorage.setItem('lang', param.lang) } @@ -845,6 +845,8 @@ } else { let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) urlparam.type = 'admin' + urlparam.lang = sessionStorage.getItem('lang') + url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) config.tbkey = key } diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index 329ef36..00167e6 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -75,6 +75,7 @@ } else { sessionStorage.clear() this.props.history.replace('/login') + window.location.reload() } }) } @@ -102,6 +103,7 @@ sessionStorage.clear() sessionStorage.setItem('iframe', `/iframe/${menuId}/@loginuid@/${bid || ''}`) this.props.history.replace('/login') + window.location.reload() } }) } diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index dbf4105..d73400e 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -120,6 +120,10 @@ sessionStorage.removeItem('applangList') } + if (param.wxAppId) { + sessionStorage.setItem('wxAppId', param.wxAppId) + } + this.getAppMessage(param.MenuID) } else if (param.type === 'view') { window.GLOB.winWidth = 420 @@ -171,6 +175,11 @@ MKEmitter.addListener('changePopview', this.initPopview) MKEmitter.addListener('triggerMenuSave', this.submitConfig) MKEmitter.addListener('changeEditMenu', this.changeEditMenu) + + if (sessionStorage.getItem('wxAppId')) { + window.GLOB.WXAppID = sessionStorage.getItem('wxAppId') + } + setTimeout(() => { this.getRoleFields() setGLOBFuncs() @@ -1486,7 +1495,7 @@ typename: sessionStorage.getItem('typename') || '', adapter: sessionStorage.getItem('adapter') || '', sysBgColor: sessionStorage.getItem('sysBgColor') || '', - MenuName: config.MenuName || '', + MenuName: config.MenuName || '' } url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) diff --git a/src/views/pay/index.jsx b/src/views/pay/index.jsx index 788a5c5..c3c5575 100644 --- a/src/views/pay/index.jsx +++ b/src/views/pay/index.jsx @@ -17,54 +17,56 @@ state = { orderId: '', orderNo: '', - appid: '', - logo: '', - name: '', - copyRight: '', - icp: '', + logo: window.GLOB.doclogo || '', + name: sessionStorage.getItem('Full_Name') || '', + copyRight: window.GLOB.copyRight || '', + icp: window.GLOB.ICP || '', total: '', unit: '', qrcode: '', second: 60, overdue: false, - overdone: false + overdone: false, + appId: '', + merchId: '' } UNSAFE_componentWillMount () { - let _urlparam = window.decodeURIComponent(window.atob(this.props.match.params.param)) - let _params = {} - _urlparam.split('&').forEach(cell => { - let _cell = cell.split('=') - _params[_cell[0]] = _cell[1] - }) + let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) - if (!sessionStorage.getItem('LoginUID') && _params.LoginUID) { - sessionStorage.setItem('LoginUID', _params.LoginUID) - } - if (!sessionStorage.getItem('UserID') && _params.userid) { - sessionStorage.setItem('UserID', _params.userid) - } + let appId = param.appId || window.GLOB.WXAppID || window.GLOB.WXminiAppID || '' + let merchId = param.merchId || window.GLOB.WXMerchID || '' this.setState({ - orderId: _params.ID, - logo: _params.logo, - name: _params.name, - copyRight: _params.copyRight, - icp: _params.icp + orderId: param.ID, + appId: appId, + merchId: merchId }) - if (_params.ID) { - this.getOrder(_params.ID) - } else { + if (param.ID && appId && merchId) { + this.getOrder(param.ID, appId, merchId) + } else if (!param.ID) { notification.warning({ top: 92, message: '鏈幏鍙栧埌璁㈠崟ID锛�', duration: 5 }) + } else if (!appId) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌搴旂敤ID锛�', + duration: 5 + }) + } else if (!merchId) { + notification.warning({ + top: 92, + message: '鏈幏鍙栧埌鍟嗘埛鍙凤紒', + duration: 5 + }) } } - getOrder = (Id) => { + getOrder = (Id, appId, merchId) => { let param = { func: 's_get_weixin_pay_native', ID: Id @@ -85,7 +87,6 @@ } this.setState({ - appid: res.appid, orderNo: res.out_trade_no, total: _total, unit: res.amount && res.amount.currency === 'CNY' ? '鍏�' : '鍏�', @@ -114,19 +115,12 @@ duration: 5 }) return - } else if (!res.appid) { - notification.warning({ - top: 10, - message: '鏈幏鍙栧埌搴旂敤ID锛�', - duration: 5 - }) - return } - Api.getWxNativePay({ 'out_biz_no': res.out_trade_no, 'out_open_id': res.appid }).then(result => { - if (result.qrcode) { + Api.getWxNativePay({ 'out_biz_no': res.out_trade_no, app_id: appId, mchid: merchId }).then(result => { + if (result.status && result.code_url) { this.setState({ - qrcode: result.qrcode + qrcode: result.code_url }) setTimeout(this.resetSecond, 1000) } else { @@ -135,7 +129,7 @@ }) notification.warning({ top: 10, - message: result.msg || '鏈幏鍙栧埌鏀粯鐮侊紒', + message: result.message || '鏈幏鍙栧埌鏀粯鐮侊紒', duration: 5 }) } @@ -198,7 +192,7 @@ } resetQrcode = () => { - const { appid, orderNo } = this.state + const { orderNo, appId, merchId } = this.state if (!orderNo) { notification.warning({ @@ -207,12 +201,26 @@ duration: 5 }) return + } else if (!appId) { + notification.warning({ + top: 10, + message: '鏈幏鍙栧埌搴旂敤ID锛�', + duration: 5 + }) + return + } else if (!merchId) { + notification.warning({ + top: 10, + message: '鏈幏鍙栧埌鍟嗘埛鍙凤紒', + duration: 5 + }) + return } - Api.getWxNativePay({ 'out_biz_no': orderNo, 'out_open_id': appid }).then(result => { - if (result.qrcode) { + Api.getWxNativePay({ 'out_biz_no': orderNo, app_id: appId, mchid: merchId }).then(result => { + if (result.status && result.code_url) { this.setState({ - qrcode: result.qrcode, + qrcode: result.code_url, overdue: false, second: 60 }) @@ -220,16 +228,16 @@ } else { notification.warning({ top: 10, - message: result.msg || '鏈幏鍙栧埌鏀粯鐮侊紒', + message: result.message || '鏈幏鍙栧埌鏀粯鐮侊紒', duration: 5 }) } }) } - onChange = () => { + // onChange = () => { - } + // } render () { const { logo, name, orderNo, icp, copyRight, total, unit, qrcode, second, overdue, overdone } = this.state diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index b1abf07..d998c92 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -115,6 +115,10 @@ sessionStorage.removeItem('applangList') } + if (param.wxAppId) { + sessionStorage.setItem('wxAppId', param.wxAppId) + } + this.getAppMessage(param.MenuID) } else if (param.type === 'view') { this.setState({ @@ -152,6 +156,10 @@ MKEmitter.addListener('changeEditMenu', this.changeEditMenu) MKEmitter.addListener('triggerMenuSave', this.triggerMenuSave) + if (sessionStorage.getItem('wxAppId')) { + window.GLOB.WXAppID = sessionStorage.getItem('wxAppId') + } + setTimeout(() => { this.getRoleFields() setGLOBFuncs() diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 6dd9642..3fae1b5 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -88,6 +88,10 @@ try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + if (param.lang) { + sessionStorage.setItem('lang', param.lang) + } + this.setState({ MenuId: param.MenuID, ParentId: param.ParentId || '', @@ -589,6 +593,8 @@ let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) urlparam.type = 'admin' urlparam.MenuType = 'BaseTable' + urlparam.lang = sessionStorage.getItem('lang') + url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) config.tbkey = key } -- Gitblit v1.8.0