权限和用户管理开发
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
package com.zyplayer.doc.core.bean.swagger;
|
||||||
|
|
||||||
|
public class Contact {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.zyplayer.doc.core.bean.swagger;
|
||||||
|
|
||||||
|
public class Info {
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
private String version;
|
||||||
|
private String title;
|
||||||
|
private Contact contact;
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContact(Contact contact) {
|
||||||
|
this.contact = contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Contact getContact() {
|
||||||
|
return contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package com.zyplayer.doc.core.bean.swagger;
|
||||||
|
|
||||||
|
public class Paths {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.zyplayer.doc.core.bean.swagger;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SwaggerApiDocs {
|
||||||
|
|
||||||
|
private String swagger;
|
||||||
|
private Info info;
|
||||||
|
private String host;
|
||||||
|
private String basePath;
|
||||||
|
private List<String> tags;
|
||||||
|
private Paths paths;
|
||||||
|
|
||||||
|
public void setSwagger(String swagger) {
|
||||||
|
this.swagger = swagger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSwagger() {
|
||||||
|
return swagger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInfo(Info info) {
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Info getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBasePath(String basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBasePath() {
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTags(List<String> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaths(Paths paths) {
|
||||||
|
this.paths = paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paths getPaths() {
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
<zyplayer.doc.swagger.version>2.0.1</zyplayer.doc.swagger.version>
|
<zyplayer.doc.swagger.version>2.0.1</zyplayer.doc.swagger.version>
|
||||||
<zyplayer.doc.core.version>1.0.0</zyplayer.doc.core.version>
|
<zyplayer.doc.core.version>1.0.0</zyplayer.doc.core.version>
|
||||||
<velocity.engine.core.version>2.0</velocity.engine.core.version>
|
<velocity.engine.core.version>2.0</velocity.engine.core.version>
|
||||||
|
<dozer.core.version>6.1.0</dozer.core.version>
|
||||||
|
<alibaba.druid.version>1.1.9</alibaba.druid.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -52,7 +54,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid</artifactId>
|
||||||
<version>1.1.9</version>
|
<version>${alibaba.druid.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
@@ -65,6 +67,11 @@
|
|||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>${fastjson.version}</version>
|
<version>${fastjson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.dozermapper</groupId>
|
||||||
|
<artifactId>dozer-core</artifactId>
|
||||||
|
<version>${dozer.core.version}</version>
|
||||||
|
</dependency>
|
||||||
<!-- 在线文档解析页面 -->
|
<!-- 在线文档解析页面 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zyplayer</groupId>
|
<groupId>com.zyplayer</groupId>
|
||||||
|
|||||||
@@ -31,11 +31,16 @@ public class Application extends SpringBootServletInitializer {
|
|||||||
String contextPath = env.getProperty("server.servlet.context-path");
|
String contextPath = env.getProperty("server.servlet.context-path");
|
||||||
contextPath = Optional.ofNullable(contextPath).orElse("").replaceFirst("/", "");
|
contextPath = Optional.ofNullable(contextPath).orElse("").replaceFirst("/", "");
|
||||||
contextPath = (contextPath.length() <= 0 || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
|
contextPath = (contextPath.length() <= 0 || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
|
||||||
|
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
String serverPort = env.getProperty("server.port");
|
||||||
logger.info("\n----------------------------------------------------------\n\t" +
|
logger.info("\n----------------------------------------------------------\n\t" +
|
||||||
"\t\t地址列表\n\t" +
|
"\t\t地址列表\n\t" +
|
||||||
"文档地址:http://{}:{}/{}document.html\n" +
|
"文档地址:http://{}:{}/{}document.html\n\t" +
|
||||||
|
//"数据库地址:http://{}:{}/{}document.html\n " +
|
||||||
|
"管理地址:http://{}:{}/{}statics/manage/home.html\n" +
|
||||||
"----------------------------------------------------------",
|
"----------------------------------------------------------",
|
||||||
InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"), contextPath
|
hostAddress, serverPort, contextPath,
|
||||||
|
hostAddress, serverPort, contextPath
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.config;
|
||||||
|
|
||||||
|
import org.dozer.DozerBeanMapperBuilder;
|
||||||
|
import org.dozer.DozerConverter;
|
||||||
|
import org.dozer.Mapper;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MapperConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Mapper dozerBeanMapper() {
|
||||||
|
DozerBeanMapperBuilder builder = DozerBeanMapperBuilder.create()
|
||||||
|
.withCustomConverter(new DateStringConvert(Date.class, String.class))
|
||||||
|
.withCustomConverter(new BigdecimalToStringConvert(BigDecimal.class, String.class));
|
||||||
|
return builder.build();
|
||||||
|
// return DozerBeanMapperBuilder.buildDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DateStringConvert extends DozerConverter<Date, String> {
|
||||||
|
private DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
public DateStringConvert(Class<Date> prototypeA, Class<String> prototypeB) {
|
||||||
|
super(prototypeA, prototypeB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String convertTo(Date source, String destination) {
|
||||||
|
destination = dateFormat.format(source);
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date convertFrom(String source, Date destination) {
|
||||||
|
try {
|
||||||
|
destination = dateFormat.parse(source);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class BigdecimalToStringConvert extends DozerConverter<BigDecimal, String> {
|
||||||
|
|
||||||
|
public BigdecimalToStringConvert(Class<BigDecimal> prototypeA, Class<String> prototypeB) {
|
||||||
|
super(prototypeA, prototypeB);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String convertTo(BigDecimal source, String destination) {
|
||||||
|
return source.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal convertFrom(String source, BigDecimal destination) {
|
||||||
|
return BigDecimal.valueOf(Double.parseDouble(source));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.zyplayer.doc.manage.framework.interceptor;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录当前请求信息
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RequestInfoInterceptor implements HandlerInterceptor {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(RequestInfoInterceptor.class);
|
||||||
|
|
||||||
|
private ThreadLocal<Long> startTimeThreadLocal = new ThreadLocal<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把当前请求记录到下来
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception arg3)
|
||||||
|
throws Exception {
|
||||||
|
long startTime = startTimeThreadLocal.get();
|
||||||
|
long totalTime = System.currentTimeMillis() - startTime;// 结束时间
|
||||||
|
logger.error("总耗时:{}ms URI:{}", totalTime, request.getRequestURI());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object haddler,
|
||||||
|
ModelAndView modelAndView) throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录请求信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
|
||||||
|
startTimeThreadLocal.set(System.currentTimeMillis());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,19 @@
|
|||||||
package com.zyplayer.doc.manage.web.manage;
|
package com.zyplayer.doc.manage.web.manage;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.zyplayer.doc.manage.repository.manage.entity.AuthInfo;
|
||||||
|
import com.zyplayer.doc.manage.repository.manage.entity.UserAuth;
|
||||||
|
import com.zyplayer.doc.manage.service.manage.AuthInfoService;
|
||||||
|
import com.zyplayer.doc.manage.service.manage.UserAuthService;
|
||||||
|
import com.zyplayer.doc.manage.web.manage.vo.AuthInfoVo;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.dozer.Mapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.util.DigestUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
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;
|
||||||
@@ -25,6 +33,12 @@ public class UserInfoController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
UserInfoService userInfoService;
|
UserInfoService userInfoService;
|
||||||
|
@Autowired
|
||||||
|
AuthInfoService authInfoService;
|
||||||
|
@Autowired
|
||||||
|
UserAuthService userAuthService;
|
||||||
|
@Autowired
|
||||||
|
Mapper mapper;
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public ResponseJson<Object> list(String userName) {
|
public ResponseJson<Object> list(String userName) {
|
||||||
@@ -32,10 +46,62 @@ public class UserInfoController {
|
|||||||
if (StringUtils.isNotBlank(userName)) {
|
if (StringUtils.isNotBlank(userName)) {
|
||||||
queryWrapper.like("user_name", userName);
|
queryWrapper.like("user_name", userName);
|
||||||
}
|
}
|
||||||
|
queryWrapper.eq("del_flag", 0);
|
||||||
List<UserInfo> userInfoList = userInfoService.list(queryWrapper);
|
List<UserInfo> userInfoList = userInfoService.list(queryWrapper);
|
||||||
|
if (userInfoList != null && userInfoList.size() > 0) {
|
||||||
|
userInfoList.forEach(val -> val.setPassword(null));
|
||||||
|
}
|
||||||
return DocResponseJson.ok(userInfoList);
|
return DocResponseJson.ok(userInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/auth/list")
|
||||||
|
public ResponseJson<Object> authList(String userIds) {
|
||||||
|
List<AuthInfo> authList = authInfoService.list();
|
||||||
|
QueryWrapper<UserAuth> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("user_id", userIds.split(","));
|
||||||
|
queryWrapper.eq("del_flag", 0);
|
||||||
|
List<UserAuth> userAuths = userAuthService.list(queryWrapper);
|
||||||
|
Map<Long, UserAuth> userAuthMap = userAuths.stream().collect(Collectors.toMap(UserAuth::getAuthId, Function.identity(), (val1, val2) -> val1));
|
||||||
|
List<AuthInfoVo> authInfoVoList = new LinkedList<>();
|
||||||
|
authList.forEach(val -> {
|
||||||
|
UserAuth userAuth = userAuthMap.get(val.getId());
|
||||||
|
AuthInfoVo infoVo = mapper.map(val, AuthInfoVo.class);
|
||||||
|
infoVo.setChecked((userAuth == null) ? 0 : 1);
|
||||||
|
authInfoVoList.add(infoVo);
|
||||||
|
});
|
||||||
|
return DocResponseJson.ok(authInfoVoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/auth/update")
|
||||||
|
public ResponseJson<Object> updateAuth(String userIds, String authIds) {
|
||||||
|
List<Long> userIdsList = Arrays.asList(userIds.split(",")).stream().collect(Collectors.mapping(val -> Long.valueOf(val), Collectors.toList()));
|
||||||
|
List<Long> authIdsList = Arrays.asList(authIds.split(",")).stream().collect(Collectors.mapping(val -> Long.valueOf(val), Collectors.toList()));
|
||||||
|
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||||
|
|
||||||
|
UserAuth userAuthUp = new UserAuth();
|
||||||
|
userAuthUp.setDelFlag(1);
|
||||||
|
userAuthUp.setUpdateTime(new Date());
|
||||||
|
userAuthUp.setUpdateUid(currentUser.getUserId());
|
||||||
|
QueryWrapper<UserAuth> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.in("user_id", userIdsList);
|
||||||
|
userAuthService.update(userAuthUp, queryWrapper);
|
||||||
|
|
||||||
|
List<UserAuth> createList = new LinkedList<>();
|
||||||
|
for (int i = 0; i < userIdsList.size(); i++) {
|
||||||
|
for (int j = 0; j < authIdsList.size(); j++) {
|
||||||
|
UserAuth userAuth = new UserAuth();
|
||||||
|
userAuth.setUserId(userIdsList.get(i));
|
||||||
|
userAuth.setAuthId(authIdsList.get(j));
|
||||||
|
userAuth.setCreateUid(currentUser.getUserId());
|
||||||
|
userAuth.setCreationTime(new Date());
|
||||||
|
userAuth.setDelFlag(0);
|
||||||
|
createList.add(userAuth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userAuthService.saveBatch(createList);
|
||||||
|
return DocResponseJson.ok();
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public ResponseJson<Object> delete(Long id) {
|
public ResponseJson<Object> delete(Long id) {
|
||||||
UserInfo userInfo = new UserInfo();
|
UserInfo userInfo = new UserInfo();
|
||||||
@@ -48,6 +114,11 @@ public class UserInfoController {
|
|||||||
|
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public ResponseJson<Object> update(UserInfo userInfo) {
|
public ResponseJson<Object> update(UserInfo userInfo) {
|
||||||
|
String password = userInfo.getPassword();
|
||||||
|
if (StringUtils.isNotBlank(password)) {
|
||||||
|
password = DigestUtils.md5DigestAsHex(password.getBytes());
|
||||||
|
userInfo.setPassword(password);
|
||||||
|
}
|
||||||
if (userInfo.getId() != null && userInfo.getId() > 0) {
|
if (userInfo.getId() != null && userInfo.getId() > 0) {
|
||||||
userInfo.setUpdateTime(new Date());
|
userInfo.setUpdateTime(new Date());
|
||||||
userInfoService.updateById(userInfo);
|
userInfoService.updateById(userInfo);
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.zyplayer.doc.manage.web.manage.vo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @since 2018-12-05
|
||||||
|
*/
|
||||||
|
public class AuthInfoVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键自增ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否选中
|
||||||
|
*/
|
||||||
|
private Integer checked;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限名
|
||||||
|
*/
|
||||||
|
private String authName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限说明
|
||||||
|
*/
|
||||||
|
private String authDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可编辑 0=否 1=是
|
||||||
|
*/
|
||||||
|
private Integer canEdit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private Long createUid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date creationTime;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public String getAuthName() {
|
||||||
|
return authName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthName(String authName) {
|
||||||
|
this.authName = authName;
|
||||||
|
}
|
||||||
|
public String getAuthDesc() {
|
||||||
|
return authDesc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthDesc(String authDesc) {
|
||||||
|
this.authDesc = authDesc;
|
||||||
|
}
|
||||||
|
public Integer getCanEdit() {
|
||||||
|
return canEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanEdit(Integer canEdit) {
|
||||||
|
this.canEdit = canEdit;
|
||||||
|
}
|
||||||
|
public Long getCreateUid() {
|
||||||
|
return createUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateUid(Long createUid) {
|
||||||
|
this.createUid = createUid;
|
||||||
|
}
|
||||||
|
public Date getCreationTime() {
|
||||||
|
return creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationTime(Date creationTime) {
|
||||||
|
this.creationTime = creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AuthInfo{" +
|
||||||
|
"id=" + id +
|
||||||
|
", authName=" + authName +
|
||||||
|
", authDesc=" + authDesc +
|
||||||
|
", canEdit=" + canEdit +
|
||||||
|
", createUid=" + createUid +
|
||||||
|
", creationTime=" + creationTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getChecked() {
|
||||||
|
return checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecked(Integer checked) {
|
||||||
|
this.checked = checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
body{width: 100%;height: 100%;margin: 0;padding: 0;}
|
||||||
|
a:focus{outline:none;}
|
||||||
|
ul{list-style: none;list-style-type: none;}
|
||||||
|
.tree li a{white-space: nowrap;}
|
||||||
|
.tree-menu li > ul{background-color: #f1f1f1;}
|
||||||
|
.tree-menu li li li li a{padding-left: 68px;}
|
||||||
|
.tree-menu li li li li li a{padding-left: 88px;}
|
||||||
|
.tree-menu li li li li li li a{padding-left: 108px;}
|
||||||
|
.tree-menu li li li li li li li a{padding-left: 128px;}
|
||||||
|
.tree-menu li li li li li li li li a{padding-left: 148px;}
|
||||||
|
.tree-menu li li li li li li li li li a{padding-left: 168px;}
|
||||||
|
.tree-menu li li li li li li li li li li a{padding-left: 188px;}
|
||||||
|
.table td, .table th {vertical-align: middle;}
|
||||||
|
|
||||||
|
/**lable的覆盖样式*/
|
||||||
|
.label{font-size: 100%;}
|
||||||
|
.label-warning {background-color: #f9f5ee; color: #f1a325;}
|
||||||
|
label{font-weight: normal;}
|
||||||
|
|
||||||
|
.nav.gray{background-color: #f1f1f1;margin-bottom: 10px;}
|
||||||
|
|
||||||
|
.doc-table tr .info{text-align: right; width: 100px;}
|
||||||
|
.setting-table tr .info{text-align: right; max-width: 150px;}
|
||||||
|
.show-doc span{color: #aaa;}
|
||||||
|
|
||||||
|
.mgresizableW{z-index: 90;height: 100%; width: 10px; cursor: e-resize;}
|
||||||
|
.ui-resizable-handle {display: block;font-size: 0.1px;position: absolute;}
|
||||||
|
#resizableLeftRight{left: 360px;}
|
||||||
|
.unselect{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
|
||||||
|
|
||||||
|
.left-body{
|
||||||
|
width: 360px; height:100%; position: fixed; top: 0; bottom: 0; left: 0;
|
||||||
|
}
|
||||||
|
.left-header{
|
||||||
|
background: #3280fc;width: 100%; height:60px;line-height:60px;
|
||||||
|
position: absolute; top: 0; bottom: 0; left: 0;text-align: center;
|
||||||
|
}
|
||||||
|
.left-header .logo{
|
||||||
|
font-size: 30px;color: #fff;
|
||||||
|
}
|
||||||
|
.left-header .icon-bars{
|
||||||
|
font-size: 24px;float: right;margin: 18px 18px 0 0;color: #fff;cursor: pointer;
|
||||||
|
}
|
||||||
|
.left-container{
|
||||||
|
width: 100%;position: absolute;background: #f1f1f1;color: rgba(163, 175, 183, .9);
|
||||||
|
top: 60px; bottom: 0; left: 0; overflow-y: auto; padding: 10px;
|
||||||
|
}
|
||||||
|
.left-container .projects{border: 0px; border-radius: 0px;}
|
||||||
|
|
||||||
|
.right-container{
|
||||||
|
position: fixed;top: 0px; bottom: 0; left: 360px; right: 0;padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-table-box{margin-top: 10px; max-height: 500px;overflow-y: auto;}
|
||||||
|
.modal-table-box{list-style: none;}
|
||||||
|
.modal-table-box ul{padding-left: 10px;}
|
||||||
|
.modal-table-box li{padding: 10px 15px; margin: 0 10px 10px 0; background-color: #f1f1f1;cursor: pointer;}
|
||||||
|
.modal-table-box li.checked{background-color: #8666b8;color:#fff;}
|
||||||
|
|
||||||
|
#rightContentMask{background-color: rgba(0, 0, 0, 0);padding: 0;z-index:9999; height: 100%;display: none;position: absolute;top: 0;bottom: 0;left:0;right: 0;}
|
||||||
|
#rightZpages{height: 100%;position: relative;top: 0;bottom: 0;left:0;right: 0;}
|
||||||
|
#rightZpages .tabs-container .tab-pane{padding: 10px;}
|
||||||
|
|
||||||
|
/* S-JSON展示的样式 */
|
||||||
|
pre.json{margin-top:0px;margin-bottom:0px;}
|
||||||
|
pre.json .canvas{font:10pt georgia;background-color:#ececec;color:#000000;border:1px solid #cecece;}
|
||||||
|
pre.json .object-brace{color:#00aa00;font-weight:bold;}
|
||||||
|
pre.json .array-brace{color:#0033ff;font-weight:bold;}
|
||||||
|
pre.json .property-name{color:#cc0000;font-weight:bold;}
|
||||||
|
pre.json .string{color:#007777;}
|
||||||
|
pre.json .number{color:#aa00aa;}
|
||||||
|
pre.json .boolean{color:#0000ff;}
|
||||||
|
pre.json .function{color:#aa6633;text-decoration:italic;}
|
||||||
|
pre.json .null{color:#0000ff;}
|
||||||
|
pre.json .comma{color:#000000;font-weight:bold;}
|
||||||
|
pre.json .annotation{color:#aaa;}
|
||||||
|
pre img{cursor: pointer;}
|
||||||
|
/* E-JSON展示的样式 */
|
||||||
|
|
||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
var ctx = "/";
|
var ctx = "/";
|
||||||
var statics = "/statics/";
|
var statics = "/statics/";
|
||||||
|
init();
|
||||||
window.onload=function(){
|
function init() {
|
||||||
ctx = getCookie("ctx");
|
ctx = getCookie("ctx");
|
||||||
statics = ctx + "statics/";
|
statics = ctx + "statics/";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,30 +4,37 @@
|
|||||||
* @since 2017年5月7日
|
* @since 2017年5月7日
|
||||||
*/
|
*/
|
||||||
var Toast = {
|
var Toast = {
|
||||||
notOpen:function(){
|
notOpen: function () {
|
||||||
var data = {
|
var data = {
|
||||||
message:"该功能暂未开放,敬请期待!",
|
message: "该功能暂未开放,敬请期待!",
|
||||||
icon: 'exclamation-sign',type:"warning",
|
icon: 'exclamation-sign', type: "warning",
|
||||||
};
|
};
|
||||||
this.show(data);
|
this.show(data);
|
||||||
},
|
},
|
||||||
warn:function(msg, time){
|
success: function (msg, time) {
|
||||||
var data = {
|
var data = {
|
||||||
message:msg,time:time,
|
message: msg, time: time,
|
||||||
icon: 'exclamation-sign',type:'warning',
|
icon: 'check-circle-o', type: 'success',
|
||||||
};
|
};
|
||||||
this.show(data);
|
this.show(data);
|
||||||
},
|
},
|
||||||
error:function(msg, time){
|
warn: function (msg, time) {
|
||||||
var data = {
|
var data = {
|
||||||
message:msg,time:time,
|
message: msg, time: time,
|
||||||
icon: 'exclamation-sign',type:'danger',
|
icon: 'exclamation-sign', type: 'warning',
|
||||||
};
|
};
|
||||||
this.show(data);
|
this.show(data);
|
||||||
},
|
},
|
||||||
show:function(data){
|
error: function (msg, time) {
|
||||||
data.time = isEmpty(data.time)?2000:data.time;
|
var data = {
|
||||||
data.placement = isEmpty(data.placement)?'top':data.placement;
|
message: msg, time: time,
|
||||||
|
icon: 'exclamation-sign', type: 'danger',
|
||||||
|
};
|
||||||
|
this.show(data);
|
||||||
|
},
|
||||||
|
show: function (data) {
|
||||||
|
data.time = isEmpty(data.time) ? 2000 : data.time;
|
||||||
|
data.placement = isEmpty(data.placement) ? 'top' : data.placement;
|
||||||
new $.zui.Messager(data.message, data).show();
|
new $.zui.Messager(data.message, data).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>关于</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../lib/zui/css/zui.min.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
这是一个关于页面
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="../lib/jquery/jquery-3.1.0.min.js"></script>
|
||||||
|
<script src="../lib/zui/js/zui.min.js"></script>
|
||||||
|
<script src="../lib/vue/vue.js"></script>
|
||||||
|
<script src="../lib/mg/js/common.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html xmlns:v-on="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>权限列表</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../../lib/zui/css/zui.min.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<table class="table table-bordered table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>权限名</th>
|
||||||
|
<th>权限说明</th>
|
||||||
|
<th>创建时间</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="(item,index) in authList" :key="item.id" :data-id="item.id" :data-index="index" >
|
||||||
|
<td>{{item.authName}}</td>
|
||||||
|
<td>{{item.authDesc}}</td>
|
||||||
|
<td>{{item.creationTime}}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="../../lib/jquery/jquery-3.1.0.min.js"></script>
|
||||||
|
<script src="../../lib/zui/js/zui.min.js"></script>
|
||||||
|
<script src="../../lib/vue/vue.js"></script>
|
||||||
|
<script src="../../lib/mg/js/common.js"></script>
|
||||||
|
<script src="../../lib/mg/js/toast.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var app = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
authList: [],
|
||||||
|
},
|
||||||
|
mounted: function(){
|
||||||
|
this.refreshList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
refreshList: function () {
|
||||||
|
post(ctx + "auth/info/list", {}, function(json){
|
||||||
|
if(validateResult(json)) {
|
||||||
|
app.authList = json.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>hello</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="app">fasfasfasfa艾斯德斯大所大所大所多撒多撒多撒多</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.reason {
|
|
||||||
color: #f00;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
123
zyplayer-doc-manage/src/main/webapp/statics/manage/home.html
Normal file
123
zyplayer-doc-manage/src/main/webapp/statics/manage/home.html
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||||
|
<title>文档管理系统 - zyplayer</title>
|
||||||
|
<link rel="shortcut icon" href="../lib/mg/img/api.ico"/>
|
||||||
|
<link rel="stylesheet" href="../lib/zui/css/zui.min.css" />
|
||||||
|
<link rel="stylesheet" href="../lib/zui/lib/dashboard/zui.dashboard.min.css" />
|
||||||
|
<link rel="stylesheet" href="../lib/zui/lib/tabs/zui.tabs.min.css" />
|
||||||
|
<link rel="stylesheet" href="../lib/mg/css/mg-ui.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="left-body" id="leftContent">
|
||||||
|
<div class="left-header">
|
||||||
|
<span class="logo" id="logoText">zyplayer-doc-manage</span>
|
||||||
|
<i class="icon icon-bars" id="changeContentWidth"></i>
|
||||||
|
</div>
|
||||||
|
<div class="scrollbar-hover left-container">
|
||||||
|
<!-- 样式类可选:tree-menu tree-folders tree-chevrons tree-angles -->
|
||||||
|
<ul class="tree tree-lines tree-menu projects" data-ride="tree">
|
||||||
|
<li id="tabZpagesNavigationLi">
|
||||||
|
<a href="#"><i class="icon icon-group"></i> 系统管理</a>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#" class="page-nav" data-id="userManage" data-href="./user/manage.html" data-icon="icon-user" data-reload="0"><i class="icon-user"></i> 人员管理</a></li>
|
||||||
|
<li><a href="#" class="page-nav" data-id="authManage" data-href="./auth/manage.html" data-icon="icon-lock" data-reload="1"><i class="icon-lock"></i> 权限列表</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="resizableLeftRight" class="ui-resizable-handle mgresizableW"></div>
|
||||||
|
<div class="right-container" id="rightContent">
|
||||||
|
<div class="right-container" id="rightContentMask"></div>
|
||||||
|
<div class="tab-page tab-zpages hide">
|
||||||
|
<div class="tabs" id="rightZpages"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
<script type="text/javascript" src="../lib/jquery/jquery-3.1.0.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../lib/zui/js/zui.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../lib/zui/lib/tabs/zui.tabs.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../lib/zui/lib/dashboard/zui.dashboard.min.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../lib/mg/js/toast.js"></script>
|
||||||
|
<script type="text/javascript" src="../lib/mg/js/common.js"></script>
|
||||||
|
<script type="text/javascript" src="../lib/mg/js/mgResizable.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// 文档管理的tables
|
||||||
|
var rightContentTabs;
|
||||||
|
/**
|
||||||
|
* 网页加载完毕后的处理
|
||||||
|
*/
|
||||||
|
$(document).ready(function(){
|
||||||
|
// 定义配置的标签页
|
||||||
|
var tabsArr = [
|
||||||
|
{id: 'about', url: './about.html', type: 'iframe', icon: 'icon-info-sign', forbidClose: false},
|
||||||
|
];
|
||||||
|
$('#rightZpages').tabs({tabs: tabsArr});
|
||||||
|
rightContentTabs = $('#rightZpages').data('zui.tabs');
|
||||||
|
/**
|
||||||
|
* 自由拖动改变左右框架的宽度
|
||||||
|
*/
|
||||||
|
$("#resizableLeftRight").mgResizableWidth({
|
||||||
|
prev:"#leftContent",
|
||||||
|
prevWtMin: 120, prevWtMax: 999999,
|
||||||
|
nextWtMin: 360, nextWtMax: 999999,
|
||||||
|
onresize:function(prevWNow, nextWNow){
|
||||||
|
changeContentWidth(prevWNow);
|
||||||
|
},
|
||||||
|
onstart:function(){
|
||||||
|
$("body").addClass("unselect");
|
||||||
|
$("#rightContentMask").show();
|
||||||
|
},
|
||||||
|
onfinish:function(){
|
||||||
|
$("body").removeClass("unselect");
|
||||||
|
$("#rightContentMask").hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面导航切换
|
||||||
|
*/
|
||||||
|
$("#tabZpagesNavigationLi").on("click", ".page-nav", function(){
|
||||||
|
var id = $(this).data("id");
|
||||||
|
var href = $(this).data("href");
|
||||||
|
var icon = $(this).data("icon");
|
||||||
|
var reload = $(this).data("reload");
|
||||||
|
$(".tab-page").hide();
|
||||||
|
$(".tab-online-debug-page").hide();
|
||||||
|
$(".tab-zpages").show();
|
||||||
|
if(reload || $("#tab-"+id).length <= 0) {
|
||||||
|
var newTab = {id: id, url: href, type: 'iframe', icon: icon};
|
||||||
|
rightContentTabs.open(newTab);
|
||||||
|
} else {
|
||||||
|
$("#tab-nav-item-"+id+" .tab-nav-link").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改左右框架的宽度
|
||||||
|
* @param width 左侧导航栏的宽度
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
function changeContentWidth(width) {
|
||||||
|
$("#leftContent").css("width", width + 'px');
|
||||||
|
$("#resizableLeftRight").css("left", width + 'px');
|
||||||
|
$("#rightContent").css("left", width + 'px');
|
||||||
|
var logoText = "zyplayer-doc-manage";
|
||||||
|
if(width < 370 && width > 290){
|
||||||
|
logoText = "zyplayer-doc";
|
||||||
|
} else if(width < 290){
|
||||||
|
logoText = "doc";
|
||||||
|
}
|
||||||
|
$("#logoText").text(logoText);
|
||||||
|
userSettings.prevWNow = width;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html xmlns:v-on="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>用户管理</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../../lib/zui/css/zui.min.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<table class="table table-bordered table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 50px;"><input type="checkbox" v-model="allUserChecked" @change="allUserCheckedChange"></th>
|
||||||
|
<th style="width: 50px;">ID</th>
|
||||||
|
<th>登录名</th>
|
||||||
|
<th>密码</th>
|
||||||
|
<th>用户名</th>
|
||||||
|
<th>邮箱</th>
|
||||||
|
<th>创建时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr v-for="(item,index) in userList" :key="item.id" :data-id="item.id" :data-index="index" >
|
||||||
|
<td><label><input type="checkbox" v-model="item.checked" @change="userCheckedChange"></label></td>
|
||||||
|
<td>{{item.id}}</td>
|
||||||
|
<td>{{item.userNo}}</td>
|
||||||
|
<td>***</td>
|
||||||
|
<td>{{item.userName}}</td>
|
||||||
|
<td>{{item.email}}</td>
|
||||||
|
<td>{{item.creationTime}}</td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-danger" type="button" @click="deleteUser(item.id)">删除</button>
|
||||||
|
<button class="btn btn-info" type="button" @click="editUser(index)">编辑</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="showAddTr" >
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td><input type="text" class="form-control" v-model="newUser.userNo"></td>
|
||||||
|
<td><input type="text" class="form-control" v-model="newUser.password"></td>
|
||||||
|
<td><input type="text" class="form-control" v-model="newUser.userName"></td>
|
||||||
|
<td><input type="text" class="form-control" v-model="newUser.email"></td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-info" type="button" v-on:click="saveAddUser">保存</button>
|
||||||
|
<button class="btn" type="button" v-on:click="addUserCancel">取消</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="8" align="center">
|
||||||
|
<button class="btn" type="button" v-on:click="btnRefreshList"> 刷新 </button>
|
||||||
|
<button class="btn btn-primary" type="button" v-on:click="addUser">增加用户</button>
|
||||||
|
<button class="btn btn-info" type="button" v-on:click="addUserAuth">分配权限</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<!-- 选择权限 -->
|
||||||
|
<div class="modal fade" id="choiceAuthModal">
|
||||||
|
<div class="modal-dialog" style="width: 650px;">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
|
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">选择分配的权限</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="alert alert-danger">选择多个用户时显示所有权限,不代表当前都具有此权限</div>
|
||||||
|
<div class="modal-table-box">
|
||||||
|
<ul id="choiceAuthListUl" class="choice">
|
||||||
|
<li v-for="(item,index) in showAuthList" :class="item.checked?'checked':''"
|
||||||
|
:key="item.id" :data-id="item.id" :data-index="index" @click="authClick(index)">
|
||||||
|
{{item.authName}}-{{item.authDesc}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div align="center" class="bottom-box">
|
||||||
|
<button type="button" class="btn btn-primary" @click="choiceAuthOk"> 确定 </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script src="../../lib/jquery/jquery-3.1.0.min.js"></script>
|
||||||
|
<script src="../../lib/zui/js/zui.min.js"></script>
|
||||||
|
<script src="../../lib/vue/vue.js"></script>
|
||||||
|
<script src="../../lib/mg/js/common.js"></script>
|
||||||
|
<script src="../../lib/mg/js/toast.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var app = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
allUserChecked: false,
|
||||||
|
showAddTr: false,
|
||||||
|
userList: [],
|
||||||
|
newUser: {},
|
||||||
|
showAuthList: [],
|
||||||
|
},
|
||||||
|
mounted: function(){
|
||||||
|
this.refreshList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
btnRefreshList: function(){
|
||||||
|
this.refreshList();
|
||||||
|
Toast.success("刷新成功!");
|
||||||
|
},
|
||||||
|
editUser: function(index){
|
||||||
|
app.showAddTr = true;
|
||||||
|
app.newUser = app.userList[index];
|
||||||
|
},
|
||||||
|
addUser: function(){
|
||||||
|
app.showAddTr = true;
|
||||||
|
},
|
||||||
|
addUserCancel: function(){
|
||||||
|
app.showAddTr = false;
|
||||||
|
app.newUser = {};
|
||||||
|
},
|
||||||
|
saveAddUser: function(){
|
||||||
|
if(isEmpty(app.newUser.userNo)) {
|
||||||
|
Toast.error("登录名不能为空");return;
|
||||||
|
}
|
||||||
|
if(isEmpty(app.newUser.userName)) {
|
||||||
|
Toast.error("用户名不能为空");return;
|
||||||
|
}
|
||||||
|
post(ctx + "user/info/update", app.newUser, function(json){
|
||||||
|
if(validateResult(json)) {
|
||||||
|
app.showAddTr = false;
|
||||||
|
app.newUser = {};
|
||||||
|
app.refreshList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addUserAuth: function(){
|
||||||
|
var userIds = this.getCheckedUserIds();
|
||||||
|
if(userIds.length <= 0) {
|
||||||
|
Toast.error("请先选中一个用户后再分配权限");return;
|
||||||
|
}
|
||||||
|
post(ctx + "user/info/auth/list", {userIds: userIds}, function(json){
|
||||||
|
if(validateResult(json)) {
|
||||||
|
app.showAuthList = json.data;
|
||||||
|
$('#choiceAuthModal').modal({moveable:true});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
choiceAuthOk: function(){
|
||||||
|
var userIds = this.getCheckedUserIds();
|
||||||
|
var authIds = "";
|
||||||
|
for (let i = 0; i < app.showAuthList.length; i++) {
|
||||||
|
if(app.showAuthList[i].checked) {
|
||||||
|
if (authIds.length > 0) {
|
||||||
|
authIds += ",";
|
||||||
|
}
|
||||||
|
authIds += app.showAuthList[i].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post(ctx + "user/info/auth/update", {userIds: userIds, authIds: authIds}, function(json){
|
||||||
|
if(validateResult(json)) {
|
||||||
|
Toast.success("保存成功!");
|
||||||
|
$('#choiceAuthModal').modal('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCheckedUserIds: function(){
|
||||||
|
var userIds = "";
|
||||||
|
for (let i = 0; i < app.userList.length; i++) {
|
||||||
|
if(app.userList[i].checked) {
|
||||||
|
if (userIds.length > 0) {
|
||||||
|
userIds += ",";
|
||||||
|
}
|
||||||
|
userIds += app.userList[i].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userIds;
|
||||||
|
},
|
||||||
|
authClick: function(index){
|
||||||
|
var checked = app.showAuthList[index].checked;
|
||||||
|
app.showAuthList[index].checked = (checked == 1) ? 0 : 1;
|
||||||
|
},
|
||||||
|
userCheckedChange: function(){
|
||||||
|
var count = 0;
|
||||||
|
for (let i = 0; i < app.userList.length; i++) {
|
||||||
|
if(app.userList[i].checked) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
app.allUserChecked = (count == app.userList.length);
|
||||||
|
},
|
||||||
|
allUserCheckedChange: function(){
|
||||||
|
for (let i = 0; i < app.userList.length; i++) {
|
||||||
|
app.userList[i].checked = app.allUserChecked;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteUser: function(id){
|
||||||
|
if(!confirm("确定要删除吗?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
post(ctx + "user/info/delete", {id: id}, function(json){
|
||||||
|
if(validateResult(json)) {
|
||||||
|
app.refreshList();
|
||||||
|
Toast.success("删除成功!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
refreshList: function () {
|
||||||
|
post(ctx + "user/info/list", {}, function(json){
|
||||||
|
if(validateResult(json)) {
|
||||||
|
app.userList = json.data;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.modal-table-box{height: 200px;overflow-y: auto;}
|
||||||
|
.modal-table-box ul{padding-left: 10px;list-style: none;}
|
||||||
|
.modal-table-box li{float: left; border: 1px solid #ccc;padding: 10px 15px; margin: 0 10px 10px 0; background-color: #ccc;cursor: pointer;}
|
||||||
|
.modal-table-box li.checked{border: 1px solid #3f51b5;background-color: #8666b8;color:#fff;}
|
||||||
|
</style>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.zyplayer.doc.swagger.controller.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import com.zyplayer.doc.swagger.framework.constant.StorageKeys;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SwaggerResourcesInfoVo {
|
||||||
|
private String url;
|
||||||
|
private String storageKey;
|
||||||
|
private Date creationTime;
|
||||||
|
private Date lastSync;
|
||||||
|
|
||||||
|
public SwaggerResourcesInfoVo(String url){
|
||||||
|
this.url = url;
|
||||||
|
this.storageKey = StorageKeys.SWAGGER_OFFLINE_DOC_START + RandomUtil.simpleUUID();
|
||||||
|
this.creationTime = new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStorageKey() {
|
||||||
|
return storageKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStorageKey(String storageKey) {
|
||||||
|
this.storageKey = storageKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreationTime() {
|
||||||
|
return creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationTime(Date creationTime) {
|
||||||
|
this.creationTime = creationTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLastSync() {
|
||||||
|
return lastSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastSync(Date lastSync) {
|
||||||
|
this.lastSync = lastSync;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user