| | |
| | | let selected = 'false' |
| | | if (_config.wrap.selected === 'always' || _config.wrap.selected === 'init') { |
| | | selected = _config.wrap.selected |
| | | } else { |
| | | _config.wrap.selected = 'false' |
| | | } |
| | | |
| | | if (_data) { |
| | |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id, lines) => { |
| | | refreshByButtonResult = (menuId, position, btn, id = '', lines) => { |
| | | const { config, BID, supComs, supNodes } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | |
| | | if (lines && lines.length === 1) { |
| | | this.loadLinedata(lines[0].$$uuid) |
| | | } else { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | } |
| | | } else if (!btn || btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | }) |
| | | } else { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | } |
| | | } |
| | | } else { |
| | |
| | | if (lines && lines.length === 1) { |
| | | this.loadLinedata(lines[0].$$uuid) |
| | | } else { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | } |
| | | } else if (position === 'mainline' || position === 'popclose') { // 刷新源组件时,附带刷新上级行与当前组件 |
| | | if (supModule && BID) { |
| | | MKEmitter.emit('reloadData', supModule, BID) |
| | | } else { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | } |
| | | } else if (!btn || btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | }) |
| | | } else { |
| | | this.loadData() |
| | | this.loadData(id) |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | checkTopLine = () => { |
| | | checkTopLine = (id) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (!data || data.length === 0 || data[0].$disabled) { |
| | |
| | | return |
| | | } |
| | | |
| | | let index = 0 |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id) |
| | | if (index === -1) { |
| | | index = 0 |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: 0, |
| | | selectKeys: [0], |
| | | selectedData: [data[0]] |
| | | activeKey: index, |
| | | selectKeys: [index], |
| | | selectedData: [data[index]] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, data[0].$$uuid, data[0]) |
| | | MKEmitter.emit('resetSelectLine', config.uuid, data[index].$$uuid, data[index]) |
| | | if (config.setting.$hasSyncModule) { |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [data[0]], data.length === 1) |
| | | MKEmitter.emit('syncBalconyData', config.uuid, [data[index]], data.length === 1) |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | async loadData () { |
| | | async loadData (id) { |
| | | const { mainSearch, menuType } = this.props |
| | | const { config, arr_field, pageIndex, search, BID, BData, selected } = this.state |
| | | |
| | |
| | | loading: false |
| | | }) |
| | | |
| | | if (selected !== 'false') { |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | this.checkTopLine(id) |
| | | }, 200) |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |
| | |
| | | start = config.setting.pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | if (selected !== 'false') { |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | this.checkTopLine() |
| | | this.checkTopLine(id) |
| | | }, 200) |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |