From b987be8dd8b6bc1fa01810daa1e1a60e58a3c921 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 04 九月 2020 17:24:36 +0800 Subject: [PATCH] 2020-09-04 --- src/templates/sharecomponent/datasourcecomponent/verifycard/index.jsx | 5 src/utils/utils-datamanage.js | 17 src/tabviews/formtab/index.jsx | 4 src/tabviews/formtab/actionList/index.jsx | 2 src/tabviews/verupmanage/actionList/index.jsx | 8 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 4 src/templates/treepageconfig/index.jsx | 4 src/menu/datasource/index.jsx | 11 src/templates/modalconfig/index.jsx | 2 src/templates/sharecomponent/tablecomponent/index.jsx | 3 src/menu/actioncomponent/verifyprint/index.jsx | 2 src/tabviews/custom/tools/simpleSearch/index.jsx | 4 src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 5 src/tabviews/subtabtable/index.jsx | 15 + src/tabviews/commontable/index.jsx | 15 + src/tabviews/zshare/actionList/normalbutton/index.jsx | 14 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx | 4 src/menu/datasource/verifycard/columnform/index.jsx | 0 src/menu/datasource/verifycard/index.jsx | 27 +- src/menu/actioncomponent/verifyexcelin/index.jsx | 4 src/tabviews/custom/components/share/searchLine/index.jsx | 4 src/menu/datasource/index.scss | 0 src/mob/datasource/verifycard/index.jsx | 4 src/templates/calendarconfig/index.jsx | 4 src/templates/subtableconfig/index.jsx | 3 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 5 src/tabviews/zshare/mutilform/index.jsx | 4 src/tabviews/custom/index.jsx | 12 src/tabviews/verupmanage/index.jsx | 2 src/templates/sharecomponent/treesettingcomponent/index.jsx | 3 src/tabviews/treepage/index.jsx | 15 + src/menu/datasource/verifycard/settingform/index.scss | 0 src/templates/sharecomponent/settingcomponent/index.jsx | 3 src/menu/datasource/verifycard/utils.jsx | 0 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 2 src/menu/datasource/verifycard/index.scss | 0 src/tabviews/verupmanage/subtabtable/index.jsx | 2 src/tabviews/zshare/topSearch/index.jsx | 4 src/templates/formtabconfig/index.jsx | 2 src/menu/datasource/verifycard/customscript/index.jsx | 0 src/templates/comtableconfig/index.jsx | 7 src/tabviews/calendar/index.jsx | 20 + src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 4 src/menu/datasource/verifycard/columnform/index.scss | 0 src/templates/sharecomponent/fieldscomponent/index.jsx | 2 src/menu/components/chart/antv-bar/index.jsx | 15 src/menu/datasource/verifycard/settingform/utils.jsx | 0 src/tabviews/subtable/index.jsx | 15 + src/utils/utils.js | 236 +++++++++---------- src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx | 2 src/templates/zshare/createfunc/index.jsx | 4 src/menu/datasource/verifycard/settingform/index.jsx | 116 ++++++--- src/templates/zshare/verifycard/index.jsx | 17 src/menu/datasource/verifycard/customscript/index.scss | 0 src/tabviews/scriptmanage/index.jsx | 4 src/views/login/index.jsx | 2 56 files changed, 377 insertions(+), 286 deletions(-) diff --git a/src/menu/actioncomponent/verifyexcelin/index.jsx b/src/menu/actioncomponent/verifyexcelin/index.jsx index 3035b8b..5a44338 100644 --- a/src/menu/actioncomponent/verifyexcelin/index.jsx +++ b/src/menu/actioncomponent/verifyexcelin/index.jsx @@ -297,7 +297,7 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { @@ -305,7 +305,7 @@ systemScripts: res.data.map(item => { return { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } }) }) diff --git a/src/menu/actioncomponent/verifyprint/index.jsx b/src/menu/actioncomponent/verifyprint/index.jsx index 23e1582..5fcad1d 100644 --- a/src/menu/actioncomponent/verifyprint/index.jsx +++ b/src/menu/actioncomponent/verifyprint/index.jsx @@ -65,7 +65,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(param).then(res => { if (res.status) { diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index bff9c9a..581a96b 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -11,7 +11,7 @@ import enUS from '@/locales/en-US/model.js' import './index.scss' -const SettingComponent = asyncComponent(() => import('@/menu/datasourcecomponent')) +const SettingComponent = asyncComponent(() => import('@/menu/datasource')) const SearchComponent = asyncComponent(() => import('@/menu/searchcomponent')) const ActionComponent = asyncComponent(() => import('@/menu/actioncomponent')) const ChartCompileForm = asyncComponent(() => import('./chartcompile')) @@ -33,8 +33,7 @@ UNSAFE_componentWillMount () { const { card, config } = this.props - // card.dataName = Utils.getdataName() - // this.props.updateConfig(card) + if (card.isNew) { let _plot = { chartType: card.type, // 鍥捐〃绫诲瀷 @@ -82,7 +81,9 @@ let _card = { uuid: card.uuid, type: card.type, - format: 'array', + format: 'array', // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡 + pageable: false, // 缁勪欢灞炴�� - 鏄惁鍙垎椤� + switchable: false, // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹� dataName: dataName, subtype: card.subtype, setting: {span: 12, height: 400, interType: 'system', name}, @@ -570,10 +571,8 @@ return ( <div className="menu-line-chart-edit-box" style={{height: card.setting.height || 400}}> <SettingComponent - config={{...card, tables: config.tables}} - MenuID={config.uuid} - tableFields={config.tableFields || []} - permFuncField={config.permFuncField || []} + config={card} + menu={config} updateConfig={this.updateComponent} /> <div className="chart-header"> diff --git a/src/menu/datasourcecomponent/index.jsx b/src/menu/datasource/index.jsx similarity index 87% rename from src/menu/datasourcecomponent/index.jsx rename to src/menu/datasource/index.jsx index a5baeb0..28735f2 100644 --- a/src/menu/datasourcecomponent/index.jsx +++ b/src/menu/datasource/index.jsx @@ -11,9 +11,7 @@ class DataSource extends Component { static propTpyes = { config: PropTypes.any, - MenuID: PropTypes.string, - tableFields: PropTypes.any, - permFuncField: PropTypes.any, + menu: PropTypes.object, updateConfig: PropTypes.func } @@ -55,7 +53,7 @@ } render () { - const { config } = this.props + const { config, menu } = this.props const { visible, dict, loading } = this.state return ( @@ -76,11 +74,8 @@ > <VerifyCard dict={dict} + menu={menu} config={config} - tableFields={this.props.tableFields} - permFuncField={this.props.permFuncField} - menuId={this.props.config.uuid} - searches={config.search} wrappedComponentRef={(inst) => this.verifyRef = inst} /> </Modal> diff --git a/src/menu/datasourcecomponent/index.scss b/src/menu/datasource/index.scss similarity index 100% rename from src/menu/datasourcecomponent/index.scss rename to src/menu/datasource/index.scss diff --git a/src/menu/datasourcecomponent/verifycard/columnform/index.jsx b/src/menu/datasource/verifycard/columnform/index.jsx similarity index 100% rename from src/menu/datasourcecomponent/verifycard/columnform/index.jsx rename to src/menu/datasource/verifycard/columnform/index.jsx diff --git a/src/menu/datasourcecomponent/verifycard/columnform/index.scss b/src/menu/datasource/verifycard/columnform/index.scss similarity index 100% rename from src/menu/datasourcecomponent/verifycard/columnform/index.scss rename to src/menu/datasource/verifycard/columnform/index.scss diff --git a/src/menu/datasourcecomponent/verifycard/customscript/index.jsx b/src/menu/datasource/verifycard/customscript/index.jsx similarity index 100% rename from src/menu/datasourcecomponent/verifycard/customscript/index.jsx rename to src/menu/datasource/verifycard/customscript/index.jsx diff --git a/src/menu/datasourcecomponent/verifycard/customscript/index.scss b/src/menu/datasource/verifycard/customscript/index.scss similarity index 100% rename from src/menu/datasourcecomponent/verifycard/customscript/index.scss rename to src/menu/datasource/verifycard/customscript/index.scss diff --git a/src/menu/datasourcecomponent/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx similarity index 94% rename from src/menu/datasourcecomponent/verifycard/index.jsx rename to src/menu/datasource/verifycard/index.jsx index e1995c4..bd5a046 100644 --- a/src/menu/datasourcecomponent/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -22,11 +22,8 @@ class VerifyCard extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� - tableFields: PropTypes.any, // 鏁版嵁婧愪俊鎭� - permFuncField: PropTypes.any, // 鏁版嵁婧愪俊鎭� - config: PropTypes.object, // 鏁版嵁婧愪俊鎭� - menuId: PropTypes.string, // 鑿滃崟Id - searches: PropTypes.array, // 鎼滅储鏉′欢 + menu: PropTypes.object, // 鑿滃崟閰嶇疆淇℃伅 + config: PropTypes.object, // 缁勪欢閰嶇疆淇℃伅 } state = { @@ -151,7 +148,7 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { @@ -160,7 +157,7 @@ res.data.forEach(item => { let _item = { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } _scripts.push(_item) @@ -413,7 +410,7 @@ } sqlverify = (resolve, reject, change = false, testScripts) => { - const { searches } = this.props + const { config } = this.props const { columns, setting, scripts } = this.state let _scripts = scripts.filter(item => item.status !== 'false') @@ -434,7 +431,7 @@ if ((setting.interType === 'inner' && !setting.innerFunc && setting.execute !== 'false') || _scripts.length > 0) { let param = { func: 's_debug_sql', - LText: SettingUtils.getDebugSql(setting, _scripts, columns, searches) + LText: SettingUtils.getDebugSql(setting, _scripts, columns, config.search) } param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' @@ -471,6 +468,7 @@ } render() { + const { menu, config } = this.props const { columns, setting, scripts, colColumns, scriptsColumns, activeKey, loading } = this.state return ( @@ -479,10 +477,9 @@ <Tabs activeKey={activeKey} className="verify-card-box" onChange={this.changeTab}> <TabPane tab="鏁版嵁婧�" key="setting"> <SettingForm - menuId={this.props.menuId} + menu={menu} dict={this.props.dict} - config={this.props.config} - permFuncField={this.props.permFuncField} + config={config} columns={columns} setting={setting} scripts={scripts} @@ -496,9 +493,9 @@ wrappedComponentRef={(inst) => this.contrastForm = inst} /> <FieldsComponent - config={{...this.props.config, columns}} + config={{...config, columns}} type="fields" - tableFields={this.props.tableFields} + tableFields={menu.tableFields} updatefield={this.updatefields} /> <Table @@ -513,7 +510,7 @@ <TabPane tab="鑷畾涔夎剼鏈�" key="scripts"> <CustomScriptsForm setting={setting} - searches={this.props.searches} + searches={config.search} initsql={this.state.initsql} dict={this.props.dict} customScripts={scripts} diff --git a/src/menu/datasourcecomponent/verifycard/index.scss b/src/menu/datasource/verifycard/index.scss similarity index 100% rename from src/menu/datasourcecomponent/verifycard/index.scss rename to src/menu/datasource/verifycard/index.scss diff --git a/src/menu/datasourcecomponent/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx similarity index 83% rename from src/menu/datasourcecomponent/verifycard/settingform/index.jsx rename to src/menu/datasource/verifycard/settingform/index.jsx index 9cdeb01..7a5eccd 100644 --- a/src/menu/datasourcecomponent/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -1,9 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { Form, Row, Col, Input, Radio, Tooltip, Icon, notification, InputNumber, Select } from 'antd' -import moment from 'moment' -import Api from '@/api' import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' import CodeMirror from '@/templates/zshare/codemirror' @@ -12,8 +10,7 @@ class SettingForm extends Component { static propTpyes = { dict: PropTypes.object, // 瀛楀吀椤� - menuId: PropTypes.string, // 鑿滃崟Id - permFuncField: PropTypes.any, // 鑿滃崟Id + menu: PropTypes.any, // 鑿滃崟閰嶇疆淇℃伅 config: PropTypes.object, // 缁勪欢閰嶇疆 setting: PropTypes.object, // 鏁版嵁婧愰厤缃� columns: PropTypes.array, // 鍒楄缃� @@ -22,10 +19,34 @@ state = { interType: this.props.setting.interType || 'system', + supModule: '', + modules: [] + } + + UNSAFE_componentWillMount () { + const { menu, setting } = this.props + let supModule = setting.supModule || '' + let modules = [] + + menu.components.forEach(item => { + if (!item.switchable || !item.setting || !item.setting.name) return + + modules.push({ + value: item.uuid, + text: item.setting.name + }) + }) + + if (supModule && supModule !== 'empty') { + if (modules.filter(item => item.value === supModule).length === 0) { + supModule = '' + } + } + + this.setState({supModule, modules}) } handleConfirm = () => { - const { setting } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� return new Promise((resolve, reject) => { this.props.form.validateFieldsAndScroll((err, values) => { @@ -87,24 +108,6 @@ } } - // 鏁版嵁婧愪繚瀛� - if ( - values.interType === 'system' && values.execute !== 'false' && - /[^\s]+\s+[^\s]+/ig.test(values.dataresource) && setting.dataresource !== values.dataresource - ) { - let param = { - func: 's_DataSrc_Save', - LText: values.dataresource, - MenuID: this.props.menuId - } - - param.LText = Utils.formatOptions(param.LText) - param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' - param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - Api.getLocalConfig(param) - } - resolve(values) } else { reject(err) @@ -124,9 +127,9 @@ } render() { - const { setting, permFuncField, columns, config } = this.props + const { setting, menu, columns, config } = this.props const { getFieldDecorator } = this.props.form - const { interType } = this.state + const { interType, supModule, modules } = this.state const formItemLayout = { labelCol: { @@ -142,9 +145,9 @@ let tooltip = null let rules = [] - if (permFuncField && permFuncField.length > 0) { - tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + permFuncField.join(', ') - let str = '^(' + permFuncField.join('|') + ')' + if (menu.permFuncField && menu.permFuncField.length > 0) { + tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + menu.permFuncField.join(', ') + let str = '^(' + menu.permFuncField.join('|') + ')' let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g') rules.push({ @@ -354,26 +357,53 @@ </Form.Item> </Col> : null} <Col span={8}> - <Form.Item label="鍒濆鍖�"> - {getFieldDecorator('onload', { - initialValue: setting.onload || 'true' + <Form.Item label={ + <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}> + <Icon type="question-circle" /> + 涓婄骇妯″潡 + </Tooltip> + }> + {getFieldDecorator('supModule', { + initialValue: supModule, + rules: [ + { + required: true, + message: this.props.dict['form.required.select'] + '涓婄骇妯″潡!' + } + ] })( - <Radio.Group> - <Radio value="true">鍔犺浇鏁版嵁</Radio> - <Radio value="false">涓嶅姞杞芥暟鎹�</Radio> - </Radio.Group> + <Select> + <Select.Option key="empty" value="empty"> 鏃� </Select.Option> + {modules.map((option, i) => + <Select.Option key={i} value={option.value}> + {option.text} + </Select.Option> + )} + </Select> )} </Form.Item> </Col> - {!config.laypage ? <Col span={8}> + {!config.pageable ? <Col span={8}> <Form.Item label={ - <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥銆�'}> + <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}> <Icon type="question-circle" /> 鍚屾鏌ヨ </Tooltip> }> {getFieldDecorator('sync', { initialValue: setting.sync || 'true' + })( + <Radio.Group> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {config.pageable ? <Col span={8}> + <Form.Item label="鍒嗛〉"> + {getFieldDecorator('laypage', { + initialValue: setting.laypage || 'false' })( <Radio.Group> <Radio value="true">鏄�</Radio> @@ -399,6 +429,18 @@ )} </Form.Item> </Col> + <Col span={8}> + <Form.Item label="鍒濆鍖栨暟鎹�"> + {getFieldDecorator('onload', { + initialValue: setting.onload || 'true' + })( + <Radio.Group> + <Radio value="true">鍔犺浇</Radio> + <Radio value="false">涓嶅姞杞�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> </Row> </Form> </div> diff --git a/src/menu/datasourcecomponent/verifycard/settingform/index.scss b/src/menu/datasource/verifycard/settingform/index.scss similarity index 100% rename from src/menu/datasourcecomponent/verifycard/settingform/index.scss rename to src/menu/datasource/verifycard/settingform/index.scss diff --git a/src/menu/datasourcecomponent/verifycard/settingform/utils.jsx b/src/menu/datasource/verifycard/settingform/utils.jsx similarity index 100% rename from src/menu/datasourcecomponent/verifycard/settingform/utils.jsx rename to src/menu/datasource/verifycard/settingform/utils.jsx diff --git a/src/menu/datasourcecomponent/verifycard/utils.jsx b/src/menu/datasource/verifycard/utils.jsx similarity index 100% rename from src/menu/datasourcecomponent/verifycard/utils.jsx rename to src/menu/datasource/verifycard/utils.jsx diff --git a/src/mob/datasource/verifycard/index.jsx b/src/mob/datasource/verifycard/index.jsx index 8f45ee7..60b8397 100644 --- a/src/mob/datasource/verifycard/index.jsx +++ b/src/mob/datasource/verifycard/index.jsx @@ -141,7 +141,7 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { @@ -150,7 +150,7 @@ res.data.forEach(item => { let _item = { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } _scripts.push(_item) diff --git a/src/tabviews/calendar/index.jsx b/src/tabviews/calendar/index.jsx index bf539b6..320c737 100644 --- a/src/tabviews/calendar/index.jsx +++ b/src/tabviews/calendar/index.jsx @@ -150,6 +150,18 @@ return item }) + // 鏁寸悊鏁版嵁婧愯嚜瀹氫箟鑴氭湰 + let _customScript = '' + config.scripts && config.scripts.forEach(script => { + if (script.status !== 'false') { + _customScript += ` + ${script.sql} + ` + } + }) + + config.setting.customScript = _customScript + this.setState({ BID: param && param.BID ? param.BID : '', loadingview: false, @@ -286,7 +298,7 @@ let _search = Utils.joinMainSearchkey(search) _search = _search ? 'where ' + _search : '' - + let param = { func: 'sPC_Get_TableData', obj_name: 'data', @@ -352,6 +364,10 @@ param.custom_script = param.custom_script.replace(item.reg, item.value) }) + param.custom_script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg ='' + ${param.custom_script} + ` + if (LText) { LText += ` aaa: @@ -380,7 +396,7 @@ param.DateCount = '' if (this.props.menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 5d6b06e..ce2b81d 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -265,7 +265,18 @@ // 鏁版嵁婧愪俊鎭澶勭悊 config.setting.laypage = config.setting.laypage !== 'false' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - config.setting.customScript = config.setting.customScript || '' // 鑷畾涔夎剼鏈� + config.setting.customScript = '' // 鑷畾涔夎剼鏈� + + if (config.setting.scripts && config.setting.scripts.length > 0) { + let _customScript = '' + config.setting.scripts.forEach(item => { + if (item.status === 'false') return + _customScript += ` + ${item.sql} + ` + }) + config.setting.customScript = _customScript + } if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ config.setting.dataresource = '' @@ -566,7 +577,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, setting.customScript, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index 0257e24..0b72187 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -171,7 +171,7 @@ }) let _orderBy = config.setting.order || '' - let param = UtilsDM.getQueryDataParams(config.setting, config.customScript, arr_field, searches, _orderBy, '', '', BID, menuType, dataManager) + let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType, dataManager) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/custom/components/share/searchLine/index.jsx b/src/tabviews/custom/components/share/searchLine/index.jsx index a809ad3..5b93aab 100644 --- a/src/tabviews/custom/components/share/searchLine/index.jsx +++ b/src/tabviews/custom/components/share/searchLine/index.jsx @@ -163,7 +163,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } deffers.push( @@ -201,7 +201,7 @@ mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) + mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) if (options.cloudServiceApi) { mainparam.rduri = options.cloudServiceApi mainparam.userid = sessionStorage.getItem('CloudUserID') || '' diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index b95e93a..e9c28fe 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -173,12 +173,14 @@ } } - component.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + if (component.setting) { + component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + } // format 鏁版嵁鏍煎紡 array 鎴� object // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О - // laypage 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ - if (component.format && component.dataName && !component.laypage && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') { + // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ + if (component.format && component.dataName && !component.pageable && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') { let param = this.getDefaultParam(component, mainSearch) params.push(param) } else { @@ -213,7 +215,7 @@ * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� */ getDefaultParam = (component, mainSearch) => { - const { columns, search, setting, dataName, format, customScript } = component + const { columns, search, setting, dataName, format } = component let searchlist = [] if (search && search.length > 0) { @@ -225,7 +227,7 @@ let arr_field = columns.map(col => col.field) let _dataresource = setting.dataresource - let _customScript = customScript + let _customScript = setting.customScript if (setting.queryType === 'statistics' || _customScript) { let allSearch = Utils.getAllSearchOptions(searchlist) diff --git a/src/tabviews/custom/tools/simpleSearch/index.jsx b/src/tabviews/custom/tools/simpleSearch/index.jsx index a809ad3..5b93aab 100644 --- a/src/tabviews/custom/tools/simpleSearch/index.jsx +++ b/src/tabviews/custom/tools/simpleSearch/index.jsx @@ -163,7 +163,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } deffers.push( @@ -201,7 +201,7 @@ mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) + mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) if (options.cloudServiceApi) { mainparam.rduri = options.cloudServiceApi mainparam.userid = sessionStorage.getItem('CloudUserID') || '' diff --git a/src/tabviews/formtab/actionList/index.jsx b/src/tabviews/formtab/actionList/index.jsx index 117d15a..fa309ba 100644 --- a/src/tabviews/formtab/actionList/index.jsx +++ b/src/tabviews/formtab/actionList/index.jsx @@ -151,7 +151,7 @@ } if (this.props.menuType === 'HS' && param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx index f9daef9..dec1fd6 100644 --- a/src/tabviews/formtab/index.jsx +++ b/src/tabviews/formtab/index.jsx @@ -216,7 +216,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (this.props.menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) if (item.database === 'sso' && options.cloudServiceApi) { // 瀛樺湪浜戠鍦板潃鏃讹紝浣跨敤浜戠绯荤粺鍙傛暟 param.rduri = options.cloudServiceApi @@ -444,7 +444,7 @@ param.DateCount = '' if (this.props.menuType !== 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param diff --git a/src/tabviews/scriptmanage/index.jsx b/src/tabviews/scriptmanage/index.jsx index bbdd033..211bc40 100644 --- a/src/tabviews/scriptmanage/index.jsx +++ b/src/tabviews/scriptmanage/index.jsx @@ -134,7 +134,7 @@ if (result.status) { this.setState({ data: result.data.map((item, index) => { - item.LongParam = Utils.formatOptions(item.LongParam, true) + item.LongParam = Utils.UnformatOptions(item.LongParam) item.key = index return item }), @@ -184,7 +184,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) param.DateCount = Utils.formatOptions(DateCount) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 return param } diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 52b0c37..ff9948e 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -348,7 +348,18 @@ // 鏁版嵁婧愪俊鎭澶勭悊 config.setting.laypage = config.setting.laypage !== 'false' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - config.setting.customScript = config.setting.customScript || '' // 鑷畾涔夎剼鏈� + config.setting.customScript = '' // 鑷畾涔夎剼鏈� + + if (config.setting.scripts && config.setting.scripts.length > 0) { + let _customScript = '' + config.setting.scripts.forEach(item => { + if (item.status === 'false') return + _customScript += ` + ${item.sql} + ` + }) + config.setting.customScript = _customScript + } if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ config.setting.dataresource = '' @@ -444,7 +455,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, setting.customScript, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType, this.props.dataManager) this.handleTableId() diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index de49711..19835b5 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -271,7 +271,18 @@ // 鏁版嵁婧愪俊鎭澶勭悊 config.setting.laypage = config.setting.laypage !== 'false' // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - config.setting.customScript = config.setting.customScript || '' // 鑷畾涔夎剼鏈� + config.setting.customScript = '' // 鑷畾涔夎剼鏈� + + if (config.setting.scripts && config.setting.scripts.length > 0) { + let _customScript = '' + config.setting.scripts.forEach(item => { + if (item.status === 'false') return + _customScript += ` + ${item.sql} + ` + }) + config.setting.customScript = _customScript + } if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ config.setting.dataresource = '' @@ -352,7 +363,7 @@ }) let _orderBy = orderBy || setting.order - let param = UtilsDM.getQueryDataParams(setting, setting.customScript, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx index 0194697..c7e9302 100644 --- a/src/tabviews/treepage/index.jsx +++ b/src/tabviews/treepage/index.jsx @@ -144,7 +144,18 @@ // 鏁版嵁婧愪俊鎭澶勭悊 config.setting.laypage = false // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡 config.setting.execute = config.setting.default !== 'false' // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡 - config.setting.customScript = config.setting.customScript || '' // 鑷畾涔夎剼鏈� + config.setting.customScript = '' // 鑷畾涔夎剼鏈� + + if (config.setting.scripts && config.setting.scripts.length > 0) { + let _customScript = '' + config.setting.scripts.forEach(item => { + if (item.status === 'false') return + _customScript += ` + ${item.sql} + ` + }) + config.setting.customScript = _customScript + } if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖ config.setting.dataresource = '' @@ -277,7 +288,7 @@ }) let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}` - let param = UtilsDM.getQueryDataParams(setting, setting.customScript, arr_field, [], setting.order, '', '', BID, this.props.menuType, this.props.dataManager) + let param = UtilsDM.getQueryDataParams(setting, arr_field, [], setting.order, '', '', BID, this.props.menuType, this.props.dataManager) let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx index 901e639..740119b 100644 --- a/src/tabviews/verupmanage/actionList/index.jsx +++ b/src/tabviews/verupmanage/actionList/index.jsx @@ -229,7 +229,7 @@ } if (param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { @@ -328,7 +328,7 @@ } if (param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param @@ -533,7 +533,7 @@ if (_localParam.LTextOut) { _localParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _localParam.secretkey = Utils.encrypt(_localParam.LTextOut, _localParam.timestamp) - _localParam.open_key = Utils.encrypt(_localParam.secretkey, _localParam.timestamp, true) + _localParam.open_key = Utils.encryptOpenKey(_localParam.secretkey, _localParam.timestamp) } } delete response.UpType @@ -542,7 +542,7 @@ if (_callbackparam.LTextOut) { _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp) - _callbackparam.open_key = Utils.encrypt(_callbackparam.secretkey, _callbackparam.timestamp, true) + _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) } return Api.getLocalConfig(_callbackparam) diff --git a/src/tabviews/verupmanage/index.jsx b/src/tabviews/verupmanage/index.jsx index b9c081f..fc97cf5 100644 --- a/src/tabviews/verupmanage/index.jsx +++ b/src/tabviews/verupmanage/index.jsx @@ -268,7 +268,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) param.DateCount = Utils.formatOptions(DateCount) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 return param } diff --git a/src/tabviews/verupmanage/subtabtable/index.jsx b/src/tabviews/verupmanage/subtabtable/index.jsx index 96e7057..d3eb69f 100644 --- a/src/tabviews/verupmanage/subtabtable/index.jsx +++ b/src/tabviews/verupmanage/subtabtable/index.jsx @@ -288,7 +288,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) param.DateCount = Utils.formatOptions(DateCount) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 return param } diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index f22403e..3b995e5 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -271,7 +271,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (this.props.menuType === 'HS' && param.timestamp) { // 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { @@ -353,7 +353,7 @@ param.LText = Utils.formatOptions(result.sql) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return Api.genericInterface(res) diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index 1f4d6b4..63686e9 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -470,7 +470,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { @@ -621,7 +621,7 @@ param.DateCount = '' if (this.props.menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index dccda3a..1fd16f9 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -295,11 +295,11 @@ } if (this.props.menuType === 'HS' && param.timestamp) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } else if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } Api.genericInterface(param).then((res) => { @@ -421,11 +421,11 @@ } if (this.props.menuType === 'HS' && param.timestamp) { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } else if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { // 鍑芥暟 s_sDataDictb_TBBack 浜戠楠岃瘉 param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param @@ -581,7 +581,7 @@ if (this.props.menuType === 'HS' && param.func === 's_sDataDictb_TBBack' && param.LTextOut) { param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LTextOut, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞� @@ -630,7 +630,7 @@ if (res.func === 's_sDataDictb_TBBack' && res.LTextOut) { res.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' res.secretkey = Utils.encrypt(res.LTextOut, res.timestamp) - res.open_key = Utils.encrypt(res.secretkey, res.timestamp, true) + res.open_key = Utils.encryptOpenKey(res.secretkey, res.timestamp) } } else { if (btn.sysInterface === 'true' && window.GLOB.mainSystemApi) { @@ -657,7 +657,7 @@ if (this.props.menuType === 'HS' && _callbackparam.func === 's_sDataDictb_TBBack' && _callbackparam.LTextOut) { _callbackparam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _callbackparam.secretkey = Utils.encrypt(_callbackparam.LTextOut, _callbackparam.timestamp) - _callbackparam.open_key = Utils.encrypt(_callbackparam.secretkey, _callbackparam.timestamp, true) + _callbackparam.open_key = Utils.encryptOpenKey(_callbackparam.secretkey, _callbackparam.timestamp) } return Api.genericInterface(_callbackparam) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index ac9f76c..497166a 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -322,7 +322,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } deffers.push( @@ -360,7 +360,7 @@ mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) + mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) if (options.cloudServiceApi) { mainparam.rduri = options.cloudServiceApi mainparam.userid = sessionStorage.getItem('CloudUserID') || '' diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index a809ad3..5b93aab 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -163,7 +163,7 @@ param.secretkey = Utils.encrypt(param.LText, param.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } deffers.push( @@ -201,7 +201,7 @@ mainparam.secretkey = Utils.encrypt(mainparam.LText, mainparam.timestamp) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - mainparam.open_key = Utils.encrypt(mainparam.secretkey, mainparam.timestamp, true) + mainparam.open_key = Utils.encryptOpenKey(mainparam.secretkey, mainparam.timestamp) if (options.cloudServiceApi) { mainparam.rduri = options.cloudServiceApi mainparam.userid = sessionStorage.getItem('CloudUserID') || '' diff --git a/src/templates/calendarconfig/index.jsx b/src/templates/calendarconfig/index.jsx index ed9157b..436af72 100644 --- a/src/templates/calendarconfig/index.jsx +++ b/src/templates/calendarconfig/index.jsx @@ -283,6 +283,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } @@ -543,6 +544,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } @@ -759,7 +761,7 @@ <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> - <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} <Panel forceRender={true} header={'鏍囩鍩烘湰淇℃伅'} key="0" id="subtable-basedata"> {/* 鑿滃崟淇℃伅 */} diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx index 118d8bd..2314262 100644 --- a/src/templates/comtableconfig/index.jsx +++ b/src/templates/comtableconfig/index.jsx @@ -328,6 +328,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } @@ -572,8 +573,7 @@ ParentID: _config.ParentId, MenuID: menu.MenuID, MenuNo: _config.MenuNo, - // EasyCode: _config.easyCode || '', - EasyCode: _config.easyCoded, + EasyCode: _config.easyCode || '', Template: _config.Template || '', MenuName: _config.MenuName, PageParam: JSON.stringify({...menu.PageParam, Template: _config.Template, OpenType: _config.OpenType}), @@ -964,6 +964,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } if (!is(fromJS(originMenu), fromJS(config))) { // 鑿滃崟淇℃伅鍙樺寲鏃讹紝鎻愮ず淇濆瓨 @@ -1289,7 +1290,7 @@ <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> - <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="main-basedata"> {/* 鑿滃崟淇℃伅 */} diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index 306bfb7..3221958 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -194,7 +194,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(param).then(res => { if (res.status) { diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index f9eabbf..6659705 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -199,7 +199,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(param).then(res => { if (res.status) { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx index 3035b8b..5a44338 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx @@ -297,7 +297,7 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { @@ -305,7 +305,7 @@ systemScripts: res.data.map(item => { return { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } }) }) diff --git a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx index 23e1582..5fcad1d 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyprint/index.jsx @@ -65,7 +65,7 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(param).then(res => { if (res.status) { diff --git a/src/templates/sharecomponent/datasourcecomponent/verifycard/index.jsx b/src/templates/sharecomponent/datasourcecomponent/verifycard/index.jsx index 821bf0d..06d871d 100644 --- a/src/templates/sharecomponent/datasourcecomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/datasourcecomponent/verifycard/index.jsx @@ -150,8 +150,7 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { @@ -160,7 +159,7 @@ res.data.forEach(item => { let _item = { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } _scripts.push(_item) diff --git a/src/templates/sharecomponent/fieldscomponent/index.jsx b/src/templates/sharecomponent/fieldscomponent/index.jsx index d96efa9..b138d3c 100644 --- a/src/templates/sharecomponent/fieldscomponent/index.jsx +++ b/src/templates/sharecomponent/fieldscomponent/index.jsx @@ -27,7 +27,7 @@ queryField = () => { const { type, config, tableFields } = this.props // 鍒ゆ柇鏄惁宸查�夋嫨琛ㄥ悕 - if (!config.tables || config.tables.length === 0) { + if (!tableFields || tableFields.length === 0) { notification.warning({ top: 92, message: '璇烽�夋嫨琛ㄥ悕锛�', diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx index 336275f..1a04540 100644 --- a/src/templates/sharecomponent/settingcomponent/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/index.jsx @@ -87,6 +87,9 @@ visible: false, loading: false }) + + delete res.customScript // 娓呴櫎鏁寸悊鍚庣殑鑷畾涔夎剼鏈� + this.props.updatesetting({...config, setting: res}) }, () => { this.setState({ diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index b5f1bc2..8bac6b7 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -159,15 +159,14 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { let _scripts = res.data.map(item => { let _item = { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } return _item diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx index ba5cad0..a429ceb 100644 --- a/src/templates/sharecomponent/tablecomponent/index.jsx +++ b/src/templates/sharecomponent/tablecomponent/index.jsx @@ -61,8 +61,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' param.secretkey = Utils.encrypt(param.LText, param.timestamp) - - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(param).then(res => { if (res.status) { diff --git a/src/templates/sharecomponent/treesettingcomponent/index.jsx b/src/templates/sharecomponent/treesettingcomponent/index.jsx index 1252a86..d1d4f11 100644 --- a/src/templates/sharecomponent/treesettingcomponent/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/index.jsx @@ -62,6 +62,9 @@ visible: false, loading: false }) + + delete res.customScript // 娓呴櫎鏁寸悊鍚庣殑鑷畾涔夎剼鏈� + this.props.updatesetting({...config, setting: res}) }, () => { this.setState({ diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index ead51b6..a0da051 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -129,15 +129,14 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { let _scripts = res.data.map(item => { let _item = { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } return _item diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index b823a8d..5468594 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -311,6 +311,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } @@ -1074,7 +1075,7 @@ <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> - <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} <Panel forceRender={true} header={'鏍囩鍩烘湰淇℃伅'} key="0" id="subtable-basedata"> {/* 鑿滃崟淇℃伅 */} diff --git a/src/templates/treepageconfig/index.jsx b/src/templates/treepageconfig/index.jsx index d987549..24d1e68 100644 --- a/src/templates/treepageconfig/index.jsx +++ b/src/templates/treepageconfig/index.jsx @@ -204,6 +204,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } @@ -564,6 +565,7 @@ message: this.state.dict['model.menu.basemsg'], duration: 5 }) + this.setState({activeKey: '0'}) return } @@ -752,7 +754,7 @@ <DndProvider backend={HTML5Backend}> {/* 宸ュ叿鏍� */} <div className="tools"> - <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> + <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}> {/* 鍩烘湰淇℃伅 */} <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="main-basedata"> {/* 鑿滃崟淇℃伅 */} diff --git a/src/templates/zshare/createfunc/index.jsx b/src/templates/zshare/createfunc/index.jsx index 7c4e88d..37e62ab 100644 --- a/src/templates/zshare/createfunc/index.jsx +++ b/src/templates/zshare/createfunc/index.jsx @@ -143,7 +143,7 @@ _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - _param.open_key = Utils.encrypt(_param.secretkey, _param.timestamp, true) + _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) return Api.getLocalConfig(_param) }).then(res => { @@ -171,7 +171,7 @@ } _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) - _param.open_key = Utils.encrypt(_param.secretkey, _param.timestamp, true) + _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) return Api.getLocalConfig(_param) }).then(res => { diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 8ecfd5a..cd682da 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -997,8 +997,7 @@ orderParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' orderParam.secretkey = Utils.encrypt(orderParam.LText, orderParam.timestamp) - - orderParam.open_key = Utils.encrypt(orderParam.secretkey, orderParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + orderParam.open_key = Utils.encryptOpenKey(orderParam.secretkey, orderParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(orderParam).then(res => { if (res.status) { @@ -1027,8 +1026,7 @@ orderDetailParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' orderDetailParam.secretkey = Utils.encrypt(orderDetailParam.LText, orderDetailParam.timestamp) - - orderDetailParam.open_key = Utils.encrypt(orderDetailParam.secretkey, orderDetailParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + orderDetailParam.open_key = Utils.encryptOpenKey(orderDetailParam.secretkey, orderDetailParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(orderDetailParam).then(res => { if (res.status) { @@ -1064,8 +1062,7 @@ voucherParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' voucherParam.secretkey = Utils.encrypt(voucherParam.LText, voucherParam.timestamp) - - voucherParam.open_key = Utils.encrypt(voucherParam.secretkey, voucherParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + voucherParam.open_key = Utils.encryptOpenKey(voucherParam.secretkey, voucherParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(voucherParam).then(res => { if (res.status) { @@ -1094,8 +1091,7 @@ voucherDetailParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' voucherDetailParam.secretkey = Utils.encrypt(voucherDetailParam.LText, voucherDetailParam.timestamp) - - voucherDetailParam.open_key = Utils.encrypt(voucherDetailParam.secretkey, voucherDetailParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + voucherDetailParam.open_key = Utils.encryptOpenKey(voucherDetailParam.secretkey, voucherDetailParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(voucherDetailParam).then(res => { if (res.status) { @@ -1134,8 +1130,7 @@ _sParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _sParam.secretkey = Utils.encrypt(_sParam.LText, _sParam.timestamp) - - _sParam.open_key = Utils.encrypt(_sParam.secretkey, _sParam.timestamp, true) // 浜戠鏁版嵁楠岃瘉 + _sParam.open_key = Utils.encryptOpenKey(_sParam.secretkey, _sParam.timestamp) // 浜戠鏁版嵁楠岃瘉 Api.getSystemConfig(_sParam).then(res => { if (res.status) { @@ -1151,7 +1146,7 @@ res.data.forEach(item => { let _item = { name: item.funcname, - value: Utils.formatOptions(item.longparam, true) + value: Utils.UnformatOptions(item.longparam) } _scripts.push(_item) diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index d20a826..43bc97d 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -6,7 +6,6 @@ /** * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ * @param {Object} setting 鏁版嵁婧愯缃� - * @param {String} customScript 鑷畾涔夎剼鏈� * @param {String} arrFields 鏌ヨ瀛楁 * @param {Array} search 鎼滅储鏉′欢 * @param {String} orderBy 鎺掑簭鏂瑰紡 @@ -17,11 +16,11 @@ * @param {Boolean} dataManager 鏁版嵁鏉冮檺 * @return {Object} param */ - static getQueryDataParams (setting, customScript, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, dataManager) { + static getQueryDataParams (setting, arrFields, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, menuType, dataManager) { let param = null if (setting.interType === 'system' || (setting.interType === 'inner' && !setting.innerFunc)) { - param = this.getDefaultQueryParam(setting, customScript, arrFields, search, orderBy, pageIndex, pageSize, menuType) + param = this.getDefaultQueryParam(setting, arrFields, search, orderBy, pageIndex, pageSize, menuType) } else { param = this.getCustomQueryParam(setting, search, orderBy, pageIndex, pageSize, menuType) } @@ -80,7 +79,7 @@ /** * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁� */ - static getDefaultQueryParam (setting, customScript, arrFields, search, orderBy, pageIndex, pageSize, menuType) { + static getDefaultQueryParam (setting, arrFields, search, orderBy, pageIndex, pageSize, menuType) { let param = { func: 'sPC_Get_TableData', obj_name: 'data', @@ -89,7 +88,13 @@ } let _dataresource = setting.dataresource - let _customScript = customScript + let _customScript = '' + + if (setting.customScript) { + _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg ='' + ${setting.customScript} + ` + } let regoptions = null if (setting.queryType === 'statistics' || _customScript) { @@ -173,7 +178,7 @@ param.DateCount = Utils.formatOptions(DateCount) if (menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉 - param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } return param diff --git a/src/utils/utils.js b/src/utils/utils.js index 013fba7..497baee 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -2,6 +2,41 @@ import md5 from 'md5' import options from '@/store/options.js' +const formatKeys = [ + { key: 'select', value: ' msltk ' }, + { key: 'from', value: ' mfrmk ' }, + { key: 'where', value: ' mwhrk ' }, + { key: 'order by', value: ' modbk ' }, + { key: 'asc', value: ' modack ' }, + { key: 'desc', value: ' moddesk ' }, + { key: 'top', value: ' mtpk ' }, + { key: 'like', value: ' mlkk ' }, + { key: 'not like', value: ' mnlkk ' }, + { key: 'between', value: ' mbtnk ' }, + { key: 'and', value: ' madk ' }, + { key: 'insert', value: ' mistk ' }, + { key: 'into', value: ' mitk ' }, + { key: 'update', value: ' muptk ' }, + { key: 'delete', value: ' mdelk ' }, + { key: 'begin', value: ' mbgink ' }, + { key: 'end', value: ' medk ' }, + { key: 'if', value: ' mefk ' }, + { key: 'while', value: ' mwilk ' }, + { key: 'create', value: ' mcrtk ' }, + { key: 'alter', value: ' matek ' }, + { key: 'len', value: ' mlnk ' }, + { key: 'left', value: ' mlftk ' }, + { key: 'right', value: ' mritk ' }, + { key: 'union', value: ' munok ' }, + { key: 'varchar', value: ' mvcrk ' }, + { key: 'getdate', value: ' mgtdtk ' }, + { key: 'TRY', value: ' mtryonek ' }, + { key: 'TRAN', value: ' mtrnk ' }, + { key: 'goto', value: ' mgtk ' }, + { key: 'set', value: ' mstk ' }, + { key: 'ROLLBACK', value: ' mrlbkk ' } +] + export default class Utils { /** * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ @@ -51,22 +86,26 @@ * @description md5鍔犲瘑 * @return {String} str 鍔犲瘑涓� * @return {String} timestamp 鏃堕棿鎴� - * @return {Boolean} isopenkey 鏄惁涓轰簯绔瘑閽� */ - static encrypt (str, timestamp, isopenkey) { - let salt1 = 'mingke' // sql璇硶鐩愬�� - let salt2 = 'open_key' // 浜戠鏁版嵁鎿嶄綔鐩愬�� - let _str = '' - - if (isopenkey) { - _str = salt2 + timestamp + str - } else { - _str = str + salt1 + timestamp - } + static encrypt (str, timestamp) { + let salt = 'mingke' // sql璇硶鐩愬�� + let _str = str + salt + timestamp if (_str.length > 8000) { _str = _str.slice(_str.length - 8000) } + return md5(_str) + } + + /** + * @description md5鍔犲瘑 浜戠openkey鍔犲瘑 + * @return {String} secretkey Ltext瀵嗛挜 + * @return {String} timestamp 鏃堕棿鎴� + */ + static encryptOpenKey (secretkey, timestamp) { + let salt = 'open_key' // 浜戠鏁版嵁鎿嶄綔鐩愬�� + let _str = salt + timestamp + secretkey + return md5(_str) } @@ -110,87 +149,56 @@ /** * @description sql鍔犲瘑 * @return {String} value - * @return {Boolean} isUnFormat // 鏄惁涓鸿В瀵� */ - static formatOptions (value, isUnFormat = false) { + static formatOptions (value) { if (!value) return '' let salt = 'minKe' // 鐩愬�� - // 鍏抽敭瀛楄浆鎹㈣鍒� - let format = [ - { key: 'select', value: ' msltk ' }, - { key: 'from', value: ' mfrmk ' }, - { key: 'where', value: ' mwhrk ' }, - { key: 'order by', value: ' modbk ' }, - { key: 'asc', value: ' modack ' }, - { key: 'desc', value: ' moddesk ' }, - { key: 'top', value: ' mtpk ' }, - { key: 'like', value: ' mlkk ' }, - { key: 'not like', value: ' mnlkk ' }, - { key: 'between', value: ' mbtnk ' }, - { key: 'and', value: ' madk ' }, - { key: 'insert', value: ' mistk ' }, - { key: 'into', value: ' mitk ' }, - { key: 'update', value: ' muptk ' }, - { key: 'delete', value: ' mdelk ' }, - { key: 'begin', value: ' mbgink ' }, - { key: 'end', value: ' medk ' }, - { key: 'if', value: ' mefk ' }, - { key: 'while', value: ' mwilk ' }, - { key: 'create', value: ' mcrtk ' }, - { key: 'alter', value: ' matek ' }, - { key: 'len', value: ' mlnk ' }, - { key: 'left', value: ' mlftk ' }, - { key: 'right', value: ' mritk ' }, - { key: 'union', value: ' munok ' }, - { key: 'varchar', value: ' mvcrk ' }, - { key: 'getdate', value: ' mgtdtk ' }, - { key: 'TRY', value: ' mtryonek ' }, - { key: 'TRAN', value: ' mtrnk ' }, - { key: 'goto', value: ' mgtk ' }, - { key: 'set', value: ' mstk ' }, - { key: 'ROLLBACK', value: ' mrlbkk ' } - ] - if (!isUnFormat) { // 鍔犲瘑 - value = value.replace(/\n/ig, ' \n ') - // 鏇挎崲鍏抽敭瀛� - format.forEach(item => { - let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig') - value = value.replace(reg, item.value) + value = value.replace(/\n/ig, ' \n ') + // 鏇挎崲鍏抽敭瀛� + formatKeys.forEach(item => { + let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig') + value = value.replace(reg, item.value) + }) + // 1銆佹浛鎹�%绗︼紙鏁版嵁搴撲腑瑙f瀽鍚巗ql鎶ラ敊锛� + value = value.replace(/%/ig, ' mpercent ') + // 1銆乪ncode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛夛紝2銆乥ase64鍔犲瘑 + value = window.btoa(window.encodeURIComponent(value)) + // 鎻掑叆瀛楃 + let index = Math.floor(value.length / 2) + value = value.slice(0, index) + salt + value.slice(index) + // base64鍔犲瘑 + value = window.btoa(value) + + return value + } + + /** + * @description 瑙e瘑 + * @return {String} value + */ + static UnformatOptions (value) { + if (!value) return '' + let salt = 'minKe' // 鐩愬�� + + try { + value = window.atob(value) + value = value.replace(salt, '') + value = window.decodeURIComponent(window.atob(value)) + + value = value.replace(/\smpercent\s/g, '%') + + formatKeys.forEach(item => { + let reg = new RegExp(item.value, 'g') + value = value.replace(reg, ' ' + item.key + ' ') }) - - // 1銆佹浛鎹�%绗︼紙鏁版嵁搴撲腑瑙f瀽鍚巗ql鎶ラ敊锛� - value = value.replace(/%/ig, ' mpercent ') - // 1銆乪ncode缂栫爜锛堜腑鏂囧瓧绗﹁秴鍑篵ase64鍔犲瘑鑼冨洿锛夛紝2銆乥ase64鍔犲瘑 - value = window.btoa(window.encodeURIComponent(value)) - - // 鎻掑叆瀛楃 - let index = Math.floor(value.length / 2) - value = value.slice(0, index) + salt + value.slice(index) - - // base64鍔犲瘑 - value = window.btoa(value) - } else { // 瑙e瘑 - try { - value = window.atob(value) - value = value.replace(salt, '') - value = window.decodeURIComponent(window.atob(value)) - - value = value.replace(/\smpercent\s/g, '%') - - format.forEach(item => { - let reg = new RegExp(item.value, 'g') - value = value.replace(reg, ' ' + item.key + ' ') - }) - - value = value.replace(/\s\n\s/ig, '\n') - value = value.replace(/(^\s+|\s+$)/ig, '') - } catch { - console.warn('UnFormat Failure') - value = '' - } + value = value.replace(/\s\n\s/ig, '\n') + value = value.replace(/(^\s+|\s+$)/ig, '') + } catch { + console.warn('UnFormat Failure') + value = '' } return value @@ -202,47 +210,11 @@ */ static sPCInUpDeFormatOptions (value) { if (!value) return {LText: '', LText1: '', LText2: ''} - let salt = 'minKe' // 鐩愬�� - // 鍏抽敭瀛楄浆鎹㈣鍒� - let format = [ - { key: 'select', value: ' msltk ' }, - { key: 'from', value: ' mfrmk ' }, - { key: 'where', value: ' mwhrk ' }, - { key: 'order by', value: ' modbk ' }, - { key: 'asc', value: ' modack ' }, - { key: 'desc', value: ' moddesk ' }, - { key: 'top', value: ' mtpk ' }, - { key: 'like', value: ' mlkk ' }, - { key: 'not like', value: ' mnlkk ' }, - { key: 'between', value: ' mbtnk ' }, - { key: 'and', value: ' madk ' }, - { key: 'insert', value: ' mistk ' }, - { key: 'into', value: ' mitk ' }, - { key: 'update', value: ' muptk ' }, - { key: 'delete', value: ' mdelk ' }, - { key: 'begin', value: ' mbgink ' }, - { key: 'end', value: ' medk ' }, - { key: 'if', value: ' mefk ' }, - { key: 'while', value: ' mwilk ' }, - { key: 'create', value: ' mcrtk ' }, - { key: 'alter', value: ' matek ' }, - { key: 'len', value: ' mlnk ' }, - { key: 'left', value: ' mlftk ' }, - { key: 'right', value: ' mritk ' }, - { key: 'union', value: ' munok ' }, - { key: 'varchar', value: ' mvcrk ' }, - { key: 'getdate', value: ' mgtdtk ' }, - { key: 'TRY', value: ' mtryonek ' }, - { key: 'TRAN', value: ' mtrnk ' }, - { key: 'goto', value: ' mgtk ' }, - { key: 'set', value: ' mstk ' }, - { key: 'ROLLBACK', value: ' mrlbkk ' } - ] value = value.replace(/\n/ig, ' \n ') // 鏇挎崲鍏抽敭瀛� - format.forEach(item => { + formatKeys.forEach(item => { let reg = new RegExp('(^|\\s)' + item.key + '(\\s|$)', 'ig') value = value.replace(reg, item.value) }) @@ -1217,8 +1189,15 @@ // 澶辨晥楠岃瘉锛屾坊鍔犳暟鎹椂涓嶇敤 if (btn.sqlType !== 'insert' && verify.invalid === 'true' && setting.dataresource) { let datasource = setting.dataresource - if (/\s/.test(datasource)) { // 鎷兼帴鍒悕 + if (/\s/.test(datasource) && !/tb$/.test(datasource)) { // 鎷兼帴鍒悕 datasource = '(' + datasource + ') tb' + } + + if (setting.customScript) { + _sql += ` + /* 鏁版嵁婧愯嚜瀹氫箟鑴氭湰锛岃娉ㄦ剰鍙橀噺瀹氫箟鏄惁閲嶅 */ + ${setting.customScript} + ` } if (btn.Ot === 'requiredOnce') { @@ -1387,11 +1366,20 @@ } else if (verify.uniques && verify.uniques.length > 0 && btn.Ot === 'requiredOnce' && setting.dataresource) { let datasource = setting.dataresource if (/\s/.test(datasource)) { // 鎷兼帴鍒悕 - datasource = '(' + datasource + ') tb' + if (!/tb$/.test(datasource)) { + datasource = '(' + datasource + ') tb' + } } else { datasource = datasource + ' tb' } + if (setting.customScript) { + _sql += ` + /* 鏁版嵁婧愯嚜瀹氫箟鑴氭湰锛岃娉ㄦ剰鍙橀噺瀹氫箟鏄惁閲嶅 */ + ${setting.customScript} + ` + } + verify.uniques.forEach(item => { _sql += ` /* 鍚岀被鏁版嵁楠岃瘉 */ diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index b1f5c80..91b0b7b 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -394,7 +394,7 @@ _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' _param.secretkey = Utils.encrypt(_param.LTextOut, _param.timestamp) - _param.open_key = Utils.encrypt(_param.secretkey, _param.timestamp, true) + _param.open_key = Utils.encryptOpenKey(_param.secretkey, _param.timestamp) Api.dostarInterface(_param).then(response => { if (response.status) { -- Gitblit v1.8.0