From c27d57333ed38c92f595219d2190ea63cef4d182 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 12 一月 2021 18:29:16 +0800 Subject: [PATCH] 2021-01-12 --- src/mob/datasource/verifycard/index.jsx | 3 src/templates/formtabconfig/index.jsx | 6 src/menu/components/share/searchcomponent/index.jsx | 3 src/tabviews/zshare/settingcomponent/editTable/index.scss | 88 ++++++ src/tabviews/zshare/settingcomponent/index.scss | 10 src/tabviews/zshare/settingcomponent/index.jsx | 52 +++ src/templates/zshare/verifycard/customscript/index.jsx | 35 ++ src/templates/sharecomponent/searchcomponent/index.jsx | 3 src/menu/components/search/main-search/index.jsx | 3 src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx | 3 src/templates/modalconfig/index.jsx | 3 src/templates/zshare/verifycard/customform/index.jsx | 3 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx | 32 + src/api/index.js | 3 src/menu/modalconfig/index.jsx | 3 src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx | 3 src/tabviews/subtable/index.jsx | 26 - src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 3 src/tabviews/commontable/index.jsx | 139 +++------- src/tabviews/zshare/settingcomponent/editTable/index.jsx | 313 ++++++++++++++++++++++++ src/menu/datasource/verifycard/index.jsx | 3 src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx | 3 src/views/login/index.jsx | 8 23 files changed, 598 insertions(+), 150 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 8c4b4e6..814044b 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -70,7 +70,8 @@ } } -window.GLOB.CacheMap = new Map() +window.GLOB.CacheMap = new Map() // 缂撳瓨閰嶇疆淇℃伅 +window.GLOB.UserCacheMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夎缃� axios.interceptors.response.use((response) => { if (response.data.ErrCode === 'LoginError') { diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index 7976772..b876a49 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -256,6 +256,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataSource } @@ -263,7 +264,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mainSystemApi && res.database === 'sso') { param.rduri = window.GLOB.mainSystemApi diff --git a/src/menu/components/share/searchcomponent/index.jsx b/src/menu/components/share/searchcomponent/index.jsx index fbad3ed..93b09e4 100644 --- a/src/menu/components/share/searchcomponent/index.jsx +++ b/src/menu/components/share/searchcomponent/index.jsx @@ -218,6 +218,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataSource } @@ -225,7 +226,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mainSystemApi && res.database === 'sso') { param.rduri = window.GLOB.mainSystemApi diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index 094a0c8..2d9c900 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -594,11 +594,12 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: result.sql } param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(result => { if (result.status) { diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 927175e..1625ac1 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -313,6 +313,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataSource } @@ -320,7 +321,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mainSystemApi && res.database === 'sso') { param.rduri = window.GLOB.mainSystemApi diff --git a/src/mob/datasource/verifycard/index.jsx b/src/mob/datasource/verifycard/index.jsx index 0df5ef4..1150f4a 100644 --- a/src/mob/datasource/verifycard/index.jsx +++ b/src/mob/datasource/verifycard/index.jsx @@ -426,11 +426,12 @@ if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { let param = { func: 's_debug_sql', + exec_type: 'y', LText: SettingUtils.getDebugSql(setting, _scripts, columns, searches) } param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(result => { if (result.status) { diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 9a7f5fd..72654e5 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -44,7 +44,7 @@ viewlost: false, // 椤甸潰涓㈠け锛�1銆佹湭鑾峰彇鍒伴厤缃�-椤甸潰涓㈠け锛�2銆侀〉闈㈡湭鍚敤 lostmsg: '', // 椤甸潰涓㈠け鏃剁殑鎻愮ず淇℃伅 config: {}, // 椤甸潰閰嶇疆淇℃伅锛屽寘鎷寜閽�佹悳绱€�佹樉绀哄垪銆佹爣绛剧瓑 - userConfig: null, // 鐢ㄦ埛鑷畾涔夎缃� + shortcuts: null, // 蹇嵎閿� searchlist: null, // 鎼滅储鏉′欢 actions: null, // 鎸夐挳闆� columns: null, // 鏄剧ず鍒� @@ -60,7 +60,6 @@ search: '', // 鎼滅储鏉′欢鏁扮粍锛屼娇鐢ㄦ椂闇�鍒嗗満鏅鐞� BIDs: {}, // 涓婄骇琛╥d pickup: false, // 涓昏〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 - tabActive: null, // 鏍囩椤靛睍寮�鎺у埗 chartId: '', // 灞曞紑鍥捐〃ID statFields: [], // 鍚堣瀛楁 statFValue: [], // 鍚堣鍊� @@ -81,7 +80,7 @@ if (result.status) { let config = '' - let userConfig = null + let shortcuts = [] let _curUserConfig = '' try { // 閰嶇疆淇℃伅瑙f瀽 @@ -94,13 +93,32 @@ // HS涓嶄娇鐢ㄨ嚜瀹氫箟璁剧疆 if (result.LongParamUser && this.props.menuType !== 'HS') { try { // 閰嶇疆淇℃伅瑙f瀽 - userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) + let userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser))) + userConfig = [] + + // if (window.GLOB.UserCacheMap.has(_param)) { + // return Promise.resolve(window.GLOB.UserCacheMap.get(_param)) + // } else { + // param = this.encryptParam(param) + // return new Promise(resolve => { + // axios({ + // url: `/webapi/dostars${param.func ? '/' + param.func : ''}`, + // data: param + // }).then(res => { + // if (res.status) { + // window.GLOB.UserCacheMap.set(_param, res) + // } + // resolve(res) + // }) + // }) + // } _curUserConfig = userConfig[this.props.MenuID] } catch (e) { console.warn('Parse Failure') - userConfig = null } } + console.log(config) + console.log(shortcuts) // 椤甸潰閰嶇疆瑙f瀽閿欒鏃舵彁绀� if (!config) { @@ -218,8 +236,6 @@ } if (_curUserConfig) { - config.easyCode = _curUserConfig.easyCode || config.easyCode || '' - config.action = config.action.map(item => { if (_curUserConfig.action[item.uuid]) { delete _curUserConfig.action[item.uuid].label @@ -240,12 +256,6 @@ return item }) } - - let _tabActive = {} // 绛涢�夊睍寮�鐨則ab椤� - - config.tabgroups.forEach(group => { - _tabActive[group.uuid] = group.sublist[0].uuid - }) let _arrField = [] // 瀛楁闆� let _columns = [] // 鏄剧ず鍒� @@ -336,29 +346,13 @@ return _item }) - if (_curUserConfig) { - _columns = _columns.map(item => { - if (_curUserConfig.columns[item.uuid]) { - delete _curUserConfig.columns[item.uuid].label - item = {...item, ..._curUserConfig.columns[item.uuid]} - } - - return item - }) - - _columns.sort((pre, next) => { - return pre.sort - next.sort - }) - } - this.setState({ loadingview: false, absFields, chartId, config, statFields, - userConfig, - tabActive: _tabActive, + shortcuts, setting: config.setting, searchlist: config.search, actions: _actions, @@ -387,8 +381,12 @@ } setShortcut = () => { - const { actions, userConfig, config } = this.state - if (!userConfig) return + const { shortcuts } = this.state + + if (!shortcuts || shortcuts.length === 0) { + document.onkeydown = () => {} + return + } document.onkeydown = (event) => { let e = event || window.event @@ -403,56 +401,21 @@ preKey = 'alt' } - if (!preKey) return + if (!preKey || !keyCode) return - let triggerId = '' + let _shortcut = preKey + keyCode - actions.some(item => { - if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { - e.preventDefault() - triggerId = item.uuid + shortcuts.some(item => { + if (item.shortcut === _shortcut) { + MKEmitter.emit('triggerBtnId', item.uuid) + + let element = item.parentId ? document.getElementById(item.parentId) : '' // 鏍囩鍒囨崲 + if (element && element.click) { + element.click() + } + return true } - return false - }) - - if (triggerId) { - MKEmitter.emit('triggerBtnId', triggerId) - return - } - - Object.keys(userConfig).some(key => { - if (key === this.props.MenuID || !userConfig[key].action) return false - - let _actions = userConfig[key].action - - Object.keys(_actions).some(btnkey => { - let item = _actions[btnkey] - - if (Array.isArray(item.shortcut) && preKey === item.shortcut[0] && keyCode === item.shortcut[1]) { - e.preventDefault() - triggerId = btnkey - - let _groupId = '' - let _ActiveTabId = '' - config.tabgroups.forEach(group => { - let _tab = group.sublist.filter(tab => tab.uuid === key)[0] - - if (!_tab) return - - _groupId = group.uuid - _ActiveTabId = _tab.uuid - }) - - if (_ActiveTabId && this.state.tabActive[_groupId] === _ActiveTabId) { - MKEmitter.emit('triggerBtnId', triggerId) - return true - } - } - return false - }) - - if (triggerId) return true return false }) } @@ -884,8 +847,8 @@ } render() { - const { menuType, MenuName } = this.props - const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state + const { menuType } = this.props + const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, chartId, search, selectedData } = this.state return ( <div className="commontable" id={this.state.ContainerId}> @@ -920,16 +883,6 @@ /> </div> <div className="main-table-box"> - {this.props.menuType !== 'HS' ? <SettingComponent - config={config} - columns={columns} - MenuName={MenuName} - dict={this.state.dict} - MenuID={this.props.MenuID} - permAction={this.props.permAction} - userConfig={this.state.userConfig} - reloadview={this.reloadview} - /> : null} {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && this.state.data && this.state.data.length > 0 ? <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" defaultChecked={pickup} onChange={this.pickupChange} /> : null } @@ -986,11 +939,11 @@ })} </Row> : null } {setting && config.tabgroups.map(group => ( - <Tabs key={group.uuid} onChange={(key) => this.setState({tabActive: {...tabActive, [group.uuid]: key}})}> + <Tabs key={group.uuid}> {group.sublist.map(_tab => { return ( <TabPane tab={ - <span> + <span id={_tab.uuid}> {_tab.icon ? <Icon type={_tab.icon} /> : null} {_tab.label} </span> @@ -999,7 +952,6 @@ Tab={_tab} MenuID={_tab.linkTab} mainSearch={_tab.searchPass === 'true' ? search : null} - userConfig={userConfig ? userConfig[_tab.uuid] : null} SupMenuID={this.props.MenuID} ContainerId={this.state.ContainerId} BID={this.state.BIDs[_tab.supMenu] || ''} @@ -1012,6 +964,7 @@ </Tabs>)) } {menuType !== 'HS' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} + {menuType !== 'HS' ? <SettingComponent config={config} dict={this.state.dict} MenuID={this.props.MenuID} permAction={this.props.permAction}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index eb8c555..6bee37b 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -35,7 +35,6 @@ mainSearch: PropTypes.any, // 涓昏〃鎼滅储鏉′欢 ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d - userConfig: PropTypes.any, // 鐢ㄦ埛鑷畾涔夎缃� } state = { @@ -92,7 +91,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, permMenus, Tab, BID, userConfig } = this.props + const { permAction, permMenus, Tab, BID } = this.props let param = { func: 'sPC_Get_LongParam', @@ -175,11 +174,14 @@ } let chartId = config.charts[0] ? config.charts[0].uuid : '' + let userConfig = null + if (window.GLOB.UserCacheMap.has(Tab.uuid)) { + userConfig = window.GLOB.UserCacheMap.get(Tab.uuid) + } if (userConfig) { config.action = config.action.map(item => { - if (userConfig.action[item.uuid]) { - delete userConfig.action[item.uuid].label + if (userConfig[item.uuid]) { item = {...item, ...userConfig.action[item.uuid]} } @@ -276,22 +278,6 @@ valid = false } }) - - // 娣诲姞鐢ㄦ埛鏄剧ず鍒楄缃� - if (userConfig) { - _columns = _columns.map(item => { - if (userConfig.columns[item.uuid]) { - delete userConfig.columns[item.uuid].label - item = {...item, ...userConfig.columns[item.uuid]} - } - - return item - }) - - _columns.sort((pre, next) => { - return pre.sort - next.sort - }) - } config.setting.tabType = 'sub' // 鏁版嵁婧愪俊鎭澶勭悊 diff --git a/src/tabviews/zshare/settingcomponent/editTable/index.jsx b/src/tabviews/zshare/settingcomponent/editTable/index.jsx new file mode 100644 index 0000000..c5c9f2c --- /dev/null +++ b/src/tabviews/zshare/settingcomponent/editTable/index.jsx @@ -0,0 +1,313 @@ +import React, { Component } from 'react' +import PropTypes from 'prop-types' +import { fromJS } from 'immutable' +import { Table, Form, Icon, Select, Cascader, notification, message } from 'antd' + +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +import './index.scss' + +let eTDict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS +const EditableContext = React.createContext() + +class EditableCell extends Component { + getInput = () => { + const { inputType, options } = this.props + + if (inputType === 'select') { + return ( + <Select> + {options.map((item, i) => (<Select.Option key={i} value={item.value}> {item.text} </Select.Option>))} + </Select> + ) + } else if (inputType === 'cascader') { + return ( + <Cascader options={options} placeholder=""/> + ) + } + } + + renderCell = (form) => { + const { getFieldDecorator } = form + const { editing, dataIndex, title, record, children, className, required, inputType } = this.props + + return ( + <td className={className}> + {editing ? ( + <Form.Item style={{ margin: 0 }}> + {getFieldDecorator(dataIndex, { + rules: [ + { + required: required, + message: ['number', 'text', 'input'].includes(inputType) ? `${eTDict['form.required.input']} ${title}!` : `${eTDict['form.required.select']} ${title}!`, + } + ], + initialValue: record[dataIndex], + })(this.getInput())} + </Form.Item> + ) : ( + children + )} + </td> + ) + } + + render() { + return <EditableContext.Consumer>{this.renderCell}</EditableContext.Consumer> + } +} + +class EditTable extends Component { + static propTpyes = { + data: PropTypes.any, // 鏁版嵁鍒楄〃 + columns: PropTypes.array, // 鏄剧ず鍒� + onChange: PropTypes.func // 鏁版嵁鍙樺寲 + } + + state = { + data: [], + editingKey: '', + visible: false, + columns: [] + } + + UNSAFE_componentWillMount () { + const { data } = this.props + let columns = fromJS(this.props.columns).toJS() + + columns.push({ + title: '鎿嶄綔', + dataIndex: 'operation', + width: '140px', + render: (text, record) => { + const { editingKey } = this.state + const editable = this.isEditing(record) + return editable ? ( + <div style={{textAlign: 'center', minWidth: '110px'}}> + <EditableContext.Consumer> + {form => ( + <span onClick={() => this.save(form, record.uuid)} style={{ marginRight: 8 , color: '#1890ff', cursor: 'pointer'}}> + {eTDict['model.save']} + </span> + )} + </EditableContext.Consumer> + <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>{eTDict['model.cancel']}</span> + </div> + ) : ( + <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px'}}> + <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><Icon type="edit" /></span> + </div> + ) + } + }) + + this.setState({ + data: data || [], + columns + }) + } + + isEditing = record => record.uuid === this.state.editingKey + + cancel = () => { + this.setState({ editingKey: '' }) + } + + copy = (item) => { + const { type } = this.props + const { data } = this.state + + if (!data || data.length === 0) { + message.warning('鏈幏鍙栧埌閰嶇疆淇℃伅') + return + } + + let msg = { key: type } + + if (item) { + msg.type = 'line' + msg.data = item + } else { + msg.type = 'array' + msg.data = data + } + + try { + msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) + } catch { + console.warn('Stringify Failure') + msg = '' + } + + if (msg) { + let oInput = document.createElement('input') + oInput.value = msg + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + message.success('澶嶅埗鎴愬姛銆�') + } + } + + onSave = (record) => { + const { columns } = this.state + const newData = [...this.state.data] + const index = newData.findIndex(item => record.uuid === item.uuid) + + if (index === -1) { + notification.warning({ + top: 92, + message: '鏁版嵁閿欒锛屾棤娉曟壘鍒拌ID锛�', + duration: 5 + }) + return + } + + let unique = true + columns.forEach(col => { + if (col.unique !== true || !unique) return + + let _index = newData.findIndex(item => record.uuid !== item.uuid && record[col.dataIndex] === item[col.dataIndex]) + + if (_index > -1) { + notification.warning({ + top: 92, + message: col.title + '涓嶅彲閲嶅锛�', + duration: 5 + }) + unique = false + } + }) + + if (!unique) return + + newData.splice(index, 1, record) + this.setState({ data: newData, editingKey: '' }, () => { + this.props.onChange(newData) + }) + } + + handleDelete = (uuid) => { + const { data } = this.state + let _data = data.filter(item => uuid !== item.uuid) + + this.setState({ + data: _data + }, () => { + this.props.onChange(_data) + }) + } + + save(form, uuid) { + const { columns } = this.state + form.validateFields((error, row) => { + if (error) { + return; + } + const newData = [...this.state.data] + const index = newData.findIndex(item => uuid === item.uuid) + + let unique = true + columns.forEach(col => { + if (col.unique !== true || !unique) return + + let _index = newData.findIndex(item => uuid !== item.uuid && row[col.dataIndex] === item[col.dataIndex]) + + if (_index > -1) { + notification.warning({ + top: 92, + message: col.title + '涓嶅彲閲嶅锛�', + duration: 5 + }) + unique = false + } + }) + + if (!unique) return + + if (index > -1) { + const item = newData[index] + newData.splice(index, 1, { + ...item, + ...row, + }) + this.setState({ data: newData, editingKey: '' }, () => { + this.props.onChange(newData) + }) + } else { + newData.push(row); + this.setState({ data: newData, editingKey: '' }, () => { + this.props.onChange(newData) + }) + } + }) + } + + edit(uuid) { + this.setState({ editingKey: uuid }) + } + + moveRow = (dragIndex, hoverIndex) => { + const { editingKey } = this.state + let _data = fromJS(this.state.data).toJS() + + if (editingKey) return + + _data.splice(hoverIndex, 0, ..._data.splice(dragIndex, 1)) + + this.setState({ + data: _data + }, () => { + this.props.onChange(_data) + }) + } + + render() { + let components = { + body: { + cell: EditableCell + } + } + + const columns = this.state.columns.map(col => { + if (!col.editable) return col + return { + ...col, + onCell: record => ({ + record, + inputType: col.inputType, + dataIndex: col.dataIndex, + options: col.options || [], + required: col.required !== false ? true : false, + title: col.title, + editing: this.isEditing(record), + onSave: this.onSave, + }), + } + }) + + return ( + <EditableContext.Provider value={this.props.form}> + <div className="modal-edit-table"> + <Table + bordered + rowKey="uuid" + components={components} + dataSource={this.state.data} + columns={columns} + rowClassName="editable-row" + pagination={false} + onRow={(record, index) => ({ + index, + moveAble: !this.state.editingKey, + moveRow: this.moveRow, + })} + /> + </div> + </EditableContext.Provider> + ) + } +} + +export default Form.create()(EditTable) \ No newline at end of file diff --git a/src/tabviews/zshare/settingcomponent/editTable/index.scss b/src/tabviews/zshare/settingcomponent/editTable/index.scss new file mode 100644 index 0000000..5943f34 --- /dev/null +++ b/src/tabviews/zshare/settingcomponent/editTable/index.scss @@ -0,0 +1,88 @@ +.modal-edit-table { + .editable-row { + .ant-form-explain { + position: absolute; + font-size: 12px; + margin-top: -4px; + } + .color-sketch-block { + width: 200px; + position: relative; + top: 8px; + } + .ant-select { + width: 100%; + } + > td { + padding: 14px 10px; + } + > td:last-child { + padding: 0px; + } + } + + thead tr th:last-child { + text-align: center; + } + .edit-operation-btn { + display: block; + text-align: center; + span { + margin-right: 10px; + cursor: pointer; + font-size: 16px; + padding: 5px; + } + .primary { + color: #1890ff; + } + .copy { + color: #26C281; + } + .danger { + color: #ff4d4f; + } + span:last-child { + margin-right: 0px; + } + } + .edit-operation-btn.disabled { + cursor: default; + span { + cursor: default; + } + .primary { + color: rgba(0, 0, 0, .25); + } + .danger { + color: rgba(0, 0, 0, .25); + } + .copy { + color: rgba(0, 0, 0, .25); + } + } + .ant-empty { + margin: 0; + } + tr.drop-over-downward td { + border-bottom: 2px dashed #1890ff; + } + tr.drop-over-upward td { + border-top: 2px dashed #1890ff; + } + .copy-control { + display: inline-block; + position: absolute; + right: 10px; + top: 2px; + + .anticon-copy { + margin-right: 7px; + color: #26C281; + } + .anticon-snippets { + color: purple; + } + } +} + diff --git a/src/tabviews/zshare/settingcomponent/index.jsx b/src/tabviews/zshare/settingcomponent/index.jsx index a16f49a..4174989 100644 --- a/src/tabviews/zshare/settingcomponent/index.jsx +++ b/src/tabviews/zshare/settingcomponent/index.jsx @@ -1,9 +1,10 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Icon, Button, Modal, notification } from 'antd' +import { Button, Modal, notification } from 'antd' import Api from '@/api' +import options from '@/store/options.js' import asyncComponent from '@/utils/asyncSpinComponent' import './index.scss' @@ -32,6 +33,45 @@ confirmLoading: false, revertLoading: false }) + + // let deffers = [] + // config.tabgroups.forEach(group => { + // group.sublist.forEach(tab => { + // deffers.push(new Promise(resolve => { + // let param = { + // func: 'sPC_Get_LongParam', + // MenuID: tab.linkTab + // } + // Api.getCacheConfig(param).then(res => { + // res.tab = tab + // resolve(res) + // }) + // })) + // }) + // }) + + // if (deffers.length > 0) { + // Promise.all(deffers).then(result => { + // let errors = result.filter(res => !res.status) + // if (errors.length > 0) { + // notification.warning({ + // top: 92, + // message: errors[0].message, + // duration: 5 + // }) + // this.setState({ + // loading: false + // }) + // return + // } + + // let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID + // result.forEach(res => { + // if (!res.LongParam) return + + // let subconfig = '' + // let subUserConfig = userConfig ? userConfig[res.tab.uuid] : '' + // } } changeMenuParam = (param) => { @@ -125,8 +165,14 @@ render() { return ( - <div> - <Icon className="custom-control" type="setting" onClick={this.controlCustomSetting} /> + <div className="page-setting-wrap"> + {options.sysType === 'local' ? <Button + icon="setting" + shape="circle" + className="page-setting" + onClick={this.handleviewconfig} + /> : null} + {/* <Icon className="custom-control" type="setting" onClick={this.controlCustomSetting} /> */} <Modal wrapClassName="common-table-custom-modal" title={'鑷畾涔夎缃�'} diff --git a/src/tabviews/zshare/settingcomponent/index.scss b/src/tabviews/zshare/settingcomponent/index.scss index 14fb20f..7299038 100644 --- a/src/tabviews/zshare/settingcomponent/index.scss +++ b/src/tabviews/zshare/settingcomponent/index.scss @@ -1,3 +1,13 @@ +.page-setting-wrap { + .page-setting { + position: fixed; + z-index: 2; + bottom: 110px; + right: 30px; + width: 40px; + height: 40px; + } +} .common-table-custom-modal { .ant-modal { top: 50px; diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index c6be862..eab6c34 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -613,6 +613,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataSource } @@ -620,7 +621,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mainSystemApi && res.database === 'sso') { param.rduri = window.GLOB.mainSystemApi @@ -1469,6 +1470,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataresource } @@ -1476,7 +1478,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(result => { if (result.status) { diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 81a6c82..857474c 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -414,6 +414,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataSource } @@ -421,7 +422,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mainSystemApi && res.database === 'sso') { param.rduri = window.GLOB.mainSystemApi diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx index 1e03a6b..3a5c827 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx @@ -122,19 +122,35 @@ aaa: ` - let _initsql = '' - this.props.scripts.forEach(script => { - if (this.state.editItem && this.state.editItem.uuid === script.uuid) return - if (script.status === 'false' || script.position !== 'init') return + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� - _initsql += ` - ${script.sql} + this.props.scripts.forEach(item => { + if (item.status === 'false') return + + if (item.position === 'init') { + _initCustomScript += ` + /* 鍒濆鍖栬剼鏈� */ + ${values.uuid === item.uuid ? values.sql : item.sql} ` + } else if (item.position === 'front') { + _prevCustomScript += ` + /* 榛樿sql鍓嶈剼鏈� */ + ${values.uuid === item.uuid ? values.sql : item.sql} + ` + } else { + _backCustomScript += ` + /* 榛樿sql鍚庤剼鏈� */ + ${values.uuid === item.uuid ? values.sql : item.sql} + ` + } }) let param = { func: 's_debug_sql', - LText: this.state.verifySql + _initsql + values.sql + tail + exec_type: 'y', + LText: this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail } param.LText = param.LText.replace(/@\$|\$@/ig, '') @@ -146,7 +162,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) Api.getLocalConfig(param).then(res => { diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx index fd6f3e0..e71b802 100644 --- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx +++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/index.jsx @@ -308,6 +308,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: values.sql } @@ -315,7 +316,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(res => { if (res.status) { diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index 6d84804..ae43ac0 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -194,6 +194,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: res.dataSource } @@ -201,7 +202,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) if (window.GLOB.mainSystemApi && res.database === 'sso') { param.rduri = window.GLOB.mainSystemApi diff --git a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx index d3c4ef6..0ec28a2 100644 --- a/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx +++ b/src/templates/sharecomponent/settingcalcomponent/verifycard/index.jsx @@ -278,11 +278,12 @@ } else if (setting.execute !== 'false' || _scripts.length > 0) { let param = { func: 's_debug_sql', + exec_type: 'y', LText: SettingUtils.getDebugSql(setting, _scripts, columns, Utils.getRegOptions(searches), config.calendar) } param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(result => { if (result.status) { diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 913ca8d..f7a193e 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -265,11 +265,12 @@ } else { // type 涓� submit 銆� verify 锛屼互鍙婂叾浠栭渶瑕侀獙璇佺殑鍦烘櫙 let param = { func: 's_debug_sql', + exec_type: 'y', LText: SettingUtils.getDebugSql(setting, _scripts, arr_field, regoptions, search) } param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(result => { if (result.status) { diff --git a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx index 33a5f76..285aff8 100644 --- a/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/settingform/index.jsx @@ -124,11 +124,12 @@ } else { // type 涓� submit 銆� verify 锛屼互鍙婂叾浠栭渶瑕侀獙璇佺殑鍦烘櫙 let param = { func: 's_debug_sql', + exec_type: 'y', LText: SettingUtils.getDebugSql(setting, _scripts) } param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) Api.getLocalConfig(param).then(result => { if (result.status) { diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx index cb3310f..c9be94d 100644 --- a/src/templates/zshare/verifycard/customform/index.jsx +++ b/src/templates/zshare/verifycard/customform/index.jsx @@ -97,6 +97,7 @@ let param = { func: 's_debug_sql', + exec_type: 'y', LText: this.props.initsql + values.sql } @@ -110,7 +111,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) Api.getLocalConfig(param).then(res => { diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx index e5058a3..d1a9a85 100644 --- a/src/templates/zshare/verifycard/customscript/index.jsx +++ b/src/templates/zshare/verifycard/customscript/index.jsx @@ -37,10 +37,11 @@ } handleConfirm = () => { + const { editItem } = this.state // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { - values.uuid = this.state.editItem ? this.state.editItem.uuid : '' + values.uuid = editItem ? editItem.uuid : '' let _quot = values.sql.match(/'{1}/g) let _lparen = values.sql.match(/\({1}/g) @@ -88,19 +89,35 @@ aaa: ` - let _initsql = '' - this.props.customScripts.forEach(script => { - if (this.state.editItem && this.state.editItem.uuid === script.uuid) return - if (script.status === 'false' || script.position !== 'init') return + let _initCustomScript = '' // 鍒濆鍖栬剼鏈� + let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈� + let _backCustomScript = '' // 榛樿sql鍚庢墽琛岃剼鏈� - _initsql += ` - ${script.sql} + this.props.customScripts.forEach(item => { + if (item.status === 'false') return + + if (item.position === 'init') { + _initCustomScript += ` + /* 鍒濆鍖栬剼鏈� */ + ${values.uuid === item.uuid ? values.sql : item.sql} ` + } else if (item.position === 'front') { + _prevCustomScript += ` + /* 榛樿sql鍓嶈剼鏈� */ + ${values.uuid === item.uuid ? values.sql : item.sql} + ` + } else { + _backCustomScript += ` + /* 榛樿sql鍚庤剼鏈� */ + ${values.uuid === item.uuid ? values.sql : item.sql} + ` + } }) let param = { func: 's_debug_sql', - LText: this.props.initsql + _initsql + values.sql + tail + exec_type: 'y', + LText: this.props.initsql + _initCustomScript + _prevCustomScript + _backCustomScript + tail } // 鏁版嵁鏉冮檺 @@ -115,7 +132,7 @@ param.LText = Utils.formatOptions(param.LText) param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') - param.secretkey = Utils.encrypt(param.LText, param.timestamp) + param.secretkey = Utils.encrypt('', param.timestamp) this.setState({loading: true}) Api.getLocalConfig(param).then(res => { diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 3fdf721..91550c6 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -255,8 +255,12 @@ Api.getTouristMsg().then(result => { if (result.status) { - result.UserID && sessionStorage.setItem('UserID', result.UserID) - result.LoginUID && sessionStorage.setItem('LoginUID', result.LoginUID) + if (result.UserID && !sessionStorage.getItem('UserID')) { + sessionStorage.setItem('UserID', result.UserID) + } + if (result.LoginUID && !sessionStorage.getItem('LoginUID')) { + sessionStorage.setItem('LoginUID', result.LoginUID) + } if (result.UserID && result.LoginUID) { this.setState({touristLogin: true}) -- Gitblit v1.8.0