From 7bba7b209c0637d7afff05953a4b0563db0e9bdc Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 15 六月 2023 14:25:57 +0800 Subject: [PATCH] Merge branch 'develop' --- src/tabviews/subtabtable/index.jsx | 205 +++++---------------------------------------------- 1 files changed, 21 insertions(+), 184 deletions(-) diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 8be474a..3388d62 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -7,7 +7,6 @@ import zhCN from '@/locales/zh-CN/main.js' import enUS from '@/locales/en-US/main.js' import Utils from '@/utils/utils.js' -import options from '@/store/options.js' import UtilsDM from '@/utils/utils-datamanage.js' import { updateSubTabTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' @@ -36,7 +35,6 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� arr_field: '', // 鏌ヨ瀛楁闆� @@ -52,7 +50,6 @@ statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� - loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 hasReqFields: false } @@ -240,7 +237,7 @@ config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 config.setting.customScript = '' // 鑷畾涔夎剼鏈� - if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) { + if (config.setting.interType === 'system') { if (config.setting.scripts && config.setting.scripts.length > 0) { let _customScript = '' config.setting.scripts.forEach(item => { @@ -306,6 +303,18 @@ } } + config.type = 'table' + config.wrap = { + show: config.setting.show || '', + float: config.setting.float || '', + advanceType: config.setting.advanceType || '', + advanceWidth: config.setting.advanceWidth || '', + drawerPlacement: config.setting.drawerPlacement || '', + searchRatio: config.setting.searchRatio || '', + searchLwidth: config.setting.searchLwidth, + borderRadius: config.setting.borderRadius, + } + this.setState({ pageSize: config.setting.pageSize || 10, loadingview: false, @@ -313,7 +322,6 @@ absFields, statFields, setting: config.setting, - searchlist: config.search, actions: _actions, columns: _columns, arr_field: _arrField.join(','), @@ -338,7 +346,7 @@ } loadData = (id) => { - const { setting, search, hasReqFields, loadCustomApi } = this.state + const { setting, search, hasReqFields } = this.state let searches = fromJS(search).toJS() @@ -352,10 +360,10 @@ } } - if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { + if (setting.interType === 'custom') { notification.warning({ top: 92, - message: '鏈缃寮忕郴缁熷湴鍧�!', + message: '绯荤粺涓嶅湪鏀寔鑷畾涔夋帴鍙�!', duration: 3 }) return @@ -365,178 +373,7 @@ selectedData: [] }) - if (setting.interType === 'custom' && loadCustomApi) { - if (setting.execTime === 'once') { - this.setState({loadCustomApi: false}) - } - - this.loadOutResource(searches) - if (setting.execType === 'async') { - this.loadmaindata(id) - } - } else { - this.loadmaindata(id) - } - } - - loadOutResource = (searches) => { - const { setting } = this.state - - let param = UtilsDM.getPrevQueryParams(setting, searches, this.props.BID) - - if (setting.execType === 'sync') { - this.setState({ - loading: true - }) - } - - Api.genericInterface(param).then(res => { - if (res.status) { - if (res.mk_ex_invoke === 'false' || res.mk_ex_invoke === false) { - this.loadmaindata() - } else { - this.customOuterRequest(res) - } - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 - }) - } - }, () => { - this.setState({ - loading: false - }) - }) - } - - customOuterRequest = (result) => { - const { setting } = this.state - let url = '' - - if (window.GLOB.systemType === 'production') { - url = setting.proInterface - } else { - url = setting.interface - } - - let mkey = result.mk_api_key || '' - - delete result.mk_ex_invoke - delete result.status - delete result.message - delete result.ErrCode - delete result.ErrMesg - delete result.mk_api_key - - let param = {} - - Object.keys(result).forEach(key => { - key = key.replace(/^mk_/ig, '') - param[key] = result[key] - }) - - Api.directRequest(url, setting.method, param, setting.cross).then(res => { - if (typeof(res) !== 'object') { - let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒' - - if (typeof(res) === 'string') { - error = res.replace(/'/ig, '"') - } - - let _result = { - mk_api_key: mkey, - $ErrCode: 'E', - $ErrMesg: error - } - - this.customCallbackRequest(_result) - } else { - if (Array.isArray(res)) { - res = { data: res } - } - res.mk_api_key = mkey - this.customCallbackRequest(res) - } - }, (e) => { - let _result = { - mk_api_key: mkey, - $ErrCode: 'E', - $ErrMesg: e && e.statusText ? e.statusText : '' - } - - this.customCallbackRequest(_result) - }) - } - - customCallbackRequest = (result) => { - const { setting } = this.state - let errSql = '' - if (result.$ErrCode === 'E') { - errSql = ` - set @ErrorCode='E' - set @retmsg='${result.$ErrMesg}' - ` - delete result.$ErrCode - delete result.$ErrMesg - } - - let lines = UtilsDM.getCallBackSql(setting, result) - let param = {} - - if (setting.callbackType === 'script') { // 浣跨敤鑷畾涔夎剼鏈� - let sql = lines.map(item => (` - ${item.insert} - ${item.selects.join(` union all - `)} - `)) - sql = sql.join('') - - param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, this.props.BID) - } else { - let name = this.props.Tab ? (this.props.Tab.label || '') : '' - param.func = 's_ex_result_back' - param.s_ex_result = lines.map((item, index) => ({ - MenuID: this.props.MenuID, - MenuName: name, - TableName: item.table, - LongText: window.btoa(window.encodeURIComponent(`${item.insert} ${item.selects.join(` union all `)}`)), - Sort: index + 1 - })) - - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { - let sql = lines.map(item => (` - ${item.insert} - ${item.selects.join(` union all - `)} - `)) - sql = sql.join('') - console.info(sql.replace(/\n\s{10}/ig, '\n')) - } - } - - Api.genericInterface(param).then(res => { - if (res.status) { - this.loadmaindata() - } else { - this.setState({ - loading: false - }) - notification.error({ - top: 92, - message: res.message, - duration: 10 - }) - } - }, () => { - this.setState({ - loading: false - }) - }) + this.loadmaindata(id) } /** @@ -626,7 +463,7 @@ const { BID } = this.props const { setting, orderBy, statFields } = this.state - if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return + if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return let _orderBy = orderBy || setting.order let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID) @@ -860,13 +697,13 @@ } render() { - const { config, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state + const { config, setting, pageSize, actions, columns, loadingview, viewlost, selectedData } = this.state return ( <div className="subtabtable" id={'subtabtable' + this.props.MenuID}> {loadingview && <Spin />} - {searchlist && searchlist.length ? - <SubSearch BID={this.props.BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null + {config.search && config.search.length ? + <SubSearch BID={this.props.BID} config={config} refreshdata={this.refreshbysearch}/> : null } {config ? <div style={{minHeight: '25px'}}> <SubAction -- Gitblit v1.8.0