From 4fdff772838dab41c8b2b08c37135fd6227bfcbb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 19 九月 2022 01:09:52 +0800 Subject: [PATCH] Merge branch 'develop' --- src/menu/components/chart/antv-bar/chartcompile/index.jsx | 37 + src/tabviews/custom/components/chart/antv-scatter/index.jsx | 82 --- src/utils/utils-datamanage.js | 19 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 82 --- src/menu/components/card/cardcellcomponent/dragaction/index.scss | 1 src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 82 --- src/menu/components/timeline/normal-timeline/index.jsx | 2 src/menu/components/card/table-card/index.jsx | 2 src/tabviews/custom/components/tree/antd-tree/index.jsx | 86 --- src/tabviews/custom/components/share/normalTable/index.scss | 2 src/tabviews/zshare/actionList/excelInbutton/index.jsx | 4 src/pc/components/login/normal-login/options.jsx | 2 src/tabviews/zshare/actionList/exceloutbutton/index.jsx | 17 src/tabviews/custom/components/carousel/data-card/index.jsx | 23 + src/api/index.js | 84 +++- src/tabviews/zshare/actionList/normalbutton/index.jsx | 5 public/README.txt | 2 src/views/mobdesign/index.jsx | 4 src/menu/components/carousel/data-card/index.jsx | 2 src/tabviews/custom/components/chart/custom-chart/index.jsx | 83 --- src/tabviews/custom/components/card/data-card/index.jsx | 25 + src/components/normalform/modalform/mkSelect/index.jsx | 2 src/views/sso/index.jsx | 2 src/tabviews/custom/components/card/table-card/index.jsx | 25 + src/tabviews/custom/components/card/prop-card/index.jsx | 87 --- src/views/pcdesign/index.jsx | 4 src/tabviews/custom/components/group/normal-group/index.jsx | 6 src/tabviews/custom/components/table/normal-table/index.jsx | 28 + src/menu/components/carousel/prop-card/index.jsx | 2 src/tabviews/custom/components/chart/antv-pie/index.jsx | 82 --- src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 23 + src/utils/timer-task.js | 71 +++ src/menu/components/card/data-card/index.jsx | 2 src/tabviews/zshare/actionList/printbutton/index.jsx | 5 src/tabviews/custom/components/table/edit-table/normalTable/index.scss | 2 src/tabviews/custom/components/carousel/prop-card/index.jsx | 23 + src/menu/components/share/clockcomponent/settingform/index.jsx | 2 src/tabviews/custom/index.jsx | 8 src/tabviews/custom/components/card/balcony/index.jsx | 85 --- src/views/appmanage/index.jsx | 4 src/menu/components/share/clockcomponent/index.jsx | 5 src/tabviews/custom/components/card/cardcellList/index.scss | 1 src/menu/components/table/normal-table/index.jsx | 2 src/tabviews/zshare/normalTable/index.scss | 3 src/views/login/index.jsx | 2 45 files changed, 481 insertions(+), 641 deletions(-) diff --git a/public/README.txt b/public/README.txt index b01eb22..14e4f03 100644 --- a/public/README.txt +++ b/public/README.txt @@ -14,6 +14,6 @@ debugger -- 鍊间负 true 鏃跺紑鍚皟璇曟ā寮忥紝寮�鍚悗绉诲姩绔瓙搴旂敤涓細鏈夋帶鍒跺彴 licenseKey -- 璁稿彲瀵嗛挜锛屽湪鍐呴儴缃戠粶涓娇鐢ㄧ郴缁熸椂锛屼細璺宠繃epc楠岃瘉 probation -- 璇曠敤鏈燂紙YYYY-MM-DD锛夛紝鍦ㄦ寮忕郴缁熶腑锛岃瘯鐢ㄦ湡鍐呰皟鐢ㄧ郴缁熸帴鍙g殑鑴氭湰浼氳褰曚笅鏉� -transfer -- 鏄惁浣跨敤杞帴鍙o紝浣跨敤杞帴鍙f椂璇疯缃负 true +transfer -- 鏄惁浣跨敤杞帴鍙o紝浣跨敤杞帴鍙f椂璇疯缃负 true, 浣跨敤杞帴鍙f椂锛屽閮ㄦ帴鍙h皟鐢ㄥ墠涓嶄細鍋氱櫥褰曢獙璇� keepPassword -- 璁颁綇瀵嗙爜锛岄粯璁ゅ紑鍚紝褰撳�间负 false 鏃剁鐢� platforms -- 绉诲姩绔彲浣跨敤鐨勫钩鍙扮被鍨嬶紝榛樿涓� ["H5", "wechat", "android", "ios", "wxMiniProgram"] 鍒嗗埆浠h〃H5椤甸潰銆佸井淇″叕浼楀彿銆佸畨鍗揂PP銆佽嫻鏋淎PP銆佸井淇″皬绋嬪簭 \ No newline at end of file diff --git a/src/api/index.js b/src/api/index.js index 3db610c..17a85f5 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -201,7 +201,7 @@ /** * @description 娓稿鐧诲綍 */ - getTouristMsg (appid, openid, memberid, scanId) { + getTouristMsg (binding_type, appid, openid, memberid, scanId) { let _SessionUid = localStorage.getItem('SessionUid') if (!_SessionUid) { // 鎵嬪姩娓呴櫎SessionUid鏃讹紝瀹炴椂鐢熸垚 @@ -216,24 +216,39 @@ TypeCharOne: 'pc', kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)) } - - param.LText = md5(window.btoa(_SessionUid + param.timestamp)) - param.secretkey = md5(param.LText + 'mingke' + param.timestamp) - - param.appkey = window.GLOB.appkey || '' - - if (appid) { - param.binding_type = 'mk' - param.thd_party_member_id = memberid - param.thd_party_openid = openid - param.thd_party_appid = appid - param.id = scanId - } let url = '/webapi/dologon/s_visitor_login' if (window.GLOB.mainSystemApi) { param.rduri = window.GLOB.mainSystemApi.replace(/\/webapi(.*)/, '/webapi/dologon/s_visitor_login') } + + if (binding_type === 'mk') { + param.binding_type = 'mk' + param.thd_party_member_id = memberid + param.thd_party_openid = openid + param.thd_party_appid = appid + param.id = scanId + } else if (binding_type === 'login_check') { // appid 姝ゆ椂涓虹洰鏍� + param.v_type = 'login_check' + param.LoginUID = sessionStorage.getItem('LoginUID') || '' + url = appid.replace(/\/webapi(.*)/, '/webapi/dologon/s_visitor_login') + + if (!param.rduri) { + param.rduri = window.GLOB.baseurl + 'webapi/dologon/s_visitor_login' + } + + param.linkurl = appid.replace(/\/webapi(.*)/, '/index.html') + } + + param.LText = md5(window.btoa(_SessionUid + param.timestamp + (param.linkurl || ''))) + + // param.secretkey = md5(param.LText + 'mingke' + param.timestamp) // v_type 涓虹┖鏃� + let solt = md5((window.GLOB.appkey + window.btoa(window.GLOB.appkey + 'mingke') + 'mingke').toLowerCase()).slice(-6).toUpperCase() + + param.v_type = param.v_type || 'Y' + param.secretkey = md5(param.LText + solt + param.timestamp) + + param.appkey = window.GLOB.appkey || '' return axios({ url: url, @@ -770,7 +785,8 @@ param.LoginUID = param.LoginUID || sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' - let url = '/webapi/dostars' + let login = false + let rduri = null if (param.rduri && /\s|\n/.test(param.rduri)) { param.rduri = param.rduri.replace(/\s|\n/g, '') @@ -779,18 +795,44 @@ } } - if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { // 鍒囨崲鐢ㄦ埛闇�瑕侀�氳繃鏈湴 + if (param.$login && !window.GLOB.transfer) { + login = true + rduri = param.rduri || '' + } + delete param.$login + + let url = '/webapi/dostars' + + if (param.rduri && !window.GLOB.transfer && /\/dostars/.test(param.rduri) && param.func !== 'webapi_ChangeUser') { url = param.rduri delete param.rduri } param = this.encryptParam(param) - return axios({ - url: `${url}${param.func ? '/' + param.func : ''}`, - method: 'post', - data: param - }) + if (login) { + return new Promise((resolve, reject) => { + this.getTouristMsg('login_check', rduri).then(res => { + if (res.status) { + axios({ + url: `${url}${param.func ? '/' + param.func : ''}`, + method: 'post', + data: param + }).then(result => { + resolve(result) + }) + } else { + resolve(res) + } + }) + }) + } else { + return axios({ + url: `${url}${param.func ? '/' + param.func : ''}`, + method: 'post', + data: param + }) + } } /** diff --git a/src/components/normalform/modalform/mkSelect/index.jsx b/src/components/normalform/modalform/mkSelect/index.jsx index 0c9e069..660fea9 100644 --- a/src/components/normalform/modalform/mkSelect/index.jsx +++ b/src/components/normalform/modalform/mkSelect/index.jsx @@ -112,6 +112,7 @@ showSearch allowClear value={value} + dropdownMatchSelectWidth={config.dropdown !== 'false'} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 || option.props.extend.toLowerCase().indexOf(input.toLowerCase()) >= 0} onSelect={this.selectChange} @@ -128,6 +129,7 @@ showSearch allowClear value={value} + dropdownMatchSelectWidth={config.dropdown !== 'false'} filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} onSelect={this.selectChange} onChange={(val) => val === undefined && this.selectChange('')} diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.scss b/src/menu/components/card/cardcellcomponent/dragaction/index.scss index 3683516..ea8410f 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.scss +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.scss @@ -114,6 +114,7 @@ background-size: cover; background-position: center center; background-repeat: no-repeat; + background-color: #f5f5f5; } .ant-mk-icon { vertical-align: top; diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx index b44b03d..09d308d 100644 --- a/src/menu/components/card/data-card/index.jsx +++ b/src/menu/components/card/data-card/index.jsx @@ -21,6 +21,7 @@ const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/components/paste')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) const { confirm } = Modal @@ -779,6 +780,7 @@ <PasteComponent options={['action', 'search', 'form', 'cardcell']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx index db3f76b..689e208 100644 --- a/src/menu/components/card/table-card/index.jsx +++ b/src/menu/components/card/table-card/index.jsx @@ -21,6 +21,7 @@ // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent')) const { confirm } = Modal @@ -589,6 +590,7 @@ <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null} diff --git a/src/menu/components/carousel/data-card/index.jsx b/src/menu/components/carousel/data-card/index.jsx index 4440080..0a4ad64 100644 --- a/src/menu/components/carousel/data-card/index.jsx +++ b/src/menu/components/carousel/data-card/index.jsx @@ -17,6 +17,7 @@ const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const { confirm } = Modal @@ -311,6 +312,7 @@ <CopyComponent type="datacard" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog}/> */} + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)}/> <SettingComponent config={card} updateConfig={this.updateComponent}/> diff --git a/src/menu/components/carousel/prop-card/index.jsx b/src/menu/components/carousel/prop-card/index.jsx index 641330c..685c304 100644 --- a/src/menu/components/carousel/prop-card/index.jsx +++ b/src/menu/components/carousel/prop-card/index.jsx @@ -18,6 +18,7 @@ const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const { confirm } = Modal @@ -419,6 +420,7 @@ <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" 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/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx index b49ad23..70b73e8 100644 --- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx +++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx @@ -262,20 +262,41 @@ } }) - if (config.plot.correction) { - delete config.plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛� - config.plot.barSize = 35 + let plot = fromJS(config.plot).toJS() + + if (plot.correction) { + delete plot.correction // 鏁版嵁淇锛堝凡寮冪敤锛� + plot.barSize = 35 + } + + if (plot.datatype !== 'statistics') { + if (plot.colors) { + plot.colors = plot.colors.map(item => { + if (fieldName[item.type]) { + item.label = fieldName[item.type] + } + return item + }) + } + if (plot.customs) { + plot.customs = plot.customs.map(item => { + if (fieldName[item.type]) { + item.name = fieldName[item.type] + } + return item + }) + } } this.setState({ visible: true, view: 'normal', - ramp: config.plot.ramp || 'false', - datatype: config.plot.datatype || 'query', + ramp: plot.ramp || 'false', + datatype: plot.datatype || 'query', fieldName: fieldName, - plot: fromJS(config.plot).toJS(), - baseFormlist: getBaseForm(config.plot, config.columns), - formlist: getOptionForm(config.plot, config.columns) + plot: plot, + baseFormlist: getBaseForm(plot, config.columns), + formlist: getOptionForm(plot, config.columns) }) } diff --git a/src/menu/components/share/clockcomponent/index.jsx b/src/menu/components/share/clockcomponent/index.jsx index 9fb414d..24de95e 100644 --- a/src/menu/components/share/clockcomponent/index.jsx +++ b/src/menu/components/share/clockcomponent/index.jsx @@ -1,6 +1,5 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { is, fromJS } from 'immutable' import { Modal } from 'antd' import { ClockCircleOutlined } from '@ant-design/icons' @@ -14,10 +13,6 @@ state = { visible: false - } - - shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) } trigger = () => { diff --git a/src/menu/components/share/clockcomponent/settingform/index.jsx b/src/menu/components/share/clockcomponent/settingform/index.jsx index 67b168c..0978f22 100644 --- a/src/menu/components/share/clockcomponent/settingform/index.jsx +++ b/src/menu/components/share/clockcomponent/settingform/index.jsx @@ -100,7 +100,7 @@ })(<InputNumber min={0} max={500} precision={0} />)} </Form.Item> </Col> : null} - {(config.subtype === 'balcony' || config.subtype === 'propcard') && timer && timer !== '2s' ? <Col span={22}> + {config.type === 'card' && (config.subtype === 'balcony' || config.subtype === 'propcard') && timer && timer !== '2s' ? <Col span={22}> <Form.Item label={ <Tooltip placement="topLeft" title="鍙互鎸囧畾瀛楁鐢ㄤ簬鎺у埗瀹氭椂鍣ㄧ殑鍏抽棴銆�"> <QuestionCircleOutlined className="mk-form-tip" /> diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx index 480a7db..a2448ee 100644 --- a/src/menu/components/table/normal-table/index.jsx +++ b/src/menu/components/table/normal-table/index.jsx @@ -21,6 +21,7 @@ const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) // const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent')) const ColumnComponent = asyncComponent(() => import('./columns')) @@ -522,6 +523,7 @@ <PasteComponent config={card} options={options} updateConfig={this.updateComponent} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> {/* <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> */} + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> diff --git a/src/menu/components/timeline/normal-timeline/index.jsx b/src/menu/components/timeline/normal-timeline/index.jsx index 87c2fe4..54da944 100644 --- a/src/menu/components/timeline/normal-timeline/index.jsx +++ b/src/menu/components/timeline/normal-timeline/index.jsx @@ -16,6 +16,7 @@ const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CardSimpleComponent = asyncComponent(() => import('@/menu/components/card/cardsimplecomponent')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) +const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent')) const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent')) const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader')) @@ -217,6 +218,7 @@ </NormalForm> <CopyComponent type="timeline" card={card}/> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/> + <ClockComponent config={card} updateConfig={this.updateComponent}/> <UserComponent config={card}/> <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} /> <SettingComponent config={card} updateConfig={this.updateComponent} /> diff --git a/src/pc/components/login/normal-login/options.jsx b/src/pc/components/login/normal-login/options.jsx index 05fa848..9731b8e 100644 --- a/src/pc/components/login/normal-login/options.jsx +++ b/src/pc/components/login/normal-login/options.jsx @@ -127,6 +127,7 @@ initval: wrap.tempId || '', tooltip: '鐭俊妯℃澘鍙湪 浜戠郴缁�->搴旂敤鏈嶅姟->寮�鍙戣�呬腑蹇�->鐭俊妯℃澘 澶勬坊鍔犮��', required: true, + dropdown: 'false', options: msgTemps }, { @@ -170,6 +171,7 @@ initval: wrap.signTempId || '', tooltip: '鐭俊妯℃澘鍙湪 浜戠郴缁�->搴旂敤鏈嶅姟->寮�鍙戣�呬腑蹇�->鐭俊妯℃澘 澶勬坊鍔犮��', required: true, + dropdown: 'false', options: msgTemps }, { diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index 8429861..c00e0fa 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -2,13 +2,12 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Spin, notification, Checkbox } from 'antd' -import moment from 'moment' 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 TimerTask from '@/utils/timer-task.js' import './index.scss' const CardCellComponent = asyncComponent(() => import('../cardcellList')) @@ -123,12 +122,18 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('syncBalconyData', this.syncBalconyData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) + } } shouldComponentUpdate (nextProps, nextState) { @@ -136,7 +141,6 @@ } componentWillUnmount () { - clearTimeout(this.timer) this.setState = () => { return } @@ -145,6 +149,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -168,72 +174,6 @@ this.setState({sync: false, data: _data}) } - } - - handleTimer = () => { - const { config } = this.state - - if (!config.timer) return - - const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) } /** @@ -370,13 +310,14 @@ if (config.timer && config.clearField) { let vals = (config.clearValue || '').split(',') if (vals.includes(_data[config.clearField])) { - clearTimeout(this.timer) + this.timer && this.timer.stop() } } } else { this.setState({ - loading: false, + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/card/cardcellList/index.scss b/src/tabviews/custom/components/card/cardcellList/index.scss index eb77a1e..2030460 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.scss +++ b/src/tabviews/custom/components/card/cardcellList/index.scss @@ -155,6 +155,7 @@ background-size: cover; background-position: center center; background-repeat: no-repeat; + background-color: #f5f5f5; } .ant-mk-picture.scale { cursor: zoom-in; diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 0d24ab6..557efcd 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -10,6 +10,7 @@ import preImg from '@/assets/img/prev.png' import nextImg from '@/assets/img/next.png' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import asyncComponent from '@/utils/asyncComponent' import './index.scss' @@ -195,11 +196,24 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('mkCheckAll', this.mkCheckAll) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData('', 'timer') + }) + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -256,6 +270,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -510,9 +526,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID) @@ -585,6 +603,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index f07fb25..71a8068 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -2,13 +2,12 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Spin, notification, Col, Row } from 'antd' -import moment from 'moment' 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 TimerTask from '@/utils/timer-task.js' import './index.scss' const CardItem = asyncComponent(() => import('../cardItem')) @@ -28,7 +27,6 @@ activeKey: '', // 閫変腑鏁版嵁 sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 data: {}, // 鏁版嵁 - timer: null, // 瀹氭椂鍣ㄦ椂闂撮棿闅� BData: '', selected: 'false', } @@ -137,11 +135,17 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) + } } shouldComponentUpdate (nextProps, nextState) { @@ -149,7 +153,6 @@ } componentWillUnmount () { - clearTimeout(this.timer) this.setState = () => { return } @@ -157,6 +160,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -208,72 +213,6 @@ } MKEmitter.emit('resetSelectLine', config.uuid, primaryId, data) - } - - handleTimer = () => { - const { config } = this.state - - if (!config.timer) return - - const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) } /** @@ -395,14 +334,14 @@ if (config.timer && config.clearField) { let vals = (config.clearValue || '').split(',') if (vals.includes(_data[config.clearField])) { - clearTimeout(this.timer) + this.timer && this.timer.stop() } } } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index c0e6424..40dce07 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -10,6 +10,7 @@ import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const CardCellComponent = asyncComponent(() => import('../cardcellList')) @@ -122,10 +123,23 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadData('timer') + }) + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -140,6 +154,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -266,9 +282,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID) @@ -312,6 +330,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 5c3334b..788da3d 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -7,6 +7,7 @@ import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const CardItem = asyncComponent(() => import('../cardItem')) @@ -106,9 +107,18 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData('timer') + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -148,6 +158,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -202,7 +214,7 @@ }) } - async loadData () { + async loadData (type) { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state @@ -220,9 +232,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) @@ -244,6 +258,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 2b3d4fe..fc913f1 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -7,6 +7,7 @@ import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const CardItem = asyncComponent(() => import('../cardItem')) @@ -105,10 +106,19 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData('timer') + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -123,6 +133,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -211,7 +223,7 @@ this.loadData() } - async loadData () { + async loadData (type) { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state @@ -234,9 +246,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, 1, BID) @@ -262,6 +276,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, 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 b90d017..4cb466d 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -13,6 +13,7 @@ import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' @@ -375,18 +376,25 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ componentWillUnmount () { - clearTimeout(this.timer) this.setState = () => { return } @@ -394,72 +402,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) - } - handleTimer = () => { - const { config } = this.state - - if (!config.timer) return - - const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) + this.timer && this.timer.stop() } /** @@ -587,9 +531,9 @@ }) } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index 9d8dbf7..bbda7f1 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -10,6 +10,7 @@ import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' @@ -166,87 +167,30 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } /** * @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 = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) + this.timer && this.timer.stop() } reloadData = (menuId) => { @@ -331,9 +275,9 @@ }) } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index f7fde28..06c4b42 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -13,6 +13,7 @@ import { chartColors } from '@/utils/option.js' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' @@ -122,87 +123,30 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } /** * @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 = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) + this.timer && this.timer.stop() } reloadData = (menuId) => { @@ -293,9 +237,9 @@ }) } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index f5b5693..bffcc3b 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -11,6 +11,7 @@ import asyncBtnComponent from './asyncButtonComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' @@ -112,18 +113,25 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ componentWillUnmount () { - clearTimeout(this.timer) this.setState = () => { return } @@ -131,72 +139,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) - } - handleTimer = () => { - const { config } = this.state - - if (!config.timer) return - - const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) + this.timer && this.timer.stop() } /** @@ -326,9 +270,9 @@ }) } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index 3223266..2680e59 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -5,12 +5,12 @@ import DataSet from '@antv/data-set' import * as echarts from 'echarts' import { Spin, Empty, notification } from 'antd' -import moment from 'moment' import Api from '@/api' import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' @@ -107,18 +107,25 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆 */ componentWillUnmount () { - clearTimeout(this.timer) this.setState = () => { return } @@ -126,72 +133,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) - } - handleTimer = () => { - const { config } = this.state - - if (!config.timer) return - - const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) + this.timer && this.timer.stop() } /** @@ -320,9 +263,9 @@ }) } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx index 699fd28..9c86c8a 100644 --- a/src/tabviews/custom/components/group/normal-group/index.jsx +++ b/src/tabviews/custom/components/group/normal-group/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Col, Empty, notification, Button, Row } from 'antd' +import { Col, notification, Button, Row } from 'antd' import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' @@ -137,8 +137,6 @@ getComponents = () => { const { config } = this.props const { mainSearch, data } = this.state - - if (!config || !config.components || config.components.length === 0) return (<Empty description={false} />) return config.components.map(item => { if (item.type === 'bar' || item.type === 'line') { @@ -343,6 +341,8 @@ const { config } = this.props const { printing } = this.state + if (!config.components || config.components.length === 0) return (<div style={config.style}></div>) + return ( <div className={'normal-group-wrap ' + (config.setting.layout || '')} id={config.uuid} style={config.style}> {config.setting && config.setting.print === 'true' ? <Button className="print-button" icon="printer" loading={printing} onClick={this.print}></Button> : null} diff --git a/src/tabviews/custom/components/share/normalTable/index.scss b/src/tabviews/custom/components/share/normalTable/index.scss index cdc9b52..ebaa748 100644 --- a/src/tabviews/custom/components/share/normalTable/index.scss +++ b/src/tabviews/custom/components/share/normalTable/index.scss @@ -100,6 +100,8 @@ position: relative; background-position: center center; background-size: cover; + background-repeat: no-repeat; + background-color: #f5f5f5; margin: 2px; } .ant-mk-picture.scale { diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss index 754dda6..4e5b652 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.scss +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.scss @@ -78,6 +78,8 @@ position: relative; background-position: center center; background-size: cover; + background-repeat: no-repeat; + background-color: #f5f5f5; margin: 2px; } .ant-mk-picture.scale { diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index d7b7184..8f7ea2a 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -8,6 +8,7 @@ import UtilsDM from '@/utils/utils-datamanage.js' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' // 閫氱敤缁勪欢 @@ -180,7 +181,7 @@ * @param { Boolean } reset 琛ㄦ牸鏄惁閲嶇疆 * @param { String } repage 琛ㄦ牸鏄惁閲嶇疆椤电爜 */ - async loadmaindata (reset, repage, id) { + async loadmaindata (reset, repage, id, type) { const { mainSearch } = this.props const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state @@ -214,9 +215,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) @@ -269,6 +272,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, @@ -612,10 +616,24 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.setState({ + pageIndex: 1 + }, () => { + this.loadmaindata(true, 'true', '', 'timer') + this.getStatFieldsValue() + }) + }) + } } /** @@ -629,6 +647,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } render() { diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 1dbcafe..99f4cda 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -8,6 +8,7 @@ import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) @@ -109,10 +110,19 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -127,6 +137,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -226,7 +238,7 @@ }) } - async loadData () { + async loadData (hastimer) { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state @@ -257,9 +269,11 @@ return } - 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, config.setting.pageSize, BID) @@ -281,6 +295,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index 3d8f850..41794b6 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -3,12 +3,11 @@ import { is, fromJS } from 'immutable' import { Spin, Empty, notification, Input, Tree } from 'antd' import { FolderOpenOutlined, FolderOutlined, FileOutlined } from '@ant-design/icons' -import moment from 'moment' import Api from '@/api' -import Utils from '@/utils/utils.js' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const { TreeNode } = Tree @@ -73,7 +72,7 @@ }, () => { if (config.setting.sync !== 'true' && config.setting.onload === 'true') { setTimeout(() => { - this.loadData(null) + this.loadData() }, config.setting.delay || 0) } else if (config.setting.sync === 'true' && _data) { this.handleData() @@ -108,87 +107,30 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) MKEmitter.addListener('resetSelectLine', this.resetParentParam) - this.handleTimer() + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData(true) + }) + } } /** * @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 = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } - - let timer = _change[config.timer] - let repeats = config.timerRepeats || 0 - - if (!timer) return - - if (repeats > 0 && repeats <=3) { - this.setState({timer, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, 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, repeats}) - this.timer = setTimeout(() => { - this.timerTask(repeats) - }, timer) - } - }) - } - - timerTask = (times) => { - const { timer, repeats } = this.state - if (!timer) return - - this.loadData(true) - - if (repeats) { - times = times - 1 - if (times <= 0) { - clearTimeout(this.timer) - return - } - } - this.timer = setTimeout(() => { - this.timerTask(times) - }, timer) + this.timer && this.timer.stop() } reloadData = (menuId) => { @@ -252,9 +194,9 @@ }) } else { this.setState({ - loading: false, - timer: null + loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index ceea329..6f41f64 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -1038,13 +1038,13 @@ } if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 - component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@datam@/ig, 'Y') + component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'') component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/') - _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@datam@/ig, 'Y') + _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/@\$/ig, '*/') } else { - component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '') - _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '') + component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx index 01747a5..0388670 100644 --- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx +++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx @@ -430,6 +430,10 @@ } else { param.rduri = btn.interface } + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { + param.$login = true + } } } diff --git a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx index ed16f15..a64d39f 100644 --- a/src/tabviews/zshare/actionList/exceloutbutton/index.jsx +++ b/src/tabviews/zshare/actionList/exceloutbutton/index.jsx @@ -260,6 +260,10 @@ } else { param.rduri = btn.interface } + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { + param.$login = true + } } } @@ -307,6 +311,10 @@ res.rduri = btn.proInterface } else { res.rduri = btn.interface + } + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { + res.$login = true } } } @@ -378,6 +386,10 @@ res.rduri = btn.proInterface } else { res.rduri = btn.interface + } + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { + res.$login = true } } } @@ -453,6 +465,11 @@ } else { param.rduri = btn.interface } + + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { + param.$login = true + } } } diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx index af088f7..73750e3 100644 --- a/src/tabviews/zshare/actionList/normalbutton/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx @@ -1629,6 +1629,11 @@ } else { result.rduri = btn.interface } + + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (result.rduri.indexOf(host) === -1 && /\/dostars/.test(result.rduri)) { + result.$login = true + } } } diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index ba05bff..776ede5 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -844,6 +844,11 @@ } else { res.rduri = btn.interface } + + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (res.rduri.indexOf(host) === -1 && /\/dostars/.test(res.rduri)) { + res.$login = true + } } } diff --git a/src/tabviews/zshare/normalTable/index.scss b/src/tabviews/zshare/normalTable/index.scss index 31344f4..0011eac 100644 --- a/src/tabviews/zshare/normalTable/index.scss +++ b/src/tabviews/zshare/normalTable/index.scss @@ -175,9 +175,10 @@ padding: 5px; } .mk-picture { - background-color: #d9d9d9; + background-color: #f5f5f5; background-position: center center; background-size: cover; + background-repeat: no-repeat; } .image-scale { cursor: zoom-in; diff --git a/src/utils/timer-task.js b/src/utils/timer-task.js new file mode 100644 index 0000000..d9e54bc --- /dev/null +++ b/src/utils/timer-task.js @@ -0,0 +1,71 @@ +import { notification } from 'antd' +import moment from 'moment' + +import Api from '@/api' +import Utils from '@/utils/utils.js' + +export default class timerTask { + constructor() { + this.timer = null + this.interval = null + this.repeats = 0 + } + + init(uuid, interval, repeats, callback) { + const _change = { '2s': 2000, '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 } + + this.interval = _change[interval] + this.repeats = repeats || 0 + + if (!this.interval) return + + if (this.repeats > 0 && this.repeats <=3) { + this.timer = setTimeout(() => { + this.timerTask(this.repeats, callback) + }, this.interval) + } else { + let _param = { + func: 's_get_timers_role', + LText: `select '${window.GLOB.appkey || ''}','${uuid}'`, + timer_type: interval, + component_id: 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 + }) + } else if (result.run_type) { + this.timer = setTimeout(() => { + this.timerTask(this.repeats, callback) + }, this.interval) + } + }) + } + } + + timerTask(times, callback) { + callback() + if (this.repeats) { + times = times - 1 + if (times <= 0) { + clearTimeout(this.timer) + return + } + } + this.timer = setTimeout(() => { + this.timerTask(times, callback) + }, this.interval) + } + + stop() { + clearTimeout(this.timer) + } +} \ No newline at end of file diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 5163438..1c66177 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -67,7 +67,15 @@ if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) { param.rduri = window.GLOB.mainSystemApi } else if (setting.sysInterface !== 'true') { - param.rduri = window.GLOB.systemType === 'production' ? (setting.proInterface || setting.interface) : setting.interface + if (window.GLOB.systemType === 'production' && setting.proInterface) { + param.rduri = setting.proInterface + } else { + param.rduri = setting.interface + } + let host = window.GLOB.baseurl.replace(/http(s):\/\//, '') + if (param.rduri.indexOf(host) === -1 && /\/dostars/.test(param.rduri)) { + param.$login = true + } } } @@ -533,7 +541,9 @@ param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) } - param.menuname = setting.MenuName || '' + if (setting.$name) { + param.menuname = setting.$name + } return param } @@ -616,7 +626,10 @@ param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') param.secretkey = Utils.encrypt('', param.timestamp) param.LText = Utils.formatOptions(param.LText) - param.menuname = setting.MenuName || '' + + if (setting.$name) { + param.menuname = setting.$name + } if (BID) { param.BID = BID diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx index e66512e..931230a 100644 --- a/src/views/appmanage/index.jsx +++ b/src/views/appmanage/index.jsx @@ -541,8 +541,8 @@ } getSmStemp = () => { - let _sql = `select ID,TemplateCode,SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a - inner join (select openid from sapp where id='${window.GLOB.appkey}') b + let _sql = `select聽ID,TemplateCode,SignName+'_'+describe as SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a + inner join (select openid from sapp where id='${window.GLOB.appkey}') b on a.openid=b.openid` _sql = Utils.formatOptions(_sql) diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index b4f267e..9803a5f 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -214,7 +214,7 @@ } authLogin = (appid, openid, memberid, scanId) => { - Api.getTouristMsg(appid, openid, memberid, scanId).then(res => { + Api.getTouristMsg('mk', appid, openid, memberid, scanId).then(res => { if (res.status) { sessionStorage.setItem('UserID', res.UserID) sessionStorage.setItem('LoginUID', res.LoginUID) diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index 24bc3ef..8e6f9a1 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -237,8 +237,8 @@ } getSmStemp = () => { - let _sql = `select ID,TemplateCode,SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a - inner join (select openid from sapp where id='${window.GLOB.appkey}') b + let _sql = `select聽ID,TemplateCode,SignName+'_'+describe as SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a + inner join (select openid from sapp where id='${window.GLOB.appkey}') b on a.openid=b.openid` _sql = Utils.formatOptions(_sql) diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index 06198dc..26c4531 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -329,8 +329,8 @@ getSmStemp = () => { if (!sessionStorage.getItem('msgTemplate')) { - let _sql = `select ID,TemplateCode,SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a - inner join (select openid from sapp where id='${window.GLOB.appkey}') b + let _sql = `select聽ID,TemplateCode,SignName+'_'+describe as SignName from (select * from bd_msn_sms_temp where deleted=0 and status=20 ) a + inner join (select openid from sapp where id='${window.GLOB.appkey}') b on a.openid=b.openid` _sql = Utils.formatOptions(_sql) diff --git a/src/views/sso/index.jsx b/src/views/sso/index.jsx index 05b6b59..60f8efa 100644 --- a/src/views/sso/index.jsx +++ b/src/views/sso/index.jsx @@ -24,7 +24,7 @@ } authLogin = (appid, openid, memberid, scanId) => { - Api.getTouristMsg(appid, openid, memberid, scanId).then(res => { + Api.getTouristMsg('mk', appid, openid, memberid, scanId).then(res => { if (res.status) { sessionStorage.setItem('UserID', res.UserID) sessionStorage.setItem('LoginUID', res.LoginUID) -- Gitblit v1.8.0