From 3c50bfdd8d605b3dd449adcb54cdf7f7c25d6c16 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 04 十一月 2022 15:46:05 +0800 Subject: [PATCH] 2022-11-04 --- src/tabviews/zshare/actionList/normalbutton/index.jsx | 538 +++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 376 insertions(+), 162 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 53d9a8b..b1d4898 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -24,11 +24,9 @@ BData: PropTypes.any, // 涓昏〃鏁版嵁 style: PropTypes.any, // 鎸夐挳鏍峰紡 selectedData: PropTypes.any, // 瀛愯〃涓�夋嫨鏁版嵁 - Tab: PropTypes.any, // 濡傛灉褰撳墠鍏冪礌涓烘爣绛炬椂锛宼ab涓烘爣绛句俊鎭� btn: PropTypes.object, // 鎸夐挳 columns: PropTypes.any, // 瀛楁鍒� setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 - ContainerId: PropTypes.any, // tab椤甸潰ID锛岀敤浜庡脊绐楁帶鍒� disabled: PropTypes.any, // 琛屾寜閽鐢� } @@ -100,7 +98,6 @@ if (btn.OpenType === 'formSubmit') { MKEmitter.addListener('triggerFormSubmit', this.actionSubmit) } - MKEmitter.addListener('returnModuleParam', this.resetModuleParam) if (btn.autoMatic) { MKEmitter.addListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit) @@ -156,7 +153,6 @@ } MKEmitter.removeListener('triggerBtnId', this.actionTrigger) MKEmitter.removeListener('triggerFormSubmit', this.actionSubmit) - MKEmitter.removeListener('returnModuleParam', this.resetModuleParam) MKEmitter.removeListener('triggerBtnPopSubmit', this.triggerBtnPopSubmit) } @@ -204,14 +200,6 @@ this.execSubmit(data, () => {}, res.form) } - resetModuleParam = (menuId, btnId, param) => { - const { btn } = this.props - - if (btn.$menuId !== menuId || btn.uuid !== btnId || !param) return - - this.moduleParams = param - } - /** * @description 鎸夐挳鐘舵�佹敼鍙� */ @@ -227,13 +215,13 @@ * @description 瑙﹀彂鎸夐挳鎿嶄綔 */ actionTrigger = (triggerId, record, type) => { - const { Tab, BID, btn, selectedData, setting } = this.props + const { BID, btn, selectedData, setting } = this.props const { loading, disabled } = this.state if (loading || disabled) return if (triggerId && btn.uuid !== triggerId) return - if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { + if (setting.supModule && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', @@ -248,7 +236,7 @@ let _this = this let data = record || selectedData || [] - + if (btn.Ot !== 'notRequired' && data.length === 0) { // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� notification.warning({ @@ -386,7 +374,6 @@ let item = { type: type, - readonly: false, readin: true, writein: true, fieldlen: fieldlen, @@ -433,11 +420,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, this.props.Tab, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -478,11 +465,11 @@ param.ID = primaryId || Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -513,11 +500,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -565,6 +552,10 @@ this.setState({checkParam: check_param}) } + if (window.GLOB.breakpoint) { + param.func = 'sPC_TableData_InUpDe_debug' + } + _params.push(param) } else if (btn.Ot === 'required') { _params = data.map((cell, index) => { @@ -582,11 +573,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, this.props.Tab, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, '', param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, '', param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -606,9 +597,13 @@ param.LText = Utils.formatOptions(param.LText) } else if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (index !== 0) { + let _cell = {} + Object.keys(cell).forEach(key => { + _cell[key.toLowerCase()] = cell[key] + }) formdata = formdata.map(_data => { - if (_data.readin && cell.hasOwnProperty(_data.key)) { - _data.value = cell[_data.key] + if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { + _data.value = _cell[_data.key.toLowerCase()] } return _data }) @@ -618,11 +613,11 @@ param.ID = Utils.getguid() if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -644,11 +639,11 @@ param.ID = primaryId if (retmsg) { - const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + const { sql, callbacksql } = getSysDefaultSql(btn, setting, formdata, param, cell, columns, retmsg, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� param.LText = sql param.$callbacksql = callbacksql } else { - param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� + param.LText = getSysDefaultSql(btn, setting, formdata, param, cell, columns, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧� if (btn.output) { param.key_back_type = 'Y' } @@ -676,6 +671,10 @@ param.menuname = btn.logLabel if (window.GLOB.probation) { param.s_debug_type = 'Y' + } + + if (window.GLOB.breakpoint) { + param.func = 'sPC_TableData_InUpDe_debug' } return param @@ -716,14 +715,14 @@ }) } - if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 鍑芥暟 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) } if (retmsg) { - param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns) + param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, primaryId, this.props.BID) } _params.push(param) @@ -741,9 +740,13 @@ if (btn.OpenType === 'pop') { // 琛ㄥ崟 if (index !== 0) { + let _cell = {} + Object.keys(cell).forEach(key => { + _cell[key.toLowerCase()] = cell[key] + }) formdata = formdata.map(_data => { - if (_data.readin && cell.hasOwnProperty(_data.key)) { - _data.value = cell[_data.key] + if (_data.readin && _cell.hasOwnProperty(_data.key.toLowerCase())) { + _data.value = _cell[_data.key.toLowerCase()] } return _data }) @@ -757,14 +760,14 @@ param[setting.primaryKey] = primaryId } - if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + if (window.GLOB.mkHS && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // special 鍑芥暟 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) } if (retmsg) { - param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns) + param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, primaryId, this.props.BID) } return param @@ -777,7 +780,7 @@ /** * @description 鑾峰彇鍥炶皟鑴氭湰鐨勫瓧娈靛畾涔� */ - getSysDeclareSql = (btn, formdata, data, columns) => { + getSysDeclareSql = (btn, formdata, data, columns, primaryId, BID = '') => { let datavars = {} // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪 // 闇�瑕佸0鏄庣殑鍙橀噺闆� let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid'] @@ -800,14 +803,11 @@ if (form.type === 'number' || form.type === 'rate') { let val = form.value - if (typeof(val) !== 'number') { - val = parseFloat(val) - if (isNaN(val)) { - val = 0 - } + if (isNaN(val)) { + val = 0 } _initFormfields.push(`@${_key}=${val}`) - } else if (['date', 'datemonth', 'datetime'].includes(form.type)) { + } else if (['date', 'datemonth'].includes(form.type)) { _initFormfields.push(`@${_key}='${form.value || '1949-10-01'}'`) } else { _initFormfields.push(`@${_key}='${form.value}'`) @@ -842,7 +842,7 @@ } // 娣诲姞鏁版嵁涓瓧娈碉紝琛ㄥ崟鍊间紭鍏�(鎸夐挳涓嶉�夎鎴栧琛屾嫾鎺ユ椂璺宠繃) - if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce') { + if (data && btn.Ot !== 'notRequired' && btn.Ot !== 'requiredOnce' && columns && columns.length > 0) { datavars = {...data, ...datavars} const setField = (col) => { @@ -884,17 +884,15 @@ } } - if (columns && columns.length > 0) { - columns.forEach(col => { - if (col.type === 'colspan' || col.type === 'old_colspan') { - col.subcols.forEach(cell => { - setField(cell) - }) - } else { - setField(col) - } - }) - } + columns.forEach(col => { + if (col.type === 'colspan' || col.type === 'old_colspan') { + col.subcols.forEach(cell => { + setField(cell) + }) + } else { + setField(col) + } + }) } // 鍙橀噺澹版槑 @@ -903,7 +901,7 @@ _declarefields = ',' + _declarefields } _sql = `/* 绯荤粺鐢熸垚 */ - Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(50),@mk_organization nvarchar(50),@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)${_declarefields} + Declare @tbid nvarchar(50),@ErrorCode nvarchar(50),@retmsg nvarchar(4000),@BillCode nvarchar(50),@BVoucher nvarchar(50),@FIBVoucherDate nvarchar(50), @FiYear nvarchar(50),@ModularDetailCode nvarchar(50), @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)${_declarefields} ` let userName = sessionStorage.getItem('User_Name') || '' @@ -926,7 +924,7 @@ // 鍒濆鍖栧嚟璇佸強鐢ㄦ埛淇℃伅瀛楁 _sql += ` /* 鍑瘉鍙婄敤鎴蜂俊鎭垵濮嬪寲璧嬪�� */ - select @BVoucher='',@FIBVoucherDate='',@FiYear='',@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}', @BillCode='', @ModularDetailCode='' + select @BVoucher='',@FIBVoucherDate='',@FiYear='',@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}', @BillCode='', @ModularDetailCode='' ` // 琛ㄥ崟鍙橀噺璧嬪�� @@ -944,6 +942,13 @@ ` } + _sql = _sql.replace(/@ID@/ig, `'${primaryId || ''}'`) + _sql = _sql.replace(/@BID@/ig, `'${BID}'`) + _sql = _sql.replace(/@LoginUID@/ig, `'${sessionStorage.getItem('LoginUID') || ''}'`) + _sql = _sql.replace(/@SessionUid@/ig, `'${localStorage.getItem('SessionUid') || ''}'`) + _sql = _sql.replace(/@UserID@/ig, `'${sessionStorage.getItem('UserID') || ''}'`) + _sql = _sql.replace(/@Appkey@/ig, `'${window.GLOB.appkey || ''}'`) + return _sql } @@ -959,25 +964,19 @@ btn.sqlType !== 'insert' && btn.Ot !== 'notRequired' && btn.verify && btn.verify.invalid === 'true' && setting.dataresource ) { - MKEmitter.emit('queryModuleParam', btn.$menuId, btn.uuid) - setTimeout(() => { - if (this.moduleParams) { - this.execRealSubmit(data, _resolve, formdata) - } else { - setTimeout(() => { - this.execRealSubmit(data, _resolve, formdata) - }, 100) - } - }, 50) + MKEmitter.emit('queryModuleParam', btn.$menuId, (param) => { + this.moduleParams = param + this.execRealSubmit(data, _resolve, formdata) + }) } else { this.execRealSubmit(data, _resolve, formdata) } } execRealSubmit = (data, _resolve, formdata) => { - const { setting, btn, Tab, BID } = this.props + const { setting, btn, BID } = this.props - if (((Tab && Tab.supMenu) || setting.supModule) && !BID) { + if (setting.supModule && !BID) { notification.warning({ top: 92, message: '闇�瑕佷笂绾т富閿�硷紒', @@ -1227,8 +1226,24 @@ const { btn } = this.props let param = null + let callback = result.mk_ex_invoke - if (btn.callbackType === 'script' || btn.callbackType === 'default') { + delete result.mk_ex_invoke + + if (callback === 'false' || callback === false) { + if (result.status) { + if (params.length === 0) { + this.execSuccess(result) + _resolve() + } else { + this.customLoopRequest(params, _resolve) + } + } else { + this.execError(result) + _resolve() + } + return + } else if (btn.callbackType === 'script' || btn.callbackType === 'default') { param = this.getCallBackSql(result, record) } else if (btn.callbackType === 'func') { param = { @@ -1265,6 +1280,10 @@ } return + } + + if (param.menuname) { + param.menuname = param.menuname + '(鍥炶皟)' } Api.genericInterface(param).then(res => { @@ -1394,8 +1413,13 @@ } }) - _backCustomScript += ` - aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + if (btn.output) { + _backCustomScript += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg,${btn.output} as mk_b_id` + } else { + _backCustomScript += ` + aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` + } let sql = [...lineMap.values()].map(item => (` ${item.insert} @@ -1560,6 +1584,11 @@ res.BID = this.props.BID } + if (res.mk_api_key) { + record.mk_api_key = res.mk_api_key + } + delete res.mk_api_key + this.outerOuterRequest(params, res, record, _resolve) } } else { @@ -1580,8 +1609,14 @@ result.func = btn.outerFunc } if (window.GLOB.mkHS) { - if (btn.sysInterface === 'true' && options.cloudServiceApi) { + if (btn.outerFunc === 's_app_version_upt') { // special 鏇存柊鐗堟湰鍙锋椂璁块棶sso + if (window.GLOB.mainSystemApi) { + result.rduri = window.GLOB.mainSystemApi + } + } else if (btn.sysInterface === 'true' && options.cloudServiceApi) { result.rduri = options.cloudServiceApi + result.userid = sessionStorage.getItem('CloudUserID') || '' + result.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' } else if (btn.sysInterface !== 'true') { if (window.GLOB.systemType === 'production' && btn.proInterface) { result.rduri = btn.proInterface @@ -1590,7 +1625,7 @@ } } - // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 if (result.func === 's_sDataDictb_TBBack' && result.LTextOut) { result.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') result.secretkey = Utils.encrypt(result.LTextOut, result.timestamp) @@ -1605,10 +1640,16 @@ } else { result.rduri = btn.interface } + + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (result.rduri.indexOf(host) === -1 && /\/dostars/.test(result.rduri)) { + result.$login = true + } } } Api.genericInterface(result).then(res => { + if (!res) return // LoginError鏃朵腑鏂姹� this.outerCallbackRequest(params, res, record, outParam, _resolve) }, () => { this.outerCallbackRequest(params, {status: false, message: 500, ErrCode: 'E', ErrMesg: 500}, record, outParam, _resolve) @@ -1623,7 +1664,36 @@ let param = null - if (btn.callbackType === 'script' || btn.callbackType === 'default') { + if (record.mk_api_key) { + result.mk_api_key = record.mk_api_key + } + + let callback = result.mk_ex_invoke + + delete result.mk_ex_invoke + + if (callback === 'false' || callback === false) { + if (result.status) { + if (params.length === 0) { + this.execSuccess(result) + _resolve() + } else { + this.outerLoopRequest(params, _resolve) + } + } else { + this.execError(result) + _resolve() + } + return + } else if (window.GLOB.mkHS && btn.outerFunc === 's_get_sVersionDetail_Ltext' && btn.callbackFunc) { // special 鐗堟湰鍗囩骇鍥炶皟澶勭悊 + if (result.status) { + this.verupRequest(params, result, outParam, _resolve) + } else { + this.execError(result) + _resolve() + } + return + } else if (btn.callbackType === 'script' || btn.callbackType === 'default') { param = this.getCallBackSql(result, record) } else if (btn.callbackType === 'func' || btn.callbackFunc) { delete result.message @@ -1635,7 +1705,7 @@ func: btn.callbackFunc } - // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 + // special 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 if (window.GLOB.mkHS && 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) @@ -1657,6 +1727,10 @@ return } + if (param.menuname) { + param.menuname = param.menuname + '(鍥炶皟)' + } + Api.genericInterface(param).then(res => { if (res.status) { // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹� @@ -1671,6 +1745,71 @@ _resolve() } }) + } + + verupRequest = (params, result, outParam, _resolve) => { + const { btn } = this.props + + delete result.message + delete result.status + + result.func = btn.callbackFunc + + let ssoParam = null + let callParam = {...outParam, ...result} + + if (callParam.LTextOut) { + callParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + callParam.secretkey = Utils.encrypt(callParam.LTextOut, callParam.timestamp) + callParam.open_key = Utils.encryptOpenKey(callParam.secretkey, callParam.timestamp) + } + + if (callParam.UpType === 'SSO' && window.GLOB.mainSystemApi) { + ssoParam = fromJS(callParam).toJS() + + ssoParam.rduri = window.GLOB.mainSystemApi + + delete ssoParam.UpType + } else { + delete callParam.UpType + } + + if (ssoParam) { + Api.genericInterface(ssoParam).then(res => { + if (!res.status) { + this.execError(res) + _resolve() + } else { + Api.genericInterface(callParam).then(re => { + if (!re.status) { + this.execError(re) + _resolve() + } else { + if (params.length === 0) { + this.execSuccess(res) + _resolve() + } else { + this.outerLoopRequest(params, _resolve) + } + } + }) + } + }) + } else { + Api.genericInterface(callParam).then(re => { + if (!re.status) { + this.execError(re) + _resolve() + } else { + if (params.length === 0) { + this.execSuccess(re) + _resolve() + } else { + this.outerLoopRequest(params, _resolve) + } + } + }) + } } /** @@ -1743,6 +1882,10 @@ } else if (btn.execSuccess !== 'never') { MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id, this.state.selines) } + + if (window.GLOB.breakpoint) { + MKEmitter.emit('refreshDebugTable') + } btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) @@ -1761,15 +1904,22 @@ node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) } - if (btn.MenuID && Array.isArray(btn.openmenu) && btn.openmenu.length > 0) { - let newtab = { - MenuID: btn.MenuID, - MenuName: btn.MenuName, - MenuNo: btn.MenuNo, - type: btn.tabType, - param: { - $BID: id + if (btn.openmenu && Array.isArray(btn.openmenu) && btn.openmenu.length > 0) { + let menuId = btn.openmenu.slice(-1)[0] + let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + + if (!newtab && btn.MenuID) { + newtab = { + MenuID: btn.MenuID, + MenuName: btn.MenuName, + MenuNo: btn.MenuNo, + type: btn.tabType, + param: { + $BID: id + } } + } else if (!newtab) { + return } if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { @@ -1802,6 +1952,15 @@ } sendWxMessage = (verify, id) => { + if (!window.GLOB.nginx) { + notification.warning({ + top: 92, + message: 'nginx鏈嶅姟灏氭湭寮�鍚紝涓嶅彲鍙戦�佹ā鏉挎秷鎭��', + duration: 5 + }) + return + } + let param = { func: 's_get_sms_weixin_local', upid: id @@ -1842,11 +2001,8 @@ _param.miniprogram.pagepath = `/pages/index/index?MenuId=${verify.wxNoteLinkMenuId}` } } - - let keys = [] + verify.wxNoteKeys.forEach(item => { - keys.push(item.key) - _param.data[item.key] = {value: '', color: item.color} }) @@ -1862,9 +2018,9 @@ m.client_msg_id = item.send_id } - keys.forEach(key => { - if (item[key] !== undefined) { - m.data[key].value = item[key] + verify.wxNoteKeys.forEach(note => { + if (item[note.value] !== undefined) { + m.data[note.key].value = item[note.value] } }) @@ -1884,6 +2040,7 @@ upid: id, send_id: n.client_msg_id || '', status_result: re.errcode === 0 ? 'S' : 'E', + errcode: re.errcode, msg_result: re.errmsg } @@ -1899,6 +2056,26 @@ duration: 5 }) } + }) + } else if (re.errcode !== 0 && re.errmsg) { + let msgs = [ + {errcode: -1, errmsg: '绯荤粺绻佸繖锛岃绋嶅�欏啀璇�'}, + {errcode: 40001, errmsg: 'access_token 鏃犳晥'}, + {errcode: 40003, errmsg: '涓嶅悎娉曠殑 OpenID'}, + {errcode: 40014, errmsg: '涓嶅悎娉曠殑 access_token'}, + {errcode: 40033, errmsg: '涓嶅悎娉曠殑璇锋眰瀛楃'}, + {errcode: 43004, errmsg: '闇�瑕佹帴鏀惰�呭叧娉�'}, + {errcode: 43019, errmsg: '闇�瑕佸皢鎺ユ敹鑰呬粠榛戝悕鍗曚腑绉婚櫎'}, + {errcode: 50005, errmsg: '鐢ㄦ埛鏈叧娉ㄥ叕浼楀彿'} + ] + + let msg = msgs.filter(m => m.errcode === re.errcode)[0] + msg = msg || re + + notification.warning({ + top: 92, + message: msg.errmsg, + duration: 5 }) } }) @@ -2003,7 +2180,7 @@ _param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk' _param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk' - Api.getLocalConfig(_param).then(result => { + Api.genericInterface(_param).then(result => { if (!result.status) { notification.warning({ top: 92, @@ -2055,10 +2232,13 @@ }) MKEmitter.emit('autoExecOver', btn.uuid, 'error') return + } else if (btn.OpenType !== 'pop' || !btnconfig || btnconfig.setting.finish !== 'unclose') { + this.setState({ + loading: false + }) } this.setState({ - loading: false, loadingNumber: '', loadingTotal: '', }) @@ -2116,6 +2296,10 @@ } else if (btn.OpenType === 'form') { let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null this.setState({check: data && data[btn.field] === btn.openVal}) + } + + if (window.GLOB.breakpoint) { + MKEmitter.emit('refreshDebugTable') } } @@ -2232,76 +2416,107 @@ } modelconfirm = () => { - const { BData, btn } = this.props + const { btn, BID } = this.props const { btnconfig, selines } = this.state let _this = this let result = [] + let _data = {} + let BData = {} + + if (selines[0]) { + Object.keys(selines[0]).forEach(key => { + _data[key.toLowerCase()] = selines[0][key] + }) + } + if (this.props.BData) { + Object.keys(this.props.BData).forEach(key => { + BData[key.toLowerCase()] = this.props.BData[key] + }) + } + btnconfig.fields.forEach(item => { if (!item.field) return - let _readin = item.readin !== 'false' - let _initval = item.initval - - if (item.type === 'linkMain' || item.type === 'funcvar') { - _readin = false - } - - if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) { - _initval = BData[item.field] - } else if (_readin && selines[0] && selines[0].hasOwnProperty(item.field)) { - _initval = selines[0][item.field] - } else if (item.type === 'date' && _initval) { - _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD') - } else if (item.type === 'datemonth' && _initval) { - _initval = moment().subtract(_initval, 'month').format('YYYY-MM') - } else if (item.type === 'datetime' && _initval) { - _initval = moment().subtract(_initval, 'days').format('YYYY-MM-DD HH:mm:ss') - } - - let _fieldlen = item.fieldlength || 50 - if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') { - _fieldlen = item.fieldlength || 512 - } else if (item.type === 'number') { - _fieldlen = item.decimal ? item.decimal : 0 - } - - if (_initval === undefined) { - _initval = '' - } - - let _type = item.type - - if (['date', 'datemonth', 'datetime'].includes(_type) && item.declareType === 'nvarchar(50)') { - _type = 'text' - } else if (item.type === 'rate') { - item.rateCount = item.rateCount || 5 - let allowHalf = item.allowHalf === 'true' - - if (allowHalf) { - _initval = parseFloat(_initval) - if (_initval % 0.5 !== 0) { - _initval = parseInt(_initval) - } - } else { - _initval = parseInt(_initval) - } - - if (isNaN(_initval) || _initval < 0) { - _initval = 0 - } else if (_initval > item.rateCount) { - _initval = item.rateCount - } - } - - result.push({ + let _item = { key: item.field, - readonly: item.readonly === 'true', readin: item.readin !== 'false' && item.readin !== 'top', - fieldlen: _fieldlen, + fieldlen: item.fieldlength || 50, writein: item.writein !== 'false', - type: _type, - value: _initval - }) + type: item.type + } + + let _initval = item.initval + let _readin = item.readin !== 'false' + let _format = item.precision || 'day' // 鏃堕棿鏍煎紡鍖� + + if (item.type === 'funcvar') { + _initval = '' + _readin = false + _item.readin = false + } else if (item.type === 'linkMain') { + _readin = false + _item.readin = false + } else if (item.type === 'date') { + if (_format !== 'day') { + _format = 'YYYY-MM-DD HH:mm:ss' + } else { + _format = 'YYYY-MM-DD' + } + } else if (item.type === 'datetime') { + _item.type = 'date' + _format = 'YYYY-MM-DD HH:mm:ss' + } + + let key = item.field.toLowerCase() + + if (_item.type === 'linkMain' && BData.hasOwnProperty(key)) { + _initval = BData[key] + } else if (_readin && _data.hasOwnProperty(key)) { + _initval = _data[key] + } else if (_item.type === 'date' && _initval) { + _initval = moment().subtract(_initval, 'days').format(_format) + } else if (_item.type === 'datemonth' && _initval) { + _initval = moment().subtract(_initval, 'month').format('YYYY-MM') + } + + _item.value = _initval === undefined ? '' : _initval + + if (_item.type === 'number' || item.declare === 'decimal') { + _item.type = 'number' + _item.fieldlen = item.decimal || 0 + } else if (['text', 'textarea', 'linkMain'].includes(_item.type)) { + _item.value = _item.value + '' + _item.value = _item.value.replace(/\t*|\v*/g, '') // 鍘婚櫎鍒惰〃绗� + + if (item.interception !== 'false') { // 鍘婚櫎棣栧熬绌烘牸 + _item.value = _item.value.replace(/(^\s*|\s*$)/g, '') + } + if (_item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 鐗规畩瀛楁鏇挎崲 + _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (BID || '')) + } + if (_item.type === 'text' && item.lenControl && item.lenControl !== 'limit') { + if (item.lenControl === 'left') { + _item.value = _item.value.substr(0, item.fieldlength) + } else { + _item.value = _item.value.slice(-item.fieldlength) + } + } + } else if (_item.type.indexOf('date') > -1) { + if (item.declareType === 'nvarchar(50)') { + _item.type = 'text' + } + } else if (_item.type === 'rate') { + let count = item.rateCount || 5 + _item.value = parseInt(_item.value) + + if (isNaN(_item.value) || _item.value < 0) { + _item.value = 0 + } else if (_item.value > count) { + _item.value = count + } + } + + result.push(_item) }) if (btnconfig.setting.display === 'exec') { @@ -2325,7 +2540,7 @@ * @description 鏄剧ず妯℃�佹 */ getModels = () => { - const { setting, BID, btn, BData } = this.props + const { BID, btn, BData } = this.props const { btnconfig, visible } = this.state if (!btnconfig || !btnconfig.setting) return null @@ -2374,12 +2589,9 @@ } else { let container = document.body - if ( - (setting.tabType === 'main' && btnconfig.setting.container === 'tab' && this.props.ContainerId) || - (btnconfig.setting.container === 'tab' && btn.ContainerId) - ) { + if (btnconfig.setting.container === 'tab' && btn.ContainerId) { width = btnconfig.setting.width > 100 ? btnconfig.setting.width : btnconfig.setting.width + '%' - container = () => document.getElementById(this.props.ContainerId || btn.ContainerId) + container = () => document.getElementById(btn.ContainerId) } return ( <Modal @@ -2415,10 +2627,12 @@ if (hidden) return null if (btn.OpenType === 'form') { - if (btn.formType === 'switch') { + if (btn.formType === 'switch') { return <Switch loading={loading} checked={check} disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} onChange={(val,e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style} className={btn.size === 'large' ? 'ant-switch-large' : ''} size={btn.size} checkedChildren={btn.openText || ''} unCheckedChildren={btn.closeText || ''}/> - } else { + } else if (btn.formType === 'radio') { return <Checkbox disabled={disabled || loading} title={disabled ? (btn.reason || '') : ''} checked={check} onChange={(e) => {e.stopPropagation();this.actionTrigger()}} style={btn.style}></Checkbox> + } else { + return <Button type="link" icon="scan" disabled={true} style={btn.style} onClick={(e) => {e.stopPropagation()}}></Button> } } -- Gitblit v1.8.0