Merge pull request #13229 from dataease/pr@dev-v2@feat_default_sort
feat(系统设置): 增加资源默认排序方式的配置项 #13050
This commit is contained in:
commit
24ab9861ad
@ -12,7 +12,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sysParameter")
|
@RequestMapping("/sysParameter")
|
||||||
@ -61,6 +63,21 @@ public class SysParameterServer implements SysParameterApi {
|
|||||||
return frontTimeOut;
|
return frontTimeOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> defaultSettings() {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put(XpackSettingConstants.DEFAULT_SORT, "1");
|
||||||
|
|
||||||
|
List<SettingItemVO> 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
|
@Override
|
||||||
public List<Object> ui() {
|
public List<Object> ui() {
|
||||||
return sysParameterManage.getUiList();
|
return sysParameterManage.getUiList();
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
INSERT INTO `core_sys_setting`(`id`, `pkey`, `pval`, `type`, `sort`)
|
||||||
|
VALUES (1048232869488627719, 'basic.defaultSort', '1', 'text', 13);
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
INSERT INTO `core_sys_setting`(`id`, `pkey`, `pval`, `type`, `sort`)
|
||||||
|
VALUES (1048232869488627719, 'basic.defaultSort', '1', 'text', 13);
|
||||||
@ -2964,7 +2964,14 @@ export default {
|
|||||||
pvp: '密碼有效期',
|
pvp: '密碼有效期',
|
||||||
defaultLogin: '默認登錄方式',
|
defaultLogin: '默認登錄方式',
|
||||||
shareDisable: '禁用分享',
|
shareDisable: '禁用分享',
|
||||||
sharePeRequire: '分享有效期密碼必填'
|
sharePeRequire: '分享有效期密碼必填',
|
||||||
|
defaultSort: '資源默認排序方式'
|
||||||
|
},
|
||||||
|
resource_sort: {
|
||||||
|
time_asc: '按創建時間升序',
|
||||||
|
time_desc: '按創建時間降序',
|
||||||
|
name_asc: '按名稱升序',
|
||||||
|
name_desc: '按名稱降序'
|
||||||
},
|
},
|
||||||
setting_email: {
|
setting_email: {
|
||||||
title: '郵件設置',
|
title: '郵件設置',
|
||||||
|
|||||||
@ -3056,7 +3056,14 @@ export default {
|
|||||||
pvp: '密码有效期',
|
pvp: '密码有效期',
|
||||||
defaultLogin: '默认登录方式',
|
defaultLogin: '默认登录方式',
|
||||||
shareDisable: '禁用分享',
|
shareDisable: '禁用分享',
|
||||||
sharePeRequire: '分享有效期密码必填'
|
sharePeRequire: '分享有效期密码必填',
|
||||||
|
defaultSort: '资源默认排序方式'
|
||||||
|
},
|
||||||
|
resource_sort: {
|
||||||
|
time_asc: '按创建时间升序',
|
||||||
|
time_desc: '按创建时间降序',
|
||||||
|
name_asc: '按名称升序',
|
||||||
|
name_desc: '按名称降序'
|
||||||
},
|
},
|
||||||
setting_email: {
|
setting_email: {
|
||||||
title: '邮件设置',
|
title: '邮件设置',
|
||||||
|
|||||||
@ -35,6 +35,12 @@ const state = reactive({
|
|||||||
{ value: '2', label: 'OIDC' },
|
{ value: '2', label: 'OIDC' },
|
||||||
{ value: '3', label: 'CAS' },
|
{ value: '3', label: 'CAS' },
|
||||||
{ value: '9', label: 'OAUTH2' }
|
{ 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()
|
loadingInstance.value?.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
const edit = (list, orgOptions, roleOptions, loginOptions) => {
|
const edit = (list, orgOptions, roleOptions, loginOptions, sortOptions) => {
|
||||||
state.orgOptions = orgOptions || []
|
state.orgOptions = orgOptions || []
|
||||||
state.roleOptions = roleOptions || []
|
state.roleOptions = roleOptions || []
|
||||||
state.loginOptions = loginOptions || []
|
state.loginOptions = loginOptions || []
|
||||||
|
state.sortOptions = sortOptions || []
|
||||||
state.settingList = list.map(item => {
|
state.settingList = list.map(item => {
|
||||||
const pkey = item.pkey
|
const pkey = item.pkey
|
||||||
if (pkey === 'basic.logLiveTime' || pkey === 'basic.thresholdLogLiveTime') {
|
if (pkey === 'basic.logLiveTime' || pkey === 'basic.thresholdLogLiveTime') {
|
||||||
@ -344,6 +351,13 @@ defineExpose({
|
|||||||
</el-radio>
|
</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="item.pkey === 'defaultSort'">
|
||||||
|
<el-radio-group v-model="state.form[item.pkey]">
|
||||||
|
<el-radio v-for="item in state.sortOptions" :key="item.value" :label="item.value">
|
||||||
|
{{ item.label }}
|
||||||
|
</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
<v-else />
|
<v-else />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|||||||
@ -71,6 +71,12 @@ const state = reactive({
|
|||||||
{ value: '2', label: 'OIDC' },
|
{ value: '2', label: 'OIDC' },
|
||||||
{ value: '3', label: 'CAS' },
|
{ value: '3', label: 'CAS' },
|
||||||
{ value: '9', label: 'OAUTH2' }
|
{ 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 = []
|
let originData = []
|
||||||
@ -133,6 +139,17 @@ const search = cb => {
|
|||||||
item.pval = state.loginOptions[0].label
|
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 {
|
} else {
|
||||||
item.pval = item.pval
|
item.pval = item.pval
|
||||||
}
|
}
|
||||||
@ -156,7 +173,8 @@ const edit = () => {
|
|||||||
cloneDeep(originData),
|
cloneDeep(originData),
|
||||||
cloneDeep(state.orgOptions),
|
cloneDeep(state.orgOptions),
|
||||||
cloneDeep(state.roleOptions),
|
cloneDeep(state.roleOptions),
|
||||||
cloneDeep(state.loginOptions)
|
cloneDeep(state.loginOptions),
|
||||||
|
cloneDeep(state.sortOptions)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const loadOrgOptions = async () => {
|
const loadOrgOptions = async () => {
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Tag(name = "系统设置:系统参数")
|
@Tag(name = "系统设置:系统参数")
|
||||||
@ApiSupport(order = 799)
|
@ApiSupport(order = 799)
|
||||||
@ -45,6 +46,10 @@ public interface SysParameterApi {
|
|||||||
@GetMapping("/requestTimeOut")
|
@GetMapping("/requestTimeOut")
|
||||||
public Integer RequestTimeOut();
|
public Integer RequestTimeOut();
|
||||||
|
|
||||||
|
@Operation(summary = "系统默认配置(非xpack)")
|
||||||
|
@GetMapping("/defaultSettings")
|
||||||
|
public Map<String, Object> defaultSettings();
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@GetMapping("/ui")
|
@GetMapping("/ui")
|
||||||
List<Object> ui();
|
List<Object> ui();
|
||||||
|
|||||||
@ -11,4 +11,6 @@ public class XpackSettingConstants {
|
|||||||
public static final String PVP = "basic.pvp";
|
public static final String PVP = "basic.pvp";
|
||||||
public static final String DEFAULT_LOGIN = "basic.defaultLogin";
|
public static final String DEFAULT_LOGIN = "basic.defaultLogin";
|
||||||
public static final String THRSHOLD_LOG_LIVE_TIME = "basic.thresholdLogLiveTime";
|
public static final String THRSHOLD_LOG_LIVE_TIME = "basic.thresholdLogLiveTime";
|
||||||
|
|
||||||
|
public static final String DEFAULT_SORT = "basic.defaultSort";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user