| | |
| | | return |
| | | } |
| | | |
| | | let getMsearch = (components) => { |
| | | let val = null |
| | | components.forEach(com => { |
| | | if (com.type !== 'search') return |
| | | |
| | | if (com.wrap && com.wrap.supModule && com.wrap.supModule.length > 0) { |
| | | let supModule = com.wrap.supModule[com.wrap.supModule.length - 1]; |
| | | |
| | | (com.search || []).forEach(item => { |
| | | if (item.type === 'datemonth') { |
| | | if (item.initval && item.dateShift) { |
| | | val = {supModule: supModule, name: com.name} |
| | | } |
| | | } else if (item.type === 'daterange') { |
| | | if (item.initval && item.dateShift) { |
| | | val = {supModule: supModule, name: com.name} |
| | | } |
| | | } else if ((item.type === 'select' || item.type === 'link') && item.resourceType === '1') { |
| | | if (/@BID@/ig.test(item.dataSource)) { |
| | | val = {supModule: supModule, name: com.name} |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | return val |
| | | } |
| | | |
| | | let checkSearch = (components, mSearch) => { |
| | | components.forEach(item => { |
| | | if (error) return |
| | | |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | let _ms = getMsearch(tab.components) |
| | | |
| | | if (_ms) { |
| | | checkSearch(tab.components, _ms) |
| | | } else { |
| | | checkSearch(tab.components, mSearch) |
| | | } |
| | | }) |
| | | return |
| | | } else if (item.type === 'group') { |
| | | checkSearch(item.components, mSearch) |
| | | return |
| | | } else if (!mSearch || !item.setting) { |
| | | return |
| | | } else if (!(item.type === 'table' || (item.type === 'card' && ['datacard', 'dualdatacard'].includes(item.subtype)))) { |
| | | return |
| | | } |
| | | |
| | | if (item.setting.useMSearch === 'true' && item.setting.supModule && item.setting.supModule[0] !== 'empty') { |
| | | let id = item.setting.supModule[item.setting.supModule.length - 1] |
| | | if (mSearch.supModule !== id) { |
| | | error = `${item.name} 使用了外部搜索,但与外部搜索(${mSearch.name})的上级组件不一致。` |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | checkSearch(config.components, getMsearch(config.components)) |
| | | |
| | | if (error) { |
| | | Modal.warning({ |
| | | title: error, |
| | | okText: '知道了' |
| | | }) |
| | | return |
| | | } |
| | | |
| | | this.sqlList = [] |
| | | this.linkMain = [] |
| | | |
| | |
| | | searches = formatSearch(searches) |
| | | |
| | | let _columns = [] |
| | | if (item.subtype === 'dualdatacard') { |
| | | if (item.subtype === 'dualdatacard' && item.setting.subdata !== 'sub_data_string') { |
| | | _columns = [...item.columns, ...item.subColumns] |
| | | } else if (item.columns) { |
| | | _columns = [...item.columns] |
| | |
| | | _search = '' |
| | | } |
| | | |
| | | let custompage = false |
| | | |
| | | if (/order\s+by\s+sort_id\s*$/i.test(_dataresource)) { |
| | | custompage = true |
| | | } else if (/@pageSize@|@orderBy@|@mk_total/i.test(_dataresource + _customScript)) { |
| | | custompage = true |
| | | } |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | item.setting.dataresource = _dataresource |
| | | item.setting.customScript = _customScript |
| | | |
| | | let custompage = /@pageSize@|@orderBy@|@mk_total/i.test(_dataresource + _customScript) |
| | | |
| | | if (_dataresource) { |
| | | if (custompage) { |