| | |
| | | } else if (config.type === 'interface') { |
| | | menu.components.forEach(item => { |
| | | if (item.type !== 'search') return |
| | | search = item.search |
| | | search = item.search || [] |
| | | }) |
| | | } else { |
| | | let filterComponent = (box, mainSearch) => { |
| | | box.components.forEach(item => { |
| | | if (item.type !== 'search') return |
| | | mainSearch = item.search |
| | | mainSearch = item.search || [] |
| | | }) |
| | | let has = false |
| | | box.components.forEach(item => { |
| | |
| | | } |
| | | |
| | | verifySubmit = () => { |
| | | const { config } = this.props |
| | | const { config, mainSearch } = this.props |
| | | |
| | | this.setState({loading: true}) |
| | | this.verifyRef.submitDataSource().then((res, hasMSearch) => { |
| | | this.verifyRef.submitDataSource().then((res) => { |
| | | |
| | | let MenuType = sessionStorage.getItem('MenuType') |
| | | |
| | |
| | | }, 150) |
| | | } |
| | | |
| | | if (config.type === 'interface' && res.setting && res.setting.useMSearch === 'true' && !hasMSearch) { |
| | | if (config.type === 'interface' && res.setting && res.setting.useMSearch === 'true' && mainSearch.length === 0) { |
| | | Modal.warning({ |
| | | title: '数据源中使用了外部搜索,但搜索条件尚未添加!', |
| | | centered: true |
| | |
| | | searches: formatSearch(search), |
| | | searchKey: '', |
| | | debugId: _setting.debugId || '', |
| | | hasMainSearch: mainSearch && mainSearch.length, |
| | | hasMainSearch: mainSearch && mainSearch.length > 0, |
| | | oriConfig: fromJS({ |
| | | scripts, |
| | | columns: columns, |
| | |
| | | |
| | | submitDataSource = () => { |
| | | const { config, mainSearch } = this.props |
| | | const { activeKey, setting, columns, subColumns, scripts, cols, median, searches, hasMainSearch } = this.state |
| | | const { activeKey, setting, columns, subColumns, scripts, cols, median, searches } = this.state |
| | | |
| | | if (config.subtype === 'dualdatacard') { |
| | | let arr = columns.map(col => col.field.toLowerCase()) |
| | |
| | | searches: _searches, |
| | | setting: res |
| | | }, () => { |
| | | this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols, searches: _searches }, hasMainSearch) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting: res, columns, subColumns, scripts, cols, searches: _searches }) }, reject, 'submit') |
| | | }) |
| | | }, () => { |
| | | reject() |
| | |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }, hasMainSearch) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') |
| | | } else if (activeKey === 'subcolumns') { |
| | | if (this.subdatasource && this.subdatasource.state.editingKey) { |
| | | notification.warning({ |
| | |
| | | reject() |
| | | return |
| | | } |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }, hasMainSearch) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') |
| | | } else if (activeKey === 'scripts') { |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }, hasMainSearch) }, reject, 'submit') |
| | | this.sqlverify(() => { resolve({setting, columns, subColumns, scripts, cols, searches }) }, reject, 'submit') |
| | | } |
| | | }) |
| | | } |