| | |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | | selected: 'false' |
| | | selected: 'false', |
| | | supNodes: [], |
| | | supComs: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | return item |
| | | }) |
| | | |
| | | let supComs = null |
| | | if (_config.wrap.supType === 'multi') { |
| | | supComs = _config.supNodes.map(item => item.componentId) |
| | | } |
| | | |
| | | this.setState({ |
| | | supComs, |
| | | selected, |
| | | precards, |
| | | nextcards, |
| | |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id, lines) => { |
| | | const { config, BID } = this.state |
| | | const { config, BID, supComs, supNodes } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | this.loadData() |
| | | } |
| | | |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | if (supComs) { |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && !supComs.includes(btn.syncComponentId)) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' || position === 'popclose') { // 主表行刷新 |
| | | let supNode = supNodes[supNodes.length - 1] |
| | | supComs.forEach((item, i) => { |
| | | setTimeout(() => { |
| | | if (supNode && supNode.key === item) { |
| | | MKEmitter.emit('reloadData', item, supNode.value) |
| | | } else { |
| | | MKEmitter.emit('reloadData', item) |
| | | } |
| | | }, i * 10) |
| | | }) |
| | | if (position === 'popclose') { // 标签关闭刷新 |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | } else { |
| | | if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) { |
| | | MKEmitter.emit('reloadData', btn.syncComponentId) // 同级标签刷新 |
| | | } |
| | | |
| | | if (position === 'mainline' && config.setting.supModule) { // 主表行刷新 |
| | | MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | } else if (position === 'popclose') { // 标签关闭刷新 |
| | | config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty')) |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | const { config, supComs } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID || id !== '') { |
| | | this.setState({ BID: id, BData: data, pageIndex: 1 }, () => { |
| | | this.loadData() |
| | | }) |
| | | if (supComs) { |
| | | if (!supComs.includes(MenuID)) return |
| | | |
| | | let supNodes = this.state.supNodes.filter(item => item.key !== MenuID) |
| | | let bid = '' |
| | | let _data = null |
| | | |
| | | if (id) { |
| | | supNodes.push({key: MenuID, value: id, data}) |
| | | } |
| | | if (supNodes.length > 0) { |
| | | bid = supNodes[supNodes.length - 1].value |
| | | _data = supNodes[supNodes.length - 1].data |
| | | } |
| | | |
| | | if (bid !== this.state.BID || bid !== '') { |
| | | this.setState({ BID: bid, BData: _data, pageIndex: 1 }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } else { |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID || id !== '') { |
| | | this.setState({ BID: id, BData: data, pageIndex: 1 }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |