| | |
| | | |
| | | _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 |
| | | }) |
| | | } |
| | | |
| | | this.setState({data: _data}) |
| | | if (config.$time && !config.setting.laypage) { |
| | | Api.getLCacheConfig(config.uuid, config.$time).then(res => { |
| | | if (!res) { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | |
| | | if (!res) return |
| | | |
| | | this.setState({data: getData(res)}) |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | Api.getLCacheConfig(config.uuid, 0).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | this.setState({data: getData(res)}) |
| | | }) |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | 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() |
| | | } else { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | searchRefresh = (searchId) => { |
| | |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id = '', lines) => { |
| | | const { config, BID } = this.state |