From a29d9d644a2a30e9ef4afcc6d728c20c218dc359 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 15 六月 2023 14:25:28 +0800 Subject: [PATCH] 2023-06-15 --- src/templates/zshare/modalform/index.jsx | 4 src/utils/utils-datamanage.js | 304 ------------- src/tabviews/zshare/mutilform/mkCheckCard/index.scss | 11 src/tabviews/zshare/mutilform/mkCheckCard/index.jsx | 3 src/tabviews/zshare/topSearch/index.jsx | 64 +- src/templates/zshare/formconfig.jsx | 40 + src/templates/comtableconfig/index.jsx | 2 src/templates/modalconfig/checkCard/index.scss | 11 src/templates/subtableconfig/index.jsx | 2 src/tabviews/calendar/index.jsx | 20 src/templates/modalconfig/checkCard/index.jsx | 6 src/api/index.js | 32 - 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/topSearch/advanceform/index.scss | 12 src/tabviews/zshare/actionList/normalbutton/index.jsx | 122 +++++ src/menu/components/search/main-search/index.scss | 12 src/templates/sharecomponent/searchcomponent/index.scss | 12 src/assets/css/main.scss | 4 src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 4 src/views/login/index.jsx | 14 23 files changed, 303 insertions(+), 1,015 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index b502ec1..71a531d 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -169,38 +169,8 @@ /** * @description 鐩存帴璇锋眰 - * @param {Object} param 鏌ヨ鍙婃彁浜ゅ弬鏁� */ - 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) } 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/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/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/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..dad5061 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -832,6 +832,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 +1243,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 +1266,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 +1360,32 @@ 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) !== '{}') { + _params.data = param + } + } else { + let _url = url + if (_params.method === 'get' && JSON.stringify(param) !== '{}') { + let keys = Object.keys(param).map(key => `${key}=${param[key]}`) + _url = _url + '?' + keys.join('&') + } else if (_params.method === 'post') { + _params.data = 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 = '鏈煡鐨勮繑鍥炵粨鏋滐紒' 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/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..f14d109 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: '闅愯棌' }] }, { @@ -2769,12 +2783,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 +3418,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 da7b51b..f7a7d70 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -281,16 +281,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') @@ -452,7 +446,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: param + }).then(res => { if (res.status) { if (res.EPC === str) { let box = [] -- Gitblit v1.8.0