From b28b2a89838cf0eb8c7c2d7ec605d79610309af9 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 15 六月 2023 17:46:11 +0800 Subject: [PATCH] 2023-06-15 --- src/templates/zshare/modalform/index.jsx | 4 src/utils/utils-datamanage.js | 304 --------- src/tabviews/custom/components/card/double-data-card/index.scss | 1 src/tabviews/zshare/topSearch/index.jsx | 64 - src/tabviews/custom/components/card/double-data-card/index.jsx | 7 src/menu/components/form/formaction/actionform/index.jsx | 2 src/templates/comtableconfig/index.jsx | 2 src/templates/modalconfig/checkCard/index.scss | 11 src/tabviews/calendar/index.jsx | 20 src/templates/modalconfig/checkCard/index.jsx | 6 src/views/tabledesign/index.jsx | 14 src/api/index.js | 102 +-- src/tabviews/zshare/topSearch/index.scss | 12 src/tabviews/subtable/index.jsx | 216 ------ src/tabviews/subtabtable/index.jsx | 205 ----- src/tabviews/commontable/index.jsx | 206 ----- src/tabviews/zshare/actionList/normalbutton/index.jsx | 139 ++++ src/tabviews/custom/components/card/data-card/index.scss | 1 src/views/mobdesign/index.jsx | 16 src/menu/components/search/main-search/index.scss | 12 src/views/menudesign/index.jsx | 14 src/tabviews/custom/components/card/data-card/index.jsx | 7 src/assets/css/main.scss | 4 src/tabviews/custom/components/card/table-card/index.scss | 7 src/menu/components/form/formaction/formconfig.jsx | 75 + src/tabviews/zshare/mutilform/mkCheckCard/index.scss | 11 src/tabviews/zshare/mutilform/mkCheckCard/index.jsx | 3 src/views/pcdesign/index.jsx | 14 src/templates/zshare/formconfig.jsx | 115 ++- src/menu/components/share/actioncomponent/formconfig.jsx | 150 ++- src/templates/sharecomponent/actioncomponent/actionform/index.jsx | 2 src/templates/subtableconfig/index.jsx | 2 /dev/null | 53 - src/menu/components/share/actioncomponent/actionform/index.jsx | 2 src/tabviews/zshare/topSearch/advanceform/index.scss | 12 src/templates/sharecomponent/searchcomponent/index.scss | 12 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 4 src/views/login/index.jsx | 14 38 files changed, 594 insertions(+), 1,251 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 46f97a8..1170c94 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -23,19 +23,11 @@ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' axios.defaults.withCredentials = false -axios.interceptors.request.use((config) => { - if (/LoginAndRedirect|getjsonresult|wxNativePay|postek/ig.test(config.url)) { - config.data = qs.stringify(config.data) - } else if (/\/doupload|\/dopreload|\/upload/.test(config.url)) { - config.headers = { 'Content-Type': 'multipart/form-data' } - } else if (config.method === 'post' && config.data) { - config.data = JSON.stringify(config.data) - } - - return config -}, (error) => { - return Promise.reject(error) -}) +// axios.interceptors.request.use((config) => { +// return config +// }, (error) => { +// return Promise.reject(error) +// }) const setCurrentUrl = (res) => { if (!!(window.history && window.history.pushState)) { @@ -63,7 +55,11 @@ axios.interceptors.response.use((response) => { if (response.data.ErrCode === 'LoginError') { - if (window.debugger === true || window.GLOB.saving) { + if (window.debugger === true) { + response.data.ErrCode = 'E' + return Promise.resolve(response.data) + } else if (window.GLOB.developing) { + sessionStorage.setItem('devError', 'true') response.data.ErrCode = 'E' return Promise.resolve(response.data) } else if (!sessionStorage.getItem('loginError')) { @@ -106,7 +102,7 @@ return axios({ url: `/webapi/dostar${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -125,7 +121,7 @@ return axios({ url: url, method: 'post', - data: param + data: qs.stringify(param) }) } @@ -197,39 +193,10 @@ }) } - /* @description 鐩存帴璇锋眰 - * @param {Object} param 鏌ヨ鍙婃彁浜ゅ弬鏁� + /** + * @description 鐩存帴璇锋眰 */ - directRequest (url, method = 'post', param, cross) { - if (cross === 'true' && param) { - return axios({ - url, - method, - data: param - }) - } else if (cross === 'true') { - return axios({ - url, - method - }) - } - - let params = { method: 'post' } - let _url = url - - if (method === 'get' && param) { - let keys = Object.keys(param).map(key => `${key}=${param[key]}`) - keys = keys.join('&') - if (keys) { - _url = _url + '?' + keys - } - } else if (method === 'post' && param) { - params.data = param - } - - _url = _url.replace(/&/ig, '%26') - params.url = '/trans/redirect?rd=' + _url + '&method=' + method - + directRequest (params) { return axios(params) } @@ -287,7 +254,7 @@ return axios({ url: url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -326,7 +293,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -386,7 +353,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -572,7 +539,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -596,7 +563,7 @@ return axios({ url: `${url}/${param.func}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -628,7 +595,7 @@ return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -668,7 +635,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status && window.GLOB.IndexDB) { let msg = { @@ -694,7 +661,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status) { window.GLOB.CacheMap.set(key, res) @@ -793,7 +760,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { if (res.status) { window.GLOB.CacheMap.set(_param, res) @@ -857,7 +824,7 @@ axios({ url: token.interface, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { _resolve(res) }) @@ -886,7 +853,7 @@ axios({ url, method: 'post', - data: _param + data: JSON.stringify(_param) }).then(result => { if (result.status) { window.GLOB.OuterToken[token.interface] = { @@ -904,7 +871,7 @@ axios({ url: token.interface, method: 'post', - data: param + data: JSON.stringify(param) }).then(res => { _resolve(res) }) @@ -976,7 +943,7 @@ return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -987,7 +954,7 @@ axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }).then(result => { resolve(result) }) @@ -1000,7 +967,7 @@ return axios({ url: `${url}${param.func ? '/' + param.func : ''}`, method: 'post', - data: param + data: JSON.stringify(param) }) } } @@ -1041,7 +1008,7 @@ return axios({ url, method: 'post', - data: param + data: JSON.stringify(param) }) } @@ -1052,6 +1019,7 @@ return axios({ url: '/webapi/doupload', method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, data: param }) } @@ -1063,6 +1031,7 @@ return axios({ url: '/webapi/dopreload', method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, data: param }) } @@ -1090,6 +1059,7 @@ return axios({ url: _url, method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, data: param }) } @@ -1103,7 +1073,7 @@ return axios({ url: _url, method: 'post', - data: param + data: qs.stringify(param) }) } @@ -1111,7 +1081,7 @@ return axios({ url: 'http://127.0.0.1:888/postek/print', method: 'post', - data: data + data: qs.stringify(data) }) } } diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 6f5c18a..a822a26 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -509,4 +509,8 @@ .component-wrap >.ant-col { min-height: 0; +} + +.ant-col.ant-col-0 { + display: inline-block; } \ No newline at end of file diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx index 7f5eae5..266c700 100644 --- a/src/menu/components/form/formaction/actionform/index.jsx +++ b/src/menu/components/form/formaction/actionform/index.jsx @@ -65,7 +65,7 @@ if (_intertype === 'custom') { _options.pop() - _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') + _options.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') if (_procMode === 'system') { _options.push('sql', 'sqlType') } else { diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx index 47ce8dd..823ad5f 100644 --- a/src/menu/components/form/formaction/formconfig.jsx +++ b/src/menu/components/form/formaction/formconfig.jsx @@ -201,35 +201,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || 'script', @@ -266,6 +237,52 @@ }, { type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] + }, + { + type: 'radio', key: 'Ot', label: '琛岃缃�', initVal: card.Ot, diff --git a/src/menu/components/search/main-search/index.scss b/src/menu/components/search/main-search/index.scss index be92a36..6aff673 100644 --- a/src/menu/components/search/main-search/index.scss +++ b/src/menu/components/search/main-search/index.scss @@ -56,18 +56,6 @@ padding: 4px 20px 4px 5px; font-size: 13px; } - .check-card-edit-box { - .no-margin-bottom { - margin-bottom: 0px; - } - .card-cell { - padding: 4px 6px; - } - .card-color-cell { - padding: 4px 6px; - min-height: 32px; - } - } } } .ant-form-item::after { diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx index b1d19ea..ddeb8b0 100644 --- a/src/menu/components/share/actioncomponent/actionform/index.jsx +++ b/src/menu/components/share/actioncomponent/actionform/index.jsx @@ -166,7 +166,7 @@ reOptions.intertype = this.state.interTypeOptions if (intertype === 'custom') { - shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') + shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 9d6f7b7..d8fa383 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -481,35 +481,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), @@ -542,6 +513,52 @@ label: '鍥炶皟鍑芥暟', initVal: card.callbackFunc || '', required: true + }, + { + type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] }, { type: 'select', @@ -1507,35 +1524,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), @@ -1570,6 +1558,52 @@ required: true }, { + type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] + }, + { type: 'select', key: 'Ot', label: '琛岃缃�', diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx index 7dec056..7ed4d3f 100644 --- a/src/tabviews/calendar/index.jsx +++ b/src/tabviews/calendar/index.jsx @@ -37,7 +37,6 @@ lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� - searchlist: null, // 鎼滅储鏉′欢 arr_field: '', // 鏌ヨ瀛楁闆� setting: null, // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑 data: null, // 鍒楄〃鏁版嵁闆� @@ -190,6 +189,18 @@ config.setting.customScript = _customScript } + 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({ hasReqFields, BID: param && param.$BID ? param.$BID : '', @@ -197,7 +208,6 @@ config: config, userConfig: userConfig, setting: config.setting, - searchlist: config.search, arr_field: config.columns.map(item => item.field).join(','), search: Utils.initMainSearch(config.search) }, () => { @@ -543,13 +553,13 @@ } render() { - const { BID, setting, searchlist, loadingview, viewlost, config, loading, data, triggerTime } = this.state + const { BID, loadingview, viewlost, config, loading, data, triggerTime } = this.state return ( <div className="calendar-page"> {loadingview && <Spin size="large" />} - {searchlist && searchlist.length > 0 ? - <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null + {config.search && config.search.length > 0 ? + <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null } {config && config.calendar ? <CalendarComponent calendar={config.calendar} loading={loading} data={data} triggerDate={this.triggerDate} changeDate={this.changeDate}/> : null} {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 2428d19..f9887fb 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -5,7 +5,6 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import options from '@/store/options.js' import UtilsDM from '@/utils/utils-datamanage.js' import { updateCommonTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' @@ -46,7 +45,6 @@ lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 shortcuts: null, // 蹇嵎閿� - searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� arr_field: '', // 鏌ヨ瀛楁闆� @@ -65,7 +63,6 @@ statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� - loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 hasReqFields: false, autoMatic: null, visible: false @@ -247,7 +244,7 @@ config.setting.customScript = '' // 鑷畾涔夎剼鏈� config.setting.dataresource = config.setting.dataresource || '' - 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 => { @@ -447,6 +444,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, @@ -457,7 +466,6 @@ statFields, shortcuts: shortcuts.length > 0 ? shortcuts : null, setting: config.setting, - searchlist: config.search, actions: _actions, columns: _columns, arr_field: _arrField.join(','), @@ -531,7 +539,7 @@ loadData = (id) => { const { MenuID } = this.props - const { setting, search, loadCustomApi, hasReqFields, ContainerId } = this.state + const { setting, search, hasReqFields, ContainerId } = this.state this.setState({ selectedData: [] @@ -549,186 +557,16 @@ } } - if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { + if (setting.interType === 'custom') { notification.warning({ top: 92, - message: '鏈缃寮忕郴缁熷湴鍧�!', + message: '绯荤粺涓嶅湪鏀寔鑷畾涔夋帴鍙�!', duration: 3 }) return } - if (setting.interType === 'custom' && loadCustomApi) { - if (setting.execTime === 'once') { - this.setState({loadCustomApi: false}) - } - - this.loadOutResource() - if (setting.execType === 'async') { - this.loadmaindata(id) - } - } else { - this.loadmaindata(id) - } - } - - loadOutResource = () => { - const { setting, search, BID } = this.state - - let param = UtilsDM.getPrevQueryParams(setting, search, 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 // 褰撳墠璇锋眰鐨刱ey鍊硷紝鐢ㄤ簬鍥炶皟 - - 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, BID } = 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, BID) - } else { - param.func = 's_ex_result_back' - param.s_ex_result = lines.map((item, index) => ({ - MenuID: this.state.config.MenuID, - MenuName: this.state.config.MenuName, - 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) } /** @@ -898,7 +736,7 @@ getStatFieldsValue = () => { const { setting, search, BID, 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, search, _orderBy, BID) @@ -1015,7 +853,7 @@ reloadview = () => { this.setState({ loadingview: true, viewlost: false, config: {}, setting: null, data: null, total: 0, loading: false, pageIndex: 1, shortcuts: null, - pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false, searchlist: null + pageSize: 10, orderBy: '', search: '', BIDs: {}, pickup: false }, () => { this.loadconfig() }) @@ -1167,13 +1005,13 @@ render() { const { MenuID } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state + const { BID, setting, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData, shortcuts, autoMatic } = this.state return ( <div className="commontable" id={this.state.ContainerId}> {loadingview ? <Spin size="large" /> : null} - {searchlist && searchlist.length ? - <MainSearch BID={BID} searchlist={searchlist} setting={setting} refreshdata={this.refreshbysearch}/> : null + {config.search && config.search.length ? + <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null } {setting && config.charts ? <Row className="chart-view" gutter={16}> {/* 瑙嗗浘缁� */} diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 6d1c6ea..9b84661 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -81,6 +81,7 @@ } _config.$extend = false + _config.$empty = true _config.subcards.forEach(item => { if (item.setting.click === 'button' && !item.setting.linkbtn) { @@ -98,9 +99,13 @@ _card = item } else if (!_card) { _config.$extend = true + if (item.setting.width !== 24) { + _config.$empty = false + } precards.push(item) } else { _config.$extend = true + _config.$empty = false nextcards.push(item) } }) @@ -1045,8 +1050,8 @@ ))} </Row> {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} - {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null} </div> + {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 鍏� ${total} 鏉 : `鍏� ${total} 鏉} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>鏌ョ湅鏇村<DownOutlined/></div> : null} </div> diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index 34a81cf..bb71f96 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -104,7 +104,6 @@ } .ant-empty { - width: 100%; min-height: 100px; padding-top: 15px; diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 33637fa..ddf5d2d 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -79,6 +79,7 @@ } _config.$extend = false + _config.$empty = true _config.subcards.forEach(item => { if (item.setting.click === 'button' && !item.setting.linkbtn) { @@ -96,9 +97,13 @@ _card = item } else if (!_card) { _config.$extend = true + if (item.setting.width !== 24) { + _config.$empty = false + } precards.push(item) } else { _config.$extend = true + _config.$empty = false nextcards.push(item) } }) @@ -1056,8 +1061,8 @@ </Col> ))} </Row> - {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null} </div> + {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null} </div> {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 鍏� ${total} 鏉 : `鍏� ${total} 鏉} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>鏌ョ湅鏇村<DownOutlined/></div> : null} diff --git a/src/tabviews/custom/components/card/double-data-card/index.scss b/src/tabviews/custom/components/card/double-data-card/index.scss index b3a5b8a..0ee2e47 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.scss +++ b/src/tabviews/custom/components/card/double-data-card/index.scss @@ -76,7 +76,6 @@ } .ant-empty { - width: 100%; min-height: 100px; padding-top: 15px; diff --git a/src/tabviews/custom/components/card/table-card/index.scss b/src/tabviews/custom/components/card/table-card/index.scss index c7b6fc8..088083a 100644 --- a/src/tabviews/custom/components/card/table-card/index.scss +++ b/src/tabviews/custom/components/card/table-card/index.scss @@ -105,6 +105,13 @@ cursor: not-allowed; color: #bcbcbc; } + .ant-empty { + min-height: 100px; + padding-top: 15px; + .ant-empty-image { + height: 60px; + } + } } .custom-card-box::after { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 694a47d..cb9aefe 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/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 { updateSubTable } from '@/utils/utils-update.js' import asyncComponent from '@/utils/asyncComponent' @@ -41,7 +40,6 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: null, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� arr_field: '', // 鏌ヨ瀛楁闆� @@ -59,7 +57,6 @@ statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� absFields: [], // 缁濆鍊煎瓧娈� - loadCustomApi: true, // 鍔犺浇澶栭儴璧勬簮 hasReqFields: false, BID: '', BData: '' @@ -285,7 +282,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 => { @@ -351,6 +348,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, BID: this.props.BID || '', @@ -361,7 +370,6 @@ absFields, statFields, setting: config.setting, - searchlist: config.search, actions: _actions, columns: _columns, arr_field: _arrField.join(','), @@ -389,7 +397,7 @@ loadData = (id) => { const { mainSearch } = this.props - const { setting, BID, search, loadCustomApi, hasReqFields } = this.state + const { setting, BID, search, hasReqFields } = this.state let searches = fromJS(search).toJS() if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 @@ -406,6 +414,15 @@ } } + if (setting.interType === 'custom') { + notification.warning({ + top: 92, + message: '绯荤粺涓嶅湪鏀寔鑷畾涔夋帴鍙�!', + duration: 3 + }) + return + } + if (this.props.Tab.supMenu && !BID) { // 涓昏〃ID涓嶅瓨鍦ㄦ椂锛屼笉鏌ヨ瀛愯〃 this.setState({ data: [], @@ -415,13 +432,6 @@ }) MKEmitter.emit('changeTableLine', this.props.Tab.ContainerId, this.props.Tab.uuid, '', '') return - } else if (window.GLOB.systemType === 'production' && setting.interType === 'custom' && !setting.proInterface) { - notification.warning({ - top: 92, - message: '鏈缃寮忕郴缁熷湴鍧�!', - duration: 3 - }) - return } this.setState({ @@ -429,177 +439,7 @@ }) MKEmitter.emit('changeTableLine', this.props.Tab.ContainerId, this.props.Tab.uuid, '', '') - 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, BID } = this.state - - let param = UtilsDM.getPrevQueryParams(setting, searches, 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, BID } = 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, BID) - } else { - param.func = 's_ex_result_back' - param.s_ex_result = lines.map((item, index) => ({ - MenuID: this.props.MenuID, - MenuName: this.props.Tab.label, - 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) } /** @@ -771,7 +611,7 @@ getStatFieldsValue = (searches) => { const { setting, BID, 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) @@ -1007,13 +847,13 @@ } render() { - const { config, BID, BData, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state + const { config, BID, BData, setting, pageSize, actions, columns, loadingview, viewlost, pickup, chartId, selectedData } = this.state return ( <div className="subtable" id={'subtable' + this.props.MenuID}> {loadingview && <Spin />} - {searchlist && searchlist.length ? - <SubSearch BID={BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null + {config.search && config.search.length ? + <SubSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null } {config && config.charts ? <Row className="chart-view" gutter={16}> {/* 瑙嗗浘缁� */} 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 diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index 07a4c6c..8b9b3ea 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import moment from 'moment' +import qs from 'qs' import { is, fromJS } from 'immutable' import { Button, Modal, notification, message, Drawer, Switch, Checkbox, Progress } from 'antd' @@ -832,6 +833,93 @@ return _params } + getLineParam = (data, formdata, retmsg) => { + const { setting, btn, columns } = this.props + let _params = [] + + if (btn.Ot === 'notRequired') { + if (retmsg) { + let param = { + $callbacksql: this.getSysDeclareSql(btn, formdata, data[0], columns, '', this.props.BID) + } + + _params.push(param) + } else { + _params.push({}) + } + } else if ( btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce' ) { + let param = {} + + if (this.props.BID) { + param.BID = this.props.BID + } + + let primaryId = '' + + if ((btn.Ot === 'requiredSgl' || btn.Ot === 'requiredOnce') && setting.primaryKey) { + let ids = data.map(d => { return d[setting.primaryKey] || ''}) + ids = ids.filter(Boolean) + primaryId = ids.join(',') + } + + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId // 璁剧疆涓婚敭鍙傛暟 + } + + if (btn.OpenType === 'pop' || btn.OpenType === 'formSubmit' || btn.OpenType === 'form') { // 琛ㄥ崟 + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + } + + if (retmsg) { + param.$callbacksql = this.getSysDeclareSql(btn, formdata, data[0], columns, primaryId, this.props.BID) + } + + _params.push(param) + } else if (btn.Ot === 'required') { + _params = data.map((cell, index) => { + let param = {} + + if (this.props.BID) { + param.BID = this.props.BID + } + + let primaryId = setting.primaryKey ? cell[setting.primaryKey] || '' : '' + + 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.toLowerCase())) { + _data.value = _cell[_data.key.toLowerCase()] + } + return _data + }) + } + + formdata.forEach(_data => { + param[_data.key] = _data.value + }) + } + if (setting.primaryKey) { + param[setting.primaryKey] = primaryId + } + + if (retmsg) { + param.$callbacksql = this.getSysDeclareSql(btn, formdata, cell, columns, primaryId, this.props.BID) + } + + return param + }) + } + + return _params + } + /** * @description 鑾峰彇鍥炶皟鑴氭湰鐨勫瓧娈靛畾涔� */ @@ -1156,8 +1244,10 @@ item.script_type = 'Y' return item }) - } else { + } else if (btn.procMode === 'inner') { _params = this.getInnerParam(data, formdata, btn.callbackType === 'script') + } else { + _params = this.getLineParam(data, formdata, btn.callbackType === 'script') } if (_params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) { @@ -1177,8 +1267,10 @@ item.script_type = 'Y' return item }) - } else { + } else if (btn.procMode === 'inner') { params = this.getInnerParam(data, formdata, btn.callbackType === 'script') + } else { + params = this.getLineParam(data, formdata, btn.callbackType === 'script') } if (params.length > 1 && btn.progress === 'progressbar' && btn.$toolbtn) { @@ -1269,7 +1361,46 @@ param[key] = result[key] }) - Api.directRequest(url, btn.method, param, btn.cross).then(res => { + let _params = { + url: url, + method: btn.method || 'post' + } + + if (btn.cross === 'true') { + if (JSON.stringify(param) !== '{}') { + if (btn.stringify === 'qs') { + _params.data = qs.stringify(param) + } else if (btn.stringify === 'JSON') { + _params.data = param + } else { + _params.data = JSON.stringify(param) + } + } + } else { + let _url = url + if (JSON.stringify(param) !== '{}') { + if (_params.method === 'get') { + let keys = Object.keys(param).map(key => `${key}=${param[key]}`) + _url = _url + '?' + keys.join('&') + } else if (_params.method === 'post') { + if (btn.stringify === 'qs') { + _params.data = qs.stringify(param) + } else if (btn.stringify === 'JSON') { + _params.data = param + } else { + _params.data = JSON.stringify(param) + } + } + } + + _url = _url.replace(/&/ig, '%26') + + _params.url = '/trans/redirect?rd=' + _url + '&method=' + _params.method + + _params.method = 'post' + } + + Api.directRequest(_params).then(res => { if (typeof(res) !== 'object') { let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒' @@ -2222,7 +2353,7 @@ if (!res.oa_access_token) return params.forEach(n => { - Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', n).then(re => { + Api.wxNginxRequest(`${domain2}cgi-bin/message/template/send?access_token=${res.oa_access_token}`, 'post', JSON.stringify(n)).then(re => { if (verify.wxNoteCallback === 'true') { let msg = re.errmsg || '' diff --git a/src/tabviews/zshare/fileupload-pice/index.jsx b/src/tabviews/zshare/fileupload-pice/index.jsx deleted file mode 100644 index fc6b969..0000000 --- a/src/tabviews/zshare/fileupload-pice/index.jsx +++ /dev/null @@ -1,491 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' -import moment from 'moment' -import { Upload, Button, Progress, notification } from 'antd' -import { UploadOutlined } from '@ant-design/icons' -import SparkMD5 from 'spark-md5' -import Api from '@/api' -import './index.scss' - -class FileUpload extends Component { - static propTpyes = { - config: PropTypes.object, // 琛ㄥ崟淇℃伅 - onChange: PropTypes.func, // 琛ㄥ崟鍙樺寲 - } - - state = { - percent: 0, - accept: '', - accepts: null, - maxFile: null, - rduri: '', - limit: 2, - compress: false, - fileType: 'text', - showprogress: false, - filelist: [] - } - - UNSAFE_componentWillMount () { - const { config } = this.props - - let filelist = [] - if (config.initval) { - if (/^data:image/.test(config.initval)) { - filelist = [{ - uid: '0', - name: 'data:image/jpeg;base64', - status: 'done', - url: config.initval, - origin: true - }] - } else { - try { - filelist = config.initval.split(',').map((url, index) => { - return { - uid: `${index}`, - name: url.slice(url.lastIndexOf('/') + 1), - status: 'done', - url: url, - origin: true - } - }) - } catch (e) { - filelist = [] - } - } - } - - let accept = '' - let accepts = null - let compress = false - let maxFile = config.maxfile && config.maxfile > 0 ? config.maxfile : null - if (config.compress === 'true' || config.compress === 'base64') { - compress = true - accepts = ['.jpg', '.png', '.gif', '.jpeg'] - accept = accepts.join(',') - if (config.compress === 'base64') { - maxFile = 1 - } - } else if (config.suffix) { - accepts = config.suffix.split(',').map(item => { - if (!/^\./ig.test(item)) { - item = '.' + item - } - return item - }) - accept = accepts.join(',') - } - let rduri = config.rduri || '' - - if (window.GLOB.systemType === 'production') { - rduri = config.proRduri || '' - } - - this.setState({ - rduri, - accept, - accepts, - filelist, - compress, - limit: config.limit || 2, - maxFile: maxFile, - fileType: config.fileType || 'text' - }) - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) - } - - onChange = ({ fileList }) => { - fileList = fileList.map(item => { - if (item.status === 'error' && /^<!DOCTYPE html>/.test(item.response)) { - item.response = '' - } - return item - }) - - this.setState({filelist: fileList}) - } - - onRemove = file => { - const files = this.state.filelist.filter(v => v.uid !== file.uid) - - this.setState({filelist: files}) - - let vals = [] - - files.forEach(item => { - if (item.origin && item.url) { - vals.push(item.url) - } else if (!item.origin && item.status === 'done' && item.response) { - vals.push(item.response) - } - }) - - this.props.onChange(vals.join(',')) - } - - onUpdate = (url) => { - let filelist = fromJS(this.state.filelist).toJS() - - if (filelist[filelist.length -1]) { - filelist[filelist.length -1].status = 'done' - filelist[filelist.length -1].response = url - filelist[filelist.length -1].origin = false - } - - filelist = filelist.filter(item => !!(item.url || item.response)) - - let vals = [] - - filelist.forEach(item => { - if (item.origin && item.url) { - vals.push(item.url) - } else if (!item.origin && item.status === 'done' && item.response) { - vals.push(item.response) - } - }) - - this.setState({filelist}) - this.props.onChange(vals.join(',')) - } - - onFail = (msg) => { - let filelist = this.state.filelist.map(item => { - if (!item.url && !item.response && !item.status) { - item.status = 'error' - } - return item - }) - - this.setState({filelist, showprogress: false, percent: 0}) - - notification.warning({ - top: 92, - message: msg || '鏂囦欢涓婁紶澶辫触锛�', - duration: 5 - }) - } - - shardupload = (params) => { - let param = params.chunks.shift() - let form = new FormData() - - form.append('file', param.binary) - form.append('fileMd5', params.file.fileMd5) - form.append('shardingMd5', param.chunkMd5) - form.append('baseDomain', window.GLOB.baseurl) - form.append('rootPath', 'Content/images/upload/') - form.append('fileName', params.file.fileName) - form.append('fileExt', params.file.fileType) - form.append('shardingCnt', param.chunks) - form.append('shardingNo', param.chunk) - form.append('LoginUID', sessionStorage.getItem('LoginUID') || '') - form.append('UserID', sessionStorage.getItem('UserID') || '') - - Api.getLargeFileUpload(form).then(res => { - if (res.status) { - if (params.chunks.length > 0) { - this.setState({ - percent: Math.floor(100 * (param.chunk / param.chunks)) - }) - this.shardupload(params) - } else { - if (res.urlPath) { - this.onUpdate(res.urlPath) - } else { - this.onFail() - } - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } - } else { - this.onFail(res.message) - } - }) - } - - getuuid = () => { - let uuid = [] - let _options = '0123456789abcdefghigklmnopqrstuv' - for (let i = 0; i < 19; i++) { - uuid.push(_options.substr(Math.floor(Math.random() * 0x20), 1)) - } - uuid = uuid.join('') - return uuid - } - - beforeUpload = (file) => { - const { accepts, compress, limit, rduri } = this.state - - if (accepts && file.name) { - let pass = false - accepts.forEach(type => { - if (new RegExp(type + '$', 'ig').test(file.name)) { - pass = true - } - }) - - if (!pass) { - setTimeout(() => { - this.onFail('鏂囦欢鏍煎紡閿欒锛�') - }, 10) - return false - } - } - - this.setState({ - showprogress: true, - percent: 0 - }) - - if (compress) { - let reader = new FileReader() - let fileSize = file.size / 1024 / 1024 - let compressRate = 0.9 - - if (fileSize / limit > 5) { - compressRate = 0.4 - } else if (fileSize / limit > 4) { - compressRate = 0.5 - } else if (fileSize / limit > 3) { - compressRate = 0.6 - } else if (fileSize / limit > 2) { - compressRate = 0.7 - } else if (fileSize > limit) { - compressRate = 0.8 - } - - reader.onload = (e) => { - let img = new Image() - let maxW = 640 - - img.onload = () => { - let cvs = document.createElement( 'canvas') - let ctx = cvs.getContext( '2d') - - if (img.width > maxW) { - img.height *= maxW / img.width - img.width = maxW - } - - cvs.width = img.width - cvs.height = img.height - - ctx.clearRect(0, 0, cvs.width, cvs.height) - ctx.drawImage(img, 0, 0, img.width, img.height) - - let param = {Base64Img: cvs.toDataURL('image/jpeg', compressRate)} - - if (this.props.config.compress === 'base64') { - this.onUpdate(param.Base64Img) - - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } else { - if (rduri) { - param.rduri = rduri - } - - Api.fileuploadbase64(param).then(result => { - if (result.status && result.Images) { - let url = window.GLOB.baseurl + result.Images - - if (rduri) { - url = rduri.replace(/webapi(.*)$/, '') + result.Images - } - - this.onUpdate(url) - - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } else { - this.onFail(result.message) - } - }) - } - } - - img.onerror = () => { - this.onFail('鍥剧墖璇诲彇澶辫触锛�') - } - - img.src = e.target.result - } - - reader.onerror = () => { - this.onFail('鏂囦欢璇诲彇澶辫触锛�') - } - - reader.readAsDataURL(file) - return false - } - - // 鍏煎鎬х殑澶勭悊 - let blobSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice - let chunkSize = 1024 * 1024 * 2 // 鍒囩墖姣忔2M - let chunks = Math.ceil(file.size / chunkSize) // 鍒囩墖鎬绘暟 - let currentChunk = 0 // 褰撳墠涓婁紶鐨刢hunk - let spark = new SparkMD5.ArrayBuffer() // 瀵筧rrayBuffer鏁版嵁杩涜md5鍔犲瘑锛屼骇鐢熶竴涓猰d5瀛楃涓� - let chunkFileReader = new FileReader() // 鐢ㄤ簬璁$畻鍑烘瘡涓猚hunkMd5 - let totalFileReader = new FileReader() // 鐢ㄤ簬璁$畻鍑烘�绘枃浠剁殑fileMd5 - let params = {chunks: [], file: {}} // 鐢ㄤ簬涓婁紶鎵�鏈夊垎鐗囩殑md5淇℃伅 - - params.file.fileName = file.name.replace(/\.{1}[^.]*$/ig, '') // 鏂囦欢鍚嶏紙鍘婚櫎鍚庣紑鍚嶏級 - params.file.fileType = file.name.replace(/^.*\.{1}/ig, '') // 鏂囦欢绫诲瀷 - params.file.fileSize = file.size // 鏂囦欢澶у皬 - params.file.fileChunks = chunks // 璁板綍鎵�鏈塩hunks鐨勯暱搴� - - if (!/^[A-Za-z0-9]+$/.test(params.file.fileName)) { // 鏂囦欢鍚嶇О鍚湁鑻辨枃鍙婃暟瀛椾箣澶栧瓧绗︽椂锛屽悕绉扮郴缁熺敓鎴� - params.file.fileName = moment().format('YYYYMMDDHHmmss') + this.getuuid() - } - - totalFileReader.readAsArrayBuffer(file) - totalFileReader.onload = (e) => { // 瀵规暣涓猼otalFile鐢熸垚md5 - spark.append(e.target.result) - params.file.fileMd5 = spark.end() // 璁$畻鏁翠釜鏂囦欢鐨刦ileMd5 - - let _param = new FormData() - _param.append('fileMd5', params.file.fileMd5) - - Api.getFilePreUpload(_param).then(res => { - if (res.status && res.urlPath) { - this.onUpdate(res.urlPath) - this.setState({ - percent: 100 - }, () => { - setTimeout(() => { - this.setState({ - showprogress: false, - percent: 0 - }) - }, 200) - }) - } else if (res.shardings && res.shardings.length > 0) { - res.shardings.forEach(shard => { - if (shard.shardingNo && parseInt(shard.shardingNo) > currentChunk) { - currentChunk = parseInt(shard.shardingNo) - } - }) - loadNext() - } else { - loadNext() - } - }) - } - - chunkFileReader.onload = (e) => { - spark.append(e.target.result) // 瀵规瘡涓�鐗囧垎鐗囪繘琛宮d5鍔犲瘑 - - params.chunks[params.chunks.length - 1].chunkMd5 = spark.end() // 娣诲姞鍒囩墖md5 - - currentChunk++ // 姣忎竴娆″垎鐗噊nload,currentChunk閮介渶瑕佸鍔狅紝浠ヤ究鏉ヨ绠楀垎鐗囩殑娆℃暟 - - if (currentChunk < chunks) { // 褰撳墠鍒囩墖鎬绘暟娌℃湁杈惧埌鎬绘暟鏃� - loadNext() - } else { - this.shardupload(params) - } - } - - chunkFileReader.onerror = () => { - this.onFail('鏂囦欢璇诲彇澶辫触锛�') - } - totalFileReader.onerror = () => { - this.onFail('鏂囦欢璇诲彇澶辫触锛�') - } - - let loadNext = () => { - let start = currentChunk * chunkSize // 璁$畻鍒嗙墖鐨勮捣濮嬩綅缃� - let end = Math.min(file.size, start + chunkSize) // 璁$畻鍒嗙墖鐨勭粨鏉熶綅缃� - - let obj = { // 姣忎竴涓垎鐗囬渶瑕佸寘鍚殑淇℃伅 - chunk: currentChunk + 1, - binary: file.slice(start, end), - start: start, - end: end, - chunks - } - - params.chunks.push(obj) - chunkFileReader.readAsArrayBuffer(blobSlice.call(file, start, end)) - } - - return false - } - - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - } - - render() { - const { showprogress, percent, filelist, maxFile, fileType, accept } = this.state - - let uploadable = 'fileupload-form-container ' - - if (maxFile && filelist.length >= maxFile) { - uploadable += 'limit-fileupload' - } - - const props = { - name: 'file', - disabled: showprogress, - listType: fileType, - fileList: filelist, - action: null, - accept: accept, - method: 'post', - multiple: false, - onChange: this.onChange, - onRemove: this.onRemove, - beforeUpload: this.beforeUpload, - className: uploadable - } - - return ( - <Upload {...props}> - {fileType !== 'picture-card' ? <Button> - <UploadOutlined /> 鐐瑰嚮涓婁紶 - </Button> : null} - {fileType === 'picture-card' ? <span style={{whiteSpace: 'nowrap'}}> - <UploadOutlined /> 鐐瑰嚮涓婁紶 - </span> : null} - {showprogress ? <Progress percent={percent} size="small" /> : null} - </Upload> - ) - } -} - -export default FileUpload \ No newline at end of file diff --git a/src/tabviews/zshare/fileupload-pice/index.scss b/src/tabviews/zshare/fileupload-pice/index.scss deleted file mode 100644 index 86f8505..0000000 --- a/src/tabviews/zshare/fileupload-pice/index.scss +++ /dev/null @@ -1,53 +0,0 @@ -.fileupload-form-container { - .ant-progress-small.ant-progress-line { - position: absolute; - bottom: -20px; - left: 0px; - } - - .ant-upload-select-picture-card { - .ant-progress-small.ant-progress-line { - bottom: 0px; - } - } - .ant-upload-list-picture-card-container { - width: 90px; - height: 90px; - } - // .ant-upload-list-picture-card .ant-upload-list-item-undefined { - // border-color: #f5222d; - // .ant-upload-list-item-name { - // color: #f5222d; - // } - // } - .ant-upload-list-picture-card .ant-upload-list-item { - width: 90px; - height: 90px; - } - .ant-upload.ant-upload-select-picture-card { - width: 90px; - height: 90px; - } - a[href^="data"] { - pointer-events: none; - .anticon-eye-o { - display: none; - } - } -} -.fileupload-form-container.limit-fileupload { - > .ant-upload { - display: inline; - >.ant-upload { - >input { - display: none; - } - >button { - display: none; - } - } - } - > .ant-upload-select-picture-card { - display: none; - } -} \ No newline at end of file diff --git a/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx b/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx index 154b7bd..9d9cb2c 100644 --- a/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx +++ b/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx @@ -289,6 +289,9 @@ if (options.length * config.width > 24) { extend += ' mutile-line' } + if (config.border === 'hide') { + extend += ' border-hide' + } return ( <div className={'check-card-form-box ' + extend}> diff --git a/src/tabviews/zshare/mutilform/mkCheckCard/index.scss b/src/tabviews/zshare/mutilform/mkCheckCard/index.scss index da3fdc4..b97b1d8 100644 --- a/src/tabviews/zshare/mutilform/mkCheckCard/index.scss +++ b/src/tabviews/zshare/mutilform/mkCheckCard/index.scss @@ -5,7 +5,7 @@ border: 1px solid #bcbcbc; background: #ffffff; border-radius: 4px; - padding: 6px; + padding: 4px 6px; margin-bottom: 2px; line-height: 1.5; transition: all 0.3s; @@ -109,9 +109,9 @@ position: relative; border: 1px solid transparent; border-radius: 4px; - padding: 6px; + padding: 4px 6px; margin-bottom: 2px; - min-height: 35px; + min-height: 32px; cursor: pointer; .anticon-check { @@ -187,4 +187,9 @@ .card-cell, .card-pic-cell { cursor: not-allowed; } +} +.check-card-form-box.border-hide { + .card-cell { + border: 0px; + } } \ No newline at end of file diff --git a/src/tabviews/zshare/topSearch/advanceform/index.scss b/src/tabviews/zshare/topSearch/advanceform/index.scss index b16452d..b3cdf80 100644 --- a/src/tabviews/zshare/topSearch/advanceform/index.scss +++ b/src/tabviews/zshare/topSearch/advanceform/index.scss @@ -32,18 +32,6 @@ .ant-calendar-picker-container { z-index: 10 !important; } - .check-card-form-box { - .no-margin-bottom { - margin-bottom: 0px; - } - .card-cell { - padding: 4px 6px; - } - .card-color-cell { - padding: 4px 6px; - min-height: 32px; - } - } .advance-button { position: absolute; left: 0; diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 2ee1aaa..bb8561d 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -25,9 +25,7 @@ class MainSearch extends Component { static propTpyes = { BID: PropTypes.any, // 鐖剁骇Id锛岀敤浜庢煡璇笅鎷夐�夋嫨椤� - searchlist: PropTypes.array, // 鎼滅储鏉′欢鍒楄〃 config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅(鑷畾涔夐〉闈�) - setting: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅(鑷畾涔夐〉闈�) refreshdata: PropTypes.func // 鍒锋柊鏁版嵁 } @@ -43,7 +41,7 @@ sign = '' UNSAFE_componentWillMount () { - const { config, searchlist, setting } = this.props + const { config } = this.props let _searchlist = [] let fieldMap = new Map() @@ -56,43 +54,29 @@ let hasReqFields = false let forbid = false // header涓笉璁剧疆楂樼骇鎼滅储 - let _setting = {showAdv: false, show: false} + let _setting = {showAdv: false, show: false, style: null} - if (setting) { - _setting.show = setting.show !== 'false' - _setting.float = setting.float || 'left' - _setting.advanceType = setting.advanceType || 'modal' - _setting.advWidth = setting.advanceWidth || 1000 - _setting.placement = setting.drawerPlacement || 'right' - _setting.ratio = setting.searchRatio || 6 - _setting.labelwidth = setting.searchLwidth !== undefined ? setting.searchLwidth : 33.3 + if (config.wrap) { + _setting.show = config.wrap.show !== 'false' + _setting.advanceType = config.wrap.advanceType || 'modal' + _setting.advWidth = config.wrap.advanceWidth || 1000 + _setting.placement = config.wrap.drawerPlacement || 'right' + _setting.ratio = config.wrap.searchRatio || 6 + _setting.labelwidth = config.wrap.searchLwidth !== undefined ? config.wrap.searchLwidth : 33.3 _setting.labelCol = {style: {width: _setting.labelwidth + '%'}} _setting.wrapperCol = {style: {width: (100 - _setting.labelwidth) + '%'}} - _setting.style = null - } else if (config) { - if (config.wrap) { - _setting.show = config.wrap.show !== 'false' - _setting.advanceType = config.wrap.advanceType || 'modal' - _setting.advWidth = config.wrap.advanceWidth || 1000 - _setting.placement = config.wrap.drawerPlacement || 'right' - _setting.ratio = config.wrap.searchRatio || 6 - _setting.labelwidth = config.wrap.searchLwidth !== undefined ? config.wrap.searchLwidth : 33.3 - _setting.labelCol = {style: {width: _setting.labelwidth + '%'}} - _setting.wrapperCol = {style: {width: (100 - _setting.labelwidth) + '%'}} - _setting.borderRadius = config.wrap.borderRadius - } - _setting.style = null - - if (config.type === 'search') { - _setting.float = config.wrap.float || 'left' - _setting.style = config.style - } else if (config.type === 'table') { - _setting.float = 'left' - } else { - _setting.float = 'right' - _setting.show = false - forbid = true - } + _setting.borderRadius = config.wrap.borderRadius + } + + if (config.type === 'search') { + _setting.float = config.wrap.float || 'left' + _setting.style = config.style + } else if (config.type === 'table') { + _setting.float = 'left' + } else { + _setting.float = 'right' + _setting.show = false + forbid = true } if (_setting.advanceType === 'drawer' && _setting.advWidth) { @@ -110,11 +94,7 @@ } } - if (searchlist) { - _searchlist = fromJS(searchlist).toJS() - } else if (config) { - _searchlist = fromJS(config.search).toJS() - } + _searchlist = fromJS(config.search).toJS() _searchlist.forEach(item => { if (item.linkField) { diff --git a/src/tabviews/zshare/topSearch/index.scss b/src/tabviews/zshare/topSearch/index.scss index 6ac744d..0f226d7 100644 --- a/src/tabviews/zshare/topSearch/index.scss +++ b/src/tabviews/zshare/topSearch/index.scss @@ -42,18 +42,6 @@ content: '*'; } } - .check-card-form-box { - .no-margin-bottom { - margin-bottom: 0px; - } - .card-cell { - padding: 4px 6px; - } - .card-color-cell { - padding: 4px 6px; - min-height: 32px; - } - } .search-button { min-height: 55px; .ant-btn-link, .ant-btn-link:hover, .ant-btn-link:active{ diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index e55643e..44a0274 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -934,7 +934,7 @@ } }) - if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { + if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { return '鏁版嵁婧愪腑涓嶆墽琛岄粯璁ql锛屼笖鏈坊鍔犺嚜瀹氫箟鑴氭湰锛屼笉鍙惎鐢紒' } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { return '鏁版嵁婧愭湭璁剧疆鍓嶇疆鑴氭湰锛屼笉鍙惎鐢紒' diff --git a/src/templates/modalconfig/checkCard/index.jsx b/src/templates/modalconfig/checkCard/index.jsx index 558e172..0813fd3 100644 --- a/src/templates/modalconfig/checkCard/index.jsx +++ b/src/templates/modalconfig/checkCard/index.jsx @@ -25,7 +25,7 @@ } let cls = '' - if (_options.length * width <= 24 && this.state.appType !== 'mob') { + if (_options.length * width <= 24) { cls = 'no-margin-bottom' } if (display === 'picture') { @@ -104,8 +104,10 @@ } render() { + const { config } = this.props + return ( - <div className="check-card-edit-box" style={{marginTop: '5px'}}> + <div className={'check-card-edit-box border-' + (config.border || 'show')} style={{marginTop: '5px'}}> <Row gutter={12}>{this.getCards()}</Row> </div> ) diff --git a/src/templates/modalconfig/checkCard/index.scss b/src/templates/modalconfig/checkCard/index.scss index 52cb625..4d08015 100644 --- a/src/templates/modalconfig/checkCard/index.scss +++ b/src/templates/modalconfig/checkCard/index.scss @@ -7,7 +7,7 @@ position: relative; border: 1px solid #bcbcbc; border-radius: 4px; - padding: 6px; + padding: 4px 6px; margin-bottom: 12px; .bg-mask { @@ -46,11 +46,11 @@ .card-color-cell { border: 1px solid transparent; border-radius: 4px; - padding: 6px; + padding: 4px 6px; background-size: cover; background-position: center; margin-bottom: 12px; - min-height: 35px; + min-height: 32px; } .content-line { @@ -64,4 +64,9 @@ .no-margin-bottom { margin-bottom: 2px; } +} +.check-card-edit-box.border-hide { + .card-cell { + border: 0px; + } } \ No newline at end of file diff --git a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx index d3d1ea1..0661538 100644 --- a/src/templates/sharecomponent/actioncomponent/actionform/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/actionform/index.jsx @@ -148,7 +148,7 @@ reOptions.intertype = this.state.interTypeOptions if (intertype === 'custom') { - shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross') + shows.push('procMode', 'interface', 'callbackType', 'proInterface', 'method', 'cross', 'stringify') if (this.record.procMode === 'system') { shows.push('sql', 'sqlType') } else if (this.record.procMode === 'inner') { diff --git a/src/templates/sharecomponent/searchcomponent/index.scss b/src/templates/sharecomponent/searchcomponent/index.scss index 9ba3f42..3b00b21 100644 --- a/src/templates/sharecomponent/searchcomponent/index.scss +++ b/src/templates/sharecomponent/searchcomponent/index.scss @@ -66,18 +66,6 @@ padding: 4px 20px 4px 5px; font-size: 13px; } - .check-card-edit-box { - .no-margin-bottom { - margin-bottom: 0px; - } - .card-cell { - padding: 4px 6px; - } - .card-color-cell { - padding: 4px 6px; - min-height: 32px; - } - } } .ant-form-explain { display: none; diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index 95350b6..67cb5a2 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -207,9 +207,9 @@ } else { reRequired.fields = true if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� - shows.push('options', 'fields', 'selectStyle') + shows.push('options', 'fields', 'selectStyle', 'border') } else if (this.record.resourceType === '1') { // 鏁版嵁婧� - shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle') + shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'database', 'selectStyle', 'border') } if (this.record.selectStyle === 'custom') { shows.push('backgroundColor') diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 524b4f1..19bfb12 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -784,7 +784,7 @@ } }) - if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { + if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) { return '鏁版嵁婧愪腑涓嶆墽琛岄粯璁ql锛屼笖鏈坊鍔犺嚜瀹氫箟鑴氭湰锛屼笉鍙惎鐢紒' } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) { return '鏁版嵁婧愭湭璁剧疆鍓嶇疆鑴氭湰锛屼笉鍙惎鐢紒' diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 9512ea7..d3ee589 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -472,12 +472,12 @@ { type: 'number', key: 'width', - min: 1, + min: 0, max: 24, precision: 0, label: '鍏冪礌瀹藉害', - initVal: card.width || 4, - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + initVal: card.width === 0 ? 0 : (card.width || 4), + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼�傛敞锛氬綋瀹藉害涓�0鏃讹紝鍏冪礌鏍规嵁鍐呭鑷�傚簲', required: true }, { @@ -822,6 +822,20 @@ }, { value: 'search', text: '鎼滅储妗�' + }] + }, + { + type: 'radio', + key: 'border', + label: '杈规', + initVal: card.border || 'show', + required: false, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hide', + text: '闅愯棌' }] }, { @@ -1204,35 +1218,6 @@ }, { type: 'radio', - key: 'method', - label: '璇锋眰鏂瑰紡', - initVal: card.method || 'post', - required: true, - options: [{ - value: 'get', - text: 'GET' - }, { - value: 'post', - text: 'POST' - }] - }, - { - type: 'radio', - key: 'cross', - label: '璺ㄥ煙璇锋眰', - initVal: card.cross || 'true', - tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', - required: false, - options: [{ - value: 'true', - text: '鏀寔' - }, { - value: 'false', - text: '涓嶆敮鎸�' - }] - }, - { - type: 'radio', key: 'callbackType', label: '鍥炶皟鏂瑰紡', initVal: card.callbackType || (card.callbackFunc ? 'func' : 'none'), @@ -1266,6 +1251,52 @@ initVal: card.callbackFunc || '', required: true, readonly: false + }, + { + type: 'radio', + key: 'method', + label: '璇锋眰鏂瑰紡', + initVal: card.method || 'post', + required: true, + options: [{ + value: 'get', + text: 'GET' + }, { + value: 'post', + text: 'POST' + }] + }, + { + type: 'radio', + key: 'cross', + label: '鎺ュ彛璺ㄥ煙', + initVal: card.cross || 'true', + tooltip: '濡傛灉鑷畾涔夋帴鍙d笉鏀寔璺ㄥ煙璇锋眰锛屼細閫氳繃褰撳墠绯荤粺杞彂銆�', + required: false, + options: [{ + value: 'true', + text: '鏀寔' + }, { + value: 'false', + text: '涓嶆敮鎸�' + }] + }, + { + type: 'radio', + key: 'stringify', + label: '搴忓垪鍖�', + initVal: card.stringify || 'text', + required: false, + options: [{ + value: 'text', + text: 'Text' + }, { + value: 'JSON', + text: 'JSON' + }, { + value: 'qs', + text: 'qs' + }] }, { type: 'radio', @@ -2769,12 +2800,12 @@ { type: 'number', key: 'width', - min: 1, + min: 0, max: 24, precision: 0, label: '鍏冪礌瀹藉害', - initVal: card.width || 4, - tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼��', + initVal: card.width === 0 ? 0 : (card.width || 4), + tooltip: '鏍呮牸甯冨眬锛屾瘡琛岀瓑鍒嗕负24鍒椼�傛敞锛氬綋瀹藉害涓�0鏃讹紝鍏冪礌鏍规嵁鍐呭鑷�傚簲', required: true }, { @@ -3404,6 +3435,20 @@ }, { type: 'radio', + key: 'border', + label: '杈规', + initVal: card.border || 'show', + required: false, + options: [{ + value: 'show', + text: '鏄剧ず' + }, { + value: 'hide', + text: '闅愯棌' + }] + }, + { + type: 'radio', key: 'selectStyle', label: '閫変腑鏁堟灉', tooltip: '鑳屾櫙鍙婃枃瀛楀彉鍖栨椂浼氫娇鐢ㄧ郴缁熻壊銆�', diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index e766b8b..27260e3 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -204,9 +204,9 @@ } else { reRequired.fields = true if (this.record.resourceType === '0') { // 鑷畾涔夎祫婧� - shows.push('options', 'fields', 'selectStyle') + shows.push('options', 'fields', 'selectStyle', 'border') } else if (this.record.resourceType === '1') { // 鏁版嵁婧� - shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle') + shows.push('dataSource', 'cardValField', 'fields', 'orderBy', 'orderType', 'disableField', 'database', 'selectStyle', 'border') } if (this.record.selectStyle === 'custom') { shows.push('backgroundColor') diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index c081694..df476aa 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -18,7 +18,7 @@ static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id) { let param = null - if (setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) { + if (setting.interType === 'system') { param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, id, BID) } else { param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, id) @@ -52,7 +52,7 @@ param.PageSize = pageSize } - if (setting.interType === 'inner' || (setting.interType === 'custom' && setting.requestMode === 'inner')) { + if (setting.interType === 'inner') { param.func = setting.innerFunc } else { if (window.GLOB.mkHS) { @@ -267,25 +267,6 @@ param.LText = Utils.formatOptions(LText) param.DateCount = Utils.formatOptions(DateCount) - // 澶氬眰缁撴瀯鏁版嵁 - // LText = `SELECT a.id as bid,a.ID,a.workerCode,a.workerName,a.jobName,a.Initials,case when isnull(m.friend_id ,'') ='' then '' - // when isnull(m.status,0)=10 then '宸叉坊鍔�' else '寰呴�氳繃' end as friend_text - // ,case when images='' then 'http://epc.mk9h.cn/Content/images/upload/img/kane.jpg' else images end as icon FROM - // (select friend_id,status from oa_mail_list where userid='sso202004100959326131C0805998B6745F886F9' and Initials=case when right('0',1)='0' then Initials else '0' end - // and status=10 and deleted=0) m - // inner join (select * from BD_workers where - // Initials=case when right('0',1)='0' then Initials else '0' end and deleted=0 ) a - // on a.id=m.friend_id ` - // param.custom_script = '' - // param.LText = Utils.formatOptions(LText) - // param.DateCount = '' - // param.prm_field = 'workerCode' - // param.arr_field = 'workerName,jobName' - // param.tabid = 'ID' - // param.parid = 'BID' - // param.sub_name = 'sub_data' - // param.sub_field = 'BID,friend_text,icon,Initials' - if (setting.sub_field) { param.sub_name = setting.subdata param.tabid = setting.primaryKey || '' @@ -466,287 +447,6 @@ } return param - } - - /** - * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ - * @param {Object} setting 鏁版嵁婧愯缃� - * @param {String} arrFields 鏌ヨ瀛楁 - * @param {Array} search 鎼滅储鏉′欢 - * @param {String} orderBy 鎺掑簭鏂瑰紡 - * @param {Number} pageIndex 椤电爜 - * @param {Number} pageSize 姣忛〉鏁伴噺 - * @param {String} BID 涓婄骇ID - * @return {Object} param - */ - static getPrevQueryParams (setting, search = [], BID) { - let param = null - if (setting.procMode !== 'inner') { - param = this.getDefaultPrevQueryParam(setting, search, BID) - } else { - param = Utils.formatCustomMainSearch(search) - param.func = setting.prevFunc || '' - } - - if (BID) { - param.BID = BID - } - - return param - } - - /** - * @description 鑾峰彇绯荤粺鍓嶇疆鑴氭湰 - */ - static getDefaultPrevQueryParam (setting, search, BID) { - let param = { - func: 'sPC_TableData_InUpDe', - exec_type: 'y', - script_type: 'Y' - } - - let sql = '' - 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') || '' - - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } - - setting.preScripts.forEach(item => { - if (item.status === 'false') return - sql += `${item.sql} - ` - }) - - if (sql) { - 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) - 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}' - ${sql} - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ - ` - - let allSearch = Utils.getAllSearchOptions(search) - allSearch.forEach(item => { - sql = sql.replace(new RegExp('@' + item.key + '@', 'ig'), `'${item.value}'`) - }) - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - sql = sql.replace(/\$@/ig, '/*') - sql = sql.replace(/@\$/ig, '*/') - } else { - sql = sql.replace(/@\$|\$@/ig, '') - } - - sql = sql.replace(/@userName@/ig, `'${userName}'`) - sql = sql.replace(/@fullName@/ig, `'${fullName}'`) - - sql = sql.replace(/@ID@/ig, `''`) - 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(/@typename@/ig, `'admin'`) - - // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞 - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { - console.info(sql.replace(/\n\s{8}/ig, '\n')) - } - } - - param.LText = Utils.formatOptions(sql) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - - if (window.GLOB.mkHS) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - if (setting.$name) { - param.menuname = setting.$name - } - - return param - } - - /** - * @description 鑾峰彇绯荤粺鍥炶皟鑴氭湰 - */ - static getCallBackQueryParams (setting, sql, errSql, BID) { - let param = { - func: 'sPC_TableData_InUpDe', - exec_type: 'y', - } - - 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') || '' - - if (sessionStorage.getItem('isEditState') === 'true') { - userName = sessionStorage.getItem('CloudUserName') || '' - fullName = sessionStorage.getItem('CloudFullName') || '' - } - - let _prevCustomScript = `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) - 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}' - ${errSql} - ` - let _backCustomScript = ` - ` - - setting.cbScripts.forEach(script => { - if (script.status === 'false') return - - if (script.position === 'front') { - _prevCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${script.sql} - ` - } else { - _backCustomScript += ` - /* 鑷畾涔夎剼鏈� */ - ${script.sql} - ` - } - }) - - _backCustomScript += ` - aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg` - - sql = _prevCustomScript + sql - sql = sql + _backCustomScript - - if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - sql = sql.replace(/\$@/ig, '/*') - sql = sql.replace(/@\$/ig, '*/') - } else { - sql = sql.replace(/@\$|\$@/ig, '') - } - - sql = sql.replace(/@ID@/ig, `''`) - 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(/@typename@/ig, `'admin'`) - - if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) { - console.info(sql.replace(/\n\s{8}/ig, '\n')) - } - - param.LText = sql - - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt('', param.timestamp) - param.LText = Utils.formatOptions(param.LText) - - if (setting.$name) { - param.menuname = setting.$name - } - - if (BID) { - param.BID = BID - } - - if (window.GLOB.mkHS) { // 绯荤粺鍑芥暟浜戠楠岃瘉 - param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) - } - - return param - } - - /** - * @description 鑾峰彇鍥炶皟sql - */ - static getCallBackSql (setting, result) { - let lines = [] - let pre = setting.callbackType === 'script' ? '@' : '' - - let getDefaultSql = (obj, tb, bid, level) => { - let keys = [] - let vals = [] - let subObjs = [] - let id = Utils.getuuid() - - delete obj.$$key - - Object.keys(obj).forEach(key => { - let val = obj[key] - if (val === null || val === undefined) return - if (typeof(val) === 'object') { - if (Array.isArray(val)) { - val.forEach(item => { - if (typeof(item) !== 'object' || Array.isArray(item)) return - if (Object.keys(item).length > 0) { - item.$$key = tb + '_' + key - subObjs.push(item) - } - }) - } else if (Object.keys(val).length > 0) { - val.$$key = tb + '_' + key - subObjs.push(val) - } - } else { - if (typeof(val) === 'string') { - val = val.replace(/'/ig, '"') - } - keys.push(key) - vals.push(`'${val}'`) - } - }) - - lines.push({ - table: tb, - insert: `Insert into ${pre}${tb} (${keys.join(',')},mk_level,mk_id,mk_bid)`, - select: `Select ${vals.join(',')},'${level}','${id}','${bid}'` - }) - - subObjs.forEach(item => { - getDefaultSql(item, item.$$key, id, level + 1) - }) - } - - getDefaultSql(result, setting.cbTable, '', 1) - - let lineMap = new Map() - lines.forEach(line => { - if (lineMap.has(line.table)) { - let _line = lineMap.get(line.table) - _line.selects.push(line.select) - lineMap.set(line.table, _line) - } else { - lineMap.set(line.table, { - table: line.table, - insert: line.insert, - selects: [line.select] - }) - } - }) - - return [...lineMap.values()] } } diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 80c0c73..44b5c39 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -326,16 +326,10 @@ // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key") // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4") - // 鑾峰彇ip鍙婂煄甯備俊鎭� - // let ipurl = window.atob('aHR0cHM6Ly9lcGMubWs5a$mkC5jbi93ZWJhcGkvaXBsb2M='.replace(/\$mk/ig, '')) - // Api.directRequest(ipurl, 'get', null, 'true').then(res => { - // if (!res || !res.ip) return - // sessionStorage.setItem('ipAddress', res.ip) - // }) - setTimeout(() => { Api.delCacheConfig() }, 50) + if (window.GLOB.filter) { let view = document.getElementById('mk-login-view') @@ -497,7 +491,11 @@ param.sign = md5(values) param.t = new Date().getTime() - Api.directRequest(_rduri + '/' + _func, 'post', param, 'true').then(res => { + Api.directRequest({ + url: _rduri + '/' + _func, + method: 'post', + data: JSON.stringify(param) + }).then(res => { if (res.status) { if (res.EPC === str) { let box = [] diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index eac50e4..fdf22ba 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -73,6 +73,13 @@ } UNSAFE_componentWillMount() { + if (sessionStorage.getItem('devError') === 'true') { + sessionStorage.clear() + window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') + window.location.reload() + return + } + if (!sessionStorage.getItem('UserID')) { sessionStorage.removeItem('isEditState') sessionStorage.removeItem('appType') @@ -87,6 +94,7 @@ window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 window.GLOB.urlFields = [] // url鍙橀噺 window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + window.GLOB.developing = true try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) @@ -864,8 +872,6 @@ menuloading: true }) - window.GLOB.saving = true - setTimeout(() => { let _pass = this.verifyConfig(config) @@ -1029,8 +1035,6 @@ menuloading: false }) - window.GLOB.saving = false - if (!res) return if (res.status) { @@ -1055,8 +1059,6 @@ this.setState({ menuloading: false }) - - window.GLOB.saving = false if (!error) { notification.warning({ diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 9fca5e9..7c8d241 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -81,6 +81,13 @@ } UNSAFE_componentWillMount() { + if (sessionStorage.getItem('devError') === 'true') { + sessionStorage.clear() + window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') + window.location.reload() + return + } + if (!sessionStorage.getItem('UserID')) { sessionStorage.removeItem('isEditState') sessionStorage.removeItem('editMenuType') @@ -90,6 +97,9 @@ } if (memberLevel < 30) return + + window.GLOB.developing = true + try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) @@ -1440,8 +1450,6 @@ menuloading: true }) - window.GLOB.saving = true - setTimeout(() => { let _pass = this.verifyConfig(config) @@ -1699,8 +1707,6 @@ menuloading: false }) - window.GLOB.saving = false - if (!res) return if (res.status) { @@ -1735,8 +1741,6 @@ this.setState({ menuloading: false }) - - window.GLOB.saving = false if (!error) { notification.warning({ diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 2badd14..a8dcca3 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -76,6 +76,13 @@ } UNSAFE_componentWillMount() { + if (sessionStorage.getItem('devError') === 'true') { + sessionStorage.clear() + window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') + window.location.reload() + return + } + if (!sessionStorage.getItem('UserID')) { sessionStorage.removeItem('isEditState') sessionStorage.removeItem('appType') @@ -92,6 +99,7 @@ window.GLOB.CacheIndependent = new Map() window.GLOB.urlFields = [] // url鍙橀噺 window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + window.GLOB.developing = true try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) @@ -1178,8 +1186,6 @@ menuloading: true }) - window.GLOB.saving = true - setTimeout(() => { let _pass = this.verifyConfig(config) @@ -1419,8 +1425,6 @@ menuloading: false }) - window.GLOB.saving = false - if (!res) return if (res.status) { @@ -1456,8 +1460,6 @@ menuloading: false }) - window.GLOB.saving = false - if (!error) { notification.warning({ top: 92, diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 25d0d54..759be21 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -63,6 +63,13 @@ } UNSAFE_componentWillMount() { + if (sessionStorage.getItem('devError') === 'true') { + sessionStorage.clear() + window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') + window.location.reload() + return + } + if (!sessionStorage.getItem('UserID')) { sessionStorage.removeItem('isEditState') sessionStorage.removeItem('appType') @@ -77,6 +84,7 @@ window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 window.GLOB.urlFields = [] // url鍙橀噺 window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 + window.GLOB.developing = true try { let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) @@ -576,8 +584,6 @@ menuloading: true }) - window.GLOB.saving = true - setTimeout(() => { let _pass = this.verifyConfig(config) @@ -680,8 +686,6 @@ menuloading: false }) - window.GLOB.saving = false - if (!res) return if (res.status) { @@ -706,8 +710,6 @@ this.setState({ menuloading: false }) - - window.GLOB.saving = false if (!error) { notification.warning({ -- Gitblit v1.8.0