forked from github/dataease
feat:仪表板主题名称双击可修改
This commit is contained in:
parent
7d5b7176a6
commit
0898bd74e6
@ -4,14 +4,17 @@ import io.dataease.base.domain.PanelSubject;
|
||||
import io.dataease.base.domain.PanelSubjectExample;
|
||||
import io.dataease.base.mapper.PanelSubjectMapper;
|
||||
import io.dataease.controller.request.panel.PanelSubjectRequest;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -47,16 +50,28 @@ public class PanelSubjectService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void update(PanelSubject request){
|
||||
|
||||
public synchronized void update(PanelSubject request){
|
||||
if(StringUtils.isEmpty(request.getId())){
|
||||
PanelSubjectExample example = new PanelSubjectExample();
|
||||
example.createCriteria().andTypeEqualTo("self");
|
||||
List<PanelSubject> subjectAll = panelSubjectMapper.selectByExample(example);
|
||||
int count = CollectionUtils.isEmpty(subjectAll)?0:subjectAll.size();
|
||||
request.setId(UUID.randomUUID().toString());
|
||||
request.setCreateTime(System.currentTimeMillis());
|
||||
request.setType("self");
|
||||
request.setName("个人主题");
|
||||
request.setName("个人主题"+count);
|
||||
panelSubjectMapper.insertSelective(request);
|
||||
}else{
|
||||
request.setUpdateTime(System.currentTimeMillis());
|
||||
panelSubjectMapper.updateByPrimaryKeySelective(request);
|
||||
PanelSubjectExample example = new PanelSubjectExample();
|
||||
example.createCriteria().andNameEqualTo(request.getName()).andIdNotEqualTo(request.getId());
|
||||
List<PanelSubject> subjectAll = panelSubjectMapper.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(subjectAll)){
|
||||
request.setUpdateTime(System.currentTimeMillis());
|
||||
panelSubjectMapper.updateByPrimaryKeySelective(request);
|
||||
}else{
|
||||
DataEaseException.throwException("名称已经存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ export default {
|
||||
matrix: 'matrix',
|
||||
suspension: 'suspension',
|
||||
subject_no_edit: 'System Subject Can Not Edit',
|
||||
subject_name_not_null: 'Subject Name Can Not Be Null'
|
||||
subject_name_not_null: 'Subject Name Can Not Be Null And Less Than 20 charts'
|
||||
},
|
||||
plugin: {
|
||||
local_install: 'Local installation',
|
||||
|
@ -1318,7 +1318,7 @@ export default {
|
||||
matrix: '矩阵分布',
|
||||
suspension: '悬浮',
|
||||
subject_no_edit: '系统主题不能修改',
|
||||
subject_name_not_null: '主题名称不能为空'
|
||||
subject_name_not_null: '主题名称需要1~20字符'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安裝',
|
||||
|
@ -1323,7 +1323,7 @@ export default {
|
||||
matrix: '矩阵分布',
|
||||
suspension: '悬浮',
|
||||
subject_no_edit: '系统主题不能修改',
|
||||
subject_name_not_null: '主题名称不能为空'
|
||||
subject_name_not_null: '主题名称需要1~20字符'
|
||||
},
|
||||
plugin: {
|
||||
local_install: '本地安装',
|
||||
|
@ -222,7 +222,7 @@ export default {
|
||||
},
|
||||
// 当输入框失去焦点时不显示输入框
|
||||
loseFocus() {
|
||||
if (this.subjectItem.name && this.subjectItem.name.length > 0) {
|
||||
if (this.subjectItem.name && this.subjectItem.name.length > 0 && this.subjectItem.name.length < 20) {
|
||||
const request = {
|
||||
id: this.subjectItem.id,
|
||||
name: this.subjectItem.name
|
||||
|
Loading…
Reference in New Issue
Block a user