forked from github/dataease
refactor: 重构系统参数-显示设置布局
This commit is contained in:
parent
39af270ce2
commit
ccba5bdce5
@ -1,6 +1,5 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
|
||||
public interface ParamConstants {
|
||||
|
||||
String getValue();
|
||||
@ -50,7 +49,6 @@ public interface ParamConstants {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum Registry implements ParamConstants {
|
||||
URL("registry.url"),
|
||||
REPO("registry.repo"),
|
||||
@ -89,7 +87,7 @@ public interface ParamConstants {
|
||||
}
|
||||
}
|
||||
|
||||
enum MAIL implements ParamConstants{
|
||||
enum MAIL implements ParamConstants {
|
||||
SERVER("smtp.host"),
|
||||
PORT("smtp.port"),
|
||||
ACCOUNT("smtp.account"),
|
||||
@ -111,11 +109,15 @@ public interface ParamConstants {
|
||||
|
||||
enum BASIC implements ParamConstants {
|
||||
FRONT_TIME_OUT("basic.frontTimeOut"),
|
||||
MSG_TIME_OUT("basic.msgTimeOut");
|
||||
MSG_TIME_OUT("basic.msgTimeOut"),
|
||||
OPEN_HOME_PAGE("ui.openHomePage");
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private BASIC(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -6,11 +6,13 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BasicInfo implements Serializable{
|
||||
public class BasicInfo implements Serializable {
|
||||
|
||||
@ApiModelProperty("请求超时时间")
|
||||
private String frontTimeOut;
|
||||
@ApiModelProperty("消息保留时间")
|
||||
private String msgTimeOut;
|
||||
@ApiModelProperty("显示首页")
|
||||
private String openHomePage;
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,10 @@ public class SystemParameterService {
|
||||
|
||||
public BasicInfo basicInfo() {
|
||||
List<SystemParameter> paramList = this.getParamList("basic");
|
||||
List<SystemParameter> homePageList = this.getParamList("ui.openHomePage");
|
||||
paramList.addAll(homePageList);
|
||||
BasicInfo result = new BasicInfo();
|
||||
result.setOpenHomePage("true");
|
||||
if (!CollectionUtils.isEmpty(paramList)) {
|
||||
for (SystemParameter param : paramList) {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.FRONT_TIME_OUT.getValue())) {
|
||||
@ -50,6 +53,10 @@ public class SystemParameterService {
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.MSG_TIME_OUT.getValue())) {
|
||||
result.setMsgTimeOut(param.getParamValue());
|
||||
}
|
||||
if (StringUtils.equals(param.getParamKey(), ParamConstants.BASIC.OPEN_HOME_PAGE.getValue())) {
|
||||
boolean open = StringUtils.equals("true", param.getParamValue());
|
||||
result.setOpenHomePage(open ? "true" : "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -137,12 +144,13 @@ public class SystemParameterService {
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
public void saveUIInfo(Map<String, List<SystemParameterDTO>> request, List<MultipartFile> bodyFiles) throws IOException {
|
||||
public void saveUIInfo(Map<String, List<SystemParameterDTO>> request, List<MultipartFile> bodyFiles)
|
||||
throws IOException {
|
||||
List<SystemParameterDTO> parameters = request.get("systemParams");
|
||||
if (null != bodyFiles)
|
||||
for (MultipartFile multipartFile : bodyFiles) {
|
||||
if (!multipartFile.isEmpty()) {
|
||||
//防止添加非图片文件
|
||||
// 防止添加非图片文件
|
||||
try (InputStream input = multipartFile.getInputStream()) {
|
||||
try {
|
||||
// It's an image (only BMP, GIF, JPG and PNG are recognized).
|
||||
@ -154,7 +162,9 @@ public class SystemParameterService {
|
||||
}
|
||||
String multipartFileName = multipartFile.getOriginalFilename();
|
||||
String[] split = Objects.requireNonNull(multipartFileName).split(",");
|
||||
parameters.stream().filter(systemParameterDTO -> systemParameterDTO.getParamKey().equalsIgnoreCase(split[1])).forEach(systemParameterDTO -> {
|
||||
parameters.stream()
|
||||
.filter(systemParameterDTO -> systemParameterDTO.getParamKey().equalsIgnoreCase(split[1]))
|
||||
.forEach(systemParameterDTO -> {
|
||||
systemParameterDTO.setFileName(split[0]);
|
||||
systemParameterDTO.setFile(multipartFile);
|
||||
});
|
||||
@ -168,7 +178,8 @@ public class SystemParameterService {
|
||||
}
|
||||
if (file != null) {
|
||||
fileService.deleteFileById(systemParameter.getParamValue());
|
||||
FileMetadata fileMetadata = fileService.saveFile(systemParameter.getFile(), systemParameter.getFileName());
|
||||
FileMetadata fileMetadata = fileService.saveFile(systemParameter.getFile(),
|
||||
systemParameter.getFileName());
|
||||
systemParameter.setParamValue(fileMetadata.getId());
|
||||
}
|
||||
if (file == null && systemParameter.getFileName() == null) {
|
||||
@ -181,5 +192,4 @@ public class SystemParameterService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -86,4 +86,4 @@ CREATE TABLE `de_engine` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.mobileBG', NULL, 'file', 0);
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.mobileBG', NULL, 'file', 14);
|
||||
|
@ -1632,7 +1632,8 @@ export default {
|
||||
themeLight: 'Light',
|
||||
themeDark: 'Dark',
|
||||
themeCustom: 'Custom',
|
||||
openHomePage: 'Show Home Page'
|
||||
openHomePage: 'Show Home Page',
|
||||
mobileBG: 'Mobile Login page BG'
|
||||
|
||||
},
|
||||
auth: {
|
||||
@ -1888,8 +1889,7 @@ export default {
|
||||
cmonth: 'This Month',
|
||||
cquarter: 'This Quarter',
|
||||
cyear: 'This Year',
|
||||
openHomePage: 'Show Home Page',
|
||||
mobileBG: 'Mobile BG'
|
||||
openHomePage: 'Show Home Page'
|
||||
},
|
||||
dynamic_year: {
|
||||
fix: 'Fixed Year',
|
||||
|
@ -1643,7 +1643,7 @@ export default {
|
||||
themeCustom: '自定義',
|
||||
openHomePage: '顯示首頁',
|
||||
|
||||
mobileBG: '移動端背景'
|
||||
mobileBG: '移動端登錄頁背景'
|
||||
|
||||
},
|
||||
auth: {
|
||||
|
@ -1651,7 +1651,7 @@ export default {
|
||||
themeDark: '深色',
|
||||
themeCustom: '自定义',
|
||||
openHomePage: '显示首页',
|
||||
mobileBG: '移动端背景'
|
||||
mobileBG: '移动端登录页背景'
|
||||
|
||||
},
|
||||
auth: {
|
||||
|
@ -31,7 +31,16 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item :label="$t('display.openHomePage')">
|
||||
<el-checkbox v-model="formInline.openHomePage" true-label="true" false-label="false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
|
||||
<div>
|
||||
|
||||
<el-button v-if="showEdit" size="small" @click="edit">{{ $t('commons.edit') }}</el-button>
|
||||
@ -103,7 +112,8 @@ export default {
|
||||
save(formInline) {
|
||||
const param = [
|
||||
{ paramKey: 'basic.frontTimeOut', paramValue: this.formInline.frontTimeOut, type: 'text', sort: 1 },
|
||||
{ paramKey: 'basic.msgTimeOut', paramValue: this.formInline.msgTimeOut, type: 'text', sort: 2 }
|
||||
{ paramKey: 'basic.msgTimeOut', paramValue: this.formInline.msgTimeOut, type: 'text', sort: 2 },
|
||||
{ paramKey: 'ui.openHomePage', paramValue: this.formInline.openHomePage, type: 'text', sort: 13 }
|
||||
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user