| | |
| | | |
| | | let valid = true // 搜索条件必填验证, 初始搜索条件, 如通过上级透视,写入搜索条件 |
| | | let hasReqFields = false |
| | | let initSearch = config.search.map(item => { |
| | | let _item = fromJS(item).toJS() |
| | | |
| | | if (_item.required === 'true' && !_item.initval) { |
| | | config.search.forEach(item => { |
| | | if (item.required !== 'true') return |
| | | if (!item.initval) { |
| | | valid = false |
| | | } |
| | | if (_item.required === 'true') { |
| | | hasReqFields = true |
| | | } |
| | | return _item |
| | | hasReqFields = true |
| | | }) |
| | | |
| | | initSearch = Utils.initMainSearch(initSearch) |
| | | |
| | | this.setState({ |
| | | loadingview: false, |
| | |
| | | columns: _columns, |
| | | arr_field: _arrField.join(','), |
| | | BID: param && param.BID ? param.BID : '', |
| | | search: Utils.initMainSearch(initSearch), // 搜索条件初始化(含有时间格式,需要转化) |
| | | search: Utils.initMainSearch(config.search), // 搜索条件初始化(含有时间格式,需要转化) |
| | | hasReqFields |
| | | }, () => { |
| | | if (config.setting.onload !== 'false' && valid) { // 初始化可加载 |
| | |
| | | } |
| | | |
| | | loadData = () => { |
| | | const { setting, search, BIDs, loadCustomApi } = this.state |
| | | let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | const { setting, search, BIDs, loadCustomApi, hasReqFields } = this.state |
| | | let requireFields = [] |
| | | |
| | | if (hasReqFields) { |
| | | requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0)) |
| | | } |
| | | |
| | | this.setState({ |
| | | selectedData: [], |
| | |
| | | let error = '未知的返回结果!' |
| | | |
| | | if (typeof(res) === 'string') { |
| | | error = res |
| | | error = res.replace(/'/ig, '"') |
| | | } |
| | | |
| | | let _result = { |