From 0647a7a6251c05466c2ea5c64878959da4b1b625 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 21 一月 2021 12:06:21 +0800 Subject: [PATCH] 增加check验证 --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 89 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 3cf59e8..3679856 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -40,7 +40,8 @@ confirmLoading: false, btnconfig: null, loading: false, - loadingNumber: '' + loadingNumber: '', + checkParam: null } shouldComponentUpdate (nextProps, nextState) { @@ -211,6 +212,7 @@ let param = { // 绯荤粺瀛樺偍杩囩▼ func: 'sPC_TableData_InUpDe' } + let check_param = null if (this.props.BID) { param.BID = this.props.BID @@ -244,6 +246,16 @@ param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) + + if (/\$check@|@check\$/ig.test(param.LText)) { + check_param = fromJS(param).toJS() + check_param.LText = check_param.LText.replace(/\$check@/ig, '/*') + check_param.LText = check_param.LText.replace(/@check\$/ig, '*/') + check_param.LText = Utils.formatOptions(check_param.LText) + + param.LText = param.LText.replace(/\$check@|@check\$/ig, '') + } + param.LText = Utils.formatOptions(param.LText) } } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 @@ -281,6 +293,16 @@ param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) + + if (/\$check@|@check\$/ig.test(param.LText)) { + check_param = fromJS(param).toJS() + check_param.LText = check_param.LText.replace(/\$check@/ig, '/*') + check_param.LText = check_param.LText.replace(/@check\$/ig, '*/') + check_param.LText = Utils.formatOptions(check_param.LText) + + param.LText = param.LText.replace(/\$check@|@check\$/ig, '') + } + param.LText = Utils.formatOptions(param.LText) } else if (btn.sql) { param.ID = primaryId @@ -296,12 +318,25 @@ param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) + + if (/\$check@|@check\$/ig.test(param.LText)) { + check_param = fromJS(param).toJS() + check_param.LText = check_param.LText.replace(/\$check@/ig, '/*') + check_param.LText = check_param.LText.replace(/@check\$/ig, '*/') + check_param.LText = Utils.formatOptions(check_param.LText) + + param.LText = param.LText.replace(/\$check@|@check\$/ig, '') + } + param.LText = Utils.formatOptions(param.LText) } } if (this.props.menuType === 'HS' && param.timestamp) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + if (check_param) { + check_param.open_key = Utils.encryptOpenKey(check_param.secretkey, check_param.timestamp) + } } else if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) @@ -310,6 +345,12 @@ if (param.func === 'sPC_TableData_InUpDe') { param.menuname = btn.logLabel + if (check_param) { + check_param.menuname = btn.logLabel + } + } + if (check_param) { + this.setState({checkParam: check_param}) } Api.genericInterface(param).then((res) => { @@ -360,6 +401,7 @@ } else { param.LText = param.LText.replace(/@\$|\$@/ig, '') } + param.LText = param.LText.replace(/\$check@|@check\$/ig, '') param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -396,6 +438,7 @@ } else { param.LText = param.LText.replace(/@\$|\$@/ig, '') } + param.LText = param.LText.replace(/\$check@|@check\$/ig, '') param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -411,6 +454,7 @@ } else { param.LText = param.LText.replace(/@\$|\$@/ig, '') } + param.LText = param.LText.replace(/\$check@|@check\$/ig, '') param.exec_type = 'y' // 鍚庡彴瑙g爜 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') @@ -872,11 +916,52 @@ } else if (res.ErrCode === 'NM') { message.error(res.message || res.ErrMesg) } - + this.setState({ loading: false }) + if (res.ErrCode === 'C') { + const _this = this + if (this.state.checkParam) { + let param = this.state.checkParam + confirm({ + title: res.message || res.ErrMesg, + onOk() { + return new Promise(resolve => { + Api.genericInterface(param).then((result) => { + if (result.status) { + _this.execSuccess(result) + } else { + _this.execError(result) + } + resolve() + }, () => { + _this.setState({ + visible: false + }) + resolve() + }) + }) + }, + onCancel() { + _this.setState({ + visible: false + }) + if (btn.execError !== 'never') { + MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) + } + } + }) + this.setState({checkParam: null}) + return + } else { + Modal.error({ + title: res.message || res.ErrMesg, + }) + } + } + if (btn.execError !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn) } -- Gitblit v1.8.0