Merge remote-tracking branch 'origin/master'
commit
88f3b379fa
|
@ -3,12 +3,22 @@ package cn.palmte.work.controller.backend;
|
|||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.config.Constant;
|
||||
import cn.palmte.work.model.Admin;
|
||||
import cn.palmte.work.model.DeptRepository;
|
||||
import cn.palmte.work.model.UserPositionRepository;
|
||||
import cn.palmte.work.pojo.ModifyPasswordRequest;
|
||||
import cn.palmte.work.service.AccountService;
|
||||
import cn.palmte.work.service.AdminService;
|
||||
import cn.palmte.work.service.SysRoleService;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.Utils;
|
||||
import cn.palmte.work.utils.excel.ExcelLogs;
|
||||
import cn.palmte.work.utils.excel.ExcelUtil;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.EncryptedDocumentException;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -16,11 +26,14 @@ import org.springframework.stereotype.Controller;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import top.jfunc.common.crypto.symmetric.DESAS;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
@ -38,6 +51,12 @@ public class AccountController extends BaseController {
|
|||
@Autowired
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private UserPositionRepository userPositionRepository;
|
||||
|
||||
@RequestMapping(value = "/updatePassword")
|
||||
@ResponseBody
|
||||
public ResponseMsg updatePassword(HttpServletRequest request, ModifyPasswordRequest modifyPasswordRequest){
|
||||
|
@ -65,10 +84,40 @@ public class AccountController extends BaseController {
|
|||
setModel(keywords, model);
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords, model);
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findAll());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
model.put("pager", accountService.getAdminList(searchInfo, pageSize, pageNumber));
|
||||
return "/admin/account_list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到新增页面
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public String add(HttpServletRequest request, Map<String, Object> model) {
|
||||
genRSAKeyPair(request, model);
|
||||
model.put("userId", -1);
|
||||
model.put("account", new Admin());
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findAll());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转编辑页面
|
||||
*/
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
|
||||
Admin admin = accountService.findUserById(userId);
|
||||
model.put("account", admin);
|
||||
model.put("userId", userId);
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
model.put("deptList", deptRepository.findAll());
|
||||
model.put("positionList", userPositionRepository.findAll());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存或更新用户
|
||||
*/
|
||||
|
@ -97,19 +146,6 @@ public class AccountController extends BaseController {
|
|||
return "redirect:/account/list";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到新增页面
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public String add(HttpServletRequest request, Map<String, Object> model) {
|
||||
genRSAKeyPair(request, model);
|
||||
model.put("userId", -1);
|
||||
model.put("account", new Admin());
|
||||
//获取所有角色
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用、禁用用户
|
||||
*/
|
||||
|
@ -123,26 +159,6 @@ public class AccountController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询用户信息编辑
|
||||
*/
|
||||
@RequestMapping("/edit")
|
||||
public String edit(@RequestParam("userId") int userId, Map<String, Object> model) {
|
||||
model.put("userId", userId);
|
||||
Admin admin = accountService.findUserById(userId);
|
||||
model.put("roleId", String.valueOf(admin.getRoleId()));
|
||||
model.put("roleType", admin.getRoleType());
|
||||
model.put("roleLevel", admin.getRoleLevel());
|
||||
model.put("realName", admin.getRealName());
|
||||
model.put("userName", admin.getUserName());
|
||||
model.put("telephone", admin.getTelephone());
|
||||
model.put("regionId", admin.getRegionId());
|
||||
model.put("account", admin);
|
||||
//获取所有角色
|
||||
model.put("roleList", sysRoleService.getAllEnableSysRole());
|
||||
return "/admin/account_input";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据删除用户
|
||||
*/
|
||||
|
@ -197,7 +213,6 @@ public class AccountController extends BaseController {
|
|||
model.put("SysUser", admin);
|
||||
genRSAKeyPair(request,model);
|
||||
return "/admin/account_password";
|
||||
|
||||
}
|
||||
|
||||
private void setModel(@RequestParam(value = "keywords", required = false) String keywords, Map<String, Object> model) {
|
||||
|
@ -205,6 +220,52 @@ public class AccountController extends BaseController {
|
|||
model.put("keywords", keywords);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param keywords
|
||||
* @param model
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(@RequestParam(value = "keywords",required = false) String keywords,Map<String, Object> model,
|
||||
HttpServletResponse response) throws IOException {
|
||||
// 初始化参数
|
||||
ConcurrentHashMap<String, String> searchInfo = getSearchInfo(keywords,model);
|
||||
downloadHeader(response , Utils.generateExcelName("人员信息"));
|
||||
accountService.exportExcel(response,searchInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*/
|
||||
@RequestMapping("/template")
|
||||
public void template(HttpServletResponse response) throws Exception{
|
||||
|
||||
String[] headers = new String[]{"工号", "手机号码", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"};
|
||||
downloadHeader(response , Utils.generateExcelName("人员信息批量导入模板"));
|
||||
ExportUtils exportUtils = new ExportUtils(headers);
|
||||
exportUtils.write(response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入
|
||||
*/
|
||||
@RequestMapping("/batchImport")
|
||||
@ResponseBody
|
||||
public String batchImport(MultipartFile file) {
|
||||
try {
|
||||
ExcelLogs logs = new ExcelLogs();
|
||||
Collection<Map> maps = ExcelUtil.importExcel(Map.class, file.getInputStream(),
|
||||
"yyyy/MM/dd HH:mm:ss", logs, 0);
|
||||
synchronized (this) {
|
||||
return JSON.toJSONString(accountService.check(maps));
|
||||
}
|
||||
} catch (OfficeXmlFileException | EncryptedDocumentException | InvalidFormatException e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("格式错误,请上传excel 2003/2007格式文件"));
|
||||
} catch (Exception e) {
|
||||
return JSON.toJSONString(ResponseMsg.buildFailedMsg("导入数据失败,请联系管理员"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,10 @@ public class BaseController {
|
|||
return getRequest().getSession();
|
||||
}
|
||||
|
||||
protected void downloadHeader(HttpServletResponse response, String fileName) {
|
||||
downloadHeader(response, fileName, "application/octet-stream");
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理下载文件的http header
|
||||
*
|
||||
|
|
|
@ -31,6 +31,8 @@ public class Admin implements Serializable{
|
|||
@Column(name = "user_name")
|
||||
private String userName;
|
||||
private String password;
|
||||
@Column(name = "emp_code")
|
||||
private String empCode;
|
||||
private String salt;
|
||||
@Column(name = "real_name")
|
||||
private String realName;
|
||||
|
@ -58,19 +60,100 @@ public class Admin implements Serializable{
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date lastUpdatedTime;
|
||||
@Column(name = "region_id")
|
||||
private int regionId;
|
||||
@Column(name = "region_name")
|
||||
private String regionName;
|
||||
@Column(name = "role_id")
|
||||
private int roleId;
|
||||
@Column(name = "role_name")
|
||||
private String roleName;
|
||||
|
||||
@Column(name = "updated__password_time")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updatedPasswordTime;
|
||||
|
||||
@Transient
|
||||
private int roleId;
|
||||
@Transient
|
||||
private String roleName;
|
||||
@Column(name = "work_location")
|
||||
private String workLocation;
|
||||
|
||||
@Column(name = "dept_id")
|
||||
private int deptId;
|
||||
|
||||
@Column(name = "dept_name")
|
||||
private String deptName;
|
||||
|
||||
@Column(name = "direct_manager")
|
||||
private String directManager;
|
||||
|
||||
@Column(name = "position_id")
|
||||
private int positionId;
|
||||
|
||||
@Column(name = "position_name")
|
||||
private String positionName;
|
||||
|
||||
@Column(name = "company_email")
|
||||
private String companyEmail;
|
||||
|
||||
public String getEmpCode() {
|
||||
return empCode;
|
||||
}
|
||||
|
||||
public void setEmpCode(String empCode) {
|
||||
this.empCode = empCode;
|
||||
}
|
||||
|
||||
public String getWorkLocation() {
|
||||
return workLocation;
|
||||
}
|
||||
|
||||
public void setWorkLocation(String workLocation) {
|
||||
this.workLocation = workLocation;
|
||||
}
|
||||
|
||||
public int getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(int deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getDirectManager() {
|
||||
return directManager;
|
||||
}
|
||||
|
||||
public void setDirectManager(String directManager) {
|
||||
this.directManager = directManager;
|
||||
}
|
||||
|
||||
public int getPositionId() {
|
||||
return positionId;
|
||||
}
|
||||
|
||||
public void setPositionId(int positionId) {
|
||||
this.positionId = positionId;
|
||||
}
|
||||
|
||||
public String getPositionName() {
|
||||
return positionName;
|
||||
}
|
||||
|
||||
public void setPositionName(String positionName) {
|
||||
this.positionName = positionName;
|
||||
}
|
||||
|
||||
public String getCompanyEmail() {
|
||||
return companyEmail;
|
||||
}
|
||||
|
||||
public void setCompanyEmail(String companyEmail) {
|
||||
this.companyEmail = companyEmail;
|
||||
}
|
||||
|
||||
@Transient
|
||||
private int roleType;
|
||||
@Transient
|
||||
|
@ -262,21 +345,7 @@ public class Admin implements Serializable{
|
|||
this.roleTypeName = roleTypeName;
|
||||
}
|
||||
|
||||
public int getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
|
||||
public void setRegionId(int regionId) {
|
||||
this.regionId = regionId;
|
||||
}
|
||||
|
||||
public String getRegionName() {
|
||||
return regionName;
|
||||
}
|
||||
|
||||
public void setRegionName(String regionName) {
|
||||
this.regionName = regionName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -116,8 +116,8 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Page getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum) {
|
||||
Page page = new Page(pageNum, pageSize);
|
||||
public Page<Admin> getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum) {
|
||||
Page<Admin> page = new Page(pageNum, pageSize);
|
||||
int thisPage = (pageNum - 1) * pageSize;
|
||||
String sql = getSelect() + getSqlExceptSelect(searchInfo) + " limit " + thisPage + "," + pageSize;
|
||||
String countSql = " SELECT COUNT(*) FROM(" + getSelect() + getSqlExceptSelect(searchInfo) + ") count_table";
|
||||
|
@ -135,6 +135,13 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
|||
admin.setRealName(ObjectKit.toString(objects[2]));
|
||||
admin.setTelephone(ObjectKit.toString(objects[7]));
|
||||
admin.setRoleName(ObjectKit.toString(objects[6]));
|
||||
|
||||
admin.setWorkLocation(ObjectKit.toString(objects[10]));
|
||||
admin.setEmpCode(ObjectKit.toString(objects[9]));
|
||||
admin.setDeptName(ObjectKit.toString(objects[11]));
|
||||
admin.setPositionName(ObjectKit.toString(objects[13]));
|
||||
admin.setDirectManager(ObjectKit.toString(objects[12]));
|
||||
admin.setCompanyEmail(ObjectKit.toString(objects[14]));
|
||||
try {
|
||||
admin.setCreatedTime(ObjectKit.toDate(objects[3]));
|
||||
} catch (ParseException e) {
|
||||
|
@ -147,7 +154,7 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
|||
}
|
||||
|
||||
public String getSelect() {
|
||||
String select = " select u.id,u.user_name,u.real_name,u.created_time,u.enabled,r.type,r.name,u.telephone,u.region_name";
|
||||
String select = " select u.id,u.user_name,u.real_name,u.created_time,u.enabled,r.type,r.name,u.telephone,u.role_name,u.emp_code,u.work_location,u.dept_name,u.direct_manager,u.position_name,u.company_email";
|
||||
return select;
|
||||
}
|
||||
|
||||
|
@ -168,13 +175,21 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
|||
|
||||
private String buildQuery(Map.Entry<String, String> item) {
|
||||
String sql = "";
|
||||
if (item.getKey().equals("userName")) {
|
||||
sql += " and u.user_name like '%" + item.getValue() + "%' ";
|
||||
if (item.getKey().equals("realName")) {
|
||||
sql += " and u.real_name like '%" + item.getValue() + "%' ";
|
||||
} else if (item.getKey().equals("telephone")) {
|
||||
sql += " and u.telephone= " + item.getValue();
|
||||
} else if (item.getKey().equals("regionId")) {
|
||||
} else if (item.getKey().equals("empCode")) {
|
||||
sql += " and u.emp_code= " + item.getValue();
|
||||
} else if (item.getKey().equals("workLocation")) {
|
||||
sql += " and u.work_location= " + item.getValue();
|
||||
} else if (item.getKey().equals("startTime")) {
|
||||
sql += " and u.created_time >= " + item.getValue() + " 00:00:00";
|
||||
} else if (item.getKey().equals("endTime")) {
|
||||
sql += " and u.created_time <= " + item.getValue() + " 23:59:59";
|
||||
} else if (item.getKey().equals("deptId")) {
|
||||
if (!item.getValue().equals("-1")) {
|
||||
sql += " and u.region_id= " + item.getValue();
|
||||
sql += " and u.dept_id= " + item.getValue();
|
||||
}
|
||||
} else if (item.getKey().equals("roleId")) {
|
||||
if (!item.getValue().equals("-1")) {
|
||||
|
@ -219,7 +234,6 @@ public class AdminRepositoryImpl implements AdminRepositoryCustom {
|
|||
admin.setRoleType(ObjectKit.toInt(objects[3]));
|
||||
admin.setRoleId(ObjectKit.toInt(objects[4]));
|
||||
admin.setTelephone(ObjectKit.toString(objects[5]));
|
||||
admin.setRegionId(ObjectKit.toInt(objects[6]));
|
||||
admin.setRoleLevel(ObjectKit.toInt(objects[7]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* 职位
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "user_position")
|
||||
public class UserPosition {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "position_name")
|
||||
private String positionName;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPositionName() {
|
||||
return positionName;
|
||||
}
|
||||
|
||||
public void setPositionName(String positionName) {
|
||||
this.positionName = positionName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package cn.palmte.work.model;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface UserPositionRepository extends JpaRepository<UserPosition,Integer> {
|
||||
|
||||
}
|
|
@ -1,14 +1,17 @@
|
|||
package cn.palmte.work.service;
|
||||
|
||||
import cn.palmte.work.bean.RegexConstant;
|
||||
import cn.palmte.work.bean.ResponseMsg;
|
||||
import cn.palmte.work.model.*;
|
||||
import cn.palmte.work.utils.DESCrypto;
|
||||
import cn.palmte.work.utils.InterfaceUtil;
|
||||
import cn.palmte.work.utils.StrKit;
|
||||
import cn.palmte.work.utils.excel.ExportUtils;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -16,8 +19,12 @@ import top.jfunc.common.db.QueryHelper;
|
|||
import top.jfunc.common.db.bean.Page;
|
||||
import top.jfunc.common.db.utils.Pagination;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.beans.Transient;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
|
@ -37,13 +44,20 @@ public class AccountService {
|
|||
public SysUserRoleRepository sysUserRoleRepository;
|
||||
|
||||
@Autowired
|
||||
Pagination pagination;
|
||||
private Pagination pagination;
|
||||
|
||||
@Autowired
|
||||
private SysRoleRepository sysRoleRepository;
|
||||
|
||||
public Page getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum) {
|
||||
return adminRepositoryImpl.getAdminList(searchInfo, pageSize, pageNum);
|
||||
@Autowired
|
||||
private DeptRepository deptRepository;
|
||||
|
||||
@Autowired
|
||||
private UserPositionRepository userPositionRepository;
|
||||
|
||||
public Page<Admin> getAdminList(ConcurrentHashMap<String, String> searchInfo, int pageSize, int pageNum) {
|
||||
Page<Admin> adminList = adminRepositoryImpl.getAdminList(searchInfo, pageSize, pageNum);
|
||||
return adminList;
|
||||
}
|
||||
|
||||
public Page<Admin> list(ConcurrentHashMap<String, String> searchInfo, int pageNumber, int pageSize) {
|
||||
|
@ -77,11 +91,7 @@ public class AccountService {
|
|||
}
|
||||
|
||||
public Admin findUserById(int userId) {
|
||||
Admin admin = adminRepositoryImpl.findAdminById(userId);
|
||||
SysRole sysRole = sysRoleRepository.findOne(admin.getRoleId());
|
||||
if(null != sysRole){
|
||||
admin.setRoleName(sysRole.getName());
|
||||
}
|
||||
Admin admin = adminRepository.findOne(userId);
|
||||
return admin;
|
||||
}
|
||||
|
||||
|
@ -89,30 +99,45 @@ public class AccountService {
|
|||
public void saveOrUpdateAccount(int userId, int roleId, Admin admin, String privateKey) {
|
||||
int createAdminId = InterfaceUtil.getAdminId();
|
||||
Admin oldAdmin = adminRepository.findOne(userId);
|
||||
Dept dept = deptRepository.findOne(admin.getDeptId());
|
||||
SysRole sysRole = sysRoleRepository.findOne(admin.getRoleId());
|
||||
UserPosition userPosition = userPositionRepository.findOne(admin.getPositionId());
|
||||
if (oldAdmin == null) {
|
||||
oldAdmin = new Admin();
|
||||
String userName = admin.getUserName();
|
||||
oldAdmin.setUserName(userName);
|
||||
String salt = RandomStringUtils.randomAlphanumeric(6).toUpperCase();
|
||||
|
||||
String newPassword = decEncPassword(admin.getTelephone().substring(5), salt, privateKey);
|
||||
|
||||
BeanUtils.copyProperties(admin, oldAdmin);
|
||||
|
||||
oldAdmin.setRealName(sysRole.getName());
|
||||
oldAdmin.setDeptName(dept.getName());
|
||||
oldAdmin.setPositionName(userPosition.getPositionName());
|
||||
oldAdmin.setPassword(newPassword);
|
||||
oldAdmin.setSalt(salt);
|
||||
oldAdmin.setEnabled(1);
|
||||
oldAdmin.setRealName(admin.getRealName());
|
||||
oldAdmin.setCreatedBy(createAdminId);
|
||||
oldAdmin.setTelephone(admin.getTelephone());
|
||||
oldAdmin.setCreatedTime(new Date());
|
||||
|
||||
} else {
|
||||
String userName = admin.getUserName();
|
||||
oldAdmin.setDeptId(admin.getDeptId());
|
||||
oldAdmin.setPositionId(admin.getPositionId());
|
||||
oldAdmin.setRealName(sysRole.getName());
|
||||
oldAdmin.setDeptName(dept.getName());
|
||||
oldAdmin.setPositionName(userPosition.getPositionName());
|
||||
oldAdmin.setEmpCode(admin.getEmpCode());
|
||||
oldAdmin.setWorkLocation(admin.getWorkLocation());
|
||||
oldAdmin.setDirectManager(admin.getDirectManager());
|
||||
oldAdmin.setCompanyEmail(admin.getCompanyEmail());
|
||||
oldAdmin.setUserName(userName);
|
||||
oldAdmin.setRealName(admin.getRealName());
|
||||
oldAdmin.setTelephone(admin.getTelephone());
|
||||
oldAdmin.setLastUpdatedBy(createAdminId);
|
||||
oldAdmin.setLastUpdatedTime(new Date());
|
||||
}
|
||||
oldAdmin.setRegionId(admin.getRegionId());
|
||||
|
||||
oldAdmin.setRoleId(admin.getRoleId());
|
||||
SysRole one = sysRoleRepository.findOne(admin.getRoleId());
|
||||
if (null != one) {
|
||||
|
@ -129,7 +154,6 @@ public class AccountService {
|
|||
sysUserRole.setCreatedBy(createAdminId);
|
||||
sysUserRole.setCreatedTime(new Date());
|
||||
sysUserRoleRepository.save(sysUserRole);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -231,4 +255,16 @@ public class AccountService {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void exportExcel(HttpServletResponse response, ConcurrentHashMap<String, String> searchInfo) throws IOException {
|
||||
String[] headers = {"工号", "手机号码", "姓名", "常驻地", "一级部门", "直接主管", "职位", "所属角色", "公司邮件地址"};
|
||||
String[] exportColumns = {"empCode", "telephone", "workLocation", "deptName", "directManager", "positionName", "roleName", "companyEmail"};
|
||||
ExportUtils.exportToExcel(headers, exportColumns, 1, 5000,
|
||||
response.getOutputStream(), (pN, pS) -> getAdminList(searchInfo, pN, pS).getList());
|
||||
}
|
||||
|
||||
public ResponseMsg check(Collection<Map> maps) {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ public class InterfaceUtil {
|
|||
return principal.getAdmin();
|
||||
}
|
||||
|
||||
public static int getRegionId() {
|
||||
/*public static int getRegionId() {
|
||||
return Optional.ofNullable(getAdmin()).map(Admin::getRegionId).orElse(0);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<div class="admin-content">
|
||||
<div class="admin-content-body">
|
||||
<div class="am-cf am-padding">
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">账号管理</strong> /
|
||||
<small><#if userId!=-1>编辑<#else>新增</#if>后端账号</small>
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">人员管理</strong> /
|
||||
<small><#if userId!=-1>编辑<#else>新增</#if>人员账号</small>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" class="am-form" id="tmpForm" action="${base}/account/save">
|
||||
|
@ -15,60 +15,25 @@
|
|||
<div class="am-tabs am-margin" data-am-tabs>
|
||||
<ul class="am-tabs-nav am-nav am-nav-tabs">
|
||||
<li class="am-active">
|
||||
<a href="#tab1"><#if userId!=-1>编辑<#else>新增</#if>用户信息</a>
|
||||
<a href="#tab1"><#if userId!=-1>编辑<#else>新增</#if>人员信息</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="am-tabs-bd">
|
||||
<div class="am-tab-panel am-fade am-in am-active" id="tab1">
|
||||
<input name="userId" id="userId" type="hidden" value="${userId!}"/>
|
||||
<#--<input name="userId" id="userId" type="hidden" value="${userId!}"/>
|
||||
<input name="level" id="level" type="hidden" value="${roleLevel!}"/>
|
||||
<#if userId!=-1><input name="roleId" id="roleId" type="hidden" value="${roleId!}"/></#if>-->
|
||||
<#--<div class="am-g am-form-group am-margin-top" <#if userId!=-1> style="display:none;" </#if>>
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
账号角色
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<select data-am-selected onchange="roleChange(this)" name="roleId" id="roleId"/>
|
||||
<option value="-1" tag="-1" <#if roleId == "-1" > selected </#if>>请选择</option>
|
||||
<#list roleList as roleNode >
|
||||
<option value="${roleNode.id}"
|
||||
tag="${roleNode.type}"
|
||||
level="${roleNode.level}" <#if roleId==roleNode.id?string>
|
||||
selected </#if>>
|
||||
${roleNode.name}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>-->
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
登录名称
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="userName" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入登录名称(20字符以内)"
|
||||
type="text" id="userName" value="${account.userName!}" minlength="1" maxlength="20"
|
||||
required <#if userId!=-1>readonly</#if>
|
||||
placeholder="请输入登录名称(20字符以内)"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
姓名
|
||||
工号
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="realName" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入账户名称(20字符以内)"
|
||||
type="text" id="realName" value="${account.realName!}" minlength="1" maxlength="20"
|
||||
required
|
||||
placeholder="请输入账户名称(20字符以内)" onKeyUp="clearValidInfo()"/>
|
||||
<input name="empCode" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入工号"
|
||||
type="text" id="empCode" value="${account.empCode!}" minlength="1"
|
||||
maxlength="20"
|
||||
required <#if userId!=-1>readonly</#if>
|
||||
placeholder="请输入工号"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
@ -84,13 +49,112 @@
|
|||
onkeyup="value=value.replace(/[^\d]/g,'')"
|
||||
type="text" id="telephone" value="${account.telephone!}" minlength="11"
|
||||
maxlength="11"
|
||||
required <#if userId!=-1>readonly</#if>
|
||||
required
|
||||
placeholder="请输入正确格式手机号码!"
|
||||
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
登录名称
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="userName" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入登录名称(20字符以内)"
|
||||
type="text" id="userName" value="${account.userName!}" minlength="1"
|
||||
maxlength="20"
|
||||
required <#if userId!=-1>readonly</#if>
|
||||
placeholder="请输入登录名称(20字符以内)"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
姓名
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="realName" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入账户名称(20字符以内)"
|
||||
type="text" id="realName" value="${account.realName!}" minlength="1"
|
||||
maxlength="20" <#if userId!=-1>readonly</#if>
|
||||
required placeholder="请输入账户名称(20字符以内)"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
常驻地
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="workLocation" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入常驻地"
|
||||
type="text" id="workLocation" value="${account.workLocation!}" minlength="1"
|
||||
maxlength="20"
|
||||
required placeholder="请输入常驻地"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
一级部门
|
||||
</div>
|
||||
<div class="am-u-sm-8 am-u-md-10">
|
||||
<select id="deptId" name="deptId"
|
||||
data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}">
|
||||
<option value="-1">请选择</option>
|
||||
<#if deptList?exists>
|
||||
<#list deptList as node>
|
||||
<option value="${node.id!}" <#if account.deptId! == node.id >
|
||||
selected </#if>>${node.name}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
直接主管
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="directManager" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入直接主管"
|
||||
type="text" id="directManager" value="${account.directManager!}"
|
||||
minlength="1" maxlength="20" <#if userId!=-1>readonly</#if>
|
||||
required placeholder="请输入直接主管"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
职位
|
||||
</div>
|
||||
<div class="am-u-sm-8 am-u-md-10">
|
||||
<select id="positionId" name="positionId"
|
||||
data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}">
|
||||
<option value="-1">请选择</option>
|
||||
<#if positionList?exists>
|
||||
<#list positionList as node>
|
||||
<option value="${node.id!}" <#if account.positionId! == node.id >
|
||||
selected </#if>>${node.positionName}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
|
@ -110,6 +174,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
<span style="color: red;">*</span>
|
||||
公司邮件地址
|
||||
</div>
|
||||
<div class="am-u-sm-6 am-u-md-6">
|
||||
<input name="companyEmail" class="js-ajax-validate"
|
||||
data-validate-async data-validation-message="请输入公司邮件地址"
|
||||
type="text" id="companyEmail" value="${account.companyEmail!}" minlength="1"
|
||||
maxlength="30"
|
||||
required placeholder="请输入公司邮件地址"/>
|
||||
</div>
|
||||
<div class="am-u-sm-2 am-u-md-4 input-msg"></div>
|
||||
</div>
|
||||
|
||||
<div class="am-g am-form-group am-margin-top">
|
||||
<div class="am-u-sm-4 am-u-md-2 am-text-right">
|
||||
|
@ -142,63 +220,10 @@
|
|||
|
||||
</@defaultLayout.layout>
|
||||
|
||||
<#macro bpTree nodes>
|
||||
<#list nodes as node>
|
||||
<tr level="${node.level}" class="level-${node.level}"
|
||||
<#if node.hasLeafNode >
|
||||
type="file"
|
||||
<#else>
|
||||
type="folder"
|
||||
</#if>
|
||||
>
|
||||
<td align="center">
|
||||
</td>
|
||||
</tr>
|
||||
<#if (!node.hasLeafNode) && node.subNodes?? && node.subNodes?size gt 0>
|
||||
<@bpTree nodes=node.subNodes />
|
||||
</#if>
|
||||
</#list>
|
||||
</#macro>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var urlBase = "${base}";
|
||||
var url;
|
||||
|
||||
function showDialog(msgTitle, message, msgType, msgTimer) {
|
||||
sendMessage({
|
||||
title: msgTitle,
|
||||
text: message,
|
||||
type: msgType,
|
||||
timer: msgTimer,
|
||||
confirmButtonText: false
|
||||
});
|
||||
}
|
||||
|
||||
function roleChange() {
|
||||
var child = $("#roleId").find("option:selected").attr("tag");
|
||||
var level = $("#roleId").find("option:selected").attr("level");
|
||||
$("#level").val(level);
|
||||
console.info(child);
|
||||
if (child == 2) {
|
||||
document.getElementById('capitalAccount').style.display = 'block';
|
||||
} else {
|
||||
document.getElementById('capitalAccount').style.display = 'none';
|
||||
}
|
||||
|
||||
if (level == 2) {
|
||||
document.getElementById('regionIdInput').style.display = 'block';
|
||||
document.getElementById('areaInput').style.display = 'none';
|
||||
} else if (level == 3) {
|
||||
document.getElementById('regionIdInput').style.display = 'block';
|
||||
document.getElementById('areaInput').style.display = 'block';
|
||||
} else {
|
||||
document.getElementById('regionIdInput').style.display = 'none';
|
||||
document.getElementById('areaInput').style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
/*表单验证:begin*/
|
||||
//自定义规则,用法:验证元素上加class="js-pattern-sort"
|
||||
|
@ -241,41 +266,10 @@
|
|||
}
|
||||
});
|
||||
/*表单验证:end*/
|
||||
|
||||
})
|
||||
|
||||
/*var selectArea = function () {
|
||||
var regionSelectedVal = $("#regionId").val();
|
||||
$.ajax({
|
||||
url: "${base}/gov/areas",
|
||||
data: {regionId: regionSelectedVal},
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (data) {
|
||||
var areas = data.data;
|
||||
//清空下拉项
|
||||
$("#areaCode option").remove();
|
||||
$.each(areas, function () {
|
||||
//为Select追加一个Option(下拉项)
|
||||
jQuery("#areaCode").append("<option value='" + this.id + "'>" + this.areaName + "</option>");
|
||||
});
|
||||
}
|
||||
});
|
||||
};*/
|
||||
|
||||
|
||||
var submit_function = function () {
|
||||
var level = $("#level").val();
|
||||
var regionId = $("#regionId").val();
|
||||
var areaCode = $("#areaCode").val();
|
||||
if (level == 2 && regionId <= 0) {
|
||||
parent.layer.msg('请选择正确的地市');
|
||||
} else if (level == 3 && (regionId <= 0 || areaCode <= 0)) {
|
||||
parent.layer.msg('请选择正确的地市和区县');
|
||||
} else {
|
||||
$("#tmpForm").submit();
|
||||
}
|
||||
$("#tmpForm").submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<div class="admin-content">
|
||||
<div class="am-cf am-padding" style="padding:1rem 1.6rem 1.6rem 1rem;margin:0px;">
|
||||
<!-- padding:1px 2px 3px 4px;上、右、下,和左 -->
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">系统管理</strong> /
|
||||
<small>后端账号管理</small>
|
||||
<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">人员管理</strong> /
|
||||
<small>人员列表</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-g">
|
||||
|
@ -16,11 +16,39 @@
|
|||
<table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="am-text-middle">登录名称</th>
|
||||
<th class="am-text-middle">姓名</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<input type="text" id="userName" class="am-form-field am-input-sm"
|
||||
value="${userName!}"/>
|
||||
<input type="text" id="realName" class="am-form-field am-input-sm"
|
||||
value="${realName!}"/>
|
||||
</div>
|
||||
</td>
|
||||
<th class="am-text-middle">手机号</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<input type="text" id="telephone" class="am-form-field am-input-sm"
|
||||
value="${telephone!}"/>
|
||||
</div>
|
||||
</td>
|
||||
<th class="am-text-middle">工号</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<input type="text" id="empCode" class="am-form-field am-input-sm"
|
||||
value="${empCode!}"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="am-text-middle">一级部门</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<select data-am-selected id="deptId" name="deptId">
|
||||
<option value="-1">全部</option>
|
||||
<#list deptList as dept>
|
||||
<option value=${dept.id!} <#if deptId! =="${dept.id}" >
|
||||
selected</#if>>${dept.name!}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<th class="am-text-middle">账号角色</th>
|
||||
|
@ -36,37 +64,41 @@
|
|||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="am-text-middle">手机号</th>
|
||||
<th class="am-text-middle">常驻地</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<input type="text" id="telephone" class="am-form-field am-input-sm"
|
||||
value="${telephone!}"/>
|
||||
</div>
|
||||
</td>
|
||||
<th class="am-text-middle">所属区域</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<select id="regionId" name="regionId"
|
||||
data-am-selected="{btnSize: 'sm',maxHeight: 200,searchBox: 1}">
|
||||
<option value="-1">全部</option>
|
||||
<#if regionList?exists>
|
||||
<#list regionList as node>
|
||||
<option value="${node.id!}" <#if regionId! == "${node.id}" >
|
||||
selected </#if>>${node.name}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
</select>
|
||||
<input type="text" id="workLocation" class="am-form-field am-input-sm"
|
||||
value="${workLocation!}"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="am-text-middle">创建时间</th>
|
||||
<td>
|
||||
<div class="am-u-sm-10">
|
||||
<div class="am-form am-form-inline">
|
||||
<div class="am-form-group am-form-icon">
|
||||
<i class="am-icon-calendar"></i>
|
||||
<input type="text" class="am-form-field am-input-sm" id="startTime"
|
||||
value="${startTime!}" placeholder="开始日期" data-am-datepicker>
|
||||
</div>
|
||||
<div class="am-form-group">至</div>
|
||||
<div class="am-form-group am-form-icon">
|
||||
<i class="am-icon-calendar"></i>
|
||||
<input type="text" class="am-form-field am-input-sm" id="endTime"
|
||||
value="${endTime!}"
|
||||
placeholder="结束日期" data-am-datepicker>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="4">
|
||||
<div align='right'>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
|
||||
id="submit-btn">搜索
|
||||
id="submit-btn" onclick="sub_function('query')">搜索
|
||||
</button>
|
||||
<button type="button" class="am-btn am-btn-default am-btn-sm am-text-secondary"
|
||||
id="submit-btn-export" onclick="sub_function('export')">导出
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
|
@ -85,6 +117,21 @@
|
|||
</button>
|
||||
</@shiro.hasPermission>
|
||||
</div>
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<div class="am-btn-group am-btn-group-xs am-form-file">
|
||||
<button type="button" id="bt_import" class="am-btn am-btn-default">
|
||||
<span class="am-icon-archive"></span>
|
||||
批量导入
|
||||
</button>
|
||||
<input id="doc-form-file" type="file" name="file"
|
||||
onChange="ajaxUploadFile('doc-form-file','${base}/account/batchImport')"
|
||||
multiple>
|
||||
</div>
|
||||
<button type="button" class="am-btn am-btn-default"
|
||||
onclick="location.href='${base}/account/template'">
|
||||
<span class="am-icon-archive"></span> 导入模板下载
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -95,22 +142,30 @@
|
|||
<table class="am-table am-table-striped am-table-hover table-main">
|
||||
<thead>
|
||||
<tr class="am-text-nowrap">
|
||||
<th class="table-title">登录名称</th>
|
||||
<th class="table-title">账号名称</th>
|
||||
<th class="table-title">手机号</th>
|
||||
<th class="table-title">账号角色</th>
|
||||
<th class="table-title">创建时间</th>
|
||||
<th class="table-title">工号</th>
|
||||
<th class="table-title">手机号码</th>
|
||||
<th class="table-title">姓名</th>
|
||||
<th class="table-title">常驻地</th>
|
||||
<th class="table-title">一级部门</th>
|
||||
<th class="table-title">直接主管</th>
|
||||
<th class="table-title">职位</th>
|
||||
<th class="table-title">所属角色</th>
|
||||
<th class="table-title">公司邮件地址</th>
|
||||
<th class="table-title">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#list pager.list as list>
|
||||
<#list pager.list as list>
|
||||
<tr>
|
||||
<td>${list.userName!}</td>
|
||||
<td>${list.realName!}</td>
|
||||
<td>${list.empCode!}</td>
|
||||
<td>${list.telephone!}</td>
|
||||
<td>${list.realName!}</td>
|
||||
<td>${list.workLocation!}</td>
|
||||
<td>${list.deptName!}</td>
|
||||
<td>${list.directManager!}</td>
|
||||
<td>${list.positionName!}</td>
|
||||
<td>${list.roleName!}</td>
|
||||
<td><#if list.createdTime??>${list.createdTime?datetime}</#if></td>
|
||||
<td>${list.companyEmail!}</td>
|
||||
<td>
|
||||
<div class="am-btn-toolbar">
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
|
@ -128,16 +183,6 @@
|
|||
class="am-icon-pencil-square-o"></span>密码重置
|
||||
</button>
|
||||
</@shiro.hasPermission>
|
||||
<@shiro.hasPermission name="ACCOUNT_BINDING">
|
||||
<#if (list.roleName) = "工地巡查员">
|
||||
<button type="button"
|
||||
class="am-btn am-btn-default am-btn-xs am-text-secondary"
|
||||
onclick="location.href='${base}/binding/select?id=${list.id?c}&type=sys'">
|
||||
<span class="am-icon-pencil-square-o"></span>
|
||||
绑定工地
|
||||
</button>
|
||||
</#if>
|
||||
</@shiro.hasPermission>
|
||||
</div>
|
||||
<div class="am-btn-group am-btn-group-xs">
|
||||
<div class="switch-button">
|
||||
|
@ -188,6 +233,12 @@
|
|||
</footer>
|
||||
</div>
|
||||
</@defaultLayout.layout>
|
||||
<script type="text/javascript" src="${base}/common/js/jquery.ajaxfileupload.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/vendor/jquery.ui.widget.js"></script>
|
||||
<script type="text/javascript" src="${base}/common/jQuery-File-Upload/js/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="${base}/common/jQuery-File-Upload/js/jquery.fileupload.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/jquery.fileupload-process.js"></script>
|
||||
<script src="${base}/common/jQuery-File-Upload/js/jquery.fileupload-validate.js"></script>
|
||||
<script src="../assets/js/amazeui.switch.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
|
@ -199,41 +250,120 @@
|
|||
$mycheckbox.each(function () {
|
||||
var myid = $(this).attr("id");
|
||||
var prop = $(this).attr("prop");
|
||||
|
||||
$(this).on({
|
||||
'switchChange.bootstrapSwitch': function (event, state) {
|
||||
toggle(myid, state ? 1 : 0);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
var keywordsObj = {};
|
||||
$("#submit-btn").on("click", function () {
|
||||
$("#pageNumber").val(1);
|
||||
if ($("#userName").val())
|
||||
keywordsObj.userName = $("#userName").val();
|
||||
if ($("#realName").val())
|
||||
keywordsObj.realName = $("#realName").val();
|
||||
if ($("#telephone").val())
|
||||
keywordsObj.telephone = $("#telephone").val();
|
||||
if ($("#empCode").val())
|
||||
keywordsObj.empCode = $("#empCode").val();
|
||||
if ($("#deptId").val())
|
||||
keywordsObj.deptId = $("#deptId").val();
|
||||
if ($("#roleId").val())
|
||||
keywordsObj.roleId = $("#roleId").val();
|
||||
if ($("#telephone").val())
|
||||
keywordsObj.telephone = parseInt($("#telephone").val());
|
||||
if ($("#regionId").val())
|
||||
keywordsObj.regionId = parseInt($("#regionId").val());
|
||||
if ($("#workLocation").val())
|
||||
keywordsObj.workLocation = $("#workLocation").val();
|
||||
if ($("#startTime").val())
|
||||
keywordsObj.startTime = $("#startTime").val();
|
||||
if ($("#endTime").val())
|
||||
keywordsObj.endTime = $("#endTime").val();
|
||||
var startTime = $("#startTime").val();
|
||||
var endTime = $("#endTime").val();
|
||||
if(startTime > endTime){
|
||||
window.confirm('开始日期应早于结束日期');
|
||||
}
|
||||
var keywords = "";
|
||||
if (!$.isEmptyObject(keywordsObj)) {
|
||||
keywords = JSON.stringify(keywordsObj);
|
||||
}
|
||||
console.log("keywords = " + keywords);
|
||||
|
||||
$("#keywords").val(keywords);
|
||||
$("#listForm").submit();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function ajaxUploadFile(id, url) {
|
||||
$.ajaxFileUpload({
|
||||
url: url,
|
||||
secureuri: false,
|
||||
fileElementId: id,// file标签的id
|
||||
dataType: 'json',// 返回数据的类型
|
||||
success: function (data, status) {
|
||||
console.log("--------success---------" + data)
|
||||
if (data.status == 0) {
|
||||
var list = data.data;
|
||||
var content = '';
|
||||
$.each(list, function (i, r) {
|
||||
content += (i + 1) + '、' + r + '<br>';
|
||||
});
|
||||
console.log('---> ' + content);
|
||||
parent.layer.open({
|
||||
title: '导入结果:',
|
||||
content: data.msg + '<br><br>' + content
|
||||
});
|
||||
} else {
|
||||
parent.layer.msg(data.msg);
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
$("#" + id).val("");
|
||||
},
|
||||
error: function (data, status, e) {
|
||||
console.log("--------error---------" + data)
|
||||
alert("-----------------" + data);
|
||||
// if ($('#modal')) {
|
||||
// $('#modal').modal('close');
|
||||
// }
|
||||
alert(e);
|
||||
$("#" + id).val("");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function initSearch() {
|
||||
var keywordsObj = {};
|
||||
if ($("#realName").val())
|
||||
keywordsObj.realName = $("#realName").val();
|
||||
if ($("#telephone").val())
|
||||
keywordsObj.telephone = $("#telephone").val();
|
||||
if ($("#empCode").val())
|
||||
keywordsObj.empCode = $("#empCode").val();
|
||||
if ($("#deptId").val())
|
||||
keywordsObj.deptId = $("#deptId").val();
|
||||
if ($("#roleId").val())
|
||||
keywordsObj.roleId = $("#roleId").val();
|
||||
if ($("#workLocation").val())
|
||||
keywordsObj.workLocation = $("#workLocation").val();
|
||||
if ($("#startTime").val())
|
||||
keywordsObj.startTime = $("#startTime").val();
|
||||
if ($("#endTime").val())
|
||||
keywordsObj.endTime = $("#endTime").val();
|
||||
var keywords = "";
|
||||
if (!$.isEmptyObject(keywordsObj)) {
|
||||
keywords = JSON.stringify(keywordsObj);
|
||||
}
|
||||
$("#keywords").val(keywords);
|
||||
};
|
||||
|
||||
var sub_function = function (type) {
|
||||
initSearch();
|
||||
if (type == 'export') {
|
||||
$("#listForm").attr("action", "${base}/account/export");
|
||||
}
|
||||
if(type == 'query'){
|
||||
$("#listForm").attr("action", "${base}/account/list");
|
||||
}
|
||||
$("#listForm").submit();
|
||||
};
|
||||
|
||||
var resetPassword = function (url) {
|
||||
var params = {};
|
||||
if (window.confirm('确定要重置密码吗?')) {
|
||||
|
@ -254,8 +384,7 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//启用或者禁用
|
||||
var toggle = function (id, status) {
|
||||
|
|
Loading…
Reference in New Issue