mirror of
https://github.com/dataease/dataease.git
synced 2026-06-10 14:17:06 +08:00
feat: 在系统设置中增加嵌入式场景下数据导出方式的配置
This commit is contained in:
@@ -244,7 +244,8 @@ public class ChartDataServer implements ChartDataApi {
|
||||
HttpServletRequest httpServletRequest = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String linkToken = httpServletRequest.getHeader(AuthConstant.LINK_TOKEN_KEY);
|
||||
LogUtil.info(request.getViewInfo().getId() + " " + StringUtils.isNotEmpty(linkToken) + " " + request.isDataEaseBi());
|
||||
if ((StringUtils.isNotEmpty(linkToken) && !request.isDataEaseBi()) || (request.isDataEaseBi() && StringUtils.isEmpty(linkToken))) {
|
||||
boolean embeddedSyncExport = request.isDataEaseBi() && StringUtils.isEmpty(linkToken) && exportCenterManage.embeddedExportSync();
|
||||
if ((StringUtils.isNotEmpty(linkToken) && !request.isDataEaseBi()) || embeddedSyncExport) {
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
try {
|
||||
Workbook wb = new SXSSFWorkbook();
|
||||
|
||||
@@ -21,6 +21,7 @@ import io.dataease.i18n.Translator;
|
||||
import io.dataease.license.config.XpackInteract;
|
||||
import io.dataease.log.DeLog;
|
||||
import io.dataease.model.ExportTaskDTO;
|
||||
import io.dataease.constant.XpackSettingConstants;
|
||||
import io.dataease.system.manage.SysParameterManage;
|
||||
import io.dataease.utils.*;
|
||||
import io.dataease.visualization.dao.auto.entity.CoreStore;
|
||||
@@ -82,6 +83,11 @@ public class ExportCenterManage implements BaseExportApi {
|
||||
return dataFillingApi;
|
||||
}
|
||||
|
||||
public boolean embeddedExportSync() {
|
||||
String mode = sysParameterManage.singleVal(XpackSettingConstants.EMBEDDED_EXPORT_MODE);
|
||||
return !StringUtils.equalsIgnoreCase(mode, "async");
|
||||
}
|
||||
|
||||
|
||||
public void download(String id, HttpServletResponse response) throws Exception {
|
||||
if (coreExportDownloadTaskMapper.selectById(id) == null) {
|
||||
|
||||
@@ -78,6 +78,7 @@ public class SysParameterServer implements SysParameterApi {
|
||||
public Map<String, Object> defaultSettings() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(XpackSettingConstants.DEFAULT_SORT, "1");
|
||||
map.put(XpackSettingConstants.EMBEDDED_EXPORT_MODE, "sync");
|
||||
|
||||
List<SettingItemVO> settingItemVOS = queryBasicSetting();
|
||||
for (SettingItemVO settingItemVO : settingItemVOS) {
|
||||
@@ -87,6 +88,9 @@ public class SysParameterServer implements SysParameterApi {
|
||||
if (StringUtils.isNotBlank(settingItemVO.getPkey()) && settingItemVO.getPkey().equalsIgnoreCase(XpackSettingConstants.DEFAULT_OPEN) && StringUtils.isNotBlank(settingItemVO.getPval())) {
|
||||
map.put(XpackSettingConstants.DEFAULT_OPEN, settingItemVO.getPval());
|
||||
}
|
||||
if (StringUtils.isNotBlank(settingItemVO.getPkey()) && settingItemVO.getPkey().equalsIgnoreCase(XpackSettingConstants.EMBEDDED_EXPORT_MODE) && StringUtils.isNotBlank(settingItemVO.getPval())) {
|
||||
map.put(XpackSettingConstants.EMBEDDED_EXPORT_MODE, settingItemVO.getPval());
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
5
core/core-frontend/auto-imports.d.ts
vendored
5
core/core-frontend/auto-imports.d.ts
vendored
@@ -4,5 +4,8 @@
|
||||
// Generated by unplugin-auto-import
|
||||
export {}
|
||||
declare global {
|
||||
|
||||
const ElForm: typeof import('element-plus-secondary/es')['ElForm']
|
||||
const ElFormItem: typeof import('element-plus-secondary/es')['ElFormItem']
|
||||
const ElInput: typeof import('element-plus-secondary/es')['ElInput']
|
||||
const ElMessageBox: typeof import('element-plus-secondary/es')['ElMessageBox']
|
||||
}
|
||||
|
||||
@@ -3889,6 +3889,9 @@ export default {
|
||||
sharePeRequire: 'Sharing validity period password required',
|
||||
defaultSort: 'Default resource sorting method',
|
||||
defaultOpen: 'Page opening method',
|
||||
embeddedExportMode: 'Embedded data export mode',
|
||||
exportModeSync: 'Synchronous',
|
||||
exportModeAsync: 'Asynchronous',
|
||||
loginLimit: 'Limit login',
|
||||
loginLimitRate: 'Limit login failure times (times)',
|
||||
loginLimitTime: 'Limit login failure time (minutes)',
|
||||
|
||||
@@ -3777,6 +3777,9 @@ export default {
|
||||
sharePeRequire: '分享有效期限密碼必填',
|
||||
defaultSort: '資源預設排序方式',
|
||||
defaultOpen: '頁面開啟方式',
|
||||
embeddedExportMode: '嵌入式資料匯出方式',
|
||||
exportModeSync: '同步',
|
||||
exportModeAsync: '異步',
|
||||
loginLimit: '限制登入',
|
||||
loginLimitRate: '限制登入失敗次數 (次)',
|
||||
loginLimitTime: '限制登入失敗時間 (分)',
|
||||
|
||||
@@ -3783,6 +3783,9 @@ export default {
|
||||
sharePeRequire: '分享有效期密码必填',
|
||||
defaultSort: '资源默认排序方式',
|
||||
defaultOpen: '页面打开方式',
|
||||
embeddedExportMode: '嵌入式数据导出方式',
|
||||
exportModeSync: '同步',
|
||||
exportModeAsync: '异步',
|
||||
loginLimit: '限制登录',
|
||||
loginLimitRate: '限制登录失败次数 (次)',
|
||||
loginLimitTime: '限制登录失败时间 (分)',
|
||||
|
||||
@@ -130,6 +130,7 @@ const setupAll = async (
|
||||
const { wsCache } = useCache()
|
||||
wsCache.set('TreeSort-backend', defaultSort['basic.defaultSort'] ?? '1')
|
||||
wsCache.set('open-backend', defaultSort['basic.defaultOpen'] ?? '0')
|
||||
wsCache.set('embeddedExportMode-backend', defaultSort['basic.embeddedExportMode'] ?? 'sync')
|
||||
app.mount(dom)
|
||||
return app
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
const defaultSort = await getDefaultSettings()
|
||||
wsCache.set('TreeSort-backend', defaultSort['basic.defaultSort'] ?? '1')
|
||||
wsCache.set('open-backend', defaultSort['basic.defaultOpen'] ?? '0')
|
||||
wsCache.set('embeddedExportMode-backend', defaultSort['basic.embeddedExportMode'] ?? 'sync')
|
||||
if ((wsCache.get('user.token') || isDesktop) && !to.path.startsWith('/de-link/')) {
|
||||
if (!userStore.getUid) {
|
||||
await userStore.setUser()
|
||||
|
||||
@@ -12,9 +12,11 @@ import { ElMessage } from 'element-plus-secondary'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useLinkStoreWithOut } from '@/store/modules/link'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { Decimal } from 'decimal.js'
|
||||
|
||||
const appStore = useAppStoreWithOut()
|
||||
const { wsCache } = useCache()
|
||||
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
|
||||
|
||||
const { t } = useI18n()
|
||||
@@ -607,6 +609,9 @@ export const exportExcelDownload = (chart, preFix, callBack?) => {
|
||||
}
|
||||
|
||||
const linkStore = useLinkStoreWithOut()
|
||||
const embeddedAsyncExport =
|
||||
(isDataEaseBi.value || appStore.getIsIframe) &&
|
||||
wsCache.get('embeddedExportMode-backend') === 'async'
|
||||
|
||||
if (isDataEaseBi.value || appStore.getIsIframe) {
|
||||
request.dataEaseBi = true
|
||||
@@ -617,7 +622,10 @@ export const exportExcelDownload = (chart, preFix, callBack?) => {
|
||||
}
|
||||
method(request)
|
||||
.then(res => {
|
||||
if (linkStore.getLinkToken || isDataEaseBi.value || appStore.getIsIframe) {
|
||||
if (
|
||||
linkStore.getLinkToken ||
|
||||
((isDataEaseBi.value || appStore.getIsIframe) && !embeddedAsyncExport)
|
||||
) {
|
||||
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
|
||||
@@ -28,6 +28,10 @@ const pvpOptions = [
|
||||
{ value: '3', label: t('commons.date.three_months') },
|
||||
{ value: '4', label: t('commons.date.one_month') }
|
||||
]
|
||||
const embeddedExportModeOptions = [
|
||||
{ value: 'sync', label: t('setting_basic.exportModeSync') },
|
||||
{ value: 'async', label: t('setting_basic.exportModeAsync') }
|
||||
]
|
||||
const requireKeys = [
|
||||
'logLiveTime',
|
||||
'thresholdLogLiveTime',
|
||||
@@ -439,6 +443,17 @@ defineExpose({
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div v-else-if="item.pkey === 'embeddedExportMode'">
|
||||
<el-radio-group v-model="state.form[item.pkey]">
|
||||
<el-radio
|
||||
v-for="item in embeddedExportModeOptions"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
>
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<v-else />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
@@ -70,6 +70,10 @@ const pvpOptions = [
|
||||
{ value: '3', label: t('commons.date.three_months') },
|
||||
{ value: '4', label: t('commons.date.one_month') }
|
||||
]
|
||||
const embeddedExportModeOptions = [
|
||||
{ value: 'sync', label: t('setting_basic.exportModeSync') },
|
||||
{ value: 'async', label: t('setting_basic.exportModeAsync') }
|
||||
]
|
||||
const tooltips = [
|
||||
{
|
||||
key: 'setting_basic.defaultOpen',
|
||||
@@ -243,6 +247,13 @@ const search = cb => {
|
||||
} else {
|
||||
item.pval = state.openOptions[0].label
|
||||
}
|
||||
} else if (item.pkey === 'basic.embeddedExportMode') {
|
||||
if (item.pval) {
|
||||
const r = embeddedExportModeOptions.filter(cur => cur.value === item.pval)
|
||||
item.pval = r?.length ? r[0].label : embeddedExportModeOptions[0].label
|
||||
} else {
|
||||
item.pval = embeddedExportModeOptions[0].label
|
||||
}
|
||||
} else {
|
||||
item.pval = item.pval
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public class XpackSettingConstants {
|
||||
public static final String DATA_FILLING_LOG_LIVE_TIME = "basic.dataFillingLogLiveTime";
|
||||
public static final String DEFAULT_SORT = "basic.defaultSort";
|
||||
public static final String DEFAULT_OPEN = "basic.defaultOpen";
|
||||
public static final String EMBEDDED_EXPORT_MODE = "basic.embeddedExportMode";
|
||||
public static final String LOGIN_LIMIT = "basic.loginLimit";
|
||||
public static final String LOGIN_LIMIT_RATE = "basic.loginLimitRate";
|
||||
public static final String LOGIN_LIMIT_TIME = "basic.loginLimitTime";
|
||||
|
||||
@@ -17,6 +17,7 @@ public class SystemSettingUtils {
|
||||
XpackSettingConstants.DEFAULT_LOGIN,
|
||||
XpackSettingConstants.THRESHOLD_LOG_LIVE_TIME,
|
||||
XpackSettingConstants.DATA_FILLING_LOG_LIVE_TIME,
|
||||
XpackSettingConstants.EMBEDDED_EXPORT_MODE,
|
||||
XpackSettingConstants.LOGIN_LIMIT,
|
||||
XpackSettingConstants.LOGIN_LIMIT_RATE,
|
||||
XpackSettingConstants.LOGIN_LIMIT_TIME,
|
||||
|
||||
Reference in New Issue
Block a user