From 76427d51a079a5fd1f45bf7188249e7a4647ae05 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 14 九月 2020 10:37:25 +0800 Subject: [PATCH] 2020-09-14 --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 164 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 121 insertions(+), 43 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 5dc56c7..027b704 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -25,7 +25,7 @@ Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� MenuID: PropTypes.string, // 鑿滃崟ID btn: PropTypes.object, // 鎸夐挳 - columns: PropTypes.array, // 瀛楁鍒� + columns: PropTypes.any, // 瀛楁鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� updateStatus: PropTypes.func, // 鎸夐挳鐘舵�佹洿鏂� @@ -79,7 +79,7 @@ */ actionTrigger = (record) => { const { setting, Tab, BID, btn, selectedData } = this.props - console.log(selectedData) + if (Tab && Tab.supMenu && !BID) { notification.warning({ top: 92, @@ -126,12 +126,12 @@ // 鏁版嵁閫夋嫨绫诲瀷鏍¢獙 this.actionSettingError() return - } else if (btn.intertype === 'inner') { - // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鍐呴儴鍑芥暟鍜屾暟鎹簮涓嶅彲鍚屾椂涓虹┖, 浣跨敤绯荤粺鍑芥暟鏃讹紝绫诲瀷涓嶅彲涓虹┖ - if (!btn.innerFunc && (!btn.sql || (btn.sql && !btn.sqlType))) { + } else if (btn.intertype === 'system') { + // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鎿嶄綔绫诲瀷鍜屾暟鎹簮涓嶅彲涓虹┖ + if (!btn.sql || !btn.sqlType) { this.actionSettingError() return - } else if (data.length === 0 && !btn.innerFunc && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { + } else if (data.length === 0 && btn.verify && btn.verify.voucher && btn.verify.voucher.enabled) { notification.warning({ top: 92, message: '浣跨敤鍒涘缓鍑瘉鍑芥暟锛岄渶瑕侀�夋嫨琛岋紒', @@ -139,13 +139,19 @@ }) return } - } else if (btn.intertype === 'outer') { - // 鎺ュ彛鍦板潃涓嶅瓨鍦ㄦ椂鎶ラ敊 - if (!btn.interface) { + } else if (btn.intertype === 'inner') { + // 浣跨敤鍐呴儴鎺ュ彛鏃讹紝鍐呴儴鍑芥暟涓嶅彲涓虹┖ + if (!btn.innerFunc) { this.actionSettingError() return } - } else if (!['inner', 'outer'].includes(btn.intertype)) { + } else if (btn.intertype === 'outer') { + // 鎺ュ彛鍦板潃涓嶅瓨鍦ㄦ椂鎶ラ敊 + if (!btn.interface && btn.sysInterface !== 'true') { + this.actionSettingError() + return + } + } else if (!['inner', 'outer', 'system'].includes(btn.intertype)) { // 鎺ュ彛绫诲瀷閿欒 this.actionSettingError() return @@ -182,7 +188,7 @@ */ execSubmit = (data, _resolve, formdata) => { const { setting, columns, btn } = this.props - if (btn.intertype === 'inner') { + if (btn.intertype === 'inner' || btn.intertype === 'system') { // 鎵ц鏂瑰紡涓哄琛屾嫾鎺ワ紝涓旀墦寮�鏂瑰紡涓鸿〃鍗曟椂锛屼細杞负寰幆鍙戦�佽姹� // 鎵撳紑鏂瑰紡涓烘ā鎬佹锛屼娇鐢ㄥ唴閮ㄥ嚱鏁版坊鍔�(鏈夋壒閲忔坊鍔犲満鏅紝宸插幓闄�) if ( @@ -223,8 +229,13 @@ param.LText = param.LText.replace(/@\$|\$@/ig, '') } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) + + param.LText2 = LText2 + param.LText1 = LText1 + param.LText = LText + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) } } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 @@ -259,8 +270,13 @@ param.LText = param.LText.replace(/@\$|\$@/ig, '') } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) + + param.LText2 = LText2 + param.LText1 = LText1 + param.LText = LText + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) } else if (btn.sql) { param.ID = primaryId @@ -272,11 +288,24 @@ } else { param.LText = param.LText.replace(/@\$|\$@/ig, '') } + + let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) + + param.LText2 = LText2 + param.LText1 = LText1 + param.LText = LText - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) } + } + + if (this.props.menuType === 'HS' && param.timestamp) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, 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) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { @@ -328,8 +357,12 @@ param.LText = param.LText.replace(/@\$|\$@/ig, '') } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) + + param.LText2 = LText2 + param.LText1 = LText1 + param.LText = LText + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) } } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 @@ -363,8 +396,13 @@ param.LText = param.LText.replace(/@\$|\$@/ig, '') } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) + + param.LText2 = LText2 + param.LText1 = LText1 + param.LText = LText + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) } else if (btn.sql) { param.ID = primaryId @@ -377,10 +415,23 @@ param.LText = param.LText.replace(/@\$|\$@/ig, '') } - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' + let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText) + + param.LText2 = LText2 + param.LText1 = LText1 + param.LText = LText + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt(param.LText, param.timestamp) } + } + + if (this.props.menuType === 'HS' && param.timestamp) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, 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) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param @@ -531,6 +582,14 @@ // 鍐呴儴璇锋眰 if (btn.innerFunc) { param.func = btn.innerFunc + + // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) + } + // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞� Api.genericInterface(param).then(res => { if (res.status) { @@ -563,11 +622,21 @@ // 澶栭儴璇锋眰 _outParam = JSON.parse(JSON.stringify(res)) + if (btn.outerFunc) { + res.func = btn.outerFunc + } if (this.props.menuType === 'HS') { if (btn.sysInterface === 'true' && options.cloudServiceApi) { res.rduri = options.cloudServiceApi } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface + } + + // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (res.func === 's_sDataDictb_TBBack' && res.LTextOut) { + res.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + res.secretkey = Utils.encrypt(res.LTextOut, res.timestamp) + res.open_key = Utils.encryptOpenKey(res.secretkey, res.timestamp) } } else { if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { @@ -575,10 +644,6 @@ } else if (btn.sysInterface !== 'true') { res.rduri = btn.interface } - } - - if (btn.outerFunc) { - res.func = btn.outerFunc } return Api.genericInterface(res) @@ -593,6 +658,14 @@ response.func = btn.callbackFunc let _callbackparam = {..._outParam, ...response} + + // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (this.props.menuType === 'HS' && _callbackparam.func === 's_sDataDictb_TBBack' && _callbackparam.LTextOut) { + _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp) + _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) + } + return Api.genericInterface(_callbackparam) } else { if (response.status) { @@ -673,6 +746,7 @@ */ execError = (res) => { const { btn } = this.props + const { btnconfig } = this.state if (res.ErrCode === 'E') { Modal.error({ @@ -694,9 +768,9 @@ } else if (res.ErrCode === 'NM') { message.error(res.message || res.ErrMesg) } - + let _unclose = false - if (btn.OpenType === 'pop') { + if (btn.OpenType === 'pop' && btnconfig && btnconfig.setting.display !== 'prompt') { _unclose = true } else { this.setState({ @@ -734,7 +808,7 @@ }) } } else { - Api.getSystemCacheConfig({ + Api.getCacheConfig({ func: 'sPC_Get_LongParam', MenuID: btn.uuid }).then(res => { @@ -766,8 +840,8 @@ } else { if (_LongParam.groups.length > 0) { _LongParam.groups.forEach(group => { - group.sublist = group.sublist.filter(cell => { - // 鏁版嵁婧恠ql璇彞锛岄澶勭悊 + group.sublist = group.sublist.map(cell => { + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛� 鏉冮檺榛戝悕鍗曞瓧娈佃缃负闅愯棌琛ㄥ崟 if (['select', 'link', 'multiselect'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) @@ -779,26 +853,27 @@ } cell.data_sql = Utils.formatOptions(_option.sql) + cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) cell.arr_field = _option.field } // 瀛楁鏉冮檺榛戝悕鍗� - if (!cell.blacklist || cell.blacklist.length === 0) return true + if (!cell.blacklist || cell.blacklist.length === 0) return cell let _black = cell.blacklist.filter(v => { return this.props.permRoles.indexOf(v) !== -1 }) if (_black.length > 0) { - return false - } else { - return true + cell.hidden = 'true' } + + return cell }) }) } else { - _LongParam.fields = _LongParam.fields.filter(cell => { - // 鏁版嵁婧恠ql璇彞锛岄澶勭悊 + _LongParam.fields = _LongParam.fields.map(cell => { + // 鏁版嵁婧恠ql璇彞锛岄澶勭悊锛屾潈闄愰粦鍚嶅崟瀛楁璁剧疆涓洪殣钘忚〃鍗� if (['select', 'link', 'multiselect'].includes(cell.type) && cell.resourceType === '1') { let _option = Utils.getSelectQueryOptions(cell) @@ -810,21 +885,22 @@ } cell.data_sql = Utils.formatOptions(_option.sql) + cell.base_sql = window.btoa(window.encodeURIComponent(_option.sql)) cell.arr_field = _option.field } // 瀛楁鏉冮檺榛戝悕鍗� - if (!cell.blacklist || cell.blacklist.length === 0) return true + if (!cell.blacklist || cell.blacklist.length === 0) return cell let _black = cell.blacklist.filter(v => { return this.props.permRoles.indexOf(v) !== -1 }) if (_black.length > 0) { - return false - } else { - return true + cell.hidden = 'true' } + + return cell }) } @@ -973,8 +1049,9 @@ destroyOnClose > <MutilForm - dict={this.state.dict} BID={BID} + dict={this.state.dict} + menuType={this.props.menuType} action={btnconfig} inputSubmit={this.handleOk} data={this.state.tabledata[0]} @@ -1000,6 +1077,7 @@ {show === 'icon' ? <Button className="action-cell" icon={btn.icon || 'dash'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} {show === 'text' ? <Button className="action-cell" loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} {show === 'all' ? <Button className="action-cell" icon={btn.icon || ''} loading={loading} onClick={() => {this.actionTrigger()}}>{btn.label}</Button> : null} + {show && show.indexOf('plus') > -1 ? <Button className="action-cell" style={{fontSize: show.substring(4) + 'px'}} icon={btn.icon || 'plus'} loading={loading} onClick={() => {this.actionTrigger()}}></Button> : null} {this.getModels()} </div> ) -- Gitblit v1.8.0