| | |
| | | { |
| | | "appId": "201912040924165801464FF1788654BC5AC73", |
| | | "appkey": "20191106103859640976D6E924E464D029CF0", |
| | | "appId": "20230324173136800278A30757BBB4780921F", |
| | | "appkey": "2023032417311621367D715E545D847E5841A", |
| | | "mainSystemApi": "http://sso.mk9h.cn/cloud/webapi/dostars", |
| | | "systemType": "", |
| | | "externalDatabase": "", |
| | |
| | | "transfer": "false", |
| | | "keepPassword": "true", |
| | | "platforms": ["H5", "wechat", "android", "ios", "wxMiniProgram"], |
| | | "host": "http://qingqiumarket.cn", |
| | | "service": "MKWMS/" |
| | | "host": "https://demo.mk9h.cn", |
| | | "service": "qisheng/" |
| | | } |
| | |
| | | /** |
| | | * @description 获取IndexedDB中的配置信息 |
| | | */ |
| | | static getIndexDBCacheConfig (MenuID) { |
| | | static getIndexDBCacheConfig (MenuID, limit) { |
| | | if (!window.GLOB.IndexDB) return Promise.resolve() |
| | | |
| | | return new Promise((resolve, reject) => { |
| | |
| | | } |
| | | |
| | | request.onsuccess = () => { |
| | | resolve(request.result) |
| | | if (limit && request.result) { |
| | | if (request.result.CreateDate > limit) { |
| | | resolve(request.result) |
| | | } else { |
| | | resolve() |
| | | } |
| | | } else { |
| | | resolve(request.result) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | |
| | | request.onsuccess = (e) => { |
| | | let cursor = e.target.result |
| | | if (cursor) { |
| | | if (cursor.value.CreateDate < date) { |
| | | if (cursor.value.CreateDate < date || cursor.value.CreateDate.length === 10) { |
| | | cursor.delete() |
| | | } |
| | | cursor.continue() |
| | |
| | | } |
| | | |
| | | delCacheConfig (type = '') { |
| | | let date = moment().subtract(7, 'days').format('YYYY-MM-DD') |
| | | let date = moment().subtract(7, 'days').format('YYYY-MM-DD HH:mm:ss') |
| | | CacheUtils.delIndexDBCacheConfig(date, type) |
| | | } |
| | | |
| | | writeCacheConfig (menuid, data) { |
| | | if (!menuid) return |
| | | let date = moment().format('YYYY-MM-DD') |
| | | let date = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let _data = data ? JSON.stringify(data) : '' |
| | | |
| | | CacheUtils.writeCacheInIndexDB({menuid, CreateDate: date, LongParam: _data}) |
| | | } |
| | | |
| | | getLCacheConfig (menuid) { |
| | | getLCacheConfig (menuid, minutes) { |
| | | return new Promise((resolve, reject) => { |
| | | if (window.GLOB.IndexDB) { |
| | | CacheUtils.getIndexDBCacheConfig(menuid).then(res => { |
| | | let limit = minutes ? moment().subtract(minutes, 'minutes').format('YYYY-MM-DD HH:mm:ss') : '' |
| | | CacheUtils.getIndexDBCacheConfig(menuid, limit).then(res => { |
| | | if (res && res.LongParam) { |
| | | let _data = JSON.parse(res.LongParam) |
| | | if (_data.length === 0) { |
| | |
| | | list = '' |
| | | } |
| | | CacheUtils.delIndexDBConfig(list) |
| | | this.delCacheConfig('all') |
| | | } |
| | | |
| | | CacheUtils.updateIndexDBversion({version: res.app_version || '1.00', createDate: curTime}) |
| | |
| | | |
| | | let _data = { $$empty: true } |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | this.loaded = true |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.loaded = true |
| | | } else if (_config.wrap.datatype === 'public') { |
| | | if (window.GLOB.CacheData.has(_config.wrap.publicId)) { |
| | | _data = window.GLOB.CacheData.get(_config.wrap.publicId) |
| | | _data = fromJS(_data).toJS() |
| | | } |
| | | } |
| | | |
| | | _data.$$BID = BID || '' |
| | |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype === 'dynamic' && config.setting.sync !== 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | MKEmitter.addListener('mkPublicData', this.mkPublicData) |
| | | } |
| | | |
| | | if (config.timer && config.wrap.datatype === 'dynamic') { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | | if (config.wrap.datatype === 'dynamic') { |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | this.initExec() |
| | | } |
| | | } |
| | | |
| | |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({data: _data}) |
| | | } |
| | |
| | | } |
| | | |
| | | let _data = null |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (_config.wrap.controlField) { |
| | | if (_config.wrap.controlVal.includes(item[_config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (_config.wrap.controlField) { |
| | | if (_config.wrap.controlVal.includes(item[_config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | config: _config, |
| | | card: _card, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | |
| | | this.loaded && this.prevCheck() |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | this.loaded && this.prevCheck() |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time && !config.setting.laypage) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | |
| | | _config.subcards = null |
| | | |
| | | let _data = null |
| | | |
| | | let selected = 'false' |
| | | if (_config.wrap.selected === 'always' || _config.wrap.selected === 'init' || _config.wrap.selected === 'sign') { |
| | | selected = _config.wrap.selected |
| | |
| | | _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''}` |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | | let wrapStyle = null |
| | | let subcard = fromJS(_card).toJS() |
| | |
| | | selected, |
| | | precards, |
| | | nextcards, |
| | | data: _data, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | |
| | | card: _card, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | let _data = res.map((item, index) => { |
| | | if (config.setting.onload === 'true') { |
| | | this.initExec() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('searchRefresh', this.searchRefresh) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | let getData = (res) => { |
| | | return res.map((item, index) => { |
| | | let children = [] |
| | | |
| | | if (item[config.setting.subdata]) { |
| | |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (config.$time && !config.setting.laypage) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res) { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | if (!res) return |
| | | |
| | | this.setState({data: getData(res)}) |
| | | }) |
| | | } else { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: getData(res)}) |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } else { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('searchRefresh', this.searchRefresh) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | searchRefresh = (searchId) => { |
| | |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id = '', lines) => { |
| | | const { config, BID } = this.state |
| | |
| | | |
| | | let _config = fromJS(config).toJS() |
| | | let _data = { $$empty: true } |
| | | let _sync = false |
| | | |
| | | let BID = '' |
| | | let BData = '' |
| | | |
| | |
| | | } |
| | | |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype === 'dynamic' && config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (_config.wrap.datatype === 'public') { |
| | | if (_data.$$loaded && selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | }, 200) |
| | | } |
| | | } else if (!_sync && selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | }, 200) |
| | | } |
| | | |
| | | if (_config.wrap.datatype === 'dynamic' && this.loaded) { |
| | | if (_config.wrap.goback === 'true' && _data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', _config.$pageId) |
| | | } else { |
| | | this.autoExec() |
| | | } |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.autoExec() |
| | | } |
| | | if (_data.$$uuid) { |
| | | setTimeout(() => { |
| | | this.transferLine() |
| | | }, 200) |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)}) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config, selected, data } = this.state |
| | | |
| | | if (config.wrap.datatype === 'dynamic') { |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | if (config.wrap.goback === 'true' && data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', config.$pageId) |
| | | } else { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else { |
| | | this.transferLine() |
| | | } |
| | | this.autoExec() |
| | | } |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | if (config.wrap.goback === 'true' && data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', config.$pageId) |
| | | } else { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else { |
| | | this.transferLine() |
| | | } |
| | | this.autoExec() |
| | | } |
| | | } |
| | | } else if (config.wrap.datatype === 'public') { |
| | | if (this.loaded) { |
| | | if (config.wrap.goback === 'true' && data.$$empty) { |
| | | this.timer && this.timer.stop() |
| | | |
| | | MKEmitter.emit('closeTabView', config.$pageId) |
| | | } else { |
| | | if (selected !== 'false') { |
| | | this.checkTopLine() |
| | | } else if (data.$$uuid) { |
| | | this.transferLine() |
| | | } |
| | | this.autoExec() |
| | | } |
| | | } |
| | | } else { |
| | | if (selected !== 'false') { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | }, 200) |
| | | } |
| | | |
| | | if (config.$cache && config.$time && config.wrap.autoExec) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res) { |
| | | this.autoExec() |
| | | } else { |
| | | Api.writeCacheConfig(config.uuid, []) |
| | | } |
| | | }) |
| | | } else { |
| | | this.autoExec() |
| | | } |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | let _data = null |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | data: _data, |
| | | config: _config, |
| | | search: _config.$searches, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time && !config.setting.laypage) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | let _data = null |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | if (_card.setting.click) { |
| | |
| | | BData: BData || '', |
| | | config: _config, |
| | | card: _card, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else { |
| | | this.openModal() |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.loaded = true |
| | | } |
| | | |
| | | _data.$$uuid = _data[_config.setting.primaryKey] || '' |
| | |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype === 'dynamic' && config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } else if (_config.wrap.display === 'modal' && _config.wrap.datatype === 'static') { |
| | | this.openModal() |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype === 'dynamic') { |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.openModal() |
| | | } |
| | | } else if (config.wrap.display === 'modal' && config.wrap.datatype === 'static') { |
| | | this.openModal() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.plot.height = Utils.getHeight(_config.plot.height) |
| | |
| | | BData: BData || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | |
| | | let that = this |
| | | |
| | |
| | | MKEmitter.addListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | MKEmitter.removeListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | plot: _config.plot, |
| | | search: _config.$searches, |
| | | transfield |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | if (_config.subtype !== 'ratioboard') { |
| | |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | |
| | | if (config.setting.sync === 'true' && this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | _data = res |
| | | } else { |
| | | _data = res[0] || {} |
| | | _data.value = _data[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | if (!is(fromJS(this.data), fromJS(_data))) { |
| | | this.data = _data |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | |
| | | if (config.subtype !== 'ratioboard') { |
| | | if (Array.isArray(this.data)) { |
| | | this.data = this.data[0] || {} |
| | | } |
| | | this.data.value = this.data[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | this.handleData() |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | |
| | | if (config.subtype !== 'ratioboard') { |
| | | if (Array.isArray(this.data)) { |
| | | this.data = this.data[0] || {} |
| | | } |
| | | this.data.value = this.data[config.plot.valueField] || 0 |
| | | } |
| | | |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | |
| | | _config.plot.$decimal = decimal |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | plot: _config.plot, |
| | | title: config.plot.title, |
| | | search: _config.$searches |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | _config.style.minHeight = _config.style.minHeight + 45 |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | search: _config.$searches |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | |
| | | this.setState({empty: res.length > 0}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | |
| | | this.setState({empty: res.length === 0}) |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | |
| | | this.setState({empty: res.length === 0}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | _config.plot.height = Utils.getHeight(_config.plot.height) |
| | | _config.style.height = 'auto' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | this.data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(this.data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | | search: _config.$searches |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | |
| | | if (this.data.length > 0) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | if (!is(fromJS(this.data), fromJS(res))) { |
| | | this.data = res |
| | | this.handleData() |
| | | } |
| | | this.setState({empty: res.length > 0}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | |
| | | this.setState({empty: res.length === 0}) |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.data = res |
| | | this.handleData() |
| | | |
| | | this.setState({empty: res.length === 0}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | if (_config.wrap.datatype !== 'static') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | } else { |
| | | this.loaded = true |
| | | } |
| | | |
| | | if (_config.css) { |
| | |
| | | data: _data, |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype !== 'static' && config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | this.renderView() |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | MKEmitter.addListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.renderView() |
| | | }) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | MKEmitter.removeListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype !== 'static') { |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.renderView() |
| | | }) |
| | | }) |
| | | } else { |
| | | this.renderView() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.renderView() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.renderView() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.renderView() |
| | | } |
| | | } else { |
| | | this.renderView() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | _data = _data[0] || {$$empty: true} |
| | |
| | | BID: BID || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype === 'dynamic' && config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | if (config.wrap.datatype === 'public') { |
| | | MKEmitter.addListener('mkPublicData', this.mkPublicData) |
| | | } |
| | | |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | MKEmitter.removeListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype === 'dynamic' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | if (config.$cache && config.$time) { |
| | | Api.getLCacheConfig(params[0].uuid, config.$time).then(res => { |
| | | if (!res) { |
| | | this.getMainData(param, params, config.uuid) |
| | | } |
| | | }) |
| | | } else { |
| | | this.getMainData(param, params, config.uuid) |
| | | } |
| | | } |
| | | |
| | | getMainData = (param, params, tabId) => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (result.message) { |
| | |
| | | window.GLOB.SyncData.set(item.name, _data) |
| | | }) |
| | | |
| | | MKEmitter.emit('transferSyncData', config.uuid) |
| | | MKEmitter.emit('transferSyncData', tabId) |
| | | } else { |
| | | MKEmitter.emit('transferSyncData', config.uuid) |
| | | MKEmitter.emit('transferSyncData', tabId) |
| | | |
| | | if (!result.message) return |
| | | if (result.ErrCode === 'N') { |
| | |
| | | setting.orisel = true |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (_config.absFields) { |
| | | _config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (_config.absFields) { |
| | | _config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (setting.selected !== 'false' && _data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', _config.uuid, '', setting.selected) |
| | | }, 200) |
| | | if (setting.selected === 'init') { |
| | | setting.selected = 'false' |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | if (setting.selected !== 'false' && _data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', _config.uuid, '', setting.selected) |
| | | }, 200) |
| | | if (setting.selected === 'init') { |
| | | setting.selected = 'false' |
| | | } |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | if (_config.wrap.collapse === 'true') { |
| | |
| | | columns: _config.cols, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | search: _config.$searches |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }, _config.setting.delay || 0) |
| | | } else if (_config.setting.onload === 'true') { |
| | | this.getStatFieldsValue() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.setting.useMSearch) { |
| | | MKEmitter.addListener('searchRefresh', this.searchRefresh) |
| | | } |
| | | |
| | | if (config.setting.sync === 'true') { |
| | | MKEmitter.addListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | 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() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('searchRefresh', this.searchRefresh) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('transferSyncData', this.transferSyncData) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config, setting } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time && !setting.laypage) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadmaindata() |
| | | this.getStatFieldsValue() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | |
| | | this.setState({pageIndex: 1}, () => { |
| | | this.reloadtable() |
| | | }) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config, setting } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.setting.useMSearch) { |
| | | MKEmitter.addListener('searchRefresh', this.searchRefresh) |
| | | } |
| | | |
| | | if (config.setting.sync === 'true') { |
| | | MKEmitter.addListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | 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() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$key = '' + item.key + item.$$uuid |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.absFields) { |
| | | config.absFields.forEach(f => { |
| | | if (!isNaN(item[f])) { |
| | | item[f] = Math.abs(item[f]) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.controlField) { |
| | | if (setting.controlVal.includes(item[setting.controlField] + '')) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('searchRefresh', this.searchRefresh) |
| | | MKEmitter.removeListener('refreshLineData', this.refreshLineData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('transferSyncData', this.transferSyncData) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | render() { |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | _data = _data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[_config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | return item |
| | | }) |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.search = [] |
| | |
| | | BData: BData || '', |
| | | data: _data, |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | if (_config.setting.sync === 'true') { |
| | | _config.setting.onload = 'false' |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | if (window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | |
| | | if (_config.$cache) { |
| | | Api.writeCacheConfig(_config.uuid, fromJS(_data).toJS()) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.setting.sync = 'false' |
| | | |
| | | this.loaded = true |
| | | |
| | | window.GLOB.SyncData.delete(_config.dataName) |
| | | } |
| | | |
| | | _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%' |
| | |
| | | config: _config, |
| | | data: _data, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (config.setting.sync !== 'true' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (config.setting.sync === 'true' && _data) { |
| | | this.handleData() |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | this.initExec() |
| | | } |
| | | |
| | | /** |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.$cache) { |
| | | if (config.$time) { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } else { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | if (!this.loaded) { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | } else if (config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } else if (this.loaded) { |
| | | this.handleData() |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config } = this.state |
| | | |
| | |
| | | } |
| | | |
| | | config.$cache = config.cacheLocal === 'true' |
| | | config.$time = config.localCacheTime || 0 |
| | | |
| | | let initInters = [] |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.MenuName, MenuID, MenuID) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.$time, config.MenuName, MenuID, MenuID) |
| | | |
| | | let params = [] |
| | | let BID = param.$BID || '' |
| | |
| | | } |
| | | } |
| | | |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName, searchId, syncId) => { |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) => { |
| | | return components.filter(item => { |
| | | item.$pageId = pageId |
| | | item.$cache = cache |
| | | item.$time = time |
| | | item.$searchId = searchId |
| | | item.$syncId = syncId |
| | | |
| | |
| | | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.$pageId = pageId |
| | | tab.$cache = cache |
| | | tab.$time = time |
| | | |
| | | let _searchId = searchId |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName, _searchId, tab.uuid) |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, _searchId, tab.uuid) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName, searchId, syncId) |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { |
| | |
| | | |
| | | this.setState({loading: true, loadingview: false}) |
| | | |
| | | if (config.$cache && config.$time) { |
| | | Api.getLCacheConfig(params[0].uuid, config.$time).then(res => { |
| | | if (!res) { |
| | | this.getMainData(param, params, config.MenuID) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | this.getMainData(param, params, config.MenuID) |
| | | } |
| | | } |
| | | |
| | | getMainData = (param, params, MenuID) => { |
| | | Api.genericInterface(param).then(result => { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | window.GLOB.SyncData.set(item.name, _data) |
| | | }) |
| | | |
| | | MKEmitter.emit('transferSyncData', config.MenuID) |
| | | MKEmitter.emit('transferSyncData', MenuID) |
| | | } else { |
| | | MKEmitter.emit('transferSyncData', config.MenuID) |
| | | MKEmitter.emit('transferSyncData', MenuID) |
| | | |
| | | if (!result.message) return |
| | | if (result.ErrCode === 'N') { |
| | |
| | | }) |
| | | } |
| | | |
| | | config.$cache = config.cacheLocal === 'true' |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, config.$cache, Tab.uuid, Tab.uuid) |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, Tab.uuid, Tab.uuid) |
| | | |
| | | // 获取主搜索条件 |
| | | config.components.forEach(component => { |
| | |
| | | |
| | | let params = [] |
| | | let BID = param.$BID || '' |
| | | let inherit = {} |
| | | |
| | | if (config.cacheUseful === 'true') { // 缓存继承 |
| | | inherit.cacheUseful = config.cacheUseful |
| | | inherit.timeUnit = config.timeUnit |
| | | inherit.cacheTime = config.cacheTime |
| | | } |
| | | |
| | | config.components = this.formatSetting(config.components, params, inherit, regs, balMap) |
| | | config.components = this.formatSetting(config.components, params, regs, balMap) |
| | | |
| | | if ([...balMap.keys()].length > 0) { |
| | | config.components = this.filterBalcony(config.components, balMap) |
| | |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab, cache, searchId, syncId) => { |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab, searchId, syncId) => { |
| | | return components.filter(item => { |
| | | item.$pageId = Tab.uuid |
| | | item.$cache = cache |
| | | item.$searchId = searchId |
| | | item.$syncId = syncId |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, cache, _searchId, tab.uuid) |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, _searchId, tab.uuid) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, cache, searchId, syncId) |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, searchId, syncId) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatSetting = (components, params, inherit, regs, balMap) => { |
| | | formatSetting = (components, params, regs, balMap) => { |
| | | let delay = 20 |
| | | return components.map(component => { |
| | | if (component.type === 'tabs') { |
| | | component.subtabs = component.subtabs.map(tab => { |
| | | tab.components = this.formatSetting(tab.components, null, null, inherit, regs, balMap) |
| | | tab = {...tab, ...inherit} |
| | | tab.components = this.formatSetting(tab.components, null, regs, balMap) |
| | | return tab |
| | | }) |
| | | return component |
| | | } else if (component.type === 'group') { |
| | | component.components = this.formatSetting(component.components, params, null, regs, balMap) |
| | | component.components = this.formatSetting(component.components, params, regs, balMap) |
| | | return component |
| | | } else if (component.wrap && component.wrap.datatype === 'public') { |
| | | component.setting.useMSearch = false |
| | |
| | | |
| | | return ( |
| | | <div className={'pop-page-wrap ' + (loading ? 'loading' : '')} style={config ? config.style : null}> |
| | | {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null} |
| | | {loading ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row className="component-wrap">{this.getComponents()}</Row> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | |
| | | selectChange = (key, value) => { |
| | | const { config } = this.props |
| | | |
| | | if (key === 'cacheUseful') { |
| | | this.props.updateConfig({...config, cacheUseful: value}) |
| | | } else if (key === 'timeUnit') { |
| | | this.props.updateConfig({...config, timeUnit: value}) |
| | | } else if (key === 'cacheLocal') { |
| | | this.props.updateConfig({...config, cacheLocal: value}) |
| | | if (key === 'cacheTime' || key === 'localCacheTime') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | |
| | | this.props.updateConfig({...config, [key]: value}) |
| | | } |
| | | |
| | | render() { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheLocal === 'true' ? <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="设置本地缓存时长后,在缓存期限内不向后台请求数据,时长最大为5天(即7200分钟)。注:时长为空时缓存数据只用于页面快速呈现,不影响接口请求。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 时长(分) |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('localCacheTime', { |
| | | initialValue: config.localCacheTime |
| | | })( |
| | | <InputNumber min={1} max={7200} precision={0} onChange={(val) => {this.selectChange('localCacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | this.props.updateConfig({...config, fstMenuId: value, parentId: _id}) |
| | | }) |
| | | } else { |
| | | if (key === 'cacheTime' || key === 'minWidth') { |
| | | if (key === 'cacheTime' || key === 'minWidth' || key === 'localCacheTime') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheLocal === 'true' ? <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="设置本地缓存时长后,在缓存期限内不向后台请求数据,时长最大为5天(即7200分钟)。注:时长为空时缓存数据只用于页面快速呈现,不影响接口请求。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 时长(分) |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('localCacheTime', { |
| | | initialValue: config.localCacheTime |
| | | })( |
| | | <InputNumber min={1} max={7200} precision={0} onChange={(val) => {this.selectChange('localCacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const MenuForm = asyncComponent(() => import('./menuform')) |
| | | const SourceWrap = asyncComponent(() => import('@/menu/modulesource')) |
| | | const Modulecell = asyncComponent(() => import('@/menu/modulecell')) |
| | | const MenuShell = asyncComponent(() => import('@/menu/menushell')) |
| | |
| | | <Collapse accordion defaultActiveKey="basedata" bordered={false}> |
| | | {/* 基本信息 */} |
| | | <Panel header="基本信息" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm config={config} updateConfig={this.updateConfig}/> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updatetable}/> |
| | | </Panel> |
| | |
| | | |
| | | // 一二级菜单切换 |
| | | selectChange = (key, value, hex) => { |
| | | if (key === 'cacheTime' || key === 'localCacheTime') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | | } |
| | | |
| | | let _config = {...this.props.config, [key]: value} |
| | | |
| | | if (key === 'statusBarbgColor' && hex) { |
| | | _config.statusBarHexColor = hex |
| | | if (key === 'statusBarbgColor') { // 小程序状态栏 |
| | | if (hex) { |
| | | _config.statusBarHexColor = hex |
| | | } else { |
| | | delete _config.statusBarHexColor |
| | | } |
| | | } |
| | | |
| | | this.props.updateConfig(_config) |
| | | } |
| | | |
| | | // 菜单名称 |
| | | changeName = (e) => { |
| | | this.props.updateConfig({...this.props.config, MenuName: e.target.value}) |
| | | } |
| | | |
| | | // 菜单参数 |
| | | changeNo = (e) => { |
| | | this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) |
| | | } |
| | | |
| | | changeRemark = (e) => { |
| | | this.props.updateConfig({...this.props.config, Remark: e.target.value}) |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | } |
| | | |
| | | render() { |
| | |
| | | message: '请输入菜单名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuName', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | message: '请输入菜单参数!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuNo', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheLocal === 'true' ? <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="设置本地缓存时长后,在缓存期限内不向后台请求数据,时长最大为5天(即7200分钟)。注:时长为空时缓存数据只用于页面快速呈现,不影响接口请求。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 时长(分) |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('localCacheTime', { |
| | | initialValue: config.localCacheTime |
| | | })( |
| | | <InputNumber min={1} max={7200} precision={0} onChange={(val) => {this.selectChange('localCacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | message: '备注最多512个字符!' |
| | | } |
| | | ] |
| | | })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} |
| | | })(<TextArea rows={2} placeholder={''} onChange={(e) => {this.selectChange('Remark', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | |
| | | const MenuForm = asyncComponent(() => import('./menuform')) |
| | | const MobShell = asyncComponent(() => import('@/mob/mobshell')) |
| | | const SourceWrap = asyncComponent(() => import('@/mob/modulesource')) |
| | | const Modulecell = asyncComponent(() => import('@/menu/modulecell')) |
| | |
| | | <Collapse accordion defaultActiveKey="component" bordered={false}> |
| | | {/* 基本信息 */} |
| | | <Panel header="基本信息" forceRender className="basedata" key="basedata"> |
| | | {/* 菜单信息 */} |
| | | <MenuForm config={config} updateConfig={this.updateConfig}/> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updateConfig}/> |
| | | </Panel> |
| | |
| | | |
| | | state = {} |
| | | |
| | | // 一二级菜单切换 |
| | | selectChange = (key, value) => { |
| | | const { config } = this.props |
| | | |
| | | if (key === 'cacheUseful') { |
| | | this.props.updateConfig({...config, cacheUseful: value}) |
| | | } else if (key === 'timeUnit') { |
| | | this.props.updateConfig({...config, timeUnit: value}) |
| | | } else if (key === 'mask') { |
| | | this.props.updateConfig({...config, mask: value}) |
| | | } else if (key === 'cacheLocal') { |
| | | this.props.updateConfig({...config, cacheLocal: value}) |
| | | // } else if (key === 'permission') { |
| | | // this.props.updateConfig({...config, permission: value}) |
| | | if (key === 'cacheTime' || key === 'localCacheTime') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 菜单名称 |
| | | changeName = (e) => { |
| | | this.props.updateConfig({...this.props.config, MenuName: e.target.value}) |
| | | } |
| | | |
| | | // 菜单参数 |
| | | changeNo = (e) => { |
| | | this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) |
| | | } |
| | | |
| | | changeRemark = (e) => { |
| | | this.props.updateConfig({...this.props.config, Remark: e.target.value}) |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | this.props.updateConfig({...config, [key]: value}) |
| | | } |
| | | |
| | | render() { |
| | |
| | | message: '请输入菜单名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuName', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | message: '请输入菜单参数!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuNo', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheLocal === 'true' ? <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="设置本地缓存时长后,在缓存期限内不向后台请求数据,时长最大为5天(即7200分钟)。注:时长为空时缓存数据只用于页面快速呈现,不影响接口请求。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 时长(分) |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('localCacheTime', { |
| | | initialValue: config.localCacheTime |
| | | })( |
| | | <InputNumber min={1} max={7200} precision={0} onChange={(val) => {this.selectChange('localCacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="对于不经常性变动的信息,缓存数据有助于提高查询效率。"> |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit === 'day' ? 7 : (config.timeUnit === 'hour' ? 23 : 59)} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | message: '备注最多512个字符!' |
| | | } |
| | | ] |
| | | })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} |
| | | })(<TextArea rows={2} placeholder={''} onChange={(e) => {this.selectChange('Remark', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |