From 0c1a33a33b45fc3265cb7fef20beb48407cd6c98 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 八月 2023 14:54:06 +0800 Subject: [PATCH] 2023-08-24 --- src/views/systemproc/proc/index.jsx | 4 src/views/design/index.jsx | 10 + src/menu/datasource/verifycard/utils.jsx | 84 +++++------ src/tabviews/custom/components/card/prop-card/index.jsx | 6 src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 2 src/utils/utils-datamanage.js | 16 +- src/menu/datasource/verifycard/settingform/index.jsx | 7 src/menu/datasource/verifycard/customscript/index.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 9 src/tabviews/custom/popview/index.jsx | 16 + src/tabviews/zshare/mutilform/index.jsx | 54 ++++++- src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx | 53 +++++-- src/tabviews/basetable/index.jsx | 16 + src/views/systemfunc/index.jsx | 43 +++-- src/tabviews/custom/index.jsx | 15 + src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx | 34 +++- src/views/systemproc/index.jsx | 9 + src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx | 7 src/menu/datasource/verifycard/index.jsx | 2 src/tabviews/custom/components/card/data-card/index.jsx | 4 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 2 21 files changed, 261 insertions(+), 134 deletions(-) diff --git a/src/menu/datasource/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx index 7e7af73..63146d0 100644 --- a/src/menu/datasource/verifycard/customscript/index.jsx +++ b/src/menu/datasource/verifycard/customscript/index.jsx @@ -312,7 +312,7 @@ <Form.Item label="鍙敤瀛楁" className="field-able"> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鍏叡鍊硷紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆�'}><span style={{color: '#1890ff'}}>BID, LoginUID, SessionUid, UserID, Appkey, time_id, typename</span></Tooltip>, <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'绯荤粺鍙橀噺锛岀郴缁熶細瀹氫箟鍙橀噺骞惰祴鍊笺��'}><span style={{color: '#fa8c16'}}>UserName, FullName, RoleID, mk_departmentcode, mk_organization, mk_user_type, mk_nation, mk_province, mk_city, mk_district, mk_address</span></Tooltip>, - <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎺掑簭銆佸垎椤典互鍙婃悳绱㈡潯浠跺彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆備娇鐢ˊpageSize@浠h〃鑷畾涔夊垎椤碉紝鎬绘暟璇蜂互mk_total杩斿洖銆�'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> + <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'鎺掑簭銆佸垎椤典互鍙婃悳绱㈡潯浠跺彉閲忥紝璇锋寜鐓xxx@鏍煎紡浣跨敤銆備娇鐢ˊpageSize@鎴朄orderBy@浠h〃鑷畾涔夊垎椤碉紝鎬绘暟璇蜂互mk_total杩斿洖銆�'}>orderBy, pageSize, pageIndex{usefulFields ? ', ' + usefulFields : ''}{type === 'calendar' ? ', mk_year' : ''}</Tooltip> <Tooltip mouseLeaveDelay={0.3} mouseEnterDelay={0.3} placement="top" title={'url鍙橀噺锛岃鎸夌収@xxx@鏍煎紡浣跨敤銆�'}>{urlFields ? ', ' : ''}<span style={{color: '#13c2c2'}}>{urlFields}</span></Tooltip> </Form.Item> </Col> diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 1f73ba2..8cc92cc 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -137,7 +137,7 @@ width: '10%', render: (text, record) => { if (record.position === 'back') { - return <span style={{color: 'orange'}}>鍚庣疆</span> + return <span style={{color: '#1890ff'}}>鍚庣疆</span> } else { return <span style={{color: '#26C281'}}>鍓嶇疆</span> } diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index c47b78b..6d5fa3e 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -406,7 +406,12 @@ </Col> {/* 鏁扮粍鏁版嵁锛岄渶璁剧疆鎺掑簭瑙勫垯 */} {config.format === 'array' ? <Col span={8}> - <Form.Item label="榛樿鎺掑簭"> + <Form.Item label={ + <Tooltip placement="topLeft" title="濡傛灉鍦ㄨ嚜瀹氫箟鑴氭湰涓娇鐢ㄤ簡@pageSize@鎴朄orderBy@锛岃鍦ㄦ暟鎹簮涓崟鐙啓鎺掑簭璇彞銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 榛樿鎺掑簭 + </Tooltip> + }> {getFieldDecorator('order', { initialValue: setting.order || 'ID desc', rules: [ diff --git a/src/menu/datasource/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx index e1efa0b..71bb2b5 100644 --- a/src/menu/datasource/verifycard/utils.jsx +++ b/src/menu/datasource/verifycard/utils.jsx @@ -11,13 +11,20 @@ let sql = '' let error = '' let _dataresource = '' - let _customScript = '' let arr_field = columns.map(item => item.field).join(',') - - scripts.forEach(item => { - _customScript += ` - ${item.sql} - ` + let _customScript = '' + let _tailScript = '' + scripts && scripts.forEach(script => { + if (script.status === 'false') return + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } }) if (!arr_field) { @@ -26,6 +33,10 @@ if (setting.interType === 'system' && setting.execute !== 'false') { _dataresource = setting.dataresource || '' + } + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' } if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { @@ -38,16 +49,17 @@ _dataresource = _dataresource.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) _customScript = _customScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) + _tailScript = _tailScript.replace(/@(BID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|upid|typename)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '') + _dataresource = _dataresource.replace(/@select\$|\$select@/ig, '') _customScript = _customScript.replace(/@select\$|\$select@/ig, '') - // _dataresource = _dataresource.replace(/@sum\$|\$sum@/ig, '') _customScript = _customScript.replace(/@sum\$|\$sum@/ig, '') - - _dataresource = _dataresource.replace(/\$sum@/ig, '/*$sum@') - _dataresource = _dataresource.replace(/@sum\$/ig, '@sum$*/') + _dataresource = _dataresource.replace(/\$sum@/ig, '/*') + _dataresource = _dataresource.replace(/@sum\$/ig, '*/') if (type === 'calendar') { _dataresource = _dataresource.replace(/@mk_year@/ig, '') @@ -64,6 +76,7 @@ if (window.GLOB.externalDatabase !== null) { _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) + _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) } if (window.GLOB.urlFields) { @@ -71,12 +84,14 @@ let reg = new RegExp('@' + field + '@', 'ig') _dataresource = _dataresource.replace(reg, `'0'`) _customScript = _customScript.replace(reg, `'0'`) + _tailScript = _tailScript.replace(reg, `'0'`) }) } // 姝e垯鏇挎崲 let _regoptions = [] let _fields = [] + let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript) searches.forEach(item => { if (!item.field) return @@ -142,6 +157,7 @@ _regoptions.forEach(item => { _dataresource = _dataresource.replace(item.reg, '0') _customScript = _customScript.replace(item.reg, '0') + _tailScript = _tailScript.replace(item.reg, '0') }) let _search = defSearch @@ -150,36 +166,14 @@ _search = '' } - let sumSql = '' - - if (_dataresource && /\/\*\$sum@/ig.test(_dataresource)) { - let _sql = _dataresource.replace(/\/\*\$sum@|@sum\$\*\//ig, '') - _sql = `/*system_query*/${_sql} ${_search}` - if (_customScript) { - sumSql = `/* sql sum楠岃瘉 */ - ${_customScript} - ${_sql} - aaa: - if @ErrorCode!='' - insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' - ` - } else { - sumSql = `/* sql sum楠岃瘉 */ - 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 ='' - ${_sql}` - } - } - // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (_dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (setting.order) { + if (custompage) { + _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` + } else if (setting.order) { _dataresource = `/*system_query*/select${setting.laypage === 'true' ? ' top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage === 'true' ? 'where rows > 0' : ''} order by tmptable.rows` } else { - _dataresource = `/*system_query*/select${setting.laypage === 'true' ? ' top 10' : ''} ${arr_field} from ${_dataresource} ${_search}` + _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` } } @@ -187,9 +181,19 @@ sql = `/* sql 楠岃瘉 */ ${_customScript} ${_dataresource} + ${_tailScript} aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' + ` + } else if (_tailScript) { + 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 ='' + ${_dataresource} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select '${timestamp}',@ErrorCode, @retmsg,'${timestamp}' ` } else { sql = `/* sql 楠岃瘉 */ @@ -244,14 +248,8 @@ }) } - if (sumSql) { - sumSql = sumSql.replace(/\n\s{10}/ig, '\n') - - console.info(sumSql) - sumSql = sumSql.replace(/\n/g, ' ') - } sql = sql.replace(/\n/g, ' ') - return { error, sql, sumSql, errors: errors.join('锛�') } + return { error, sql, errors: errors.join('锛�') } } } \ No newline at end of file diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 3eff170..82a0fe4 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -505,9 +505,15 @@ } let _customScript = '' + let _tailScript = '' component.scripts && component.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -527,21 +533,23 @@ if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (component.setting.laypage) { - component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) - } + component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) component.setting.delay = delay delay += 20 diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 084a03c..3258dde 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -282,7 +282,9 @@ return item }) - this.setState({data: _data}) + this.setState({data: _data}, () => { + this.prevCheck() + }) }) } } else { diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 3f6d02c..f114efa 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -190,7 +190,11 @@ let _data = res.data[0] || {$$empty: true} _data.$$uuid = _data[config.setting.primaryKey] || '' - this.setState({data: _data}) + this.setState({data: _data}, () => { + if (selected !== 'false') { + this.checkTopLine() + } + }) }) } else { if (config.wrap.goback === 'true' && data.$$empty) { diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index fbdce49..195ad72 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -713,6 +713,11 @@ group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' } + if (item.$cache && item.$time) { + group.$cache = item.$cache + group.$time = item.$time + } + group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { @@ -826,6 +831,10 @@ cell.errorType = 'error2' } } + } else if (cell.OpenType === 'pop' && item.$cache && item.$time && cell.modal) { + cell.modal.$cache = item.$cache + cell.modal.$time = item.$time + cell.modal.uuid = cell.uuid + 'pop' } if (cell.syncComponentId) { @@ -1007,9 +1016,7 @@ component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (component.setting.laypage) { - component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) - } + component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) if (component.setting.sync === 'true') { // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ @@ -1143,6 +1150,8 @@ inter.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 inter.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� + inter.setting.custompage = /@pageSize@|@orderBy@/i.test(inter.setting.dataresource + inter.setting.customScript) + return inter }) } diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index 5fc621c..edc4113 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -748,9 +748,15 @@ } let _customScript = '' + let _tailScript = '' component.scripts && component.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -770,21 +776,23 @@ if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� - if (component.setting.laypage) { - component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) - } + component.setting.custompage = /@pageSize@|@orderBy@/i.test(component.setting.dataresource + component.setting.customScript) if (component.setting.sync === 'true') { // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 30bcbf7..3dfd201 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -818,6 +818,10 @@ _setting.dataresource = '' } + if (/\s/.test(_setting.dataresource)) { + _setting.dataresource = '(' + _setting.dataresource + ') tb' + } + let _customScript = '' let _tailScript = '' btn.verify.scripts && btn.verify.scripts.forEach(script => { @@ -847,10 +851,7 @@ _setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� _setting.laypage = pagination - - if (_setting.laypage) { - _setting.custompage = /@pageSize@/i.test(_setting.dataresource + _setting.customScript) - } + _setting.custompage = /@pageSize@|@orderBy@/i.test(_setting.dataresource + _setting.customScript) _setting.queryType = btn.verify.queryType _setting.$name = btn.logLabel diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 33e80b9..e9a26ed 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -610,8 +610,9 @@ } this.record = record + let ID = this.props.data ? this.props.data.$$uuid || '' : '' - this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => { + this.setState({ formlist, ID }, () => { if (unload) return if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) { @@ -629,13 +630,29 @@ } if (deForms.length > 0) { - if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { - this.improveSimpleActionForm(deForms) + if (action.$cache && action.setting.cache !== 'false') { + Api.getLCacheConfig(action.uuid, action.$time, this.props.BID, ID).then(res => { + if (!res.valid) { + this.getFormData(deForms) + } else { + this.resetFormList(res.data, true) + } + }) } else { - this.improveActionForm(deForms) + this.getFormData(deForms) } } }) + } + + getFormData = (deForms) => { + if (deForms.length === 1) { + this.improveSimpleActionForm(deForms) + } else if (!window.GLOB.mkHS && window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { + this.improveSimpleActionForm(deForms) + } else { + this.improveActionForm(deForms) + } } /** @@ -647,8 +664,8 @@ let deffers = [] let mainItems = [] // 浜戠鎴栧崟鐐规暟鎹� let localItems = [] // 鏈湴鏁版嵁 - let cache = action.setting.cache !== 'false' - let debug = window.GLOB.debugger === true + let cache = action.setting.cache !== 'false' && !action.$cache + let skip = false let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` let _sso = _sql @@ -661,7 +678,7 @@ sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) sql = sql.replace(/@BID@/ig, `'${BID}'`) - if (debug) { + if (window.GLOB.debugger === true) { console.info(sql) } @@ -675,7 +692,7 @@ sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`) sql = sql.replace(/@BID@/ig, `'${BID}'`) - if (debug) { + if (window.GLOB.debugger === true) { console.info(sql) } @@ -712,6 +729,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -753,6 +771,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -768,7 +787,7 @@ delete result.message delete result.status - this.resetFormList(result) + this.resetFormList(result, skip) }) } @@ -776,8 +795,11 @@ * @description 娴嬭瘯绯荤粺鑾峰彇涓嬫媺琛ㄥ崟閫夐」淇℃伅 */ improveSimpleActionForm = (deForms) => { - let cache = this.props.action.setting.cache !== 'false' + const { action } = this.props + + let cache = this.props.action.setting.cache !== 'false' && !action.$cache let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20) select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n` + let skip = false let deffers = deForms.map((form, index) => { let param = { @@ -812,6 +834,7 @@ message: res.message, duration: 5 }) + skip = true } resolve(res) }) @@ -822,6 +845,7 @@ Promise.all(deffers).then(response => { let result = {} + response.forEach(res => { result = {...result, ...res} }) @@ -831,11 +855,17 @@ delete result.message delete result.status - this.resetFormList(result) + this.resetFormList(result, skip) }) } - resetFormList = (result) => { + resetFormList = (result, skip) => { + const { BID, action } = this.props + + if (action.$cache && action.setting.cache !== 'false' && !skip) { + Api.writeCacheConfig(action.uuid, fromJS(result).toJS(), BID, this.state.ID) + } + let reFieldsVal = null let _formlist = fromJS(this.state.formlist).toJS().map(item => { if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx index 10dcfb6..6d1b718 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/datasource/index.jsx @@ -229,7 +229,12 @@ </Form.Item> </Col> : null} {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> - <Form.Item label="鎺掑簭鏂瑰紡"> + <Form.Item label={ + <Tooltip placement="topLeft" title="濡傛灉鍦ㄨ嚜瀹氫箟鑴氭湰涓娇鐢ㄤ簡@pageSize@鎴朄orderBy@锛岃鍦ㄦ暟鎹簮涓崟鐙啓鎺掑簭璇彞銆�"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鎺掑簭鏂瑰紡 + </Tooltip> + }> {getFieldDecorator('order', { initialValue: setting.order || '', rules: [ diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index a262c40..ebce7e5 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -164,7 +164,7 @@ width: '10%', render: (text, record) => { if (record.position === 'back') { - return <span style={{color: 'orange'}}>鍚庣疆</span> + return <span style={{color: '#1890ff'}}>鍚庣疆</span> } else { return <span style={{color: '#26C281'}}>鍓嶇疆</span> } diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx index 6b955e5..0d8cbf7 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx @@ -28,33 +28,45 @@ } let _customScript = '' + let _tailScript = '' scripts && scripts.forEach(script => { if (script.status === 'false') return - _customScript += ` - ${script.sql} - ` + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } }) - if (_customScript) { - _customScript = `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 ='' - ${_customScript} - ` - } + let declare = `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 =''` if (verify.defaultSql === 'false') { _dataresource = '' } + + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) + _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '') // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) + _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) } + + let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript) // 姝e垯鏇挎崲 let _regoptions = regoptions.map(item => { @@ -78,36 +90,43 @@ _regoptions.forEach(item => { _dataresource = _dataresource.replace(item.reg, item.value) _customScript = _customScript.replace(item.reg, item.value) + _tailScript = _tailScript.replace(item.reg, item.value) }) if (verify.queryType === 'statistics' && _dataresource) { _search = '' } - // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 + // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (_dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - - if (verify.order) { - _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${verify.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows` - } else { + if (custompage || !verify.order) { _dataresource = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search}` + } else { + _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${verify.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` } } if (_customScript) { sql = `/* sql 楠岃瘉 */ + ${declare} ${_customScript} ${_dataresource} + ${_tailScript} aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ ` + } else if (_tailScript) { + sql = `${declare} + ${_dataresource} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` } else { 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 ='' + ${declare} ${_dataresource}` } sql = sql.replace(/\n\s{8}/ig, '\n') diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 3e57618..5a622de 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -67,7 +67,7 @@ width: '10%', render: (text, record) => { if (record.position === 'back') { - return <span style={{color: 'orange'}}>鍚庣疆</span> + return <span style={{color: '#1890ff'}}>鍚庣疆</span> } else { return <span style={{color: '#26C281'}}>鍓嶇疆</span> } diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx index 3d26d40..969fa63 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/utils.jsx @@ -5,11 +5,18 @@ let _dataresource = setting.dataresource || '' let _customScript = '' + let _tailScript = '' scripts && scripts.forEach(script => { if (script.status === 'false') return - _customScript += ` - ${script.sql} - ` + if (script.position !== 'back') { + _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` + ${script.sql} + ` + } }) if (_customScript) { @@ -22,16 +29,22 @@ if (setting.defaultSql === 'false') { _dataresource = '' } + if (/\s/.test(_dataresource)) { + _dataresource = '(' + _dataresource + ') tb' + } _dataresource = _dataresource.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _customScript = _customScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) + _tailScript = _tailScript.replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id|datam|typename)@/ig, `'${timestamp}'`) _dataresource = _dataresource.replace(/@\$|\$@/ig, '') _customScript = _customScript.replace(/@\$|\$@/ig, '') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '') // 澶栬仈鏁版嵁搴撴浛鎹� if (window.GLOB.externalDatabase !== null) { _dataresource = _dataresource.replace(/@db@/ig, window.GLOB.externalDatabase) _customScript = _customScript.replace(/@db@/ig, window.GLOB.externalDatabase) + _tailScript = _tailScript.replace(/@db@/ig, window.GLOB.externalDatabase) } let arr_field = columns.map(col => col.field) @@ -43,10 +56,6 @@ // 鏁版嵁婧愬鐞�, 瀛樺湪鏄剧ず鍒楁椂 if (_dataresource) { - if (/\s/.test(_dataresource)) { - _dataresource = '(' + _dataresource + ') tb' - } - if (setting.order) { _dataresource = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows` } else { @@ -58,10 +67,21 @@ sql = `/* sql 楠岃瘉 */ ${_customScript} ${_dataresource} + ${_tailScript} aaa: if @ErrorCode!='' insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ ` + } else if (_tailScript) { + 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 ='' + ${declareSql} + ${_dataresource} + ${_tailScript} + aaa: + if @ErrorCode!='' + insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ + ` } else { 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 ='' diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index be72648..0d4babb 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -201,16 +201,14 @@ let arr_field = setting.all_field || setting.arr_field if (_dataresource) { - if (setting.laypage && orderBy) { - if (setting.custompage) { - LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + if (setting.custompage) { + LText = `/*system_query*/select ${arr_field} from ${_dataresource} ${_search} ` + } else if (setting.laypage && orderBy) { + LText = `/*system_query*/select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` + if (setting.sub_field) { + DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` } else { - LText = `/*system_query*/select top ${pageSize} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable where rows > ${pageSize * (pageIndex - 1)} order by tmptable.rows ` - if (setting.sub_field) { - DateCount = `/*system_query*/select count(1) as total from (select distinct ${setting.primaryKey} from ${_dataresource} ${_search})a` - } else { - DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` - } + DateCount = `/*system_query*/select count(1) as total from ${_dataresource} ${_search}` } } else if (orderBy) { LText = `/*system_query*/select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${orderBy}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows ` diff --git a/src/views/design/index.jsx b/src/views/design/index.jsx index a616714..f965c69 100644 --- a/src/views/design/index.jsx +++ b/src/views/design/index.jsx @@ -15,10 +15,16 @@ state = { editLevel: false, mainMenu: null, + unvalid: !sessionStorage.getItem('UserID'), menuTree: [] } componentDidMount() { + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + return + } + if (sessionStorage.getItem('isEditState') === 'true') { sessionStorage.removeItem('isEditState') this.props.history.replace('/main') @@ -45,7 +51,9 @@ } render () { - const { editLevel, menuTree, mainMenu } = this.state + const { editLevel, menuTree, mainMenu, unvalid } = this.state + + if (unvalid) return null return ( <div className={'mk-main-view ' + (window.GLOB.systemType || '')}> diff --git a/src/views/systemfunc/index.jsx b/src/views/systemfunc/index.jsx index 1c71550..270c6ea 100644 --- a/src/views/systemfunc/index.jsx +++ b/src/views/systemfunc/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import { ConfigProvider } from 'antd' +import { withRouter } from 'react-router-dom' import zhCN from 'antd/es/locale/zh_CN' import asyncComponent from '@/utils/asyncComponent' @@ -11,25 +12,29 @@ const Tabview = asyncComponent(() => import('@/components/tabview')) -class Design extends Component { +class MkHS extends Component { UNSAFE_componentWillMount() { - sessionStorage.setItem('role_id', sessionStorage.getItem('cloudRole_id')) - sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) - sessionStorage.setItem('User_Name', sessionStorage.getItem('CloudUserName')) - sessionStorage.setItem('Full_Name', sessionStorage.getItem('CloudFullName')) - - document.body.className = 'mk-blue-black' - window.GLOB.dataFormat = false // 鍘婚櫎姘村嵃 - window.GLOB.mkHS = true - - // HS涓嬩笉鍙紑鍚柇鐐硅皟璇� - window.GLOB.breakpoint = false - sessionStorage.removeItem('breakpoint') - - Object.defineProperty(window, 'debugger', { - writable: false, - value: false - }) + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + } else { + sessionStorage.setItem('role_id', sessionStorage.getItem('cloudRole_id')) + sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM')) + sessionStorage.setItem('User_Name', sessionStorage.getItem('CloudUserName')) + sessionStorage.setItem('Full_Name', sessionStorage.getItem('CloudFullName')) + + document.body.className = 'mk-blue-black' + window.GLOB.dataFormat = false // 鍘婚櫎姘村嵃 + window.GLOB.mkHS = true + + // HS涓嬩笉鍙紑鍚柇鐐硅皟璇� + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + + Object.defineProperty(window, 'debugger', { + writable: false, + value: false + }) + } } componentDidMount () { @@ -57,4 +62,4 @@ } } -export default Design \ No newline at end of file +export default withRouter(MkHS) \ No newline at end of file diff --git a/src/views/systemproc/index.jsx b/src/views/systemproc/index.jsx index 07d4919..9f1f68a 100644 --- a/src/views/systemproc/index.jsx +++ b/src/views/systemproc/index.jsx @@ -1,5 +1,6 @@ import React, {Component} from 'react' import { ConfigProvider } from 'antd' +import { withRouter } from 'react-router-dom' import zhCN from 'antd/es/locale/zh_CN' import Header from '../systemfunc/header' @@ -7,6 +8,12 @@ import './index.scss' class SysProc extends Component { + componentDidMount() { + if (!sessionStorage.getItem('UserID')) { + this.props.history.replace('/login') + } + } + render () { const { params } = this.props.match let func = params && params.func ? params.func : '' @@ -22,4 +29,4 @@ } } -export default SysProc \ No newline at end of file +export default withRouter(SysProc) \ No newline at end of file diff --git a/src/views/systemproc/proc/index.jsx b/src/views/systemproc/proc/index.jsx index 73dd12e..62ce63a 100644 --- a/src/views/systemproc/proc/index.jsx +++ b/src/views/systemproc/proc/index.jsx @@ -29,7 +29,7 @@ if (sessionStorage.getItem('permFuncField')) { this.setState({permFuncs: JSON.parse(sessionStorage.getItem('permFuncField'))}) - } else { + } else if (sessionStorage.getItem('UserID')) { Api.getCloudConfig({func: 'sPC_Get_Roles_sModular'}).then(res => { if (res.status) { let _permFuncs = [] @@ -58,7 +58,7 @@ }) } - if (this.props.func) { + if (this.props.func && sessionStorage.getItem('UserID')) { setTimeout(() => { this.search(this.props.func) }, 500) -- Gitblit v1.8.0