forked from github/dataease
Merge branch 'main' of github.com:dataease/dataease into main
This commit is contained in:
commit
cc2abfa06f
@ -0,0 +1,40 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
* Date: 2021-05-25
|
||||
* Description:
|
||||
*/
|
||||
public class CommonConstants {
|
||||
|
||||
|
||||
//操作类型
|
||||
public static final class OPT_TYPE{
|
||||
|
||||
public static final String INSERT = "insert";
|
||||
|
||||
public static final String UPDATE = "update";
|
||||
|
||||
public static final String DELETE = "delete";
|
||||
|
||||
public static final String SELECT = "select";
|
||||
|
||||
}
|
||||
|
||||
//操作类型
|
||||
public static final class CHECK_RESULT{
|
||||
|
||||
// 不存在
|
||||
public static final String NONE = "none";
|
||||
|
||||
// 全局存在
|
||||
public static final String EXIST_ALL= "exist_all";
|
||||
|
||||
// 当前用户存在
|
||||
public static final String EXIST_USER= "exist_user";
|
||||
|
||||
// 其他用户存在
|
||||
public static final String EXIST_OTHER= "exist_other";
|
||||
|
||||
}
|
||||
}
|
@ -7,14 +7,11 @@ package io.dataease.commons.constants;
|
||||
*/
|
||||
public class SystemConstants {
|
||||
|
||||
public final static String WITH_EXTEND_NOW = "now";
|
||||
public final static String WITH_EXTEND_PARENT = "parent";
|
||||
public final static String WITH_EXTEND_CHILDREN = "children";
|
||||
|
||||
|
||||
public final static int PRIVILEGE_VALUE_ON= 1;
|
||||
public final static int PRIVILEGE_VALUE_OFF = 0;
|
||||
|
||||
public static final class WITH_EXTEND{
|
||||
public final static String NOW = "now";
|
||||
public final static String PARENT = "parent";
|
||||
public final static String CHILDREN = "children";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -49,4 +49,10 @@ public class PanelTemplateController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/nameCheck")
|
||||
public String nameCheck(@RequestBody PanelTemplateRequest request) {
|
||||
return panelTemplateService.nameCheck(request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class BaseTreeRequest {
|
||||
private String pid;
|
||||
|
||||
//now 返回当前条件查询的数据 parent 返回当前数据查询的数据同时递归父节点数据; children 返回当前数据查询的数据同时递归子节点数据
|
||||
private String withExtend= SystemConstants.WITH_EXTEND_NOW;
|
||||
private String withExtend= SystemConstants.WITH_EXTEND.NOW;
|
||||
|
||||
private String createBy;
|
||||
|
||||
|
@ -12,6 +12,8 @@ import lombok.Data;
|
||||
public class PanelTemplateRequest extends PanelTemplateWithBLOBs {
|
||||
private String sort;
|
||||
|
||||
private String optType;
|
||||
|
||||
private Boolean withChildren = false;
|
||||
|
||||
public PanelTemplateRequest() {
|
||||
|
@ -3,15 +3,20 @@ package io.dataease.service.panel;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.PanelTemplateMapper;
|
||||
import io.dataease.base.mapper.ext.ExtPanelTemplateMapper;
|
||||
import io.dataease.commons.constants.CommonConstants;
|
||||
import io.dataease.commons.constants.PanelConstants;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.controller.request.panel.PanelTemplateRequest;
|
||||
import io.dataease.dto.panel.PanelTemplateDTO;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@ -54,16 +59,30 @@ public class PanelTemplateService {
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public PanelTemplateDTO save(PanelTemplateRequest request) {
|
||||
if (StringUtils.isEmpty(request.getId())) {
|
||||
//如果level 是0(第一级)设置父级为对应的templateType
|
||||
if(request.getLevel()==0){
|
||||
request.setPid(request.getTemplateType());
|
||||
}
|
||||
request.setId(UUID.randomUUID().toString());
|
||||
request.setCreateTime(System.currentTimeMillis());
|
||||
request.setCreateBy(AuthUtils.getUser().getUsername());
|
||||
//如果level 是0(第一级)指的是分类目录 设置父级为对应的templateType
|
||||
if(request.getLevel()==0){
|
||||
request.setPid(request.getTemplateType());
|
||||
String nameCheckResult = this.nameCheck(CommonConstants.OPT_TYPE.INSERT,request.getName(),request.getPid(),null);
|
||||
if(CommonConstants.CHECK_RESULT.EXIST_ALL.equals(nameCheckResult)){
|
||||
throw new RuntimeException(Translator.get("i18n_same_folder_can_not_repeat"));
|
||||
}
|
||||
}else{//模板插入 相同文件夹同名的模板进行覆盖(先删除)
|
||||
PanelTemplateExample exampleDelete = new PanelTemplateExample();
|
||||
exampleDelete.createCriteria().andPidEqualTo(request.getPid()).andNameEqualTo(request.getName());
|
||||
panelTemplateMapper.deleteByExample(exampleDelete);
|
||||
}
|
||||
panelTemplateMapper.insert(request);
|
||||
} else {
|
||||
String nameCheckResult = this.nameCheck(CommonConstants.OPT_TYPE.UPDATE,request.getName(),request.getPid(),request.getId());
|
||||
if(CommonConstants.CHECK_RESULT.EXIST_ALL.equals(nameCheckResult)){
|
||||
throw new RuntimeException(Translator.get("i18n_same_folder_can_not_repeat"));
|
||||
}
|
||||
panelTemplateMapper.updateByPrimaryKeySelective(request);
|
||||
}
|
||||
PanelTemplateDTO panelTemplateDTO = new PanelTemplateDTO();
|
||||
@ -73,6 +92,29 @@ public class PanelTemplateService {
|
||||
}
|
||||
|
||||
|
||||
//名称检查
|
||||
public String nameCheck(String optType,String name,String pid,String id){
|
||||
PanelTemplateExample example = new PanelTemplateExample();
|
||||
if(CommonConstants.OPT_TYPE.INSERT.equals(optType)){
|
||||
example.createCriteria().andPidEqualTo(pid).andNameEqualTo(name);
|
||||
|
||||
}else if(CommonConstants.OPT_TYPE.UPDATE.equals(optType)){
|
||||
example.createCriteria().andPidEqualTo(pid).andNameEqualTo(name).andIdNotEqualTo(id);
|
||||
}
|
||||
List<PanelTemplate> panelTemplates = panelTemplateMapper.selectByExample(example);
|
||||
if(CollectionUtils.isEmpty(panelTemplates)){
|
||||
return CommonConstants.CHECK_RESULT.NONE;
|
||||
}else{
|
||||
return CommonConstants.CHECK_RESULT.EXIST_ALL;
|
||||
}
|
||||
}
|
||||
|
||||
public String nameCheck(PanelTemplateRequest request){
|
||||
return nameCheck(request.getOptType(),request.getName(),request.getPid(),request.getId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void delete(String id){
|
||||
Assert.notNull(id, "id cannot be null");
|
||||
panelTemplateMapper.deleteByPrimaryKey(id);
|
||||
|
@ -103,7 +103,7 @@ public class SysAuthService {
|
||||
}
|
||||
|
||||
private List<String> getAuthModels(String id, String type) {
|
||||
List<VAuthModelDTO> vAuthModelDTOS = searchAuthModelTree(new BaseTreeRequest(id,type, SystemConstants.WITH_EXTEND_CHILDREN));
|
||||
List<VAuthModelDTO> vAuthModelDTOS = searchAuthModelTree(new BaseTreeRequest(id,type, SystemConstants.WITH_EXTEND.CHILDREN));
|
||||
List<String> authSources = Optional.ofNullable(vAuthModelDTOS).orElse(new ArrayList<>()).stream().map(VAuthModelDTO::getId)
|
||||
.collect(Collectors.toList());
|
||||
return authSources;
|
||||
|
@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -48,7 +49,7 @@ public class SysUserService {
|
||||
private ExtSysUserMapper extSysUserMapper;
|
||||
|
||||
|
||||
public List<SysUserGridResponse> query(BaseGridRequest request){
|
||||
public List<SysUserGridResponse> query(BaseGridRequest request) {
|
||||
GridExample gridExample = request.convertExample();
|
||||
List<SysUserGridResponse> lists = extSysUserMapper.query(gridExample);
|
||||
lists.forEach(item -> {
|
||||
@ -60,18 +61,18 @@ public class SysUserService {
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int save(SysUserCreateRequest request){
|
||||
public int save(SysUserCreateRequest request) {
|
||||
SysUser user = BeanUtils.copyBean(new SysUser(), request);
|
||||
long now = System.currentTimeMillis();
|
||||
user.setCreateTime(now);
|
||||
user.setUpdateTime(now);
|
||||
user.setIsAdmin(false);
|
||||
if (ObjectUtils.isEmpty(user.getPassword()) || StringUtils.equals(user.getPassword(), DEFAULT_PWD)){
|
||||
if (ObjectUtils.isEmpty(user.getPassword()) || StringUtils.equals(user.getPassword(), DEFAULT_PWD)) {
|
||||
user.setPassword(CodingUtil.md5(DEFAULT_PWD));
|
||||
}else{
|
||||
} else {
|
||||
user.setPassword(CodingUtil.md5(user.getPassword()));
|
||||
}
|
||||
if(StringUtils.isEmpty(user.getLanguage())){
|
||||
if (StringUtils.isEmpty(user.getLanguage())) {
|
||||
user.setLanguage("zh_CN");
|
||||
}
|
||||
int insert = sysUserMapper.insert(user);
|
||||
@ -82,29 +83,33 @@ public class SysUserService {
|
||||
|
||||
/**
|
||||
* 修改用户密码清楚缓存
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@Transactional
|
||||
public int update(SysUserCreateRequest request){
|
||||
public int update(SysUserCreateRequest request) {
|
||||
if (StringUtils.isEmpty(request.getPassword())) {
|
||||
request.setPassword(null);
|
||||
}
|
||||
SysUser user = BeanUtils.copyBean(new SysUser(), request);
|
||||
long now = System.currentTimeMillis();
|
||||
user.setUpdateTime(now);
|
||||
deleteUserRoles(user.getUserId());//先删除用户角色关联
|
||||
saveUserRoles(user.getUserId(), request.getRoleIds());//再插入角色关联
|
||||
return sysUserMapper.updateByPrimaryKey(user);
|
||||
|
||||
return sysUserMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改个人信息
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@Transactional
|
||||
public int updatePersonInfo(SysUserCreateRequest request){
|
||||
public int updatePersonInfo(SysUserCreateRequest request) {
|
||||
SysUser user = BeanUtils.copyBean(new SysUser(), request);
|
||||
long now = System.currentTimeMillis();
|
||||
user.setUpdateTime(now);
|
||||
@ -114,7 +119,7 @@ public class SysUserService {
|
||||
|
||||
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
public int updateStatus(SysUserStateRequest request){
|
||||
public int updateStatus(SysUserStateRequest request) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(request.getUserId());
|
||||
sysUser.setEnabled(request.getEnabled());
|
||||
@ -123,6 +128,7 @@ public class SysUserService {
|
||||
|
||||
/**
|
||||
* 修改用户密码清楚缓存
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ -133,7 +139,7 @@ public class SysUserService {
|
||||
if (ObjectUtils.isEmpty(user)) {
|
||||
throw new RuntimeException("用户不存在");
|
||||
}
|
||||
if (!StringUtils.equals(CodingUtil.md5(request.getPassword()), user.getPassword())){
|
||||
if (!StringUtils.equals(CodingUtil.md5(request.getPassword()), user.getPassword())) {
|
||||
throw new RuntimeException("密码错误");
|
||||
}
|
||||
SysUser sysUser = new SysUser();
|
||||
@ -143,7 +149,7 @@ public class SysUserService {
|
||||
}
|
||||
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
public int adminUpdatePwd(SysUserPwdRequest request){
|
||||
public int adminUpdatePwd(SysUserPwdRequest request) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(request.getUserId());
|
||||
sysUser.setPassword(CodingUtil.md5(request.getNewPassword()));
|
||||
@ -151,13 +157,13 @@ public class SysUserService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户角色关联
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
private int deleteUserRoles(Long userId){
|
||||
private int deleteUserRoles(Long userId) {
|
||||
SysUsersRolesExample example = new SysUsersRolesExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId);
|
||||
return sysUsersRolesMapper.deleteByExample(example);
|
||||
@ -165,10 +171,11 @@ public class SysUserService {
|
||||
|
||||
/**
|
||||
* 保存用户角色关联
|
||||
*
|
||||
* @param userId
|
||||
* @param roleIds
|
||||
*/
|
||||
private void saveUserRoles(Long userId, List<Long> roleIds){
|
||||
private void saveUserRoles(Long userId, List<Long> roleIds) {
|
||||
roleIds.forEach(roleId -> {
|
||||
SysUsersRolesKey sysUsersRolesKey = new SysUsersRolesKey();
|
||||
sysUsersRolesKey.setUserId(userId);
|
||||
@ -179,33 +186,33 @@ public class SysUserService {
|
||||
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId")
|
||||
@Transactional
|
||||
public int delete(Long userId){
|
||||
public int delete(Long userId) {
|
||||
deleteUserRoles(userId);
|
||||
return sysUserMapper.deleteByPrimaryKey(userId);
|
||||
}
|
||||
|
||||
public SysUser findOne(SysUser user){
|
||||
public SysUser findOne(SysUser user) {
|
||||
if (ObjectUtils.isEmpty(user)) return null;
|
||||
if (ObjectUtils.isNotEmpty(user.getUserId())){
|
||||
if (ObjectUtils.isNotEmpty(user.getUserId())) {
|
||||
return sysUserMapper.selectByPrimaryKey(user.getUserId());
|
||||
}
|
||||
SysUserExample example = new SysUserExample();
|
||||
SysUserExample.Criteria criteria = example.createCriteria();
|
||||
if (ObjectUtils.isNotEmpty(user.getUsername())){
|
||||
if (ObjectUtils.isNotEmpty(user.getUsername())) {
|
||||
criteria.andUsernameEqualTo(user.getUsername());
|
||||
List<SysUser> sysUsers = sysUserMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(sysUsers))return sysUsers.get(0);
|
||||
if (CollectionUtils.isNotEmpty(sysUsers)) return sysUsers.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public List<SysUser> users(List<Long> userIds){
|
||||
public List<SysUser> users(List<Long> userIds) {
|
||||
return userIds.stream().map(sysUserMapper::selectByPrimaryKey).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId")
|
||||
public void setLanguage(Long userId,String language) {
|
||||
public void setLanguage(Long userId, String language) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(userId);
|
||||
sysUser.setLanguage(language);
|
||||
|
@ -36,3 +36,11 @@ export function find(data) {
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
export function nameCheck(data) {
|
||||
return request({
|
||||
url: '/template/nameCheck',
|
||||
data: data,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ export default {
|
||||
button: 'Button',
|
||||
man: 'Man',
|
||||
woman: 'Woman',
|
||||
nick_name: 'Nick Name',
|
||||
nick_name: 'Name',
|
||||
confirmPassword: 'Confirm Password',
|
||||
upload: 'Upload',
|
||||
cover: 'Cover',
|
||||
not_cover: 'Not Cover',
|
||||
@ -934,7 +935,7 @@ export default {
|
||||
role: 'Role',
|
||||
user: 'User',
|
||||
linkAuth: 'Datasource Permissions',
|
||||
datasetAuth: 'Data Permissions',
|
||||
datasetAuth: 'Dataset Permissions',
|
||||
chartAuth: 'Chart Permissions',
|
||||
panelAuth: 'Panel Permissions',
|
||||
deptHead: 'All Dept',
|
||||
@ -962,5 +963,11 @@ export default {
|
||||
enterprise: 'Enterprise',
|
||||
suport: 'Get technical support',
|
||||
update_success: 'Update Success'
|
||||
},
|
||||
template: {
|
||||
exit_same_template_check: 'The Same Name Exists In Now Class. Do You Want To Override It?',
|
||||
override: 'Override',
|
||||
cancel: '取消',
|
||||
confirm_upload: 'Upload Confirm'
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,8 @@ export default {
|
||||
gender: '性別',
|
||||
man: '男',
|
||||
woman: '女',
|
||||
nick_name: '暱稱',
|
||||
nick_name: '姓名',
|
||||
confirmPassword: '確認密碼',
|
||||
upload: '上傳',
|
||||
cover: '覆蓋',
|
||||
not_cover: '不覆蓋',
|
||||
@ -929,14 +930,14 @@ export default {
|
||||
auth: {
|
||||
authConfig: '權限配置',
|
||||
authQuickConfig: '權限快捷配置',
|
||||
dept: '部門',
|
||||
dept: '组织',
|
||||
role: '角色',
|
||||
user: '用戶',
|
||||
linkAuth: '數據源權限',
|
||||
datasetAuth: '數據權限',
|
||||
datasetAuth: '數據集權限',
|
||||
chartAuth: '視圖權限',
|
||||
panelAuth: '儀表盤權限',
|
||||
deptHead: '所有部門',
|
||||
deptHead: '所有组织',
|
||||
roleHead: '所有角色',
|
||||
userHead: '所有用戶',
|
||||
linkAuthHead: '所有數據源',
|
||||
@ -961,5 +962,12 @@ export default {
|
||||
enterprise: '企業版',
|
||||
suport: '獲取技術支持',
|
||||
update_success: '更新成功'
|
||||
},
|
||||
template: {
|
||||
exit_same_template_check: '当前存在相同名称模板,是否覆盖?',
|
||||
override: '覆盖',
|
||||
cancel: '取消',
|
||||
confirm_upload: '上传确认'
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -100,7 +100,8 @@ export default {
|
||||
gender: '性别',
|
||||
man: '男',
|
||||
woman: '女',
|
||||
nick_name: '昵称',
|
||||
nick_name: '姓名',
|
||||
confirmPassword: '确认密码',
|
||||
upload: '上传',
|
||||
cover: '覆盖',
|
||||
not_cover: '不覆盖',
|
||||
@ -402,7 +403,7 @@ export default {
|
||||
special_characters_are_not_supported: '不支持特殊字符',
|
||||
mobile_number_format_is_incorrect: '手机号码格式不正确',
|
||||
email_format_is_incorrect: '邮箱格式不正确',
|
||||
password_format_is_incorrect: '有效密码:6-30位,英文大小写字母+数字+特殊字符(可选)',
|
||||
password_format_is_incorrect: '有效密码:8-30位,英文大小写字母+数字+特殊字符(可选)',
|
||||
old_password: '旧密码',
|
||||
new_password: '新密码',
|
||||
repeat_password: '确认密码',
|
||||
@ -932,14 +933,14 @@ export default {
|
||||
auth: {
|
||||
authConfig: '权限配置',
|
||||
authQuickConfig: '权限快捷配置',
|
||||
dept: '部门',
|
||||
dept: '组织',
|
||||
role: '角色',
|
||||
user: '用户',
|
||||
linkAuth: '数据源权限',
|
||||
datasetAuth: '数据权限',
|
||||
datasetAuth: '数据集权限',
|
||||
chartAuth: '视图权限',
|
||||
panelAuth: '仪表盘权限',
|
||||
deptHead: '所有部门',
|
||||
deptHead: '所有组织',
|
||||
roleHead: '所有角色',
|
||||
userHead: '所有用户',
|
||||
linkAuthHead: '所有数据源',
|
||||
@ -964,5 +965,11 @@ export default {
|
||||
enterprise: '企业版',
|
||||
suport: '获取技术支持',
|
||||
update_success: '更新成功'
|
||||
},
|
||||
template: {
|
||||
exit_same_template_check: '当前分类存在相同名称模板,是否覆盖?',
|
||||
override: '覆盖',
|
||||
cancel: '取消',
|
||||
confirm_upload: '上传确认'
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa">
|
||||
<de-main-container>
|
||||
<panel-main v-show="componentName==='PanelMain'" />
|
||||
<chart-edit v-if="componentName==='ChartEdit'" />
|
||||
<chart-edit v-if="componentName==='ChartEdit'" :param="param" />
|
||||
<panel-edit v-if="componentName==='PanelEdit'" />
|
||||
<!-- <component :is="component" :param="param" />-->
|
||||
</de-main-container>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</el-tabs>
|
||||
</de-aside-container>
|
||||
<de-main-container>
|
||||
<PanelViewShow />
|
||||
<PanelViewShow v-if="mainActiveName==='PanelMain'" />
|
||||
</de-main-container>
|
||||
</de-container>
|
||||
</template>
|
||||
@ -41,6 +41,14 @@ export default {
|
||||
showEnshrine: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
mainActiveName() {
|
||||
return this.$store.state.panel.mainActiveName
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('panel/setMainActiveName', 'PanelMain')
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
// 点击分析面板需要刷新分享内容
|
||||
|
@ -40,7 +40,7 @@
|
||||
<!--TODO 仪表盘预览区域-->
|
||||
<el-row class="panel-design-preview">
|
||||
<div ref="imageWrapper" style="width: 100%;height: 100%">
|
||||
<Preview v-if="mainActiveName==='PanelMain'&&showMain" />
|
||||
<Preview v-if="showMain" />
|
||||
</div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
@ -74,7 +74,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
showMain: true,
|
||||
templateInfo: '',
|
||||
templateInfo: {},
|
||||
templateSaveTitle: '保存为模板',
|
||||
templateSaveShow: false,
|
||||
hasStar: false
|
||||
@ -84,9 +84,6 @@ export default {
|
||||
panelInfo() {
|
||||
return this.$store.state.panel.panelInfo
|
||||
},
|
||||
mainActiveName() {
|
||||
return this.$store.state.panel.mainActiveName
|
||||
},
|
||||
...mapState([
|
||||
'componentData',
|
||||
'canvasStyleData'
|
||||
@ -146,7 +143,7 @@ export default {
|
||||
})
|
||||
},
|
||||
refreshTemplateInfo() {
|
||||
this.templateInfo = ''
|
||||
this.templateInfo = {}
|
||||
html2canvas(this.$refs.imageWrapper).then(canvas => {
|
||||
const snapshot = canvas.toDataURL('image/jpeg', 0.2) // 0.2是图片质量
|
||||
if (snapshot !== '') {
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-row>
|
||||
<el-col :span="4"> {{ $t('panel.template_nale')}}</el-col>
|
||||
<el-col :span="4"> {{ $t('panel.template_nale') }}</el-col>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="templateInfo.name" clearable size="mini" />
|
||||
</el-col>
|
||||
@ -26,21 +26,20 @@
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row class="root-class">
|
||||
<el-button @click="cancel()">{{ $t('commons.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="save()">{{ $t('commons.save')}}</el-button>
|
||||
<el-button @click="cancel()">{{ $t('commons.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="save()">{{ $t('commons.save') }}</el-button>
|
||||
</el-row>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { post } from '@/api/panel/panel'
|
||||
import { save, nameCheck, showTemplateList } from '@/api/system/template'
|
||||
|
||||
export default {
|
||||
name: 'SaveToTemplate',
|
||||
props: {
|
||||
templateInfo: {
|
||||
type: Object,
|
||||
require: true
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -61,7 +60,7 @@ export default {
|
||||
templateType: 'self',
|
||||
level: '0'
|
||||
}
|
||||
post('/template/templateList', param).then(response => {
|
||||
showTemplateList(param).then(response => {
|
||||
this.data = response.data
|
||||
})
|
||||
},
|
||||
@ -81,13 +80,41 @@ export default {
|
||||
this.$warning(this.$t('panel.template_name_cannot_be_empty'))
|
||||
return false
|
||||
}
|
||||
post('/template/save', this.templateInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
this.$emit('closeSaveDialog')
|
||||
|
||||
const nameCheckRequest = {
|
||||
pid: this.templateInfo.pid,
|
||||
name: this.templateInfo.name,
|
||||
optType: 'insert'
|
||||
}
|
||||
nameCheck(nameCheckRequest).then(response => {
|
||||
if (response.data.indexOf('exist') > -1) {
|
||||
this.$confirm(this.$t('template.exit_same_template_check'), this.$t('template.confirm_upload'), {
|
||||
confirmButtonText: this.$t('template.override'),
|
||||
cancelButtonText: this.$t('template.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
save(this.templateInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
debugger
|
||||
this.$emit('closeSaveDialog')
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
} else {
|
||||
save(this.templateInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
debugger
|
||||
this.$emit('closeSaveDialog')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { save } from '@/api/system/template'
|
||||
import { save, nameCheck } from '@/api/system/template'
|
||||
|
||||
export default {
|
||||
|
||||
@ -70,14 +70,40 @@ export default {
|
||||
this.$warning(this.$t('chart.name_can_not_empty'))
|
||||
return false
|
||||
}
|
||||
save(this.templateInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
debugger
|
||||
this.$emit('closeEditTemplateDialog')
|
||||
const nameCheckRequest = {
|
||||
pid: this.templateInfo.pid,
|
||||
name: this.templateInfo.name,
|
||||
optType: 'insert'
|
||||
}
|
||||
nameCheck(nameCheckRequest).then(response => {
|
||||
if (response.data.indexOf('exist') > -1) {
|
||||
this.$confirm(this.$t('template.exit_same_template_check'), this.$t('template.confirm_upload'), {
|
||||
confirmButtonText: this.$t('template.override'),
|
||||
cancelButtonText: this.$t('template.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
save(this.templateInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
debugger
|
||||
this.$emit('closeEditTemplateDialog')
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
} else {
|
||||
save(this.templateInfo).then(response => {
|
||||
this.$message({
|
||||
message: this.$t('commons.save_success'),
|
||||
type: 'success',
|
||||
showClose: true
|
||||
})
|
||||
debugger
|
||||
this.$emit('closeEditTemplateDialog')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleFileChange(e) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
@templateEdit="templateEdit"
|
||||
@showCurrentTemplate="showCurrentTemplate"
|
||||
@templateImport="templateImport"
|
||||
@showTemplateEditDialog="showTemplateEditDialog"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="self">
|
||||
@ -25,6 +26,7 @@
|
||||
@templateEdit="templateEdit"
|
||||
@showCurrentTemplate="showCurrentTemplate"
|
||||
@templateImport="templateImport"
|
||||
@showTemplateEditDialog="showTemplateEditDialog"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<layout-content :header="formType=='add' ? $t('user.create') : $t('user.modify')" back-name="system-user">
|
||||
<el-form ref="createUserForm" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
|
||||
<el-form-item :label="$t('commons.name')" prop="username">
|
||||
<el-form-item label="ID" prop="username">
|
||||
<el-input v-model="form.username" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||
@ -13,6 +13,12 @@
|
||||
<el-form-item :label="$t('commons.email')" prop="email">
|
||||
<el-input v-model="form.email" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formType !== 'modify'" :label="$t('commons.password')" prop="password">
|
||||
<el-input v-model="form.password" autocomplete="off" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formType !== 'modify'" :label="$t('commons.confirmPassword')" prop="confirmPassword">
|
||||
<el-input v-model="form.confirmPassword" autocomplete="off" show-password />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('commons.gender')">
|
||||
<el-radio-group v-model="form.gender" style="width: 178px">
|
||||
@ -127,6 +133,10 @@ export default {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
{ required: true, validator: this.repeatValidator, trigger: 'blur' }
|
||||
],
|
||||
newPassword: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
{
|
||||
@ -158,6 +168,13 @@ export default {
|
||||
this.initRoles()
|
||||
},
|
||||
methods: {
|
||||
repeatValidator(rule, value, callback) {
|
||||
if (value !== this.form.password) {
|
||||
callback(new Error(this.$t('member.inconsistent_passwords')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.depts = null
|
||||
this.formType = 'add'
|
||||
@ -169,6 +186,7 @@ export default {
|
||||
this.formType = 'modify'
|
||||
this.dialogVisible = true
|
||||
this.form = Object.assign({}, row)
|
||||
this.form.password = ''
|
||||
if (this.form.deptId === 0) {
|
||||
this.form.deptId = null
|
||||
}
|
||||
|
@ -125,7 +125,7 @@
|
||||
:rules="rule"
|
||||
class="demo-ruleForm"
|
||||
>
|
||||
<el-form-item :label="$t('member.new_password')" prop="newpassword">
|
||||
<el-form-item :label="$t('member.new_password')" prop="newPassword">
|
||||
<el-input v-model="ruleForm.newPassword" type="password" autocomplete="off" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
@ -37,7 +37,13 @@ export default {
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' }
|
||||
],
|
||||
newPwd: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' }
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
|
||||
message: this.$t('member.password_format_is_incorrect'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
repeatPwd: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
|
@ -2,7 +2,7 @@
|
||||
<layout-content header="个人信息">
|
||||
<div>
|
||||
<el-form ref="createUserForm" :disabled="formType !== 'modify'" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
|
||||
<el-form-item :label="$t('commons.user')" prop="username">
|
||||
<el-form-item label="ID" prop="username">
|
||||
<el-input v-model="form.username" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||
|
Loading…
Reference in New Issue
Block a user