From 9d8e130d49bd824c849dd000c7f30bed7586a90c Mon Sep 17 00:00:00 2001 From: junjun Date: Mon, 11 Nov 2024 10:10:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B5=84=E6=BA=90=E9=BB=98=E8=AE=A4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=96=B9=E5=BC=8F=E7=9A=84=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=20#13050?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/server/SysParameterServer.java | 17 ++++++++++++++++ .../resources/db/desktop/V2.10.3__ddl.sql | 2 ++ .../resources/db/migration/V2.10.3__ddl.sql | 2 ++ core/core-frontend/src/locales/tw.ts | 9 ++++++++- core/core-frontend/src/locales/zh-CN.ts | 9 ++++++++- .../system/parameter/basic/BasicEdit.vue | 16 ++++++++++++++- .../system/parameter/basic/BasicInfo.vue | 20 ++++++++++++++++++- .../dataease/api/system/SysParameterApi.java | 5 +++++ .../constant/XpackSettingConstants.java | 2 ++ 9 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 core/core-backend/src/main/resources/db/desktop/V2.10.3__ddl.sql create mode 100644 core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql diff --git a/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java b/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java index 5b97137b1c..462cfb6a13 100644 --- a/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java +++ b/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java @@ -12,7 +12,9 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; import java.util.List; +import java.util.Map; @RestController @RequestMapping("/sysParameter") @@ -61,6 +63,21 @@ public class SysParameterServer implements SysParameterApi { return frontTimeOut; } + @Override + public Map defaultSettings() { + Map map = new HashMap<>(); + map.put(XpackSettingConstants.DEFAULT_SORT, "1"); + + List settingItemVOS = queryBasicSetting(); + for (int i = 0; i < settingItemVOS.size(); i++) { + SettingItemVO settingItemVO = settingItemVOS.get(i); + if (StringUtils.isNotBlank(settingItemVO.getPkey()) && settingItemVO.getPkey().equalsIgnoreCase(XpackSettingConstants.DEFAULT_SORT) && StringUtils.isNotBlank(settingItemVO.getPval())) { + map.put(XpackSettingConstants.DEFAULT_SORT, settingItemVO.getPval()); + } + } + return map; + } + @Override public List ui() { return sysParameterManage.getUiList(); diff --git a/core/core-backend/src/main/resources/db/desktop/V2.10.3__ddl.sql b/core/core-backend/src/main/resources/db/desktop/V2.10.3__ddl.sql new file mode 100644 index 0000000000..036684523c --- /dev/null +++ b/core/core-backend/src/main/resources/db/desktop/V2.10.3__ddl.sql @@ -0,0 +1,2 @@ +INSERT INTO `core_sys_setting`(`id`, `pkey`, `pval`, `type`, `sort`) +VALUES (1048232869488627719, 'basic.defaultSort', '1', 'text', 13); diff --git a/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql b/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql new file mode 100644 index 0000000000..036684523c --- /dev/null +++ b/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql @@ -0,0 +1,2 @@ +INSERT INTO `core_sys_setting`(`id`, `pkey`, `pval`, `type`, `sort`) +VALUES (1048232869488627719, 'basic.defaultSort', '1', 'text', 13); diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts index 1e3dc9ab9b..5129b6c570 100644 --- a/core/core-frontend/src/locales/tw.ts +++ b/core/core-frontend/src/locales/tw.ts @@ -2964,7 +2964,14 @@ export default { pvp: '密碼有效期', defaultLogin: '默認登錄方式', shareDisable: '禁用分享', - sharePeRequire: '分享有效期密碼必填' + sharePeRequire: '分享有效期密碼必填', + defaultSort: '資源默認排序方式' + }, + resource_sort: { + time_asc: '按創建時間升序', + time_desc: '按創建時間降序', + name_asc: '按名稱升序', + name_desc: '按名稱降序' }, setting_email: { title: '郵件設置', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index e711aa5435..da59f8ba91 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -3056,7 +3056,14 @@ export default { pvp: '密码有效期', defaultLogin: '默认登录方式', shareDisable: '禁用分享', - sharePeRequire: '分享有效期密码必填' + sharePeRequire: '分享有效期密码必填', + defaultSort: '资源默认排序方式' + }, + resource_sort: { + time_asc: '按创建时间升序', + time_desc: '按创建时间降序', + name_asc: '按名称升序', + name_desc: '按名称降序' }, setting_email: { title: '邮件设置', diff --git a/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue b/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue index 217ec85b68..e80736b2c4 100644 --- a/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue +++ b/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue @@ -35,6 +35,12 @@ const state = reactive({ { value: '2', label: 'OIDC' }, { value: '3', label: 'CAS' }, { value: '9', label: 'OAUTH2' } + ], + sortOptions: [ + { value: '0', label: t('resource_sort.time_asc') }, + { value: '1', label: t('resource_sort.time_desc') }, + { value: '2', label: t('resource_sort.name_asc') }, + { value: '3', label: t('resource_sort.name_desc') } ] }) @@ -119,10 +125,11 @@ const closeLoading = () => { loadingInstance.value?.close() } -const edit = (list, orgOptions, roleOptions, loginOptions) => { +const edit = (list, orgOptions, roleOptions, loginOptions, sortOptions) => { state.orgOptions = orgOptions || [] state.roleOptions = roleOptions || [] state.loginOptions = loginOptions || [] + state.sortOptions = sortOptions || [] state.settingList = list.map(item => { const pkey = item.pkey if (pkey === 'basic.logLiveTime' || pkey === 'basic.thresholdLogLiveTime') { @@ -344,6 +351,13 @@ defineExpose({ +
+ + + {{ item.label }} + + +
diff --git a/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue b/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue index c5ec2716a6..e0553d5131 100644 --- a/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue +++ b/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue @@ -71,6 +71,12 @@ const state = reactive({ { value: '2', label: 'OIDC' }, { value: '3', label: 'CAS' }, { value: '9', label: 'OAUTH2' } + ], + sortOptions: [ + { value: '0', label: t('resource_sort.time_asc') }, + { value: '1', label: t('resource_sort.time_desc') }, + { value: '2', label: t('resource_sort.name_asc') }, + { value: '3', label: t('resource_sort.name_desc') } ] }) let originData = [] @@ -133,6 +139,17 @@ const search = cb => { item.pval = state.loginOptions[0].label } } + } else if (item.pkey === 'basic.defaultSort') { + if (item.pval) { + const r = state.sortOptions.filter(cur => cur.value === item.pval) + if (r?.length) { + item.pval = r[0].label + } else { + item.pval = state.sortOptions[1].label + } + } else { + item.pval = state.sortOptions[1].label + } } else { item.pval = item.pval } @@ -156,7 +173,8 @@ const edit = () => { cloneDeep(originData), cloneDeep(state.orgOptions), cloneDeep(state.roleOptions), - cloneDeep(state.loginOptions) + cloneDeep(state.loginOptions), + cloneDeep(state.sortOptions) ) } const loadOrgOptions = async () => { diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java index b177d4ecdb..85e2582c65 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/system/SysParameterApi.java @@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; +import java.util.Map; @Tag(name = "系统设置:系统参数") @ApiSupport(order = 799) @@ -45,6 +46,10 @@ public interface SysParameterApi { @GetMapping("/requestTimeOut") public Integer RequestTimeOut(); + @Operation(summary = "系统默认配置(非xpack)") + @GetMapping("/defaultSettings") + public Map defaultSettings(); + @Hidden @GetMapping("/ui") List ui(); diff --git a/sdk/common/src/main/java/io/dataease/constant/XpackSettingConstants.java b/sdk/common/src/main/java/io/dataease/constant/XpackSettingConstants.java index f56eaf2fcb..37699a61a7 100644 --- a/sdk/common/src/main/java/io/dataease/constant/XpackSettingConstants.java +++ b/sdk/common/src/main/java/io/dataease/constant/XpackSettingConstants.java @@ -11,4 +11,6 @@ public class XpackSettingConstants { public static final String PVP = "basic.pvp"; public static final String DEFAULT_LOGIN = "basic.defaultLogin"; public static final String THRSHOLD_LOG_LIVE_TIME = "basic.thresholdLogLiveTime"; + + public static final String DEFAULT_SORT = "basic.defaultSort"; }