1
This commit is contained in:
@@ -1,219 +0,0 @@
|
||||
package com.kelp.plat.controller;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.plat.entity.E_Role;
|
||||
import com.kelp.plat.entity.U_Role;
|
||||
import com.kelp.plat.service.E_RFService;
|
||||
import com.kelp.plat.service.E_RoleService;
|
||||
import com.kelp.plat.service.U_RFService;
|
||||
import com.kelp.plat.service.U_RoleService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RequestMapping("/plat/urole")
|
||||
@Controller
|
||||
public class URoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private U_RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private U_RFService rfService;
|
||||
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("mfs", rfService.getMFs());
|
||||
|
||||
return new ModelAndView("/plat/urole","modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<U_Role> list(HttpServletRequest request, Page<U_Role> page, String qname, String qtype, Integer qlevel) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<U_Role>();
|
||||
}
|
||||
|
||||
return roleService.getPage(page.getPageIndex(), page.getLimit(), qname, qlevel);
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request,U_Role role) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(role);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (roleService.getByName(role.getName()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "角色名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
role.setId(null);
|
||||
roleService.add(role);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request,U_Role role) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(role);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (role.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("role", role);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
U_Role roleP = roleService.getByName(role.getName());
|
||||
if (roleP != null && !role.getId().equals(roleP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "角色名称已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
roleService.update(role);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
U_Role role = roleService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "操作成功");
|
||||
modelMap.put("role", role);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids == null || ids.length() == 0) {
|
||||
ids = "";
|
||||
}
|
||||
|
||||
String[] ids_ = ids.split(",");
|
||||
|
||||
roleService.delete(ids_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(U_Role role) {
|
||||
|
||||
if (role == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(role.getName())
|
||||
|| role.getName().length() > 20) {
|
||||
return new ErrorMessage("角色名称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (role.getLevel() == null) {
|
||||
return new ErrorMessage("角色级别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!StringUtil.isEmpty(role.getDescription()) && role.getDescription().length() > 128) {
|
||||
return new ErrorMessage("角色说明长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
@RequestMapping("/toGrant")
|
||||
public @ResponseBody ModelMap toGrant(HttpServletRequest request,
|
||||
String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (id == null || id.length() > 32) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put("role", roleService.getById(id));
|
||||
modelMap.put("rfs", rfService.getRFs(id));
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/grant")
|
||||
public @ResponseBody ModelMap grant(HttpServletRequest request,
|
||||
String roleId, String functionIds) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtil.isEmpty(roleId) || roleId.length() > 32) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法数据!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(functionIds)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "授权成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (functionIds.endsWith(",")) {
|
||||
functionIds = functionIds.substring(0, functionIds.length() - 1);
|
||||
}
|
||||
|
||||
String[] functionIds_ = functionIds.split(",");
|
||||
rfService.setRFs(roleId, functionIds_);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "授权成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,469 +0,0 @@
|
||||
package com.kelp.website.controller;
|
||||
|
||||
import com.google.code.kaptcha.Constants;
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.common.config.RedisBean;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.constant.RegexConstants;
|
||||
import com.kelp.common.utils.CookieUtil;
|
||||
import com.kelp.common.utils.jwt.JwtUtil;
|
||||
import com.kelp.common.utils.security.Md5Utils;
|
||||
import com.kelp.crm.entity.EAccount;
|
||||
import com.kelp.plat.entity.Account;
|
||||
import com.kelp.plat.service.E_RoleService;
|
||||
import com.kelp.plat.service.RoleService;
|
||||
import com.kelp.website.entity.UAccount;
|
||||
import com.kelp.website.entity.UAccountVo;
|
||||
import com.kelp.website.service.UAccountService;
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2025/4/28 14:30
|
||||
*/
|
||||
@RequestMapping("/website")
|
||||
@Controller
|
||||
public class UAccountController extends BaseController {
|
||||
|
||||
protected String RESULT = "result";
|
||||
protected String MESSAGE = "message";
|
||||
|
||||
@Autowired
|
||||
protected RedisBean redisBean;
|
||||
@Autowired
|
||||
private E_RoleService roleService;
|
||||
@Autowired
|
||||
private UAccountService uAccountService;
|
||||
|
||||
@RequestMapping("/login")
|
||||
public @ResponseBody ModelMap login(HttpServletRequest request, HttpServletResponse response, String telephone,
|
||||
String password, String timestamp, String captcha) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtil.isEmpty(telephone) || telephone.length() != 11) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "手机号格式有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(password) || password.length() > 50) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "密码不能为空或长度错误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
// if (StringUtil.isEmpty(timestamp) || timestamp.length() > 128) {
|
||||
// modelMap.put(RESULT, false);
|
||||
// modelMap.put(MESSAGE, "非法请求!");
|
||||
// return modelMap;
|
||||
// }
|
||||
|
||||
// if (StringUtil.isEmpty(captcha) || captcha.length() > 4) {
|
||||
// modelMap.put(RESULT, false);
|
||||
// modelMap.put(MESSAGE, "非法请求!");
|
||||
// return modelMap;
|
||||
// }
|
||||
|
||||
// String captcha_ = redisBean.hget(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
// if(captcha_ == null || !captcha_.equals(captcha)) {
|
||||
// modelMap.put(RESULT, false);
|
||||
// modelMap.put(MESSAGE, "验证码不正确或已过期!");
|
||||
// return modelMap;
|
||||
// }
|
||||
|
||||
// 验证登录信息
|
||||
UAccount sysUser = uAccountService.getByTelephone(telephone);
|
||||
if (sysUser == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "账号不存在!");
|
||||
return modelMap;
|
||||
}
|
||||
boolean a=!sysUser.getPassword().equals(password);
|
||||
// if ((sysUser != null && !sysUser.getPassword().equals(password))) {
|
||||
// modelMap.put(RESULT, false);
|
||||
// modelMap.put(MESSAGE, "账号或密码错误!");
|
||||
// return modelMap;
|
||||
// }
|
||||
// if (sysUser.getState().equals("10")) {
|
||||
// modelMap.put(RESULT, false);
|
||||
// modelMap.put(MESSAGE, "账号已禁用!");
|
||||
// return modelMap;
|
||||
// }
|
||||
|
||||
// 删除redis中的验证码
|
||||
redisBean.hdel(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
|
||||
String token = JwtUtil.sign(String.valueOf(sysUser.getId()), request.getSession().getId(), KeyConstant.JWTKEY);
|
||||
// 设置token到cookie
|
||||
CookieUtil.addCookie(response, "token", token);
|
||||
|
||||
// 向redis中写入
|
||||
redisBean.hset(String.valueOf(sysUser.getId()), "u_token", token);
|
||||
redisBean.hset(String.valueOf(sysUser.getId()), "u_role",sysUser.getRoleId());
|
||||
modelMap.put("enterpriseName",sysUser.getEnterpriseName());
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "登录成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
@RequestMapping("/register")
|
||||
public @ResponseBody ModelMap register(HttpServletRequest request,HttpServletResponse response, UAccountVo sysUserVo ) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
UAccount sysUser=new UAccount();
|
||||
BeanUtils.copyProperties(sysUserVo,sysUser);
|
||||
ErrorMessage message = invalid(sysUser);
|
||||
String timestamp=sysUserVo.getTimestamp();
|
||||
String captcha= sysUserVo.getCaptcha();
|
||||
if (StringUtil.isEmpty(timestamp) || timestamp.length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
String captcha_ = redisBean.hget(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||
if(captcha_ == null || !captcha_.equals(captcha)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "验证码不正确或已过期!");
|
||||
return modelMap;
|
||||
}
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (uAccountService.getByTelephone(sysUser.getTelephone()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
sysUser.setId(null);
|
||||
sysUser.setPassword(Md5Utils.hash(sysUser.getPassword()));
|
||||
sysUser.setRoleId("1");
|
||||
uAccountService.add(sysUser);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
|
||||
private ErrorMessage invalid(UAccount sysUser) {
|
||||
|
||||
if (sysUser == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(sysUser.getName()) || sysUser.getName().length() > 128) {
|
||||
return new ErrorMessage("昵称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(sysUser.getTelephone()) || sysUser.getTelephone().length() > 128) {
|
||||
return new ErrorMessage("手机号不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!sysUser.getTelephone().matches(RegexConstants.MOBILE_PHONE_NUMBER_PATTERN)) {
|
||||
return new ErrorMessage("手机号格式有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
@RequestMapping("/toPage")
|
||||
public @ResponseBody ModelAndView toPage(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roles", roleService.getAll());
|
||||
|
||||
// 从redis中取当前登录人所属部门id
|
||||
modelMap.put("departmentId", getDepartmentId(request));
|
||||
|
||||
return new ModelAndView("/website/account", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<UAccount> list(HttpServletRequest request, Page<UAccount> page, String qdepartmentId,
|
||||
String qname, String qtelephone, String qroleId, String qstate) {
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<UAccount>();
|
||||
}
|
||||
|
||||
if (StringUtil.isEmpty(qdepartmentId)) {
|
||||
// 从redis中取当前登录人所属部门id
|
||||
qdepartmentId = getDepartmentId(request);
|
||||
}
|
||||
|
||||
return uAccountService.getPage(page.getPageIndex(), page.getLimit(), getEnterpriseId(request), qdepartmentId,
|
||||
qname, qtelephone, qroleId, qstate);
|
||||
}
|
||||
|
||||
@RequestMapping("/toEdit")
|
||||
public @ResponseBody ModelMap toEdit(HttpServletRequest request, String id) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法操作!");
|
||||
|
||||
if (id != null && id.length() > 0 && id.length() <= 32) {
|
||||
UAccount account = uAccountService.getById(id);
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "");
|
||||
modelMap.put("account", account);
|
||||
}
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
public @ResponseBody ModelMap add(HttpServletRequest request, UAccount account) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (uAccountService.getByTelephone(account.getTelephone()) != null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setId(null);
|
||||
|
||||
account.setPassword(Md5Utils.hash("d1234567"));
|
||||
uAccountService.add(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
public @ResponseBody ModelMap update(HttpServletRequest request, UAccount account) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
ErrorMessage message = invalid(account);
|
||||
if (!message.getStatus()) {
|
||||
modelMap.put(MESSAGE, message.getMessage());
|
||||
modelMap.put(RESULT, message.getStatus());
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getId() == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "数据有误!");
|
||||
modelMap.put("account", account);
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
UAccount accountP = uAccountService.getByTelephone(account.getTelephone());
|
||||
if (accountP != null && !account.getId().equals(accountP.getId())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "电话号码已经存在!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
accountP = uAccountService.getById(String.valueOf(account.getId()));
|
||||
if (accountP == null) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "非法请求!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setCreateTime(accountP.getCreateTime());
|
||||
account.setUpdateTime(System.currentTimeMillis());
|
||||
account.setPassword(accountP.getPassword());
|
||||
|
||||
|
||||
uAccountService.update(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "保存成功!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public @ResponseBody ModelMap delete(HttpServletRequest request, String ids) {
|
||||
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (ids != null && ids.length() > 0) {
|
||||
String[] ids_ = ids.split(",");
|
||||
uAccountService.delete(ids_);
|
||||
}
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "删除成功!");
|
||||
|
||||
return modelMap;
|
||||
|
||||
}
|
||||
|
||||
private ErrorMessage invalid(EAccount account) {
|
||||
|
||||
if (account == null) {
|
||||
return new ErrorMessage("数据有误!", false);
|
||||
}
|
||||
|
||||
if (account.getDepartmentId() == null) {
|
||||
return new ErrorMessage("所属部门不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
return new ErrorMessage("昵称不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRealName() != null && account.getRealName().length() > 128) {
|
||||
return new ErrorMessage("真实姓名长度有误!", false);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(account.getTelephone()) || account.getTelephone().length() > 128) {
|
||||
return new ErrorMessage("手机号不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (!account.getTelephone().matches(RegexConstants.MOBILE_PHONE_NUMBER_PATTERN)) {
|
||||
return new ErrorMessage("手机号格式有误!", false);
|
||||
}
|
||||
|
||||
if (account.getSex() == null || account.getSex().length() != 1) {
|
||||
return new ErrorMessage("性别不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getRoleId() == null) {
|
||||
return new ErrorMessage("账号角色不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
if (account.getState() == null || account.getState().length() != 2) {
|
||||
return new ErrorMessage("账号状态不能为空或长度有误!", false);
|
||||
}
|
||||
|
||||
return new ErrorMessage("", true);
|
||||
}
|
||||
|
||||
@RequestMapping("/toSelfInfo")
|
||||
public @ResponseBody ModelAndView toSelfInfo(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
modelMap.put("roleName", roleService.getById(redisBean.hget(getAccountId(request), "e_role")).getName());
|
||||
|
||||
UAccount account = uAccountService.getById(getAccountId(request));
|
||||
modelMap.put("account", account);
|
||||
|
||||
return new ModelAndView("/website/self_info", "modelMap", modelMap);
|
||||
}
|
||||
|
||||
@RequestMapping("/selfInfo")
|
||||
public @ResponseBody ModelMap selfInof(HttpServletRequest request, HttpServletResponse response, UAccount account,
|
||||
MultipartFile avatarFile) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtils.isEmpty(account.getName()) || account.getName().length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "昵称不能为空或长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (account.getName() != null && account.getName().length() > 128) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "真实姓名长度有误!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
UAccount accountP = uAccountService.getById(getAccountId(request));
|
||||
accountP.setName(account.getName());
|
||||
|
||||
|
||||
// if (avatarFile != null && !avatarFile.isEmpty()) {
|
||||
// String avatarPath = fileUploadService.uploadImageFile(avatarFile);
|
||||
// if (avatarPath != null && avatarPath.equals("10")) {
|
||||
// modelMap.put(RESULT, false);
|
||||
// modelMap.put(MESSAGE, "文件格式不正确!");
|
||||
// return modelMap;
|
||||
// }
|
||||
//
|
||||
// accountP.setAvatar(avatarPath);
|
||||
// }
|
||||
|
||||
uAccountService.update(accountP);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "个人资料修改成功!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/toPassword")
|
||||
public @ResponseBody ModelAndView toPassword(HttpServletRequest request, HttpServletResponse response) {
|
||||
return new ModelAndView("/crm/password");
|
||||
}
|
||||
|
||||
@RequestMapping("/password")
|
||||
public @ResponseBody ModelMap password(HttpServletRequest request, HttpServletResponse response, String opassword,
|
||||
String npassword, String cpassword) {
|
||||
ModelMap modelMap = new ModelMap();
|
||||
|
||||
if (StringUtils.isEmpty(opassword) || opassword.length() < 6) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "原始密码不能为空!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(npassword) || npassword.length() < 6) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码不能为空且不能少于6位!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (!opassword.matches(RegexConstants.LETTER_DIGIT_PATTERN)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码必须包含数字和字母!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(cpassword) || !cpassword.equals(npassword)) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "新密码与确认密码不一致!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
String accountId = getAccountId(request);
|
||||
UAccount account = uAccountService.getById(accountId);
|
||||
if (!Md5Utils.hash(opassword).equals(account.getPassword())) {
|
||||
modelMap.put(RESULT, false);
|
||||
modelMap.put(MESSAGE, "旧密码输入不正确!");
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
account.setPassword(Md5Utils.hash(npassword));
|
||||
uAccountService.update(account);
|
||||
|
||||
modelMap.put(RESULT, true);
|
||||
modelMap.put(MESSAGE, "密码修改成功,建议您重新登录!");
|
||||
|
||||
return modelMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.kelp.website.controller;
|
||||
|
||||
import com.kelp.base.Page;
|
||||
import com.kelp.biz.entity.Dict;
|
||||
import com.kelp.common.constant.KeyConstant;
|
||||
import com.kelp.common.utils.AESUtil;
|
||||
import com.kelp.common.utils.CookieUtil;
|
||||
import com.kelp.common.utils.jwt.JwtUtil;
|
||||
import com.kelp.crm.entity.ECustomer;
|
||||
import com.kelp.crm.entity.Enterprise;
|
||||
import com.kelp.crm.service.ECustomerService;
|
||||
import com.kelp.crm.service.EnterpriseService;
|
||||
import com.kelp.framework.base.controller.ErrorMessage;
|
||||
import com.kelp.website.entity.UAccount;
|
||||
import com.kelp.website.entity.UContract;
|
||||
import com.kelp.website.service.UAccountService;
|
||||
import com.kelp.website.service.UContractService;
|
||||
import com.opensymphony.oscache.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2025/4/30 9:00
|
||||
*/
|
||||
@RequestMapping("/website/contract")
|
||||
@Controller
|
||||
public class UContractController {
|
||||
protected String RESULT = "result";
|
||||
protected String MESSAGE = "message";
|
||||
@Autowired
|
||||
UContractService uContractService;
|
||||
@Autowired
|
||||
UAccountService uAccountService;
|
||||
@Autowired
|
||||
ECustomerService eCustomerService;
|
||||
@Autowired
|
||||
EnterpriseService enterpriseService;
|
||||
@RequestMapping("/list")
|
||||
public @ResponseBody Page<UContract> list(HttpServletRequest request, Page<UContract> page, String qname, String qtype, String qstate) {
|
||||
String token = CookieUtil.getCookie(request, "token");
|
||||
String accountId = JwtUtil.getId(token);
|
||||
UAccount uAccount = uAccountService.getById(accountId);
|
||||
String encrypt = AESUtil.encrypt(uAccount.getTelephone(), KeyConstant.TELEPHONE);
|
||||
ECustomer byPhone = eCustomerService.getByPhone(encrypt);
|
||||
if(byPhone ==null){
|
||||
page = new Page<UContract>();
|
||||
}
|
||||
|
||||
if (page == null) {
|
||||
page = new Page<UContract>();
|
||||
}
|
||||
|
||||
return uContractService.getPage(page.getPageIndex(), page.getLimit(), byPhone.getId());
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.kelp.website.controller;
|
||||
|
||||
import com.kelp.framework.base.controller.BaseController;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 后端访问地址
|
||||
*/
|
||||
@RequestMapping("/website")
|
||||
@Controller
|
||||
public class UIndexController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* springboot 启动访问的页面,如果不写默认访问index
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/index")
|
||||
public String index(HttpServletRequest request, HttpServletResponse response) {
|
||||
return "/website/login";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,413 +0,0 @@
|
||||
layui.use([ 'form', 'table' ], function() {
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
|
||||
//table options
|
||||
options = {
|
||||
elem : '#dataTable',
|
||||
url : basePath + '/plat/urole/list',
|
||||
method: 'post',
|
||||
where:{
|
||||
qname:$("#qname").val(),
|
||||
qlevel:$("#qlevel").val()
|
||||
},
|
||||
//分页请求参数
|
||||
request:{
|
||||
pageName: 'pageIndex', //页码
|
||||
limitName: 'limit' //每页多少数据
|
||||
},
|
||||
//返回的数据格式
|
||||
response:{
|
||||
statusName: 'status', //数据状态的字段名称,默认:code
|
||||
statusCode: 200, //成功的状态码,默认:0
|
||||
msgName: 'message', //状态信息的字段名称,默认:msg
|
||||
countName: 'total', //数据总数的字段名称,默认:count
|
||||
dataName: 'data' //数据列表的字段名称,默认:data
|
||||
},
|
||||
//每页10条数据
|
||||
limit: 10,
|
||||
//加载时出现加载条
|
||||
loading: true,
|
||||
toolbar : '#toolbar' // 开启头部工具栏,并为其绑定左侧模板
|
||||
,
|
||||
defaultToolbar : [
|
||||
{ // 自定义头部工具栏右侧图标
|
||||
title : '搜索',
|
||||
layEvent : 'search_box_display',
|
||||
icon : 'layui-icon-search'
|
||||
} ,
|
||||
'filter', 'exports', 'print'],
|
||||
title : '角色列表',
|
||||
cellMinWidth: 120,
|
||||
cols: [[
|
||||
{type:'numbers'},
|
||||
{type: 'checkbox'},
|
||||
{field:'id',title: 'id', hide:true},
|
||||
{field:'name', title: '名称',event:'edit',style:'cursor: pointer;'},
|
||||
{field:'level', title: '级别'},
|
||||
{field:'description', title: '说明'},
|
||||
{field: 'right',title:'操作', toolbar: '#rowbar'},
|
||||
]],
|
||||
done:function (res) {//返回数据执行回调函数
|
||||
layer.close(layer.load(2)); //返回数据关闭loading
|
||||
},
|
||||
fixedHeader: true,
|
||||
id: 'dataTable',
|
||||
page : true
|
||||
};
|
||||
|
||||
//加载数据
|
||||
table.render(options);
|
||||
|
||||
//监听toolbar事件
|
||||
table.on('toolbar(tablefilter)', function(obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'add':
|
||||
add();
|
||||
break;
|
||||
case 'edit':
|
||||
var data = checkStatus.data;
|
||||
if(data.length == 0){
|
||||
layer.msg('请先选择要编辑的数据!',{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
if(data.length > 1){
|
||||
layer.msg('只能选择一条要编辑的数据!',{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
if(data.length == 1){
|
||||
edit(data[0].id);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
var data = checkStatus.data;
|
||||
if(data.length == 0){
|
||||
layer.msg('请先选择要删除的数据!',{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
var ids_ = "";
|
||||
for(var i=0;i<data.length;i++){
|
||||
ids_ += data[i].id + ",";
|
||||
}
|
||||
layer.confirm('您真的要删除所选择数据吗?', function(index){
|
||||
delete_(ids_);
|
||||
layer.close(index);
|
||||
});
|
||||
break;
|
||||
// 自定义头工具栏右侧图标 - 隐藏搜索栏
|
||||
case 'search_box_display':
|
||||
searchboxToggle();
|
||||
break;
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
// 监听rowbar事件
|
||||
table.on('tool(tablefilter)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('您真的要删除吗?', function(index) {
|
||||
delete_(data.id);
|
||||
layer.close(index);
|
||||
});
|
||||
} else if (obj.event === 'edit') {
|
||||
edit(data.id);
|
||||
} else if(obj.event === 'grant'){
|
||||
grant(data.id);
|
||||
}
|
||||
});
|
||||
|
||||
//添加
|
||||
function add(){
|
||||
|
||||
//清理数据
|
||||
$("#edit_id_").val("");
|
||||
$("#name").val("");
|
||||
$("#level").val("");
|
||||
$("#description").val("");
|
||||
|
||||
//刷新页面
|
||||
form.render();
|
||||
|
||||
layer.open({
|
||||
title:"添加/编辑",
|
||||
area: ['100%','100%'],
|
||||
closeBtn:1,
|
||||
type: 1,
|
||||
scrollbar:false,
|
||||
content:$("#form_edit"),
|
||||
cancel: function(index, layero){
|
||||
layer.close(index);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//关闭添加/编辑页面
|
||||
form.on('submit(close_)', function (data){
|
||||
layer.close(layer.index);
|
||||
});
|
||||
|
||||
//添加或编辑保存数据
|
||||
form.on('submit(edit_)', function (data){
|
||||
|
||||
var result = false;
|
||||
|
||||
var name = data.field.name;
|
||||
var level = data.field.level;
|
||||
var description = data.field.description;
|
||||
var id_ = data.field.edit_id_;
|
||||
|
||||
var url = basePath + "/plat/urole/add";
|
||||
|
||||
if(id_.length > 0){
|
||||
url = basePath + "/plat/urole/update";
|
||||
}
|
||||
|
||||
if(name.length == 0 || name.length > 20){
|
||||
layer.msg('名称不能为空且不能超过20个字符!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(level.length == 0 || level.length > 2){
|
||||
layer.msg('级别不能为空且不能超过20个字符!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(description.length == 0 || description.length > 20){
|
||||
layer.msg('说明不能超过20个字符!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
"id":id_,
|
||||
"name":name,
|
||||
"level":level,
|
||||
"description":description,
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
layer.msg(data.message,{icon:1,time:2000});
|
||||
layer.closeAll("page");
|
||||
reload();
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('保存失败,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
});
|
||||
|
||||
//编辑
|
||||
function edit(id){
|
||||
|
||||
$.ajax({
|
||||
url: basePath + "/plat/urole/toEdit",
|
||||
data: {
|
||||
"id":id
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
$("#edit_id_").val(data.role.id);
|
||||
$("#name").val(data.role.name);
|
||||
$("#level").val(data.role.level);
|
||||
$("#description").val(data.role.description);
|
||||
|
||||
//刷新页面
|
||||
form.render();
|
||||
|
||||
layer.open({
|
||||
title:"添加/编辑",
|
||||
area: ['100%','100%'],
|
||||
closeBtn:1,
|
||||
type: 1,
|
||||
scrollbar:false,
|
||||
content:$("#form_edit"),
|
||||
cancel: function(index, layero){
|
||||
layer.close(index);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('服务器错误,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//删除
|
||||
function delete_(ids){
|
||||
$.ajax({
|
||||
url: basePath + "/plat/urole/delete",
|
||||
data: {
|
||||
"ids":ids
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
reload();
|
||||
layer.msg('删除成功!',{icon:1,time:1000});
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('服务器错误,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//监听全选事件
|
||||
form.on('checkbox(pgroup_)',function(data){
|
||||
if(data.elem.checked){
|
||||
$("input[name='" + data.elem.id +"']").each(function(){
|
||||
$(this).prop("checked",true);
|
||||
});
|
||||
form.render();
|
||||
}else{
|
||||
$("input[name='" + data.elem.id +"']").each(function(){
|
||||
$(this).prop("checked",false);
|
||||
});
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
|
||||
//打开授权页面
|
||||
function grant(id){
|
||||
|
||||
$.ajax({
|
||||
url: basePath + "/plat/urole/toGrant",
|
||||
data: {
|
||||
"id":id
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
|
||||
$("#grant_id_").val(data.role.id);
|
||||
|
||||
$("input:checkbox").each(function(){
|
||||
$(this).prop("checked",false);
|
||||
});
|
||||
|
||||
for(var i=0;i<data.rfs.length;i++){
|
||||
if($("input[fid='" + data.rfs[i].functionId + "']")[0] != null){
|
||||
var aa = $("input[fid='" + data.rfs[i].functionId + "']")[0].checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
//刷新页面
|
||||
form.render();
|
||||
|
||||
layer.open({
|
||||
title:"角色 " + data.role.name + " 权限",
|
||||
area: ['100%','100%'],
|
||||
closeBtn:1,
|
||||
type: 1,
|
||||
scrollbar:false,
|
||||
content:$("#form_grant"),
|
||||
cancel: function(index, layero){
|
||||
layer.close(index);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('服务器错误,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//授权
|
||||
form.on('submit(grant_)', function (data){
|
||||
|
||||
var result = false;
|
||||
|
||||
var roleId = $("#grant_id_").val();
|
||||
|
||||
var functionIds = "";
|
||||
|
||||
$(".pfunction").each(function(){
|
||||
if($(this).prop("checked")){
|
||||
functionIds += $(this).val() + ",";
|
||||
}
|
||||
});
|
||||
|
||||
var url = basePath + "/plat/urole/grant";
|
||||
|
||||
if(roleId.length > 32){
|
||||
layer.msg('角色信息有误!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(functionIds.length == 0){
|
||||
layer.msg('请选择角色权限!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
"roleId":roleId,
|
||||
"functionIds":functionIds
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
result = true;
|
||||
layer.msg(data.message,{icon:1,time:2000});
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('服务器错误,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
});
|
||||
|
||||
$('#reload').on('click', function(){
|
||||
reload();
|
||||
});
|
||||
|
||||
$("#resetq").on('click',function(){
|
||||
$("#qname").val("");
|
||||
$("#qlevel").val("");
|
||||
form.render();
|
||||
});
|
||||
|
||||
$("#resetf").on('click',function(){
|
||||
$("#form_edit")[0].reset();
|
||||
});
|
||||
|
||||
function reload(){
|
||||
layer.load(2);
|
||||
options.where.qname = $("#qname").val();
|
||||
options.where.qlevel = $("#qlevel").val();
|
||||
table.reload("dataTable",options);
|
||||
}
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
.layui-table-cell{
|
||||
height:auto!important;
|
||||
white-space:normal;
|
||||
}
|
||||
|
||||
#avatarImg{
|
||||
width:200px;
|
||||
height:200px;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
|
||||
.uploadButton {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
background: #d8b49c;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
border-radius: 2px;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uploadFile {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.kelp-avatarPreview {
|
||||
float:right;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
.layui-table-cell{
|
||||
height:auto!important;
|
||||
white-space:normal;
|
||||
}
|
||||
|
||||
#avatarImg{
|
||||
width:200px;
|
||||
height:200px;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
|
||||
.uploadButton {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
background: #d8b49c;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
border-radius: 2px;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uploadFile {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.kelp-avatarPreview {
|
||||
float:right;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
.layui-table-cell{
|
||||
height:auto!important;
|
||||
white-space:normal;
|
||||
}
|
||||
|
||||
#avatarImg{
|
||||
width:200px;
|
||||
height:200px;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
|
||||
.uploadButton {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
background: #d8b49c;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
border-radius: 2px;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uploadFile {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.kelp-avatarPreview {
|
||||
float:right;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
.layui-table-cell{
|
||||
height:auto!important;
|
||||
white-space:normal;
|
||||
}
|
||||
|
||||
#avatarImg{
|
||||
width:200px;
|
||||
height:200px;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
|
||||
.uploadButton {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
background: #d8b49c;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
border-radius: 2px;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uploadFile {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.kelp-avatarPreview {
|
||||
float:right;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
.layui-table-cell{
|
||||
height:auto!important;
|
||||
white-space:normal;
|
||||
}
|
||||
|
||||
#avatarImg{
|
||||
width:200px;
|
||||
height:200px;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
|
||||
.uploadButton {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
background: #d8b49c;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
border-radius: 2px;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uploadFile {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.kelp-avatarPreview {
|
||||
float:right;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#avatarImg{
|
||||
width:200px;
|
||||
height:200px;
|
||||
margin-bottom:2px;
|
||||
}
|
||||
|
||||
.uploadButton {
|
||||
width: 200px;
|
||||
height: auto;
|
||||
overflow: hidden;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
background: #d8b49c;
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
border-radius: 2px;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.uploadFile {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
opacity: 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.kelp-avatarPreview {
|
||||
float:right;
|
||||
}
|
||||
@@ -1,328 +0,0 @@
|
||||
layui.use([ 'form', 'table' ], function() {
|
||||
var form = layui.form;
|
||||
var table = layui.table;
|
||||
|
||||
//table options
|
||||
options = {
|
||||
elem : '#dataTable',
|
||||
url : basePath + '/website/account/list',
|
||||
method: 'post',
|
||||
where:{
|
||||
qname:$("#qname").val(),
|
||||
qtelephone:$("#qtelephone").val(),
|
||||
qroleId:$("#qroleId").val(),
|
||||
qstate:$("#qstate").val(),
|
||||
},
|
||||
//分页请求参数
|
||||
request:{
|
||||
pageName: 'pageIndex', //页码
|
||||
limitName: 'limit' //每页多少数据
|
||||
},
|
||||
//返回的数据格式
|
||||
response:{
|
||||
statusName: 'status', //数据状态的字段名称,默认:code
|
||||
statusCode: 200, //成功的状态码,默认:0
|
||||
msgName: 'message', //状态信息的字段名称,默认:msg
|
||||
countName: 'total', //数据总数的字段名称,默认:count
|
||||
dataName: 'data' //数据列表的字段名称,默认:data
|
||||
},
|
||||
//每页10条数据
|
||||
limit: 10,
|
||||
//加载时出现加载条
|
||||
loading: true,
|
||||
toolbar : '#toolbar' // 开启头部工具栏,并为其绑定左侧模板
|
||||
,
|
||||
defaultToolbar : [
|
||||
{ // 自定义头部工具栏右侧图标
|
||||
title : '搜索',
|
||||
layEvent : 'search_box_display',
|
||||
icon : 'layui-icon-search'
|
||||
} ,
|
||||
'filter', 'exports', 'print'],
|
||||
title : '账号列表',
|
||||
cellMinWidth: 120,
|
||||
cols: [[
|
||||
{type:'numbers'},
|
||||
{type: 'checkbox'},
|
||||
{field:'id', title: 'id',hide:true},
|
||||
{field:'name', title: '昵称',sort:true},
|
||||
{field:'telephone', title: '手机号',sort:true},
|
||||
{field:'roleId', title: '所属角色',sort:true,templet: '#roleTpl'},
|
||||
{field:'state', title: '状态',templet: '#stateTpl'},
|
||||
{field: 'right',title:'操作', toolbar: '#rowbar'},
|
||||
]],
|
||||
done:function (res) {//返回数据执行回调函数
|
||||
layer.close(layer.load(2)); //返回数据关闭loading
|
||||
},
|
||||
fixedHeader: true,
|
||||
id: 'dataTable',
|
||||
page : true
|
||||
};
|
||||
|
||||
//加载数据
|
||||
table.render(options);
|
||||
|
||||
//监听toolbar事件
|
||||
table.on('toolbar(tablefilter)', function(obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'add':
|
||||
add();
|
||||
break;
|
||||
case 'edit':
|
||||
var data = checkStatus.data;
|
||||
if(data.length == 0){
|
||||
layer.msg('请先选择要编辑的数据!',{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
if(data.length > 1){
|
||||
layer.msg('只能选择一条要编辑的数据!',{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
if(data.length == 1){
|
||||
edit(data[0].id);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
var data = checkStatus.data;
|
||||
if(data.length == 0){
|
||||
layer.msg('请先选择要禁用的数据!',{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
var ids_ = "";
|
||||
for(var i=0;i<data.length;i++){
|
||||
ids_ += data[i].id + ",";
|
||||
}
|
||||
layer.confirm('您真的要禁用所选择数据吗?', function(index){
|
||||
delete_(ids_);
|
||||
layer.close(index);
|
||||
});
|
||||
break;
|
||||
// 自定义头工具栏右侧图标 - 隐藏搜索栏
|
||||
case 'search_box_display':
|
||||
searchboxToggle();
|
||||
break;
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
// 监听rowbar事件
|
||||
table.on('tool(tablefilter)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('您真的要禁用吗?', function(index) {
|
||||
delete_(data.id);
|
||||
layer.close(index);
|
||||
});
|
||||
} else if (obj.event === 'edit') {
|
||||
edit(data.id);
|
||||
}
|
||||
});
|
||||
|
||||
//添加
|
||||
function add(){
|
||||
|
||||
//清理数据
|
||||
$("#edit_id_").val("");
|
||||
$("#name").val("");
|
||||
$("#realName").val("");
|
||||
$("#telephone").val("");
|
||||
$("#sex").val("0");
|
||||
$("#roleId").val("");
|
||||
$("#state").val("00");
|
||||
|
||||
//刷新页面
|
||||
form.render();
|
||||
|
||||
layer.open({
|
||||
title:"添加/编辑",
|
||||
area: ['100%','100%'],
|
||||
closeBtn:1,
|
||||
type: 1,
|
||||
scrollbar:false,
|
||||
content:$("#form_edit"),
|
||||
cancel: function(index, layero){
|
||||
layer.close(index);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//关闭添加/编辑页面
|
||||
form.on('submit(close_)', function (data){
|
||||
layer.close(layer.index);
|
||||
});
|
||||
|
||||
//添加或编辑保存数据
|
||||
form.on('submit(edit_)', function (data){
|
||||
|
||||
var result = false;
|
||||
|
||||
var name = data.field.name;
|
||||
var realName = data.field.realName;
|
||||
var telephone = data.field.telephone;
|
||||
var sex = data.field.sex;
|
||||
var roleId = data.field.roleId;
|
||||
var state = data.field.state;
|
||||
var id_ = data.field.edit_id_;
|
||||
|
||||
var url = basePath + "/website/account/add";
|
||||
|
||||
if(id_.length > 0){
|
||||
url = basePath + "/website/account/update";
|
||||
}
|
||||
|
||||
if(name.length == 0 || name.length > 50){
|
||||
layer.msg('昵称不能为空且不能超过50个字符!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(realName != null && realName.length > 0 && realName.length > 50){
|
||||
layer.msg('真实姓名不能超过50个字符!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(telephone.length == 0 || telephone.length > 20){
|
||||
layer.msg('手机号不能为空且不能超过20个字符!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(sex.length == 0 || sex.length != 1){
|
||||
layer.msg('性别不能为空或数据非法!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(roleId.length == 0 || roleId.length > 32){
|
||||
layer.msg('所属角色不能为空或数据非法!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
if(state.length == 0 || state.length != 2){
|
||||
layer.msg('账号状态不能为空或数据非法!',{icon:2,time:2000});
|
||||
return result;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
"id":id_,
|
||||
"name":name,
|
||||
"realName":realName,
|
||||
"telephone":telephone,
|
||||
"sex":sex,
|
||||
"roleId":roleId,
|
||||
"state":state,
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
layer.msg(data.message,{icon:1,time:2000});
|
||||
layer.closeAll("page");
|
||||
reload();
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('保存失败,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
});
|
||||
|
||||
//编辑
|
||||
function edit(id){
|
||||
|
||||
$.ajax({
|
||||
url: basePath + "/website/account/toEdit",
|
||||
data: {
|
||||
"id":id
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
$("#edit_id_").val(data.account.id);
|
||||
$("#name").val(data.account.name);
|
||||
$("#realName").val(data.account.realName);
|
||||
$("#telephone").val(data.account.telephone);
|
||||
$("#sex").val(data.account.sex);
|
||||
$("#roleId").val(data.account.roleId);
|
||||
$("#state").val(data.account.state);
|
||||
|
||||
//刷新页面
|
||||
form.render();
|
||||
|
||||
layer.open({
|
||||
title:"添加/编辑",
|
||||
area: ['100%','100%'],
|
||||
closeBtn:1,
|
||||
type: 1,
|
||||
scrollbar:false,
|
||||
content:$("#form_edit"),
|
||||
cancel: function(index, layero){
|
||||
layer.close(index);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('服务器错误,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//删除
|
||||
function delete_(ids){
|
||||
$.ajax({
|
||||
url: basePath + "/website/account/delete",
|
||||
data: {
|
||||
"ids":ids
|
||||
},
|
||||
type : 'post',
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
if (data.result == true) {
|
||||
reload();
|
||||
layer.msg('删除成功!',{icon:1,time:1000});
|
||||
} else {
|
||||
layer.msg(data.message,{icon:2,time:2000});
|
||||
}
|
||||
},
|
||||
error : function() {
|
||||
layer.msg('服务器错误,请重试!',{icon:2,time:2000});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#reload').on('click', function(){
|
||||
reload();
|
||||
});
|
||||
|
||||
$("#resetq").on('click',function(){
|
||||
$("#qname").val("");
|
||||
$("#qtelephone").val("");
|
||||
$("#qroleId").val("");
|
||||
$("#qstate").val("00");
|
||||
form.render();
|
||||
});
|
||||
|
||||
$("#resetf").on('click',function(){
|
||||
$("#form_edit")[0].reset();
|
||||
});
|
||||
|
||||
function reload(){
|
||||
layer.load(2);
|
||||
options.where.qname = $("#qname").val();
|
||||
options.where.qtelephone = $("#qtelephone").val();
|
||||
options.where.qroleId = $("#qroleId").val();
|
||||
options.where.qstate = $("#qstate").val();
|
||||
table.reload("dataTable",options);
|
||||
}
|
||||
});
|
||||
@@ -1,149 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<title>客户角色管理</title>
|
||||
<#include "/common/include.ftl"/>
|
||||
<#include "/common/plugins.ftl"/>
|
||||
<#include "/common/kelp.ftl"/>
|
||||
<script type="text/javascript" src="${base}/static/plat/js/urole.js" ></script>
|
||||
</head>
|
||||
|
||||
<body >
|
||||
<!-- search box start -->
|
||||
<div class="kelp-search-collapse" id="kelp_searchbox">
|
||||
<div class="layui-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qname" id="qname" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">级别:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="qlevel" id="qlevel" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline" style="margin-top:-7px;">
|
||||
<button class="layui-btn layui-btn-sm" id="reload">查询</button>
|
||||
<button class="layui-btn layui-btn-sm" id="resetq">重置</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- search box end -->
|
||||
|
||||
<!-- table start -->
|
||||
<table class="layui-hide" id="dataTable" lay-filter="tablefilter"></table>
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i></button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="edit"><i class="layui-icon"></i></button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="delete"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="rowbar">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon"></i></a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i></a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="grant"><i class="layui-icon"></i></a>
|
||||
</script>
|
||||
<!-- table end -->
|
||||
|
||||
<!-- editor form start -->
|
||||
<form class="layui-form" id="form_edit" hidden style="margin-top: 20px;">
|
||||
<input type="hidden" class="layui-input" placeholder="" id="edit_id_" name="edit_id_">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="name" id="name" class="layui-input" lay-verify="required" maxlength="20"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>级别:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="level" id="level" class="layui-input" lay-verify="required" maxlength="20"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>说明:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="description" id="description" lay-verify="required" class="layui-textarea" style="width:97%;height:80%"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button lay-submit lay-filter="edit_" class="layui-btn layui-btn-sm" id="edit_save">保存</button>
|
||||
<button lay-filter="close_" class="layui-btn layui-btn-sm" id="edit_close">关闭</button>
|
||||
<button type="button" id="resetf" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- editor form end -->
|
||||
|
||||
<!-- grant form start -->
|
||||
<form class="layui-form" id="form_grant" hidden style="margin-top: 20px;">
|
||||
<input type="hidden" class="layui-input" placeholder="" id="grant_id_" name="grant_id_">
|
||||
|
||||
<div style="width:96%;margin:0 auto;">
|
||||
<table class="layui-table" id="grant_table" lay-filter="grant_table">
|
||||
<colgroup>
|
||||
<col width="200">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>模块名称</th>
|
||||
<th>功能</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#list modelMap.mfs as mfs>
|
||||
<tr>
|
||||
<td><input type="checkbox" lay-skin="primary" title="${mfs.module.name}" id="${mfs.module.id}" lay-filter="pgroup_" class="pgroup_"/></td>
|
||||
<td>
|
||||
<#list mfs.functions as function>
|
||||
<div style="width:200px;float:left;margin-top:5px;">
|
||||
<input type="checkbox" lay-skin="primary" class="pfunction" fid="${function.id}" title="${function.name}" name="${function.moduleId}" value="${function.id}"/>
|
||||
</div>
|
||||
</#list>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button lay-submit lay-filter="grant_" class="layui-btn layui-btn-sm" id="grant_save">授权</button>
|
||||
<button lay-filter="close_" class="layui-btn layui-btn-sm" id="grant_close">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- grant form end -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,193 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<title>账号管理</title>
|
||||
<#include "/common/include.ftl"/>
|
||||
<#include "/common/plugins.ftl"/>
|
||||
<#include "/common/kelp.ftl"/>
|
||||
<script type="text/javascript" src="${base}/static/website/js/account.js" ></script>
|
||||
</head>
|
||||
|
||||
<body >
|
||||
<!-- search box start -->
|
||||
<div class="kelp-search-collapse" id="kelp_searchbox">
|
||||
<div class="layui-form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">所属角色</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="qroleId" id="qroleId" lay-search=''>
|
||||
<option value="" selected>全部</option>
|
||||
<#list modelMap.roles as role>
|
||||
<option value="${role.id}">${role.name}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qname" id="qname" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">电话:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qtelephone" id="qtelephone" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">状态:</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="qstate" id="qstate">
|
||||
<option value="">全部</option>
|
||||
<option value="00" selected>正常</option>
|
||||
<option value="10">锁定</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline" style="margin-top:-7px;">
|
||||
<button class="layui-btn layui-btn-sm" id="reload">查询</button>
|
||||
<button class="layui-btn layui-btn-sm" id="resetq">重置</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- search box end -->
|
||||
|
||||
<!-- table start -->
|
||||
<table class="layui-hide" id="dataTable" lay-filter="tablefilter"></table>
|
||||
|
||||
<script type="text/html" id="stateTpl">
|
||||
{{#if(d.state == "00"){}}
|
||||
正常
|
||||
{{#}}}
|
||||
{{#if(d.state == "10"){}}
|
||||
锁定
|
||||
{{#}}}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="roleTpl">
|
||||
<#list modelMap.roles as role>
|
||||
{{#if(d.roleId == "${role.id}"){}}
|
||||
${role.name}
|
||||
{{#}}}
|
||||
</#list>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon"></i></button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="edit"><i class="layui-icon"></i></button>
|
||||
<button type="button" class="layui-btn layui-btn-sm" lay-event="delete"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="rowbar">
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon"></i></a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon"></i></a>
|
||||
</script>
|
||||
<!-- table end -->
|
||||
|
||||
<!-- editor form start -->
|
||||
<form class="layui-form" id="form_edit" hidden style="margin-top: 20px;">
|
||||
<input type="hidden" class="layui-input" placeholder="" id="edit_id_" name="edit_id_">
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>基本信息</legend>
|
||||
</fieldset>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>所属角色:</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="roleId" id="roleId" lay-verify="required" lay-search=''>
|
||||
<option value="">请选择</option>
|
||||
<#list modelMap.roles as role>
|
||||
<option value="${role.id}">${role.name}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>昵称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="name" id="name" class="layui-input" lay-verify="required" maxlength="20"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>手机号:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="tel" name="telephone" id="telephone" class="layui-input" lay-verify="required|phone" maxlength="20"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>其他信息</legend>
|
||||
</fieldset>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>真实姓名:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="realName" id="realName" class="layui-input" lay-verify="required" maxlength="20"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"><span style="color:red; margin-right: 5px">*</span>性别:</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="sex" id="sex" lay-verify="required" >
|
||||
<option value="">请选择</option>
|
||||
<option value="0">男</option>
|
||||
<option value="1">女</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">状态:</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="state" id="state">
|
||||
<option value="00" selected>正常</option>
|
||||
<option value="10">锁定</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
<div class="layui-input-block">
|
||||
<div class="layui-footer" style="left: 0;">
|
||||
<button lay-submit lay-filter="edit_" class="layui-btn layui-btn-sm" id="edit_save">保存</button>
|
||||
<button lay-filter="close_" class="layui-btn layui-btn-sm" id="edit_close">关闭</button>
|
||||
<button type="button" id="resetf" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- editor form end -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user