From 4cf3c14e6cd5ababdc6c7fddad1726395ed083b7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 16 三月 2021 12:21:16 +0800 Subject: [PATCH] 2021-03-16 --- src/index.js | 21 -- src/menu/components/share/usercomponent/index.jsx | 7 src/tabviews/custom/components/card/prop-card/index.jsx | 81 ++++++++ src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 75 +++++++ package-lock.json | 5 src/views/design/header/index.jsx | 4 src/components/header/index.jsx | 2 src/menu/components/share/clockcomponent/index.scss | 7 src/tabviews/custom/components/chart/antv-pie/index.jsx | 75 +++++++ src/tabviews/zshare/actionList/printbutton/index.jsx | 4 src/menu/components/chart/antv-pie/index.jsx | 2 src/menu/components/share/clockcomponent/settingform/index.scss | 0 src/menu/components/chart/antv-bar/index.jsx | 7 src/api/index.js | 48 ++--- src/menu/components/share/clockcomponent/settingform/index.jsx | 72 ++++++++ src/views/appmanage/index.jsx | 4 src/views/design/sidemenu/index.jsx | 2 package.json | 1 src/menu/components/share/clockcomponent/index.jsx | 70 +++++++ src/menu/components/card/prop-card/index.jsx | 2 src/tabviews/zshare/actionList/normalbutton/index.jsx | 4 21 files changed, 414 insertions(+), 79 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4a2649..fd8ff65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11573,6 +11573,11 @@ "verror": "1.10.0" } }, + "jssha": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jssha/-/jssha-3.2.0.tgz", + "integrity": "sha512-QuruyBENDWdN4tZwJbQq7/eAK85FqrI4oDbXjy5IBhYD+2pTJyBUWZe8ctWaCkrV0gy6AaelgOZZBMeswEa/6Q==" + }, "jsx-ast-utils": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz", diff --git a/package.json b/package.json index ad7bc05..5ca8645 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "jest-resolve": "24.8.0", "jest-watch-typeahead": "0.3.1", "jsbarcode": "^3.11.3", + "jssha": "^3.2.0", "md5": "^2.2.1", "mini-css-extract-plugin": "0.5.0", "moment": "^2.24.0", diff --git a/src/api/index.js b/src/api/index.js index cc33aa0..eaa86c6 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -2,6 +2,7 @@ import qs from 'qs' import { notification } from 'antd' import md5 from 'md5' +import jsSHA from 'jssha' import moment from 'moment' import Utils from '@/utils/utils.js' import CacheUtils from './cacheutils' @@ -215,15 +216,23 @@ * @description 鐧诲綍绯荤粺, 鑾峰彇鐢ㄦ埛淇℃伅 */ getusermsg (username, password, isCloud = false) { + let param = { // func: 'webapi_login', UserName: username, - Password: password, systemType: options.sysType, - Type: 'X' + Type: 'S' } - param.Password = Utils.formatOptions(param.Password) + // Type: 'S' 鏃� + let shaObj = new jsSHA('SHA-1', 'TEXT') + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + shaObj.update(password) + param.Password = shaObj.getHash('HEX').toUpperCase() + param.Password = md5(username + param.Password + param.timestamp) + + // Type: 'X' 鏃� + // param.Password = Utils.formatOptions(password) param.appkey = window.GLOB.appkey || '' if (isCloud) { @@ -382,19 +391,9 @@ param.lang = param.lang || sessionStorage.getItem('lang') || '' param.appkey = window.GLOB.appkey || '' param.SessionUid = localStorage.getItem('SessionUid') || '' - - if (sessionStorage.getItem('CloudUserID') && options.cloudServiceApi) { // 瀛樺湪浜戠鐧诲綍淇℃伅锛屼笖瀛樺湪浜戠鍦板潃 - param.rduri = options.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } else if (window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - param.userid = sessionStorage.getItem('UserID') - param.LoginUID = sessionStorage.getItem('LoginUID') || '' - } else { - param.userid = sessionStorage.getItem('UserID') - param.LoginUID = sessionStorage.getItem('LoginUID') || '' - } + param.rduri = options.cloudServiceApi || '' + param.userid = sessionStorage.getItem('CloudUserID') || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' param = this.encryptParam(param) @@ -413,15 +412,11 @@ param.appkey = window.GLOB.appkey || '' param.SessionUid = localStorage.getItem('SessionUid') || '' - if (sessionStorage.getItem('CloudUserID') && options.cloudServiceApi) { // 瀛樺湪浜戠鐧诲綍淇℃伅锛屼笖瀛樺湪浜戠鍦板潃 + if (options.cloudServiceApi) { // 闈炰簯绔姹� param.rduri = options.cloudServiceApi - param.userid = sessionStorage.getItem('CloudUserID') + param.userid = sessionStorage.getItem('CloudUserID') || '' param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' - } else if (window.GLOB.mainSystemApi) { - param.rduri = window.GLOB.mainSystemApi - param.userid = sessionStorage.getItem('UserID') - param.LoginUID = sessionStorage.getItem('LoginUID') || '' - } else { + } else { // 浜戠璇锋眰 param.userid = sessionStorage.getItem('UserID') param.LoginUID = sessionStorage.getItem('LoginUID') || '' } @@ -692,15 +687,15 @@ * @description 鑾峰彇涓氬姟閫氱敤鎺ュ彛 */ genericInterface (param) { - param.userid = sessionStorage.getItem('UserID') + param.userid = sessionStorage.getItem('UserID') || '' param.lang = sessionStorage.getItem('lang') || '' param.SessionUid = localStorage.getItem('SessionUid') || '' param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' if (options.cloudServiceApi && param.rduri === options.cloudServiceApi) { // HS涓嬭彍鍗� - param.userid = sessionStorage.getItem('CloudUserID') || '' - param.LoginUID = sessionStorage.getItem('CloudLoginUID') || '' + param.userid = sessionStorage.getItem('CloudUserID') || param.userid || '' + param.LoginUID = sessionStorage.getItem('CloudLoginUID') || param.LoginUID || '' } param = this.encryptParam(param) @@ -729,7 +724,6 @@ method: 'post', data: param }).then(res => { - try { const blob = new Blob([res]) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index cd34bd4..ce3a860 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -314,7 +314,7 @@ if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl + trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') } else { try { trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'} diff --git a/src/index.js b/src/index.js index c842e6d..cc743d1 100644 --- a/src/index.js +++ b/src/index.js @@ -57,10 +57,9 @@ sessionStorage.setItem('role_id', sessionStorage.getItem('localRole_id') || '') sessionStorage.setItem('dataM', sessionStorage.getItem('localDataM') || '') -// 娴嬭瘯绯荤粺鏂囦欢缃簬admin涓� +// 鏂扮郴缁熸枃浠剁疆浜巃dmin涓� ../options.json fetch('./options.json') -// fetch(process.env.NODE_ENV === 'production' ? '../options.json' : './options.json') .then(response => response.json()) .catch(() => { document.getElementById('root').innerHTML = '<div style="text-align: center; font-size: 30px; margin-top: 40vh;">绯荤粺閰嶇疆淇℃伅鑾峰彇澶辫触锛岃鑱旂郴绠$悊鍛橈紒</div>' @@ -106,24 +105,6 @@ } if (config.mainSystemApi) { let systemApi = config.mainSystemApi - - // if (/^(http|https):\/\//ig.test(systemApi)) { - // let _systemApi = /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(systemApi) - - // systemApi = _systemApi ? _systemApi[0] : '' - // } else { - // systemApi = '' - // } - - // // 涓氬姟绯荤粺杩炴帴浜戠鏃讹紝鏍煎紡鍖栧鐞� - // if (systemApi && systemApi === /^(http|https):\/\/[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62}|(:[0-9]{1,4}))+\.?/ig.exec(options.cloudServiceApi)[0]) { - // GLOB.dataFormat = true - // } - - // if (systemApi) { - // systemApi = systemApi + '/webapi/dostars' - // } - // 涓氬姟绯荤粺涓嶅厑璁歌繛鎺ヤ簯绔紝涓氬姟绯荤粺杩炴帴sso.mk9h.cn鏃讹紝鏁版嵁铏氬寲澶勭悊 if (systemApi && systemApi.indexOf('cloud.mk9h.cn') > -1) { systemApi = '' diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx index bf52a3c..655f7e9 100644 --- a/src/menu/components/card/prop-card/index.jsx +++ b/src/menu/components/card/prop-card/index.jsx @@ -20,6 +20,7 @@ const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const { confirm } = Modal @@ -383,6 +384,7 @@ <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index c788cc8..c20c65a 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -24,6 +24,7 @@ const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class antvBarLineChart extends Component { static propTpyes = { @@ -838,12 +839,7 @@ let _card = {...card, style} - // this.setState({ - // card: _card - // }) - this.updateComponent(_card) - // this.props.updateConfig(_card) } handleLog = (type, logs, item) => { @@ -894,6 +890,7 @@ <PasteComponent config={card} options={['action', 'search', 'form']} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index 32c3168..98d0d70 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -22,6 +22,7 @@ const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) class antvBarLineChart extends Component { static propTpyes = { @@ -457,6 +458,7 @@ <PasteComponent config={card} options={['search', 'form']} updateConfig={this.updateComponent} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <Icon className="close" title="delete" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/components/share/clockcomponent/index.jsx b/src/menu/components/share/clockcomponent/index.jsx new file mode 100644 index 0000000..65549fc --- /dev/null +++ b/src/menu/components/share/clockcomponent/index.jsx @@ -0,0 +1,70 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { is, fromJS } from 'immutable' +import { Icon, Modal } from 'antd' + +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' +import ClockForm from './settingform' +import './index.scss' + +class ClockComponent extends Component { + static propTpyes = { + btnlog: PropTypes.array, + updateConfig: PropTypes.func + } + + state = { + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + visible: false, + timer: '', + } + + shouldComponentUpdate (nextProps, nextState) { + return !is(fromJS(this.state), fromJS(nextState)) + } + + trigger = () => { + const { config } = this.props + + this.setState({ + visible: true, + timer: config.timer || '' + }) + } + + submit = () => { + const { config } = this.props + + this.verifyRef.handleConfirm().then(res => { + this.setState({ + visible: false + }) + this.props.updateConfig({...config, timer: res.timer}) + }) + } + + render () { + const { visible, loading, timer } = this.state + + return ( + <div className="clock-component-wrap"> + <Icon type="clock-circle" title="瀹氭椂鍣�" onClick={this.trigger} /> + <Modal + title="瀹氭椂鍣ㄨ缃�" + visible={visible} + width={500} + maskClosable={false} + confirmLoading={loading} + onOk={this.submit} + onCancel={() => this.setState({ visible: false })} + destroyOnClose + > + <ClockForm timer={timer} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/> + </Modal> + </div> + ) + } +} + +export default ClockComponent \ No newline at end of file diff --git a/src/menu/components/share/clockcomponent/index.scss b/src/menu/components/share/clockcomponent/index.scss new file mode 100644 index 0000000..997bba1 --- /dev/null +++ b/src/menu/components/share/clockcomponent/index.scss @@ -0,0 +1,7 @@ +.clock-component-wrap { + display: inline-block; + + >.anticon-clock-circle { + color: rgb(38, 194, 129); + } +} \ No newline at end of file diff --git a/src/menu/components/share/clockcomponent/settingform/index.jsx b/src/menu/components/share/clockcomponent/settingform/index.jsx new file mode 100644 index 0000000..bac1266 --- /dev/null +++ b/src/menu/components/share/clockcomponent/settingform/index.jsx @@ -0,0 +1,72 @@ +import React, {Component} from 'react' +import PropTypes from 'prop-types' +import { Form, Row, Col, Select } from 'antd' + +import './index.scss' + +class SettingForm extends Component { + static propTpyes = { + timer: PropTypes.string, // 缁勪欢鍚嶇О + inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 + } + + state = {} + + handleConfirm = () => { + // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� + return new Promise((resolve, reject) => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + resolve(values) + } else { + reject(err) + } + }) + }) + } + + render() { + const { getFieldDecorator } = this.props.form + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } + + return ( + <div> + <Form {...formItemLayout}> + <Row gutter={24}> + <Col span={22}> + <Form.Item label="瀹氭椂鍣�"> + {getFieldDecorator('timer', { + initialValue: this.props.timer || '' + })( + <Select> + <Select.Option value=""> 鏃� </Select.Option> + <Select.Option value="15s"> 15绉� </Select.Option> + <Select.Option value="30s"> 30绉� </Select.Option> + <Select.Option value="1min"> 1鍒嗛挓 </Select.Option> + <Select.Option value="5min"> 5鍒嗛挓 </Select.Option> + <Select.Option value="10min"> 10鍒嗛挓 </Select.Option> + <Select.Option value="15min"> 15鍒嗛挓 </Select.Option> + <Select.Option value="30min"> 30鍒嗛挓 </Select.Option> + <Select.Option value="1hour"> 1灏忔椂 </Select.Option> + </Select> + )} + </Form.Item> + </Col> + </Row> + </Form> + </div> + ) + } +} + +export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/share/clockcomponent/settingform/index.scss b/src/menu/components/share/clockcomponent/settingform/index.scss new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/menu/components/share/clockcomponent/settingform/index.scss diff --git a/src/menu/components/share/usercomponent/index.jsx b/src/menu/components/share/usercomponent/index.jsx index f2326d2..30caa31 100644 --- a/src/menu/components/share/usercomponent/index.jsx +++ b/src/menu/components/share/usercomponent/index.jsx @@ -13,10 +13,9 @@ import MKEmitter from '@/utils/events.js' import './index.scss' -class DataSource extends Component { +class UserComponent extends Component { static propTpyes = { - btnlog: PropTypes.array, - handlelog: PropTypes.func + btnlog: PropTypes.array } state = { @@ -228,4 +227,4 @@ } } -export default DataSource \ No newline at end of file +export default UserComponent \ No newline at end of file diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index bce3459..555429a 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -3,10 +3,12 @@ import { is, fromJS } from 'immutable' import { connect } from 'react-redux' import { Spin, notification, Col } from 'antd' +import moment from 'moment' -import asyncComponent from '@/utils/asyncComponent' import Api from '@/api' +import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' +import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' import { modifyTabview } from '@/store/action' import './index.scss' @@ -29,7 +31,8 @@ loading: false, // 鏁版嵁鍔犺浇鐘舵�� activeKey: '', // 閫変腑鏁版嵁 sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 - data: {} // 鏁版嵁 + data: {}, // 鏁版嵁 + timer: null // 瀹氭椂鍣ㄦ椂闂撮棿闅� } UNSAFE_componentWillMount () { @@ -111,6 +114,7 @@ MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + this.handleTimer() } shouldComponentUpdate (nextProps, nextState) { @@ -118,6 +122,7 @@ } componentWillUnmount () { + clearTimeout(this.timer) this.setState = () => { return } @@ -153,6 +158,65 @@ }) } } + } + + handleTimer = () => { + const { config } = this.state + + if (!config.timer) return + + const _change = { + '15s': 15000, + '30s': 30000, + '1min': 60000, + '5min': 300000, + '10min': 600000, + '15min': 900000, + '30min': 1800000, + '1hour': 3600000 + } + + let timer = _change[config.timer] + + if (!timer) return + + let _param = { + func: 's_get_timers_role', + LText: `select '${window.GLOB.appkey || ''}','${config.uuid}'`, + timer_type: config.timer, + component_id: config.uuid + } + + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 鏃堕棿鎴� + _param.LText = Utils.formatOptions(_param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑 + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5瀵嗛挜 + + Api.getSystemConfig(_param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } else if (result.run_type) { + this.setState({timer}) + this.timer = setTimeout(() => { + this.timerTask() + }, timer) + } + }) + } + + timerTask = () => { + const { timer } = this.state + if (!timer) return + + this.loadData(true) + + this.timer = setTimeout(() => { + this.timerTask() + }, timer) } /** @@ -199,7 +263,7 @@ this.loadData() } - async loadData () { + async loadData (hastimer) { const { mainSearch, menuType } = this.props const { config, arr_field, BID } = this.state @@ -227,9 +291,11 @@ }) } - this.setState({ - loading: true - }) + if (!hastimer) { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID, menuType) @@ -246,7 +312,8 @@ }) } else { this.setState({ - loading: false + loading: false, + timer: null }) notification.error({ top: 92, 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 c9a083d..1d2ba36 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -5,6 +5,7 @@ import { connect } from 'react-redux' import DataSet from '@antv/data-set' import { Spin, Empty, Select, notification } from 'antd' +import moment from 'moment' import asyncComponent from './asyncButtonComponent' import { chartColors } from '@/utils/option.js' @@ -236,12 +237,14 @@ MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('getexceloutparam', this.getexceloutparam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + this.handleTimer() } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ componentWillUnmount () { + clearTimeout(this.timer) this.setState = () => { return } @@ -249,6 +252,65 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('getexceloutparam', this.getexceloutparam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + } + + handleTimer = () => { + const { config } = this.state + + if (!config.timer) return + + const _change = { + '15s': 15000, + '30s': 30000, + '1min': 60000, + '5min': 300000, + '10min': 600000, + '15min': 900000, + '30min': 1800000, + '1hour': 3600000 + } + + let timer = _change[config.timer] + + if (!timer) return + + let _param = { + func: 's_get_timers_role', + LText: `select '${window.GLOB.appkey || ''}','${config.uuid}'`, + timer_type: config.timer, + component_id: config.uuid + } + + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 鏃堕棿鎴� + _param.LText = Utils.formatOptions(_param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑 + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5瀵嗛挜 + + Api.getSystemConfig(_param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } else if (result.run_type) { + this.setState({timer}) + this.timer = setTimeout(() => { + this.timerTask() + }, timer) + } + }) + } + + timerTask = () => { + const { timer } = this.state + if (!timer) return + + this.loadData(true) + + this.timer = setTimeout(() => { + this.timerTask() + }, timer) } /** @@ -325,7 +387,7 @@ /** * @description 鏁版嵁鍔犺浇 */ - async loadData () { + async loadData (hastimer) { const { mainSearch, menuType } = this.props const { config, arr_field, BID, search } = this.state @@ -348,9 +410,11 @@ }) } - this.setState({ - loading: true - }) + if (!hastimer) { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType) @@ -365,7 +429,8 @@ }) } else { this.setState({ - loading: false + loading: false, + timer: null }) notification.error({ top: 92, diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index df58e29..076dcfd 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -5,6 +5,7 @@ import { connect } from 'react-redux' import DataSet from '@antv/data-set' import { Spin, Empty, notification } from 'antd' +import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -115,17 +116,78 @@ componentDidMount () { MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) + this.handleTimer() } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ componentWillUnmount () { + clearTimeout(this.timer) this.setState = () => { return } MKEmitter.removeListener('reloadData', this.reloadData) MKEmitter.removeListener('resetSelectLine', this.resetParentParam) + } + + handleTimer = () => { + const { config } = this.state + + if (!config.timer) return + + const _change = { + '15s': 15000, + '30s': 30000, + '1min': 60000, + '5min': 300000, + '10min': 600000, + '15min': 900000, + '30min': 1800000, + '1hour': 3600000 + } + + let timer = _change[config.timer] + + if (!timer) return + + let _param = { + func: 's_get_timers_role', + LText: `select '${window.GLOB.appkey || ''}','${config.uuid}'`, + timer_type: config.timer, + component_id: config.uuid + } + + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 鏃堕棿鎴� + _param.LText = Utils.formatOptions(_param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑 + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5瀵嗛挜 + + Api.getSystemConfig(_param).then(result => { + if (!result.status) { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + return + } else if (result.run_type) { + this.setState({timer}) + this.timer = setTimeout(() => { + this.timerTask() + }, timer) + } + }) + } + + timerTask = () => { + const { timer } = this.state + if (!timer) return + + this.loadData(true) + + this.timer = setTimeout(() => { + this.timerTask() + }, timer) } reloadData = (menuId) => { @@ -155,7 +217,7 @@ this.pierender() } - async loadData () { + async loadData (hastimer) { const { mainSearch, menuType } = this.props const { config, arr_field, search, BID } = this.state @@ -178,9 +240,11 @@ }) } - this.setState({ - loading: true - }) + if (!hastimer) { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType) @@ -195,7 +259,8 @@ }) } else { this.setState({ - loading: false + loading: false, + timer: null }) notification.error({ top: 92, diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index fc44aa9..8e6997a 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1586,6 +1586,10 @@ _fieldlen = item.decimal ? item.decimal : 0 } + if (_initval === undefined) { + _initval = '' + } + return { key: item.field, readonly: item.readonly === 'true', diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 33b5643..aa69d91 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -1205,6 +1205,10 @@ _fieldlen = item.decimal ? item.decimal : 0 } + if (_initval === undefined) { + _initval = '' + } + return { key: item.field, readonly: item.readonly === 'true', diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index ee1fa6b..3efc3ba 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -26,7 +26,7 @@ { title: '搴旂敤鍚嶇О', dataIndex: 'remark', key: 'remark', align: 'center' }, { title: '搴旂敤缂栫爜', dataIndex: 'kei_no', key: 'kei_no', align: 'center' }, { - title: 'Action', + title: '鎿嶄綔', key: 'action', align: 'center', render: (text, record) => (<Button type="link" onClick={() => this.deleteApp(record)} style={{color: '#ff4d4f'}}>鍒犻櫎</Button>), @@ -97,7 +97,7 @@ render: (text, record) => (text ? <img style={{width: '32px', height: '32px'}} src={text} alt="" /> : null) }, { - title: 'Action', + title: '鎿嶄綔', key: 'action', align: 'center', width: '190px', diff --git a/src/views/design/header/index.jsx b/src/views/design/header/index.jsx index 258382a..5b8c73d 100644 --- a/src/views/design/header/index.jsx +++ b/src/views/design/header/index.jsx @@ -139,7 +139,7 @@ if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl + trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') trdItem.forbidden = true } else { try { @@ -324,7 +324,7 @@ {editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>閫�鍑�</Button> : null} {/* 杩涘叆缂栬緫鎸夐挳 */} {!editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null} - {!editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 30 ? + {!editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ? <span onClick={() => {window.open('#/appmanage')}} className="mobile" type="edit"> 搴旂敤绠$悊 <Icon type="arrow-right" /></span> : null } {/* window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'home', MenuId: 'home_page_id', MenuName: '棣栭〉' }))) */} diff --git a/src/views/design/sidemenu/index.jsx b/src/views/design/sidemenu/index.jsx index 98a3069..ba7518c 100644 --- a/src/views/design/sidemenu/index.jsx +++ b/src/views/design/sidemenu/index.jsx @@ -212,7 +212,7 @@ if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) { trdItem.type = 'iframe' - trdItem.LinkUrl = trd.LinkUrl + trdItem.LinkUrl = trd.LinkUrl.replace('&', '&') trdItem.forbidden = true } else { try { -- Gitblit v1.8.0