| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, BID } = this.props |
| | | const { data, BID, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = { $$empty: true } |
| | | let _sync = false |
| | |
| | | _data = _data[0] || {} |
| | | } |
| | | _sync = false |
| | | } else if (_sync && initdata) { |
| | | _data = initdata |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | } |
| | | } |
| | | |
| | |
| | | _data.$$BID = BID || '' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | if (_config.wrap.position === 'fixed') { |
| | | _config.style.position = 'fixed' |
| | | if (_config.wrap.position === 'fixed' || _config.wrap.position === 'absolute') { |
| | | _config.style.position = _config.wrap.position |
| | | _config.style.zIndex = 2 |
| | | _config.style.left = _config.wrap.left || '' |
| | | _config.style.right = _config.wrap.right || '' |
| | |
| | | _config.style.bottom = _config.wrap.bottom || '' |
| | | _config.style.transform = _config.wrap.transform || '' |
| | | _config.style.width = _config.wrap.realwidth || '' |
| | | } else { |
| | | _config.style.zIndex = 2 |
| | | _config.style.left = _config.wrap.left || '' |
| | | _config.style.right = _config.wrap.right || '' |
| | | _config.style.top = _config.wrap.top || '' |
| | | _config.style.bottom = _config.wrap.bottom || '' |
| | | } |
| | | |
| | | let show = true |
| | |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | } |
| | |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn) => { |
| | | refreshByButtonResult = (menuId, position, btn, id, lines) => { |
| | | const { config, BID, syncConfig } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | this.loadData() // 数据刷新 |
| | | if (syncConfig) { |
| | | MKEmitter.emit('refreshByButtonResult', syncConfig.uuid, position, btn, id, lines) |
| | | |
| | | this.loadData() |
| | | } else { |
| | | let supModule = config.wrap.supModule |
| | | |
| | | if (syncConfig) { |
| | | supModule = syncConfig.setting.supModule |
| | | btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId) |
| | | |
| | | MKEmitter.emit('refreshByButtonResult', syncConfig.uuid, position, btn) |
| | | if (!btn.syncComponentId || btn.syncComponentId !== supModule) { |
| | | if (position === 'mainline' || position === 'popclose') { // 刷新源组件时,附带刷新上级行与当前组件 |
| | | if (supModule && BID) { |
| | | MKEmitter.emit('reloadData', supModule, BID) |
| | | } else { |
| | | this.loadData() |
| | | } |
| | | } else { |
| | | this.loadData() |
| | | } |
| | | } |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | supModule && MKEmitter.emit('reloadData', supModule, (BID || 'empty')) |
| | | if (position === 'popclose') { // 标签关闭刷新 |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | this.setState({ |
| | | data: _data, |