| | |
| | | * @return {Object} setting 页面设置 |
| | | * @return {Array} columns 显示字段 |
| | | */ |
| | | static getDebugSql (setting, scripts, columns, searches) { |
| | | static getDebugSql (setting, scripts, columns, searches, calendar) { |
| | | let sql = '' |
| | | let _dataresource = '' |
| | | let _customScript = '' |
| | |
| | | } |
| | | |
| | | // 正则替换 |
| | | let _regoptions = searches.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'${item.value}'` |
| | | } |
| | | }) |
| | | let _regoptions = [] |
| | | let _search = '' |
| | | |
| | | // 日历中的年份替换 |
| | | if (setting.queryType === 'statistics' || _customScript) { |
| | | _regoptions.push({ |
| | | reg: new RegExp('@calendarDate@', 'ig'), |
| | | value: `1970-01-01 00:00:00.000` |
| | | }) |
| | | _regoptions.push({ |
| | | reg: new RegExp('@calendarDate1@', 'ig'), |
| | | value: `2030-12-31 23:59:59.999` |
| | | _regoptions = searches.map(item => { |
| | | return { |
| | | reg: new RegExp('@' + item.key + '@', 'ig'), |
| | | value: `'0'` |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (setting.queryType === 'statistics' && _dataresource) { |
| | | // 日历中的年份替换 |
| | | if (calendar.refresh === 'true') { |
| | | _regoptions.push({ |
| | | reg: new RegExp('@calendarDate@', 'ig'), |
| | | value: `'1970-01-01 00:00:00.000'` |
| | | }) |
| | | _regoptions.push({ |
| | | reg: new RegExp('@calendarDate1@', 'ig'), |
| | | value: `'2030-12-31 23:59:59.999'` |
| | | }) |
| | | } |
| | | |
| | | if ((setting.queryType === 'statistics' || calendar.refresh === 'true') && _dataresource) { |
| | | _regoptions.forEach(item => { |
| | | _dataresource = _dataresource.replace(item.reg, item.value) |
| | | }) |