Commit e28c882f authored by 廖旭伟's avatar 廖旭伟

Merge remote-tracking branch 'origin/master'

parents 68dedd4d 3c413d6a
......@@ -194,10 +194,11 @@ export default {
.preview-btn {
border-top: 1px solid #ccc;
height: 100px;
padding: 0px 10px;
display: flex;
flex-direction: column;
justify-content: center;
flex-shrink: 0;
}
}
</style>
\ No newline at end of file
</style>
......@@ -429,8 +429,8 @@ export default {
if (code === 1) {
this.formData.previewImagePath = res.data.url;
let result = await skinSave({
...this.curProduct,
...this.formData,
...this.curProduct,
});
let { code, msg } = result.data;
if (code === 1) {
......
......@@ -9,7 +9,9 @@
package com.mortals.xhx.base.system.resource.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
......@@ -31,7 +33,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @throws AppException
*/
public List<ResourceEntity> findAllEnable() throws AppException;
List<ResourceEntity> findAllEnable() throws AppException;
/**
* 根据用户查询可用资源
......@@ -39,7 +41,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @throws AppException
*/
public List<ResourceEntity> findListByUserId(Long userId) throws AppException;
List<ResourceEntity> findListByUserId(Long userId) throws AppException;
/**
* 查询用户可用资源
......@@ -47,7 +49,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return 字符串,多个以逗号分隔
* @throws AppException
*/
public String findUrlByUserId(Long userId) throws AppException;
String findUrlByUserId(Long userId) throws AppException;
/**
* 查询用户用资源集合
......@@ -55,7 +57,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return
* @throws AppException
*/
public Set<String> findUrlSetByUserId(Long userId) throws AppException;
Set<String> findUrlSetByUserId(Long userId) throws AppException;
/**
* 获取所有资源,不分页
......@@ -63,5 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @param userType
*/
List<ResourceEntity> findAll(int userType);
Rest<String> refreshResourceUrl(String packageName, Context context);
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
package com.mortals.xhx.base.system.resource.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
......@@ -18,19 +19,17 @@ import com.mortals.xhx.base.system.resource.dao.ResourceDao;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.model.ResourceQuery;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.model.RoleAuthEntity;
import com.mortals.xhx.base.system.role.model.RoleAuthQuery;
import com.mortals.xhx.base.system.role.service.RoleAuthService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.ControllerScanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode;
......@@ -39,6 +38,7 @@ import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode;
* <p>Description: ResourceServiceImpl service接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
*
* @author
* @version 1.0.0
*/
......@@ -88,6 +88,74 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
return dao.getAll(userType);
}
@Override
public Rest<String> refreshResourceUrl(String packageName, Context context) {
List<Class<?>> classList = ControllerScanUtil.getAllClassByPackageName(packageName);
//System.out.println(classList); //获取到了所有的类
List<ResourceEntity> newResourcelist = ControllerScanUtil.getAnnotationInfo(classList).stream().filter(f->!ObjectUtils.isEmpty(f.getUrl())).collect(Collectors.toList());
Map<String, List<ResourceEntity>> localResourceMap = this.find(new ResourceQuery()).stream().collect(Collectors.groupingBy(x -> x.getName()));
Map<String, List<ResourceEntity>> newResourceMap = newResourcelist.stream().collect(Collectors.groupingBy(x -> x.getName()));
//更新 与新增 新加的;
newResourceMap.entrySet().forEach(item -> {
List<ResourceEntity> resourceEntities = item.getValue();
if (ObjectUtils.isEmpty(resourceEntities)) return;
if (resourceEntities.size() == 1) {
ResourceEntity resourceEntity = resourceEntities.get(0);
saveUpdateResourceEntity(context, localResourceMap, resourceEntity);
} else if (resourceEntities.size() > 1) {
//原始扫描 有多个资源列表针对一个名称的
for (ResourceEntity resourceEntity : resourceEntities) {
saveUpdateResourceEntity(context, localResourceMap, resourceEntity);
}
}
});
return Rest.ok();
}
private void saveUpdateResourceEntity(Context context, Map<String, List<ResourceEntity>> localResourceMap, ResourceEntity resourceEntity) {
//查找 本地是否已经存在了
List<ResourceEntity> tempResourceList = localResourceMap.getOrDefault(resourceEntity.getName(), new ArrayList<>());
if (tempResourceList.size() == 0) {
//新增 resource;
resourceEntity.setCreateUserId(this.getContextUserId(context));
resourceEntity.setCreateTime(new Date());
this.save(resourceEntity, context);
} else if (tempResourceList.size() == 1) {
//更新
ResourceEntity tempResource = tempResourceList.get(0);
Set<String> setUrl = Arrays.stream(resourceEntity.getUrl().split(",")).collect(Collectors.toSet());
Arrays.stream(tempResource.getUrl().split(",")).forEach(i -> {
setUrl.add(i);
});
tempResource.setUrl(setUrl.stream().collect(Collectors.joining(",")));
this.update(tempResource, context);
} else if (tempResourceList.size() > 1) {
//找到多个同名的 资源配置
for (ResourceEntity tempResource : tempResourceList) {
//模糊匹配到路径有一个存在的
Set<String> setUrl = Arrays.stream(resourceEntity.getUrl().split(",")).collect(Collectors.toSet());
String[] splitUrl = tempResource.getUrl().split(",");
Boolean bool = false;
for (int i = 0; i < splitUrl.length; i++) {
if (setUrl.contains(splitUrl[i])) {
bool = true;
break;
}
}
if (bool) {
//匹配到了,更新当前这个资源
Arrays.stream(tempResource.getUrl().split(",")).forEach(i -> {
setUrl.add(i);
});
tempResource.setUrl(setUrl.stream().collect(Collectors.joining(",")));
this.update(tempResource, context);
}
}
}
}
@Override
protected void updateAfter(ResourceEntity entity, Context context) throws AppException {
......
package com.mortals.xhx.base.system.resource.web;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.common.code.AuthType;
import com.mortals.xhx.common.code.SourceType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.common.code.AuthType;
import com.mortals.xhx.common.code.SourceType;
import java.util.HashMap;
import java.util.Map;
/**
* 资源信息
......@@ -32,37 +31,63 @@ import com.mortals.xhx.common.code.SourceType;
@Slf4j
@RestController
@RequestMapping("resource")
public class ResourceController extends BaseCRUDJsonBodyMappingController<ResourceService,ResourceEntity,Long> {
public class ResourceController extends BaseCRUDJsonBodyMappingController<ResourceService, ResourceEntity, Long> {
public ResourceController() {
super.setModuleDesc("资源信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
Map<String, Object> statsus = new HashMap<String, Object>();
statsus.put("authType", AuthType.getEnumMap());
statsus.put("sourceType", SourceType.getEnumMap());
if (getCurUser().isAdmin()) {
statsus.put("userType", IBaseEnum.getEnumMap(UserType.class));
} else {
statsus.put("userType", UserType.findByValue(getCurUser().getUserType()));
}
model.put(KEY_RESULT_DICT, statsus);
}
/**
* 获取所有资源
*
* @return
*/
@PostMapping("allResources")
public String allResources(int userType) {
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "所有的customer以及user");
ret.put(KEY_RESULT_DATA, service.findAll(userType));
return ret.toJSONString();
}
@Override
protected void doListBefore(ResourceEntity query, Map<String, Object> model, Context context) throws AppException {
public ResourceController(){
super.setModuleDesc("资源信息");
}
super.doListBefore(query, model, context);
}
@Override
protected void init(Map<String, Object> model, Context context) {
Map<String, Object> statsus = new HashMap<String, Object>();
statsus.put("authType", AuthType.getEnumMap());
statsus.put("sourceType", SourceType.getEnumMap());
if (getCurUser().isAdmin()) {
statsus.put("userType", IBaseEnum.getEnumMap(UserType.class));
} else {
statsus.put("userType", UserType.findByValue(getCurUser().getUserType()));
}
model.put(KEY_RESULT_DICT, statsus);
}
/**
* 资源路径刷新
*/
@PostMapping(value = "refreshUrl")
@UnAuth
public Rest<String> refreshUrl(@RequestParam(name = "packageName", defaultValue = "com.mortals.xhx") String packageName) {
log.info("刷新资源路径,packageName", packageName);
String busiDesc = this.getModuleDesc() + "资源路径刷新";
Rest<String> rest = Rest.ok(busiDesc + " 【成功】");
try {
this.service.refreshResourceUrl(packageName, getContext());
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 获取所有资源
*
* @return
*/
@PostMapping("allResources")
public String allResources(int userType) {
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "所有的customer以及user");
ret.put(KEY_RESULT_DATA, service.findAll(userType));
return ret.toJSONString();
}
}
\ No newline at end of file
package com.mortals.xhx.base.system.user.model;
package com.mortals.xhx.base.system.user.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.model.model.ModelEntity;
......@@ -7,15 +8,20 @@ import lombok.Data;
import java.util.List;
/**
* Description:User
* date: 2021-9-26 16:11:48
* 用户信息业务视图对象
*
* @author zxfei
* @date 2022-07-05
*/
@Data
public class UserEntityExt extends BaseEntityLong {
public class UserVo extends BaseEntityLong {
/**
* 站点名称
*/
private String siteName;
private String roleIds;
/**
* 唯一标识
*/
......@@ -35,12 +41,9 @@ public class UserEntityExt extends BaseEntityLong {
*/
private Long expireTime;
private String oldPassword;
private String newPassword;
private String siteIds;
private List<ModelEntity> modleList;
/**
* 所属区域code,多个逗号分隔
*/
private String areaCodes;
}
\ No newline at end of file
/**
* 文件:UserService.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
* 文件:UserService.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.user.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.pdu.user.UserPdu;
......@@ -25,11 +27,11 @@ import java.util.Set;
* <p>Description: UserService service接口 </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @author
* @version 1.0.0
*/
public interface UserService extends ICRUDCacheService<UserEntity,Long> {
public interface UserService extends ICRUDCacheService<UserEntity, Long> {
/**
* 用户登录
*
......@@ -39,7 +41,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;
UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;
/**
* 校验用户名与密码是否正确
......@@ -49,7 +51,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
UserEntity doCheckUser(String loginName, String password) throws AppException;
UserEntity doCheckUser(String loginName, String password) throws AppException;
/**
* 检查用户是否存在
......@@ -58,7 +60,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userId 密码
* @return
*/
boolean existUser(String loginName, Long userId) throws AppException;
boolean existUser(String loginName, Long userId) throws AppException;
/**
* 通过登录用户获取菜单功能权限
......@@ -66,7 +68,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user
* @return
*/
List<MenuEntity> findOutlookBarList(IUser user);
List<MenuEntity> findOutlookBarList(IUser user);
/**
* 查询用户所有有权限的菜单ID
......@@ -74,7 +76,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity
* @return
*/
Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
/**
* 查询用户记录
......@@ -86,7 +88,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;
Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;
/**
* 为客户创建用户
......@@ -101,8 +103,8 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
String userName, String mobile) throws AppException;
UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
String userName, String mobile) throws AppException;
/**
* 用户修改密码
......@@ -113,11 +115,14 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return
* @throws AppException
*/
boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
void updateWidthDao(UserEntity userEntity);
void updateWidthDao(UserEntity userEntity);
void updateUserList(List<UserPdu> list);
Rest<Void> refreshUser();
UserDao getUserDao();
}
\ No newline at end of file
......@@ -2,7 +2,9 @@ package com.mortals.xhx.base.system.user.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
......@@ -16,10 +18,7 @@ import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -37,11 +36,7 @@ import java.util.Map;
@RequestMapping("user")
public class UserController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> {
@Autowired
private UserService userService;
public UserController() {
super.setFormClass(UserForm.class);
super.setModuleDesc("用户信息");
}
......@@ -63,26 +58,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
}
@Override
protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException {
entity.setLoginPwd(null);
entity.setLoginPwd1(null);
entity.setLoginPwd2(null);
return super.editAfter(id, model, entity, context);
}
@Override
protected int saveAfter(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (entity.getId() == getCurUser().getId()) {
//saveCurrUserForSession(request, response, userService.get(form.getEntity().getId(), false));
}
return super.saveAfter(entity, model, context);
}
@Override
protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (service.existUser(entity.getLoginName(), entity.getId())) {
......@@ -108,6 +83,15 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
}
@PostMapping({"refreshUser"})
@UnAuth
public Rest<Object> refreshUser() {
log.info("刷新用户");
this.service.refreshUser();
return Rest.ok("用户同步刷新操作成功");
}
public static void main(String[] args) {
String token = "eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIzNGE5NDA5ZDVhOTQ3MWNhMzdkYjZkYmMwY2JjZTc5In0.MWyQW40HYDxyUz7PJRf_nRsFPWx3Hr811Ime984nixs";
......
/**
* 文件:UserForm.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.user.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
/**
* <p>Title: 用户信息</p>
* <p>Description: UserForm </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class UserForm extends BaseCRUDFormLong<UserEntity> {
private UserEntity entity = new UserEntity();
private UserQuery query = new UserQuery();
public UserForm(){
}
@Override
public UserEntity getEntity() {
return entity;
}
public void setEntity(UserEntity entity) {
this.entity = entity;
}
@Override
public UserQuery getQuery() {
return query;
}
public void setQuery(UserQuery query) {
this.query = query;
}
}
\ No newline at end of file
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.feign.user.IUserFeign;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.mortals.framework.springcloud.service.IApplicationService;
import org.springframework.util.ObjectUtils;
import java.util.List;
@Component
......@@ -15,10 +28,33 @@ public class DemoStartService implements IApplicationService {
private static Log logger = LogFactory.getLog(DemoStartService.class);
@Autowired
private ICacheService cacheService;
@Autowired
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Override
public void start() {
ThreadPool.getInstance().init(10);
// ThreadPool.getInstance().init(10);
logger.info("开始服务..[配置已加载完成,但部分框架还未初始化,比如:Kafka]");
/* Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
if(!ObjectUtils.isEmpty(list.getData().getData())){
//初始化更新门户用户站点树
cacheService.del(Constant.USER_SITE_TREE);
userService.updateUserList(list.getData().getData());
}
}*/
}
@Override
......
......@@ -40,14 +40,19 @@ public class DemoStartedService implements IApplicationStartedService {
private UserService userService;
@Autowired
private ICacheService cacheService;
@Autowired
private SiteService siteService;
@Override
public void start() {
ThreadPool.getInstance().init(10);
logger.info("开始服务..[初始化用户站点树]");
//删除redis 中的 站点树
cacheService.del(USER_SITE_TREE);
UserEntity userEntity = new UserEntity();
siteService.updateAllSiteTree(null);
/* UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(0L);
Context contextTemp = new Context();
......@@ -61,8 +66,7 @@ public class DemoStartedService implements IApplicationStartedService {
contextTemp = new Context();
contextTemp.setUser(userEntity);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
ThreadPool.getInstance().execute(syncTreeSiteThread);*/
}
......
......@@ -41,14 +41,13 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Override
public void excuteTask(ITask task) throws AppException {
userService.refreshUser();
log.info("同步用户");
UserPdu userPdu = new UserPdu();
/* UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());
userService.updateUserList(list.getData().getData());*/
//resourceService.updateUserList();
......
......@@ -69,7 +69,15 @@ public class AppController extends BaseCRUDJsonBodyMappingController<AppService,
super.init(model, context);
}
/**
* @param query
* @return
*/
@Override
@UnAuth
public Rest<Object> list(@RequestBody AppEntity query) {
return super.list(query);
}
/**
* @param query
......
......@@ -3,6 +3,8 @@ package com.mortals.xhx.module.app.web;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
......@@ -54,6 +56,17 @@ public class AppDatasetController extends BaseCRUDJsonBodyMappingController<AppD
super.setModuleDesc("自助终端应用数据集");
}
/**
* @param query
* @return
*/
@Override
@UnAuth
public Rest<Object> list(@RequestBody AppDatasetEntity query) {
return super.list(query);
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
......
package com.mortals.xhx.module.app.web;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.AppFieldTypeEnum;
......@@ -52,5 +54,13 @@ public class AppInfoFieldController extends BaseCRUDJsonBodyMappingController<Ap
super.init(model, context);
}
/**
* @param query
* @return
*/
@Override
@UnAuth
public Rest<Object> list(@RequestBody AppInfoFieldEntity query) {
return super.list(query);
}
}
\ No newline at end of file
package com.mortals.xhx.module.app.web;
import cn.hutool.core.net.url.UrlBuilder;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -64,6 +65,16 @@ public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppV
}
/**
* @param query
* @return
*/
@Override
@UnAuth
public Rest<Object> list(@RequestBody AppVersionEntity query) {
return super.list(query);
}
@Override
protected void doListBefore(AppVersionEntity query, Map<String, Object> model, Context context) throws AppException {
List<OrderCol> orderColList = new ArrayList<>();
......
......@@ -67,4 +67,6 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
Rest<String> syncMatterBySiteId(SiteEntity siteEntity, Context context);
void deleteBysiteIdAndSource(Long siteId, Integer source, Context context);
void updateAllSiteTree(Context context);
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.HttpUtil;
import com.mortals.framework.util.StringUtils;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.AreaLevelDxTypeEnum;
import com.mortals.xhx.common.code.AreaLevelEnum;
......@@ -25,6 +27,7 @@ import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.device.DevicePdu;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.MatterHtmlParseUtil;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.area.model.AreaEntity;
......@@ -191,14 +194,19 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
super.saveAfter(entity, context);
//刷新站点树
//ThreadPool.getInstance().execute(new SyncTreeSiteThread(this,context));
Rest<String> rest = userFeign.synchSiteAuth();
/* Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());
}
}*/
this.updateAllSiteTree(context);
//新加的站点 只需要更新全树
//更新同步部门相关
deptService.syncDeptBySiteId(entity, context);
......@@ -239,7 +247,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
}
}
//查詢指定的站點ids
// log.info(String.format("siteQuery==>%s", JSON.toJSONString(siteQuery)));
// log.info(String.format("siteQuery==>%s", JSON.toJSONString(siteQuery)));
siteList = this.find(siteQuery);
}
//如果是管理员 默认全部站点
......@@ -340,16 +348,16 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
@Override
protected void updateAfter(SiteEntity entity, Context context) throws AppException {
super.updateAfter(entity,context);
super.updateAfter(entity, context);
//刷新站点树
Rest<String> rest = userFeign.synchSiteAuth();
/* Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());
}
}*/
if (refresh) {
//通知设备更新站点信息
DevicePdu devicePdu = new DevicePdu();
......@@ -384,8 +392,8 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
if (!ObjectUtils.isEmpty(collect)) {
return collect;
} else {
//反全站点树
return getSiteTreeSelects("0");
//反全站点树 如果没有全站点树,则临时构建 admin 为全站点树
return getSiteTreeSelects("1");
}
//如果所属站点为空返回全节点树
......@@ -815,6 +823,28 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
this.dao.delete(condition);
}
/**
* @param context
*/
@Override
public void updateAllSiteTree(Context context) {
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(0L);
Context contextTemp = new Context();
contextTemp.setUser(userEntity);
SyncTreeSiteThread syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(1L);
contextTemp = new Context();
contextTemp.setUser(userEntity);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
}
public List<MatterEntity> subList(List<MatterEntity> firstList, List<MatterEntity> secondList) {
Set<String> secondSet = secondList.parallelStream().map(e -> e.getMatterNo()).collect(Collectors.toSet());
......
......@@ -85,6 +85,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.12</version>
</dependency>
</dependencies>
<build>
......
package com.mortals.xhx.feign.selfsystem;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 自助服务系统 Feign接口
*
* @author zxfei
* @date 2022-10-26
*/
@FeignClient(name = "sst-manager", path = "/sst", fallbackFactory = SelfSystemFeignFallbackFactory.class)
public interface ISelfSystemFeign extends IFeign {
/**
* 用户刷新通知
*
* @param
* @return
*/
@PostMapping(value = "/user/refreshUser")
Rest<Void> refreshUser();
}
@Slf4j
@Component
class SelfSystemFeignFallbackFactory implements FallbackFactory<ISelfSystemFeign> {
@Override
public ISelfSystemFeign create(Throwable t) {
return new ISelfSystemFeign() {
/**
* @return
*/
@Override
public Rest<Void> refreshUser() {
return Rest.fail("暂时无法通知设备,请稍后再试!");
}
};
}
}
package com.mortals.xhx.feign.smartoffice;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 服务系统 Feign接口
*
* @author zxfei
* @date 2022-10-26
*/
@FeignClient(name = "smart-office-manager", path = "/office", fallbackFactory = SmartSystemFeignFallbackFactory.class)
public interface ISmartSystemFeign extends IFeign {
/**
* 用户刷新通知
*
* @param
* @return
*/
@PostMapping(value = "/user/refreshUser")
Rest<Void> refreshUser();
}
@Slf4j
@Component
class SmartSystemFeignFallbackFactory implements FallbackFactory<ISmartSystemFeign> {
@Override
public ISmartSystemFeign create(Throwable t) {
return new ISmartSystemFeign() {
/**
* @return
*/
@Override
public Rest<Void> refreshUser() {
return Rest.fail("暂时无法通知设备,请稍后再试!");
}
};
}
}
import http from "../request/http";
let baseURL = process.env.VUE_APP_API_BASE_URL;
// 获取资源列表
export function getResourceList(params) {
return http.post(`${baseURL}/zwfw/resource/list`, params);
}
// 保存资源
export function saveResource(params) {
return http.post(`${baseURL}/zwfw/resource/save`, params);
}
// 删除资源
export function delResource(params) {
return http.get(`${baseURL}/zwfw/resource/delete`, params);
}
// 查询角色权限列表
export function getRoleResourceList(params) {
return http.post(`${baseURL}/zwfw/role/auth/list`, params);
}
// 保存角色资源
export function distributionSource(params) {
return http.post(`${baseURL}/zwfw/role/auth/distributionSource`, params);
}
// 自动刷新资源
export function refreshUrl(params) {
return http.post(`${baseURL}/zwfw/resource/refreshUrl`, params);
}
......@@ -85,8 +85,6 @@ export default {
// console.log(this.menuListData);
// console.log(this.menuTreeData);
// this.getMenuDict(); //弃用
} else {
this.$message.error(res.msg);
}
});
},
......
......@@ -38,7 +38,7 @@ axios.interceptors.response.use(
if (response.data.code !== undefined && response.data.msg !== undefined) {
// 取出数据
let { code, msg } = response.data;
if (code === -1) {
if (code === -1 || code === 405) {
message.error({
content: msg,
maxCount: 1,
......
......@@ -20,11 +20,16 @@ const router = new VueRouter({
base: process.env.BASE_URL,
routes: routeConfig,
});
router.beforeEach((to, from, next) => {
let islogin = store.getters["user/token"];
// let routerPath = store.getters["user/routerList"];
// let toRootPathArr = to.matched.map((v) => v.path);
// let bol = hasIntersection(toRootPathArr, routerPath);
if (islogin) {
next();
// if (routerPath.includes(to.path) || bol) {
// next();
// }
} else {
// 再次判断防止死循环
if (to.path === "/") {
......@@ -35,6 +40,10 @@ router.beforeEach((to, from, next) => {
}
});
// function hasIntersection(arr1, arr2) {
// return arr1.some((item) => arr2.includes(item));
// }
router.afterEach((to, from, next) => {
window.scrollTo(0, 0);
});
......
......@@ -19,7 +19,7 @@ const routes = [
children: [
{
path: "dataAdmin",
redirect: "/",//升级前门户跳转重定向
redirect: "/", //升级前门户跳转重定向
},
{
path: "pickUp",
......@@ -31,7 +31,6 @@ const routes = [
),
meta: { title: "取件记录报表" },
children: [
{
path: "pickUpRecord",
name: "pickUpRecord",
......@@ -730,6 +729,15 @@ const routes = [
),
meta: { title: "角色权限管理" },
},
{
path: "resourceManage",
name: "resourceManage",
component: () =>
import(
/* webpackChunkName: "resourceManage" */ "@/views/thePlatformIsSet/components/permissionsModel/ResourceManage.vue"
),
meta: { title: "资源信息管理" },
},
],
},
{
......
......@@ -11,6 +11,7 @@ export default {
siteName: "", // 站点名称
siteId: "", // 站点id
searForm: {}, // 报表搜索
routerList: [], // 用户权限路由
},
getters: {
siteId: (state) => state.siteId,
......@@ -22,8 +23,14 @@ export default {
let { menuList = [] } = state.userData;
return menuList;
},
routerList(state) {
return state.routerList;
},
},
mutations: {
SET_routerList(state, routerList) {
state.routerList = [...new Set([...state.routerList, ...routerList])];
},
SET_USERDATA(state, data) {
state.userData = data;
},
......
......@@ -16,13 +16,13 @@
>
<span v-else>0</span>)
</p>
<p
<a-tooltip
v-for="(v, i) in businessInfo.matterlist"
:key="v.id"
class="matter-item"
:title="v"
>
{{ i + 1 }}.{{ v.matterName }}
</p>
<p class="matter-item cursor-default">{{ i + 1 }}.{{ v }}</p>
</a-tooltip>
</div>
<div class="take-info">
<div class="take-info-item">
......@@ -134,4 +134,4 @@ export default {
color: #1890ff;
border-color: #1890ff;
}
</style>
\ No newline at end of file
</style>
......@@ -390,6 +390,7 @@ export default {
if (res.code == 1) {
let { data } = res;
let { business } = row;
console.log(data);
this.businessName = business;
this.businessInfo = data;
this.analysisVisible = true;
......@@ -518,5 +519,4 @@ export default {
};
</script>
<style lang="less" scoped>
</style>
\ No newline at end of file
<style lang="less" scoped></style>
......@@ -76,6 +76,7 @@
import Swiper from "swiper";
import { censusListInterface } from "@/api/dataAdmin";
import Storage from "@/utils/js/Storage";
import { mapMutations } from "vuex";
export default {
components: {},
data() {
......@@ -138,6 +139,7 @@ export default {
this.initSwiper();
},
methods: {
...mapMutations("user", ["SET_routerList"]),
initSwiper() {
this.mySwiper = new Swiper(".swiper-container", {
speed: 1500,
......@@ -180,6 +182,7 @@ export default {
CensusType_2: this.CensusType_2,
CensusType_3: this.CensusType_3,
};
this.SET_routerList(this.getReportPath(censusObj));
let key = this.findFirstNonEmpty(censusObj);
if (key) {
this.active = key;
......@@ -189,7 +192,6 @@ export default {
this.censusList = [];
this.active = "CensusType_1";
if (this.$route.path != "/home/dataManagement") {
console.log(1);
this.$router.push("/home/dataManagement");
}
}
......@@ -203,6 +205,7 @@ export default {
this.$router.push(this.censusList[0].censusUrl);
}
},
// 找出第一个不为空的报表类别
findFirstNonEmpty(obj) {
for (let key in obj) {
if (obj[key].length > 0) {
......@@ -211,6 +214,13 @@ export default {
}
return null;
},
// 获取报表路由
getReportPath(obj = {}) {
let arr = Object.values(obj)
.flat()
.map((v) => v.censusUrl);
return arr;
},
changeRouter(path) {
this.$router.push(path);
},
......
......@@ -326,7 +326,12 @@ export default {
this.initSwiper();
},
methods: {
...mapMutations("user", ["set_token", "SET_USERDATA", "set_siteList"]),
...mapMutations("user", [
"set_token",
"SET_USERDATA",
"set_siteList",
"SET_routerList",
]),
initSwiper() {
this.mySwiper = new Swiper(".mySwiper", {
effect: "cube", // 方块动画
......@@ -377,6 +382,7 @@ export default {
this.set_token(token);
this.SET_USERDATA(user);
this.set_siteList(siteList);
this.SET_routerList(this.getUrl(user.menuList));
if (siteList.length) {
storage.set(2, "siteId", siteList[0].id);
storage.set(2, "siteName", siteList[0].siteName);
......@@ -420,6 +426,21 @@ export default {
}
});
},
// 递归获取菜单url
getUrl(menus = []) {
let urls = [];
let fn = (arr) => {
arr.forEach((v) => {
urls.push(v.url);
if (v.childList && v.childList.length) {
fn(v.childList);
}
});
};
fn(menus);
return urls;
},
},
};
</script>
......
......@@ -225,7 +225,7 @@ export default {
imgPath: [
//图标
{
required: true, //是否必选
required: false, //是否必选
message: "请选择图标",
trigger: "change",
},
......@@ -245,7 +245,7 @@ export default {
remark: [
//描述
{
required: true, //是否必选
required: false, //是否必选
message: "请输入描述",
trigger: "blur",
},
......
......@@ -212,6 +212,7 @@ export default {
page: this.tablePagination.current,
size: -1,
});
if (res.code != 1) return;
let { data, total, dict } = res.data;
let { menuType } = dict;
this.tablePagination.total = total;
......@@ -410,4 +411,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
<template>
<div class="w-full">
<!-- 头部操作 -->
<div class="header_box flex justify-between items-center">
<a-space>
<a-button type="primary" class="addclass" @click="addSresource"
>新增资源</a-button
>
<a-button
v-permission="[1]"
type="primary"
class="addclass"
@click="refSresource"
>刷新资源</a-button
>
<a-button type="danger" @click="delAll">批量删除</a-button>
</a-space>
<a-space>
<a-input
v-model="searchForm.name"
style="width: 250px"
placeholder="请输入资源名称搜索"
>
<a-icon slot="prefix" type="search" />
</a-input>
<a-select
v-model="searchForm.authType"
placeholder="请选择权限类型"
style="width: 150px"
>
<a-select-option value="">全部</a-select-option>
<a-select-option
v-for="(v, key) in dict.authType"
:key="key"
:value="Number(key)"
>{{ v }}</a-select-option
>
</a-select>
<a-button type="primary" class="addclass" @click="handleSerch"
>搜索</a-button
>
<a-button @click="resetList">重置</a-button>
</a-space>
</div>
<!-- 表格 -->
<a-table
:columns="columns"
:data-source="tableSourceData"
size="small"
bordered
:scroll="{ y: 590 }"
:row-key="(record) => record.id"
:pagination="tablePagination"
@change="pagTableChange"
:loading="loading"
:row-selection="{
selectedRowKeys: selectedRowKeys,
onChange: onSelectChange,
}"
>
<!-- 资源 -->
<template slot="url" slot-scope="text">
<a-tag color="blue" class="mb-[4px]" v-for="(v, i) in text" :key="i">
{{ v }}
</a-tag>
</template>
<!-- 认证类型 -->
<template slot="authType" slot-scope="text">
<a-tag> {{ dict.authType[text] }} </a-tag>
</template>
<span slot="action" slot-scope="text, record">
<a-space>
<a-button type="link" @click="handleEdit(record)">编辑</a-button>
<a-button class="delete" type="link" @click="handleDel(record.id)"
>删除</a-button
>
</a-space>
</span>
</a-table>
<!-- 新增、编辑 -->
<AddResurce
ref="AddResurce"
:title="title"
:visible.sync="visible"
:dict="dict"
@add="getResourceList"
></AddResurce>
</div>
</template>
<script>
import { getResourceList, delResource, refreshUrl } from "@/api/resource";
import AddResurce from "./components/AddResurce.vue";
export default {
components: {
AddResurce,
},
data() {
const columns = [
{
title: "序号",
width: 80,
align: "center",
customRender: (text, record, index) => {
return (
(this.tablePagination.current - 1) * this.tablePagination.pageSize +
index +
1
);
},
},
{
title: "名称",
width: 400,
dataIndex: "name",
},
{
title: "资源",
dataIndex: "url",
scopedSlots: { customRender: "url" },
},
{
title: "认证类型",
width: 200,
dataIndex: "authType",
scopedSlots: { customRender: "authType" },
},
{
title: "操作",
width: 150,
align: "center",
scopedSlots: { customRender: "action" },
},
];
return {
loading: false,
visible: false,
title: "新增资源",
columns,
searchForm: {
name: "",
authType: "",
},
dict: {}, // 字典
selectedRowKeys: [],
tableSourceData: [],
tablePagination: {
current: 1,
pageSize: 10,
total: 0,
showQuickJumper: true, //是否可以快速跳转至某页
showSizeChanger: true, //是否可以改变 pageSize
showTotal: (total, range) => `共${total}条`,
pageSizeOptions: ["10", "20", "30"],
},
};
},
created() {
this.getResourceList();
},
methods: {
// 获取列表数据
async getResourceList() {
this.loading = true;
let res = await getResourceList({
page: this.tablePagination.current,
size: this.tablePagination.pageSize,
...this.searchForm,
name: `%${this.searchForm.name}%`,
});
this.loading = false;
if (res.code !== 1) return;
let { data, dict, total } = res.data;
if (!data.length && this.tablePagination.current > 1) {
this.tablePagination.current -= 1;
this.getResourceList();
}
data.forEach((v) => {
v.url = v.url.split(",");
});
this.tableSourceData = data;
this.dict = dict;
this.tablePagination.total = total;
},
// 新增
addSresource() {
this.title = "新增资源";
this.$refs.AddResurce.onAdd();
this.visible = true;
},
// 搜索
handleSerch() {
this.tablePagination.current = 1;
this.getResourceList();
},
// 重置搜索
resetList() {
Object.assign(this.searchForm, this.$options.data().searchForm);
this.tablePagination.current = 1;
this.getResourceList();
},
// 分页
pagTableChange({ current, pageSize }) {
this.tablePagination.current = current;
this.tablePagination.pageSize = pageSize;
this.getResourceList();
},
// 编辑
handleEdit(row) {
this.title = "编辑资源";
this.$refs.AddResurce.onEdit(row);
this.visible = true;
},
// 勾选
onSelectChange(keys) {
this.selectedRowKeys = keys;
},
// 批量删除
delAll() {
if (!this.selectedRowKeys.length) {
this.$message.warning("请先勾选数据");
return;
}
let ids = this.selectedRowKeys.join(",");
this.handleDel(ids);
},
// 删除
handleDel(id) {
let _this = this;
this.$confirm({
okType: "danger",
title: "系统提示",
content: "此操作将删除该资源信息,是否继续?",
okText: "",
cancelText: "",
centered: true,
async onOk() {
let res = await delResource({
id,
});
let { code, msg } = res;
if (code == 1) {
_this.$message.success(msg);
_this.getResourceList();
}
},
});
},
// 刷新资源
async refSresource() {
let _this = this;
this.$confirm({
title: "系统提示",
content: "确定要刷新资源吗?",
okText: "",
cancelText: "",
centered: true,
async onOk() {
let res = await refreshUrl();
if (res.code == 1) {
_this.$message.success(res.msg);
_this.getResourceList();
}
},
});
},
},
};
</script>
<style lang="less" scoped>
.header_box {
padding-bottom: 1rem;
}
</style>
......@@ -30,6 +30,7 @@
:dataSource="tableSourceData"
>
<template slot="operation" slot-scope="text, record, index">
<a-button type="link" @click="apportion(record)">分配资源</a-button>
<a-button type="link" @click="pushRouter(record)">功能授权</a-button>
<a-button type="link" @click="showRoleEditModal(true, record)"
>编辑</a-button
......@@ -53,20 +54,30 @@
:roleDict="roleDict"
@getRoleList="getRoleList"
/>
<!-- 分配权限 -->
<ApportionAuth
ref="ApportionAuth"
:visible.sync="authVisible"
></ApportionAuth>
</div>
</div>
</template>
<script>
import { deepClone } from "@/utils/js/common.js";
import { roleList, roleDelete } from "@/api/authorityMis.js";
import AddEditRole from "./components/addEditRole.vue";
import ApportionAuth from "./components/ApportionAuth.vue";
import { mapState } from "vuex";
export default {
name: "PortalAdminVueAuthorityMis",
components: {
AddEditRole,
ApportionAuth,
},
data() {
return {
searchRoleName: undefined,
authVisible: false,
tableLoading: false,
tablePagination: {
current: 1,
......@@ -106,7 +117,7 @@ export default {
{
title: "操作",
align: "center",
width: "200px",
width: "250px",
dataIndex: "operation",
scopedSlots: {
customRender: "operation",
......@@ -118,9 +129,7 @@ export default {
roleDict: {},
};
},
components: {
AddEditRole,
},
computed: {
...mapState("user", ["userData"]),
},
......@@ -196,6 +205,11 @@ export default {
},
});
},
// 分配资源
apportion(row) {
this.$refs.ApportionAuth.onAdd(row.id);
this.authVisible = true;
},
},
};
</script>
......
......@@ -133,8 +133,10 @@ export default {
// 获取区域数据
async getListByParentId(parentId = 0) {
let res = await getListByParentId({ parentId });
let { data } = res.data;
this.treeData = data;
if (res.code == 1) {
let { data } = res.data;
this.treeData = data;
}
},
// 异步获取区域
......
......@@ -169,8 +169,10 @@ export default {
// 获取区域数据
async getListByParentId(parentId = 0) {
let res = await getListByParentId({ parentId });
let { data } = res.data;
this.treeData = data;
if (res.code == 1) {
let { data } = res.data;
this.treeData = data;
}
},
// 异步获取区域
......
......@@ -62,6 +62,7 @@ export default {
<style lang="less" scoped>
@headerH: 4.5rem;
.Container {
width: 100%;
height: 100% !important;
// background: #fac;
background: #f5f5f5;
......@@ -146,4 +147,4 @@ export default {
// }
}
}
</style>
\ No newline at end of file
</style>
This diff is collapsed.
......@@ -31,7 +31,6 @@ Content-Type: application/json
{
"page":1,
"size":10
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment