| | |
| | | throw 'CREATE TABLE ERROR' |
| | | }) |
| | | |
| | | tx.executeSql('CREATE TABLE IF NOT EXISTS CACHES (menuid varchar(50), CreateDate varchar(50), LongParam text, CDefine1 varchar(50), CDefine2 varchar(50))', [], () => { |
| | | |
| | | }, () => { |
| | | // eslint-disable-next-line |
| | | throw 'CREATE TABLE ERROR' |
| | | }) |
| | | |
| | | if (window.GLOB.systemType === '') { |
| | | tx.executeSql('CREATE TABLE IF NOT EXISTS FUNCS (func_code varchar(50), key_sql text, CDefine1 varchar(50), CDefine2 varchar(50), CDefine3 varchar(50))', [], () => { |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 将缓存数据写入websql |
| | | */ |
| | | static writeCacheInWebSql (data) { |
| | | if (!window.GLOB.WebSql) return |
| | | window.GLOB.WebSql.transaction(tx => { |
| | | tx.executeSql(`DELETE FROM CACHES where menuid='${data[0]}'`) |
| | | if (data[2]) { |
| | | tx.executeSql('INSERT INTO CACHES (menuid, CreateDate, LongParam) VALUES (?, ?, ?)', data) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取websql中的配置信息 |
| | | */ |
| | | static getWebSqlCacheConfig (MenuID) { |
| | | if (!window.GLOB.WebSql) return Promise.resolve() |
| | | return new Promise((resolve, reject) => { |
| | | window.GLOB.WebSql.transaction(tx => { |
| | | tx.executeSql(`SELECT * FROM CACHES WHERE menuid='${MenuID}'`, [], (tx, results) => { |
| | | resolve(results.rows[0]) |
| | | }, (tx, results) => { |
| | | console.warn(results) |
| | | resolve() |
| | | }) |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 删除websql中超过7天的缓存信息 |
| | | */ |
| | | static delWebSqlCacheConfig (date, type) { |
| | | if (!window.GLOB.WebSql) return |
| | | window.GLOB.WebSql.transaction(tx => { |
| | | if (type === 'all') { |
| | | tx.executeSql('DELETE FROM CACHES') |
| | | } else { |
| | | tx.executeSql(`DELETE FROM CACHES where CreateDate<'${date}'`) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 打开IndexedDB |
| | | */ |
| | | static openIndexDB (db) { |
| | | try { |
| | | let request = window.indexedDB.open(db, 1) |
| | | let request = window.indexedDB.open(db, 2) |
| | | request.onerror = () => { |
| | | console.warn('IndexedDB 初始化失败!') |
| | | } |
| | |
| | | let objectStore = window.GLOB.IndexDB.createObjectStore('configs', { keyPath: 'id' }) |
| | | objectStore.createIndex('menuid', 'menuid', { unique: false }) |
| | | objectStore.createIndex('userid', 'userid', { unique: false }) |
| | | } |
| | | if (!window.GLOB.IndexDB.objectStoreNames.contains('caches')) { |
| | | window.GLOB.IndexDB.createObjectStore('caches', { keyPath: 'menuid' }) |
| | | } |
| | | if (window.GLOB.systemType === '' && !window.GLOB.IndexDB.objectStoreNames.contains('funcs')) { |
| | | window.GLOB.IndexDB.createObjectStore('funcs', { keyPath: 'id' }) |
| | |
| | | static writeInIndexDB (data) { |
| | | if (!window.GLOB.IndexDB || !data) return |
| | | |
| | | let request = window.GLOB.IndexDB.transaction(['configs'], 'readwrite') |
| | | .objectStore('configs') |
| | | .add(data) |
| | | window.GLOB.IndexDB.transaction(['configs'], 'readwrite').objectStore('configs').add(data) |
| | | } |
| | | |
| | | request.onerror = () => { |
| | | window.GLOB.IndexDB = null |
| | | /** |
| | | * @description 将数据写入IndexedDB |
| | | */ |
| | | static writeCacheInIndexDB (data) { |
| | | if (!window.GLOB.IndexDB) return |
| | | |
| | | let objectStore = window.GLOB.IndexDB.transaction(['caches'], 'readwrite').objectStore('caches') |
| | | objectStore.delete(data.menuid) |
| | | |
| | | if (data.LongParam) { |
| | | objectStore.add(data) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取IndexedDB中的配置信息 |
| | | */ |
| | | static getIndexDBCacheConfig (MenuID) { |
| | | if (!window.GLOB.IndexDB) return Promise.resolve() |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | let request = window.GLOB.IndexDB.transaction(['caches']).objectStore('caches').get(MenuID) |
| | | |
| | | request.onerror = () => { |
| | | resolve() |
| | | } |
| | | |
| | | request.onsuccess = () => { |
| | | resolve(request.result) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 删除IndexedDB中超过7天的缓存信息 |
| | | */ |
| | | static delIndexDBCacheConfig (date, type) { |
| | | if (!window.GLOB.IndexDB) return |
| | | |
| | | if (type === 'all') { |
| | | window.GLOB.IndexDB.transaction(['caches'], 'readwrite').objectStore('caches').clear() |
| | | } else { |
| | | let request = window.GLOB.IndexDB.transaction(['caches'], 'readwrite').objectStore('caches').openCursor() |
| | | |
| | | request.onsuccess = (e) => { |
| | | let cursor = e.target.result |
| | | if (cursor) { |
| | | if (cursor.value.CreateDate < date) { |
| | | cursor.delete() |
| | | } |
| | | cursor.continue() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * @description 手机号验证码登录 |
| | | */ |
| | | getphoneusermsg (phoneNo, checkcode, isCloud = false, ipAddress, city) { |
| | | getphoneusermsg (phoneNo, checkcode, isCloud = false) { |
| | | let param = { |
| | | // func: 'webapi_login', |
| | | mob: phoneNo, |
| | |
| | | check_code: checkcode, |
| | | way_no: 'sms_vcode', |
| | | systemType: options.sysType, |
| | | login_city: city, |
| | | login_id_address: ipAddress, |
| | | login_city: sessionStorage.getItem('city') || '', |
| | | login_id_address: sessionStorage.getItem('ipAddress') || '', |
| | | kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)), |
| | | device_id: localStorage.getItem('SessionUid'), |
| | | appkey: window.GLOB.appkey || '' |
| | |
| | | /** |
| | | * @description 登录系统, 获取用户信息 |
| | | */ |
| | | getusermsg (username, password, isCloud = false, ipAddress, city) { |
| | | getusermsg (username, password, isCloud = false) { |
| | | let param = { |
| | | // func: 'webapi_login', |
| | | UserName: username, |
| | | systemType: options.sysType, |
| | | Type: 'S', |
| | | login_city: city, |
| | | login_id_address: ipAddress, |
| | | login_city: sessionStorage.getItem('city') || '', |
| | | login_id_address: sessionStorage.getItem('ipAddress') || '', |
| | | kei_id: window.btoa(window.encodeURIComponent(window.GLOB.host)), |
| | | device_id: localStorage.getItem('SessionUid'), |
| | | timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | |
| | | }) |
| | | } |
| | | |
| | | delCacheConfig (type = '') { |
| | | let date = moment().subtract(7, 'days').format('YYYY-MM-DD') |
| | | CacheUtils.delWebSqlCacheConfig(date, type) |
| | | CacheUtils.delIndexDBCacheConfig(date, type) |
| | | } |
| | | |
| | | writeCacheConfig (menuid, data) { |
| | | if (!menuid) return |
| | | let date = moment().format('YYYY-MM-DD') |
| | | let _data = data ? JSON.stringify(data) : '' |
| | | |
| | | CacheUtils.writeCacheInWebSql([menuid, date, _data]) |
| | | CacheUtils.writeCacheInIndexDB({menuid, CreateDate: date, LongParam: _data}) |
| | | } |
| | | |
| | | getLCacheConfig (menuid) { |
| | | return new Promise((resolve, reject) => { |
| | | if (window.GLOB.WebSql) { |
| | | CacheUtils.getWebSqlCacheConfig(menuid).then(res => { |
| | | if (res && res.LongParam) { |
| | | let _data = JSON.parse(res.LongParam) |
| | | if (_data.length === 0) { |
| | | resolve() |
| | | } else { |
| | | resolve(_data) |
| | | } |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } else if (window.GLOB.IndexDB) { |
| | | CacheUtils.getIndexDBCacheConfig(menuid).then(res => { |
| | | if (res && res.LongParam) { |
| | | let _data = JSON.parse(res.LongParam) |
| | | if (_data.length === 0) { |
| | | resolve() |
| | | } else { |
| | | resolve(_data) |
| | | } |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } else { |
| | | resolve() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 获取系统版本信息,启用或更新websql |
| | | */ |
| | |
| | | resolve() |
| | | } else { |
| | | Api.updateAppVersion() |
| | | Api.delCacheConfig('all') |
| | | setTimeout(() => { |
| | | notification.success({ |
| | | top: 92, |
| | |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { config } = this.props |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | values.sync = values.sync || 'false' |
| | | |
| | | if (['navbar', 'balcony', 'menubar', 'interface'].includes(config.type)) { |
| | | values.onload = 'true' |
| | | } |
| | | |
| | | // 数据源前端验证 |
| | | if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) { |
| | | let _quot = values.dataresource.match(/'{1}/g) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('syncBalconyData', this.syncBalconyData) |
| | |
| | | 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.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | } |
| | | } |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | _data.$$empty = true |
| | | } else { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('mkCheckAll', this.mkCheckAll) |
| | |
| | | }, () => { |
| | | this.loadData('', 'timer') |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) 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}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | start = config.setting.pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | 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.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | _data.$$empty = true |
| | | } else { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | }, () => { |
| | | this.loadData('timer') |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) 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}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | start = config.setting.pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | let data = [] |
| | | |
| | | if (type === 'plus') { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) 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}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData('timer') |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (!result.data || !result.data[0]) { |
| | | _data.$$empty = true |
| | | } else { |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | |
| | | state = { |
| | | config: null, |
| | | data: null, |
| | | data: [], |
| | | BID: '', |
| | | BData: '', |
| | | plot: null, |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | data: _data || [], |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | this.handleData() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.handleData() |
| | | }) |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | |
| | | |
| | | let that = this |
| | | |
| | | if (config.plot.subtype === 'mindmap') { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | | |
| | | if (nextProps.data && nextProps.data[config.dataName]) { |
| | | _data = nextProps.data[config.dataName] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | this.handleData() |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config, sync } = this.state |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res}) |
| | | |
| | | this.handleData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | |
| | | |
| | | async loadData () { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, BID } = this.state |
| | | const { config, arr_field, BID, data } = this.state |
| | | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | data: {} |
| | | data: [] |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = result.data || [] |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | data: result.data || [], |
| | | loading: false |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(data), fromJS(result.data || []))) { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | } |
| | | |
| | | handleData = () => { |
| | | const { plot, data } = this.state |
| | | |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | |
| | | if (!data || data.length === 0) { |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { plot, data } = this.state |
| | | |
| | | if (data.length === 0) { |
| | | this.setState({empty: true}) |
| | | } else { |
| | | this.setState({empty: false}) |
| | |
| | | transfield: {}, // 字段名称翻译 |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | search: null, // 搜索条件 |
| | | vFields: [], // 数值字段 |
| | | vstFields: null, // 统计数据值字段信息 |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | data: _data || [], |
| | | BID: BID || '', |
| | | vFields: vFields, |
| | | vstFields: vstFields, |
| | |
| | | * @description 图表数据更新,刷新内容 |
| | | */ |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { sync, config } = this.state |
| | | const { sync, config, data } = this.state |
| | | |
| | | if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) { |
| | | let _data = [] |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.setState({sync: false, data: _data}) |
| | | |
| | | if (!is(fromJS(data), fromJS(_data))) { |
| | | this.handleData() |
| | | }) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | data: result.data || [], |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(result.data || []))) { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | getdata = () => { |
| | | const { data, plot, vFields, config } = this.state |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (data.length === 0) { |
| | | this.setState({empty: true}) |
| | | return [] |
| | | } |
| | |
| | | percent = true |
| | | } |
| | | |
| | | if (!data || data.length === 0) { |
| | | if (data.length === 0) { |
| | | this.setState({empty: true}) |
| | | return [] |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.setState({sync: false, data: _data}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | this.handleData() |
| | | }) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | let _data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | _data = res |
| | | } else { |
| | | _data = {value: res[0][config.plot.valueField]} |
| | | } |
| | | |
| | | this.setState({data: _data}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.viewrender() |
| | | |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | |
| | | async loadData (hastimer) { |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | let data = null |
| | | if (config.subtype === 'ratioboard') { |
| | | data = result.data || [] |
| | |
| | | data.value = result.data[0][config.plot.valueField] |
| | | } |
| | | } |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(data), fromJS(this.state.data))) { |
| | | reset = false |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(data))) { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | title: '', // 组件标题 |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | search: null, // 搜索条件 |
| | | chart: null |
| | | } |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | data: _data || [], |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | plot: _config.plot, |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.setState({sync: false, data: _data}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | this.handleData() |
| | | }) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | handleData = () => { |
| | | const { plot, chartId } = this.state |
| | | |
| | | let _element = document.getElementById(chartId) |
| | | let _element = document.getElementById(this.state.chartId) |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 100) |
| | | } |
| | | |
| | | viewrender = () => { |
| | | const { plot } = this.state |
| | | |
| | | if (plot.shape === 'nest') { |
| | | this.nestrender() |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | data: result.data || [], |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(result.data || []))) { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | chartId: Utils.getuuid(), // 图表Id |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | search: null, // 搜索条件 |
| | | chart: null |
| | | } |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | data: _data || [], |
| | | BID: BID || '', |
| | | empty: !_data, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data, empty: !_data,}, () => { |
| | | this.setState({sync: false, data: _data, empty: false}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | this.handleData() |
| | | }) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res, empty: false}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | data: result.data || [], |
| | | empty: false, |
| | | loading: false |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(result.data || []))) { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | if (_element) { |
| | | _element.innerHTML = '' |
| | | } |
| | | this.scatterrender() |
| | | |
| | | setTimeout(() => { |
| | | this.scatterrender() |
| | | }, 100) |
| | | } |
| | | |
| | | /** |
| | |
| | | loading: false, // 数据加载状态 |
| | | sync: false, // 是否统一请求数据 |
| | | plot: null, // 图表设置 |
| | | data: null, // 数据 |
| | | data: [], // 数据 |
| | | search: null, // 搜索条件 |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | data: _data, |
| | | data: _data || [], |
| | | empty: !_data || _data.length === 0, |
| | | BID: BID || '', |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data, empty: _data.length === 0}, () => { |
| | | this.setState({sync: false, data: _data, empty: _data.length === 0}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | this.handleData() |
| | | }) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res, empty: false}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let reset = true |
| | | |
| | | if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { |
| | | reset = false |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false, |
| | | empty: result.data.length === 0 |
| | | }, () => { |
| | | if (!reset) return |
| | | this.handleData() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(result.data || []))) { |
| | | this.handleData() |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | |
| | | setTimeout(() => { |
| | | this.viewrender() |
| | | }, 150) |
| | | }, 100) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res[0]}, () => { |
| | | this.renderView() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | _data = nextProps.data[config.dataName] |
| | | } |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.renderView() |
| | | }) |
| | | this.setState({sync: false, data: _data}) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | setTimeout(() => { |
| | | this.renderView() |
| | | }, 10) |
| | | } |
| | | } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({}, () => { |
| | | this.loadData() |
| | |
| | | if (result.status) { |
| | | let _data = result.data || {} |
| | | |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: _data, |
| | | loading: false |
| | | }, () => { |
| | | this.renderView() |
| | | }) |
| | | |
| | | if (!is(fromJS(this.state.data), fromJS(_data))) { |
| | | setTimeout(() => { |
| | | this.renderView() |
| | | }, 10) |
| | | } |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | const { config } = this.props |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(this.props.config.$pageId) |
| | | let BData = window.GLOB.CacheData.get(config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let param = getStructuredParams(params, this.props.config, BID) |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result |
| | | }) |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | const { config } = this.props |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(this.props.config.$pageId) |
| | | let BData = window.GLOB.CacheData.get(config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let param = getStructuredParams(params, this.props.config, BID) |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result |
| | | }) |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if ((setting.selected !== 'false' || (setting.orisel && id)) && result.data && result.data.length > 0) { |
| | | setTimeout(() => { |
| | | MKEmitter.emit('mkCheckTopLine', config.uuid, id, setting.selected) |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync, setting } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) 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 |
| | | })}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | return item |
| | | })}) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | |
| | | |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 40px; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 40px; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | const { config, sync } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false |
| | |
| | | popview = 'popview' |
| | | } |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs) |
| | | config.$cache = config.cacheLocal === 'true' |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview) |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | |
| | | } |
| | | } |
| | | |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview) => { |
| | | filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) => { |
| | | return components.filter(item => { |
| | | item.$pageId = pageId |
| | | item.$cache = cache |
| | | |
| | | if (item.style && item.style.boxShadow) { |
| | | delete item.style.hShadow |
| | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.$pageId = pageId |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview) |
| | | tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview) |
| | | item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | let param = getStructuredParams(params, this.state.config, this.state.BID || '') |
| | | const { config } = this.state |
| | | let param = getStructuredParams(params, config, this.state.BID || '') |
| | | |
| | | this.setState({loading: true, loadingview: false}) |
| | | |
| | |
| | | delete result.message |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result, |
| | |
| | | |
| | | return ( |
| | | <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null} |
| | | {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row className="component-wrap">{this.getComponents()}</Row> |
| | | {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} |
| | | {config && window.GLOB.breakpoint ? <DebugTable /> : null} |
| | |
| | | }) |
| | | } |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab) |
| | | config.$cache = config.cacheLocal === 'true' |
| | | |
| | | config.components = this.filterComponent(config.components, roleId, balMap, param, Tab, config.$cache) |
| | | |
| | | // 获取主搜索条件 |
| | | let mainSearch = [] |
| | |
| | | }) |
| | | } |
| | | |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab) => { |
| | | filterComponent = (components, roleId, balMap, urlparam, Tab, cache) => { |
| | | return components.filter(item => { |
| | | item.$pageId = Tab.uuid |
| | | item.$cache = cache |
| | | |
| | | if (item.style && item.style.boxShadow) { |
| | | delete item.style.hShadow |
| | |
| | | item.subtabs = item.subtabs.map(tab => { |
| | | tab.$pageId = Tab.uuid |
| | | |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab) |
| | | tab.components = this.filterComponent(tab.components, roleId, balMap, urlparam, Tab, cache) |
| | | return tab |
| | | }) |
| | | |
| | |
| | | return false |
| | | } |
| | | |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab) |
| | | item.components = this.filterComponent(item.components, roleId, balMap, urlparam, Tab, cache) |
| | | |
| | | return true |
| | | } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) { |
| | |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | let param = getStructuredParams(params, this.state.config, this.state.BID || '') |
| | | const { config } = this.state |
| | | let param = getStructuredParams(params, config, this.state.BID || '') |
| | | |
| | | this.setState({loading: true}) |
| | | |
| | |
| | | delete result.message |
| | | delete result.ErrMesg |
| | | delete result.ErrCode |
| | | |
| | | if (config.$cache) { |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | Api.writeCacheConfig(item.uuid, _data) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result, |
| | |
| | | |
| | | return ( |
| | | <div className={'pop-page-wrap ' + (loading ? 'loading' : '')} style={config ? config.style : null}> |
| | | {loading ? <Spin className="view-spin" size="large" /> : null} |
| | | {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row className="component-wrap">{this.getComponents()}</Row> |
| | | {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} |
| | | </div> |
| | |
| | | let _this = this |
| | | |
| | | let param = { |
| | | func: 'webapi_ChangeUser' |
| | | func: 'webapi_ChangeUser', |
| | | login_city: sessionStorage.getItem('city') || '', |
| | | login_id_address: sessionStorage.getItem('ipAddress') || '', |
| | | domain_name: window.btoa(window.encodeURIComponent(window.GLOB.host)), |
| | | } |
| | | |
| | | if (this.props.BID) { |
| | |
| | | * @description 生成单个组件sPC_Get_structured_data请求参数 |
| | | */ |
| | | export function getStructDefaultParam (component, searchlist, first) { |
| | | const { columns, setting, dataName, format } = component |
| | | const { columns, setting, dataName, format, uuid } = component |
| | | |
| | | let arr_field = columns.map(col => col.field) |
| | | let _dataresource = setting.dataresource |
| | |
| | | } |
| | | |
| | | return { |
| | | uuid: uuid, |
| | | name: dataName, |
| | | $name: setting.$name, |
| | | columns: columns, |
| | |
| | | * @param {Object} param 用户名密码等信息 |
| | | */ |
| | | async loginsubmit (param) { |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getusermsg(param.username, param.password, false, ipAddress, city) |
| | | let res = await Api.getusermsg(param.username, param.password, false) |
| | | if (res.status) { |
| | | if (res.check_mob) { |
| | | let loginWays = this.state.loginWays.filter(item => item.type === 'sms_vcode') |
| | |
| | | } |
| | | |
| | | async phoneloginsubmit (param) { |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let ipAddress = sessionStorage.getItem('ipAddress') || '' |
| | | |
| | | // 登录提交 |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false, ipAddress, city) |
| | | let res = await Api.getphoneusermsg(param.phone, param.vercode, false) |
| | | if (res.status) { |
| | | sessionStorage.setItem('UserID', res.UserID) |
| | | sessionStorage.setItem('LoginUID', res.LoginUID) |
| | |
| | | // if (!res || !res.ip) return |
| | | // sessionStorage.setItem('ipAddress', res.ip) |
| | | // }) |
| | | |
| | | setTimeout(() => { |
| | | Api.delCacheConfig() |
| | | }, 50) |
| | | if (window.GLOB.filter) { |
| | | let view = document.getElementById('mk-login-view') |
| | | |