组织机构,请假记录等
This commit is contained in:
parent
ce6189ae9a
commit
5f710b18a1
|
|
@ -1,10 +1,7 @@
|
|||
package com.bonus.leader.performance.manager.manager.controller;
|
||||
|
||||
import com.bonus.leader.performance.manager.manager.annotation.LogAnnotation;
|
||||
import com.bonus.leader.performance.manager.manager.entity.AnnouncementBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.DownloadFileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.FileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.TreeBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.*;
|
||||
import com.bonus.leader.performance.manager.manager.service.AnnouncementService;
|
||||
import com.bonus.leader.performance.manager.manager.service.ProgressService;
|
||||
import com.bonus.leader.performance.manager.manager.utils.*;
|
||||
|
|
@ -38,6 +35,7 @@ public class AnnouncementController {
|
|||
List<AnnouncementBean> list = service.getAnnouncementList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getAnnouncementType")
|
||||
@ApiOperation(value = "系统公告-分类管理列表")
|
||||
|
|
@ -273,4 +271,13 @@ public class AnnouncementController {
|
|||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getAskLeaveList")
|
||||
@ApiOperation(value = "请假记录报表-列表查询")
|
||||
public R getAskLeaveList(AskLeaveBean o){
|
||||
List<AskLeaveBean> list = service.getAskLeaveList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.leader.performance.manager.manager.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.bonus.leader.performance.manager.manager.dao.RoleDao;
|
||||
import com.bonus.leader.performance.manager.manager.entity.RoleDto;
|
||||
|
|
@ -10,16 +12,13 @@ import com.bonus.leader.performance.manager.manager.table.PageTableHandler;
|
|||
import com.bonus.leader.performance.manager.manager.table.PageTableRequest;
|
||||
import com.bonus.leader.performance.manager.manager.table.PageTableResponse;
|
||||
import com.bonus.leader.performance.manager.manager.service.RoleService;
|
||||
import com.bonus.leader.performance.manager.manager.utils.AjaxRes;
|
||||
import com.bonus.leader.performance.manager.manager.utils.GlobalConst;
|
||||
import com.bonus.leader.performance.manager.manager.utils.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.bonus.leader.performance.manager.manager.annotation.LogAnnotation;
|
||||
import com.google.common.collect.Maps;
|
||||
|
|
@ -103,11 +102,124 @@ public class RoleController {
|
|||
/*----------------------------------------新版角色管理接口------------------------------------------------*/
|
||||
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("getNewRoleList")
|
||||
@ApiOperation(value = "角色管理-列表查询")
|
||||
public R getNewRoleList(RoleBean o){
|
||||
List<RoleBean> list = roleService.getNewRoleList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
@LogAnnotation
|
||||
@PostMapping("getNewRoleList")
|
||||
@ApiOperation(value = "角色管理-列表查询")
|
||||
public R getNewRoleList(RoleBean o) {
|
||||
List<RoleBean> list = roleService.getNewRoleList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()) : R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@RequestMapping(value = "addNewRoleData", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "角色-新增")
|
||||
@Transactional
|
||||
@PreAuthorize("hasAuthority('sys:role:add')")
|
||||
public AjaxRes addInfo(@RequestBody RoleDto bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = roleService.addInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if (cb > 0) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String id = roleDao.getRoleIdByName(bean.getName());
|
||||
map.put("roleId", id);
|
||||
ar.setSucceed(map, GlobalConst.INIT_SUCCEED);
|
||||
if (cb == 5) {
|
||||
ar.setFailMsg("角色已存在");
|
||||
}
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateNewRoleData", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "角色-修改")
|
||||
@PreAuthorize("hasAuthority('sys:role:update')")
|
||||
@Transactional
|
||||
public AjaxRes updateInfo(@RequestBody RoleDto bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = roleService.updateInfo(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if (cb > 0) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String id = roleDao.getRoleIdByName(bean.getName());
|
||||
map.put("roleId", id);
|
||||
ar.setSucceed(map, GlobalConst.INIT_SUCCEED);
|
||||
if (cb == 5) {
|
||||
ar.setFailMsg("角色已存在");
|
||||
}
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("delNewById")
|
||||
@ApiOperation(value = "系统公告-删除公告")
|
||||
public AjaxRes delNewById(RoleDto bean) {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int result = roleService.delNewById(bean);
|
||||
if (result == 1) {
|
||||
ar.setSucceedMsg(GlobalConst.DATA_SUCCEED);
|
||||
} else {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "uploadPermission", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "角色-新增权限")
|
||||
@Transactional
|
||||
@PreAuthorize("hasAuthority('sys:role:add')")
|
||||
public AjaxRes uploadPermission(@RequestBody RoleDto bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = roleService.uploadPermission(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if (cb > 0) {
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updatePermission", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "角色-修改权限")
|
||||
@PreAuthorize("hasAuthority('sys:role:update')")
|
||||
@Transactional
|
||||
public AjaxRes updatePermission(@RequestBody RoleDto bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = roleService.updatePermission(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if (cb > 0) {
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
@RequestMapping(value = "updateRoleLevel", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "角色-修改角色级别")
|
||||
@Transactional
|
||||
public AjaxRes updateRoleLevel(@RequestBody RoleDto bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = roleService.updateRoleLevel(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if (cb > 0) {
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "insertRolePersonData", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "角色-新增成员")
|
||||
@Transactional
|
||||
public AjaxRes insertRolePersonData(@RequestBody RoleBean bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = roleService.insertRolePersonData(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if (cb > 0) {
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.leader.performance.manager.manager.dao.UserDao;
|
|||
import com.bonus.leader.performance.manager.manager.entity.MapBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.UserDto;
|
||||
import com.bonus.leader.performance.manager.manager.entity.ZNode;
|
||||
import com.bonus.leader.performance.manager.manager.model.LeaderBean;
|
||||
import com.bonus.leader.performance.manager.manager.model.SysUser;
|
||||
import com.bonus.leader.performance.manager.manager.table.PageTableHandler;
|
||||
import com.bonus.leader.performance.manager.manager.table.PageTableRequest;
|
||||
|
|
@ -130,6 +131,13 @@ public class UserController {
|
|||
List<SysUser> list = userService.getMsgList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
@LogAnnotation
|
||||
@PostMapping("getLeaderList")
|
||||
@ApiOperation(value = "公司领导设置-列表")
|
||||
public R getLeaderList(LeaderBean o){
|
||||
List<LeaderBean> list = userService.getLeaderList(o);
|
||||
return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("switchListen")
|
||||
|
|
@ -221,9 +229,6 @@ public class UserController {
|
|||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "getListPerson", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "个人信息-查询")
|
||||
|
|
@ -281,7 +286,6 @@ public class UserController {
|
|||
}else {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
|
@ -298,7 +302,42 @@ public class UserController {
|
|||
}
|
||||
return ar;
|
||||
}
|
||||
@LogAnnotation
|
||||
@PostMapping("setSort")
|
||||
@ApiOperation(value = "公司领导设置-排序设置")
|
||||
public AjaxRes setSort(LeaderBean bean) {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int result = userService.setSort(bean);
|
||||
if(result==1){
|
||||
ar.setSucceedMsg(GlobalConst.DATA_SUCCEED);
|
||||
}else {
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
@LogAnnotation
|
||||
@PostMapping("delLeaderById")
|
||||
@ApiOperation(value = "公司领导设置-删除")
|
||||
public AjaxRes delLeaderById(LeaderBean bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
userService.delLeaderById(bean);
|
||||
ar.setSucceedMsg(GlobalConst.DATA_SUCCEED);
|
||||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "insertLeaderData", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "用户管理-选择领导")
|
||||
public AjaxRes insertLeaderData(@RequestBody SysUser bean) throws Exception {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
int cb = userService.insertLeaderData(bean);
|
||||
ar.setFailMsg(GlobalConst.DATA_FAIL);
|
||||
if(cb>0){
|
||||
ar.setFailMsg(GlobalConst.INIT_SUCCEED);
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.bonus.leader.performance.manager.manager.dao;
|
||||
|
||||
import com.bonus.leader.performance.manager.manager.entity.AnnouncementBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.DownloadFileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.FileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.TreeBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -49,4 +46,7 @@ public interface AnnouncementDao {
|
|||
int updateTreeChild(TreeBean bean);
|
||||
|
||||
int delTreeChildById(TreeBean bean);
|
||||
|
||||
List<AskLeaveBean> getAsLeaveList(AskLeaveBean o);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.leader.performance.manager.manager.dao;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.bonus.leader.performance.manager.manager.entity.RoleDto;
|
||||
import com.bonus.leader.performance.manager.manager.model.Role;
|
||||
import com.bonus.leader.performance.manager.manager.model.RoleBean;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
|
|
@ -17,7 +18,8 @@ import org.apache.ibatis.annotations.Update;
|
|||
public interface RoleDao {
|
||||
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
@Insert("insert into sys_role(name, description, createTime, updateTime) values(#{name}, #{description}, now(),now())")
|
||||
@Insert("insert into sys_role(name,status, description, create_time, update_time) values(#{name}, " +
|
||||
"#{status},#{description}, now(),now())")
|
||||
int save(Role role);
|
||||
|
||||
int count(@Param("params") Map<String, Object> params);
|
||||
|
|
@ -25,13 +27,14 @@ public interface RoleDao {
|
|||
List<Role> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
@Select("select * from sys_role t where t.id = #{id}")
|
||||
@Select("select id,name,role_level as level,description,status from sys_role t where t.id = #{id}")
|
||||
Role getById(Long id);
|
||||
|
||||
@Select("select * from sys_role t where t.name = #{name}")
|
||||
@Select("select * from sys_role t where t.name = #{name} and is_active = 1")
|
||||
Role getRole(String name);
|
||||
|
||||
@Update("update sys_role t set t.name = #{name}, t.description = #{description}, updateTime = now() where t.id = #{id}")
|
||||
@Update("update sys_role t set t.name = #{name},t.status=#{status}, t.description = #{description}, update_time = " +
|
||||
"now() where t.id = #{id}")
|
||||
int update(Role role);
|
||||
|
||||
@Select("select * from sys_role r inner join sys_role_user ru on r.id = ru.roleId where ru.userId = #{userId}")
|
||||
|
|
@ -49,4 +52,16 @@ public interface RoleDao {
|
|||
int deleteRoleUser(Long roleId);
|
||||
|
||||
List<RoleBean> getNewRoleList(RoleBean o);
|
||||
|
||||
int delNewById(RoleDto bean);
|
||||
|
||||
String getRoleIdByName(String name);
|
||||
|
||||
int updateRoleLevel(RoleDto bean);
|
||||
|
||||
int getIsExistRelation(String roleId, String id);
|
||||
|
||||
int updateRolePersonData(String roleId, String id);
|
||||
|
||||
int insertRolePersonData(String roleId, String id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.Map;
|
|||
|
||||
import com.bonus.leader.performance.manager.manager.entity.MapBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.ZNode;
|
||||
import com.bonus.leader.performance.manager.manager.model.LeaderBean;
|
||||
import com.bonus.leader.performance.manager.manager.model.SysUser;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
|
|
@ -69,4 +70,20 @@ public interface UserDao {
|
|||
int delById(SysUser bean);
|
||||
|
||||
int insertLoginInfo(SysUser sysuser);
|
||||
|
||||
List<LeaderBean> getLeaderList(LeaderBean o);
|
||||
|
||||
int setOtherSort(LeaderBean bean);
|
||||
|
||||
int setSort(LeaderBean bean);
|
||||
|
||||
int setOtherSort2(LeaderBean bean);
|
||||
|
||||
int delLeaderById(LeaderBean bean);
|
||||
|
||||
int updateLeaderSortDown(LeaderBean bean);
|
||||
|
||||
int getMaxLeaderSort();
|
||||
|
||||
int insertLeaderData(SysUser bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.leader.performance.manager.manager.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* FileName: AskLeaveBean
|
||||
*
|
||||
* @author tqzhang
|
||||
* Date: 2024 2024/3/4 13:50
|
||||
* Description:请假记录报表
|
||||
*/
|
||||
@Data
|
||||
public class AskLeaveBean {
|
||||
private String id;
|
||||
private String name;
|
||||
private String type;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String matter;
|
||||
private String createTime;
|
||||
private String leaveDay;
|
||||
private String timeRange;
|
||||
private String keyWord;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.bonus.leader.performance.manager.manager.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* FileName: LeaderBean
|
||||
*
|
||||
* @author tqzhang
|
||||
* Date: 2024 2024/2/29 13:29
|
||||
* Description:公司领导
|
||||
*/
|
||||
@Data
|
||||
public class LeaderBean {
|
||||
|
||||
private String id;
|
||||
private String username;
|
||||
private String phone;
|
||||
private String orgName;
|
||||
private String roleName;
|
||||
private String sort;
|
||||
private String keyWord;
|
||||
private String userId;
|
||||
private String oldSort;
|
||||
}
|
||||
|
|
@ -8,6 +8,26 @@ public class Role extends BaseEntity<Long> {
|
|||
|
||||
private String description;
|
||||
|
||||
private String status;
|
||||
|
||||
private String level;
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import lombok.Data;
|
|||
@Data
|
||||
public class RoleBean {
|
||||
private String id;
|
||||
private String roleId;
|
||||
private String userId;
|
||||
private String name;
|
||||
private String description;
|
||||
private String createTime;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class SysUser extends BaseEntity<Long> {
|
|||
private String keyWord;
|
||||
private String orgName;
|
||||
private String roleName;
|
||||
|
||||
private String createTimes;
|
||||
private String level;
|
||||
private String orgId;
|
||||
private String pId;
|
||||
|
|
@ -47,6 +47,15 @@ public class SysUser extends BaseEntity<Long> {
|
|||
private String month;
|
||||
private String ip;
|
||||
private String type;
|
||||
private String sort;
|
||||
|
||||
public String getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(String sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.bonus.leader.performance.manager.manager.service;
|
||||
|
||||
import com.bonus.leader.performance.manager.manager.entity.AnnouncementBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.DownloadFileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.FileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.TreeBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -41,4 +38,6 @@ public interface AnnouncementService {
|
|||
int updateTreeChild(TreeBean bean);
|
||||
|
||||
int delTreeChildById(TreeBean bean);
|
||||
|
||||
List<AskLeaveBean> getAskLeaveList(AskLeaveBean o);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,4 +12,18 @@ public interface RoleService {
|
|||
void deleteRole(Long id);
|
||||
|
||||
List<RoleBean> getNewRoleList(RoleBean o);
|
||||
|
||||
int addInfo(RoleDto bean);
|
||||
|
||||
int updateInfo(RoleDto bean);
|
||||
|
||||
int delNewById(RoleDto bean);
|
||||
|
||||
int uploadPermission(RoleDto bean);
|
||||
|
||||
int updatePermission(RoleDto bean);
|
||||
|
||||
int updateRoleLevel(RoleDto bean);
|
||||
|
||||
int insertRolePersonData(RoleBean bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.leader.performance.manager.manager.service;
|
|||
import com.bonus.leader.performance.manager.manager.entity.MapBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.UserDto;
|
||||
import com.bonus.leader.performance.manager.manager.entity.ZNode;
|
||||
import com.bonus.leader.performance.manager.manager.model.LeaderBean;
|
||||
import com.bonus.leader.performance.manager.manager.model.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -46,4 +47,12 @@ public interface UserService {
|
|||
int resetPassword(SysUser bean);
|
||||
|
||||
int delById(SysUser bean);
|
||||
|
||||
List<LeaderBean> getLeaderList(LeaderBean o);
|
||||
|
||||
int setSort(LeaderBean bean);
|
||||
|
||||
int delLeaderById(LeaderBean bean);
|
||||
|
||||
int insertLeaderData(SysUser bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ package com.bonus.leader.performance.manager.manager.service.impl;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.bonus.leader.performance.manager.manager.dao.AnnouncementDao;
|
||||
import com.bonus.leader.performance.manager.manager.entity.AnnouncementBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.DownloadFileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.FileBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.TreeBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.*;
|
||||
import com.bonus.leader.performance.manager.manager.service.AnnouncementService;
|
||||
import com.bonus.leader.performance.manager.manager.utils.UserUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -143,4 +140,9 @@ public class AnnouncementServiceImpl implements AnnouncementService {
|
|||
public int delTreeChildById(TreeBean bean) {
|
||||
return dao.delTreeChildById(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AskLeaveBean> getAskLeaveList(AskLeaveBean o) {
|
||||
return dao.getAsLeaveList(o);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,70 @@ public class RoleServiceImpl implements RoleService {
|
|||
return roleDao.getNewRoleList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addInfo(RoleDto role) {
|
||||
Role r = roleDao.getRole(role.getName());
|
||||
if (r != null) {
|
||||
return 5;
|
||||
}
|
||||
return roleDao.save(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateInfo(RoleDto role) {
|
||||
Role r = roleDao.getRole(role.getName());
|
||||
if (r != null && !r.getId().equals(role.getId())) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
return roleDao.update(role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delNewById(RoleDto bean) {
|
||||
return roleDao.delNewById(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int uploadPermission(RoleDto bean) {
|
||||
roleDao.deleteRolePermission(bean.getId());
|
||||
List<Long> permissionIds = bean.getPermissionIds();
|
||||
permissionIds.remove(0L);
|
||||
if (!CollectionUtils.isEmpty(permissionIds)) {
|
||||
return roleDao.saveRolePermission(bean.getId(), permissionIds);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updatePermission(RoleDto bean) {
|
||||
roleDao.deleteRolePermission(bean.getId());
|
||||
List<Long> permissionIds = bean.getPermissionIds();
|
||||
permissionIds.remove(0L);
|
||||
if (!CollectionUtils.isEmpty(permissionIds)) {
|
||||
return roleDao.saveRolePermission(bean.getId(), permissionIds);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRoleLevel(RoleDto bean) {
|
||||
return roleDao.updateRoleLevel(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertRolePersonData(RoleBean bean) {
|
||||
String userId = bean.getUserId();
|
||||
String[] userIdArr = userId.split(",");
|
||||
int code = 0;
|
||||
for (String id : userIdArr) {
|
||||
int num = roleDao.getIsExistRelation(bean.getRoleId(), id);
|
||||
if (num > 0){
|
||||
code = roleDao.updateRolePersonData(bean.getRoleId(), id);
|
||||
}else {
|
||||
code = roleDao.insertRolePersonData(bean.getRoleId(), id);
|
||||
}
|
||||
}
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
package com.bonus.leader.performance.manager.manager.service.impl;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -15,6 +8,7 @@ import com.bonus.leader.performance.manager.manager.dao.UserDao;
|
|||
import com.bonus.leader.performance.manager.manager.dao.UtilDao;
|
||||
import com.bonus.leader.performance.manager.manager.entity.MapBean;
|
||||
import com.bonus.leader.performance.manager.manager.entity.ZNode;
|
||||
import com.bonus.leader.performance.manager.manager.model.LeaderBean;
|
||||
import com.bonus.leader.performance.manager.manager.model.SysUser;
|
||||
import com.bonus.leader.performance.manager.manager.utils.UserUtil;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -176,6 +170,50 @@ public class UserServiceImpl implements UserService {
|
|||
return userDao.delById(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeaderBean> getLeaderList(LeaderBean o) {
|
||||
return userDao.getLeaderList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setSort(LeaderBean bean) {
|
||||
int code = 0;
|
||||
if(Integer.parseInt(bean.getOldSort()) > Integer.parseInt(bean.getSort())) {
|
||||
code = userDao.setOtherSort(bean);
|
||||
}else {
|
||||
code = userDao.setOtherSort2(bean);
|
||||
}
|
||||
if (code > 0){
|
||||
code = userDao.setSort(bean);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delLeaderById(LeaderBean bean) {
|
||||
int code = userDao.delLeaderById(bean);
|
||||
if (code > 0){
|
||||
code = userDao.updateLeaderSortDown(bean);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertLeaderData(SysUser bean) {
|
||||
String userId = bean.getUserId();
|
||||
String[] userArr = userId.split(",");
|
||||
int sort = userDao.getMaxLeaderSort();
|
||||
bean.setUsername(UserUtil.getLoginUser().getId().toString());
|
||||
int code = 0;
|
||||
for (String id : userArr) {
|
||||
sort++;
|
||||
bean.setUserId(id);
|
||||
bean.setSort(String.valueOf(sort));
|
||||
code = userDao.insertLeaderData(bean);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
|
|
|
|||
|
|
@ -126,24 +126,17 @@
|
|||
</select>
|
||||
<select id="getCompanyProTree"
|
||||
resultType="com.bonus.leader.performance.manager.manager.entity.TreeBean">
|
||||
SELECT id,
|
||||
org_name as title,
|
||||
parent_id as parentId,
|
||||
level
|
||||
FROM sys_organization
|
||||
WHERE LEVEL = '0'
|
||||
and is_active = '1' and is_enable = '1'
|
||||
union all
|
||||
SELECT s.id as id, s.org_name as title, s.parent_id as parentId, s.level
|
||||
FROM sys_organization s
|
||||
left join sys_organization so on so.id = s.parent_id
|
||||
WHERE s.is_active = '1' and s.LEVEL = '1' and so.is_active = '1' and so.is_enable = '1'
|
||||
union all
|
||||
SELECT s.id as id, s.org_name as title, s.parent_id as parentId, s.level
|
||||
FROM sys_organization s
|
||||
left join sys_organization so on so.id = s.parent_id
|
||||
left join sys_organization sos on sos.id = so.parent_id
|
||||
WHERE s.is_active = '1' and s.LEVEL = '2' and so.is_active = '1' and so.is_enable = '1' and sos.is_active = '1' and sos.is_enable = '1'
|
||||
SELECT
|
||||
id,
|
||||
org_name AS title,
|
||||
parent_id AS parentId,
|
||||
LEVEL,
|
||||
org_type as type
|
||||
FROM
|
||||
sys_organization
|
||||
WHERE
|
||||
is_active = '1'
|
||||
AND is_enable = '1'
|
||||
</select>
|
||||
<select id="getPersonTree" resultType="com.bonus.leader.performance.manager.manager.entity.TreeBean">
|
||||
SELECT id,
|
||||
|
|
@ -179,4 +172,30 @@
|
|||
left join sys_organization so1 on so1.id = so.parent_id
|
||||
where so.id = #{id} and so.is_active = '1' and so.is_enable = '1'
|
||||
</select>
|
||||
<select id="getAsLeaveList" resultType="com.bonus.leader.performance.manager.manager.entity.AskLeaveBean">
|
||||
select
|
||||
al.id as id,
|
||||
al.ask_leave_type as type,
|
||||
al.ask_leave_reason as reason,
|
||||
al.start_time as startTime,
|
||||
al.end_time as endTime,
|
||||
al.create_time as createTime,
|
||||
al.is_active as status,
|
||||
su.username as userName
|
||||
from ask_leave al
|
||||
left join sys_user su on al.user_id = su.id
|
||||
where al.is_active = '1'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND(
|
||||
su.username LIKE concat ('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
AND al.ask_leave_type = #{type}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND DATE(al.create_time) = #{startTime}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -10,6 +10,15 @@
|
|||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<update id="updateRoleLevel">
|
||||
update sys_role set role_level = #{level} where id = #{id}
|
||||
</update>
|
||||
<update id="updateRolePersonData">
|
||||
update sys_role_user set userId = #{id} where roleId = #{roleId}
|
||||
</update>
|
||||
<delete id="delNewById">
|
||||
update sys_role set is_active = '0' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(1) from sys_role t
|
||||
|
|
@ -28,6 +37,14 @@
|
|||
select * from sys_role t
|
||||
where t.is_active = '1'
|
||||
</select>
|
||||
<select id="getRoleIdByName" resultType="java.lang.String">
|
||||
select id from sys_role t
|
||||
where t.name = #{name} and t.is_active = '1'
|
||||
</select>
|
||||
<select id="getIsExistRelation" resultType="java.lang.Integer">
|
||||
select count(1) from sys_role_user t
|
||||
where t.roleId = #{roleId} and t.userId = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="saveRolePermission">
|
||||
insert into sys_role_permission(roleId, permissionId) values
|
||||
|
|
@ -36,5 +53,8 @@
|
|||
(#{roleId}, #{permissionId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertRolePersonData">
|
||||
insert into sys_role_user(roleId, userId) values (#{roleId}, #{id})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -3,202 +3,245 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.leader.performance.manager.manager.dao.UserDao">
|
||||
|
||||
<sql id="where">
|
||||
<where>
|
||||
<if test="params.username != null and params.username != ''">
|
||||
and t.username like concat('%', #{params.username}, '%')
|
||||
</if>
|
||||
<if test="params.nickname != null and params.nickname != ''">
|
||||
and t.nickname like concat('%', #{params.nickname}, '%')
|
||||
</if>
|
||||
<if test="params.status != null and params.status != ''">
|
||||
and t.status = #{params.status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<delete id="delById">
|
||||
update sys_user set is_active = '0' where id = #{id}
|
||||
</delete>
|
||||
<sql id="where">
|
||||
<where>
|
||||
<if test="params.username != null and params.username != ''">
|
||||
and t.username like concat('%', #{params.username}, '%')
|
||||
</if>
|
||||
<if test="params.nickname != null and params.nickname != ''">
|
||||
and t.nickname like concat('%', #{params.nickname}, '%')
|
||||
</if>
|
||||
<if test="params.status != null and params.status != ''">
|
||||
and t.status = #{params.status}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
<delete id="delById">
|
||||
update sys_user
|
||||
set is_active = '0'
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="delLeaderById">
|
||||
delete from sys_leader where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="count" resultType="int">
|
||||
select count(1) from sys_user t
|
||||
<include refid="where" />
|
||||
</select>
|
||||
<select id="count" resultType="int">
|
||||
select count(1) from sys_user t
|
||||
<include refid="where"/>
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
select * from sys_user t
|
||||
<include refid="where" />
|
||||
${params.orderBy}
|
||||
<select id="list" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
select * from sys_user t
|
||||
<include refid="where"/>
|
||||
${params.orderBy}
|
||||
limit #{offset}, #{limit}
|
||||
</select>
|
||||
<select id="getRole" resultType="com.bonus.leader.performance.manager.manager.entity.MapBean">
|
||||
select id as `key`,name as `value` from sys_role where is_active ='1'
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and id = #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getDepartmentTree" resultType="com.bonus.leader.performance.manager.manager.entity.ZNode">
|
||||
SELECT
|
||||
ID,
|
||||
org_name as name,
|
||||
parent_id as pId,
|
||||
0 as type
|
||||
FROM
|
||||
sys_organization
|
||||
WHERE
|
||||
is_active = '1' and is_enable = '1'
|
||||
</select>
|
||||
<select id="getListById" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
select t.id ,
|
||||
t.username,
|
||||
t.phone,
|
||||
t.org_id as departmentId,
|
||||
so.org_name as department,
|
||||
t.role_id as roleId,
|
||||
sr.name as roleNamer
|
||||
from sys_user t
|
||||
left join sys_organization so on so.id = t.org_id and so.is_active = '1'
|
||||
left join sys_role sr on sr.id = t.role_id and sr.is_active = '1'
|
||||
where
|
||||
t.is_active = '1' and t.id= #{id}
|
||||
</select>
|
||||
<select id="getMsgList" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
select
|
||||
t.ID as id,
|
||||
t.username,
|
||||
t.phone,
|
||||
sr.name as roleName,
|
||||
so.org_name as orgName,
|
||||
t.createTime as createTimes,
|
||||
t.status as status
|
||||
from sys_user t
|
||||
left join sys_role sr on t.role_id = sr.id and sr.is_active = '1'
|
||||
left join sys_organization so on t.org_id = so.id and sr.is_active = '1'
|
||||
where
|
||||
t.is_active = '1'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and t.username like concat('%', #{keyWord}, '%')
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and t.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and t.org_id = #{orgId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getEyId" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
SELECT
|
||||
username AS username,
|
||||
phone AS phone
|
||||
FROM sys_user
|
||||
WHERE id = #{userId};
|
||||
</select>
|
||||
</select>
|
||||
<select id="getRole" resultType="com.bonus.leader.performance.manager.manager.entity.MapBean">
|
||||
select id as `key`,name as `value` from sys_role where is_active ='1'
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and id = #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getDepartmentTree" resultType="com.bonus.leader.performance.manager.manager.entity.ZNode">
|
||||
SELECT ID,
|
||||
org_name as name,
|
||||
parent_id as pId,
|
||||
0 as type
|
||||
FROM sys_organization
|
||||
WHERE is_active = '1'
|
||||
and is_enable = '1'
|
||||
</select>
|
||||
<select id="getListById" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
select t.id,
|
||||
t.username,
|
||||
t.phone,
|
||||
t.org_id as departmentId,
|
||||
so.org_name as department,
|
||||
t.role_id as roleId,
|
||||
sr.name as roleNamer
|
||||
from sys_user t
|
||||
left join sys_organization so
|
||||
on so.id = t.org_id and so.is_active = '1'
|
||||
left join sys_role sr
|
||||
on sr.id = t.role_id and sr.is_active = '1'
|
||||
where t.is_active = '1'
|
||||
and t.id = #{id}
|
||||
</select>
|
||||
<select id="getMsgList" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
select
|
||||
t.ID as id,
|
||||
t.username,
|
||||
t.phone,
|
||||
sr.name as roleName,
|
||||
so.org_name as orgName,
|
||||
t.createTime as createTimes,
|
||||
t.status as status
|
||||
from sys_user t
|
||||
left join sys_role sr on t.role_id = sr.id and sr.is_active = '1'
|
||||
left join sys_organization so on t.org_id = so.id and sr.is_active = '1'
|
||||
where
|
||||
t.is_active = '1'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and t.username like concat('%', #{keyWord}, '%')
|
||||
</if>
|
||||
<if test="roleId != null and roleId != ''">
|
||||
and t.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="orgId != null and orgId != ''">
|
||||
and t.org_id = #{orgId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getEyId" resultType="com.bonus.leader.performance.manager.manager.model.SysUser">
|
||||
SELECT username AS username,
|
||||
phone AS phone
|
||||
FROM sys_user
|
||||
WHERE id = #{userId};
|
||||
</select>
|
||||
<select id="getLeaderList" resultType="com.bonus.leader.performance.manager.manager.model.LeaderBean">
|
||||
select
|
||||
sl.id,
|
||||
su.username,
|
||||
su.phone,
|
||||
so.org_name as orgName,
|
||||
sr.name as roleName,
|
||||
sl.sort
|
||||
from sys_leader sl
|
||||
left join sys_user su on sl.user_id = su.id and su.is_active = '1'
|
||||
left join sys_organization so on su.org_id = so.id and so.is_active = '1'
|
||||
left join sys_role sr on su.role_id = sr.id and sr.is_active = '1'
|
||||
where sl.is_active = '1'
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and su.username like concat('%', #{keyWord}, '%')
|
||||
</if>
|
||||
order by sl.sort
|
||||
</select>
|
||||
<select id="getMaxLeaderSort" resultType="java.lang.Integer">
|
||||
select max(sort) from sys_leader where is_active = '1'
|
||||
</select>
|
||||
|
||||
<insert id="saveUserRoles">
|
||||
insert into sys_role_user(roleId, userId) values
|
||||
<foreach collection="roleIds" item="roleId" separator=",">
|
||||
(#{roleId}, #{userId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addInfo">
|
||||
insert into sys_user(username,password,phone,role_id,org_id,status,is_active)
|
||||
values (#{username},#{password},#{phone},#{roleId},#{departmentId},'1','1')
|
||||
</insert>
|
||||
<insert id="insertroleUser">
|
||||
INSERT INTO sys_role_user(userId, roleId)
|
||||
SELECT id, #{roleId}
|
||||
FROM sys_user
|
||||
WHERE phone = #{phone} and is_active = '1'
|
||||
</insert>
|
||||
<insert id="insertLoginInfo">
|
||||
insert into login_logs
|
||||
(system_name, ip, address, createTime, month, is_active, userId)
|
||||
values
|
||||
(#{systemName}, #{ipAddress}, #{hostName}, now(), #{month}, '1', #{userId})
|
||||
</insert>
|
||||
<insert id="saveUserRoles">
|
||||
insert into sys_role_user(roleId, userId) values
|
||||
<foreach collection="roleIds" item="roleId" separator=",">
|
||||
(#{roleId}, #{userId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addInfo">
|
||||
insert into sys_user(username, password, phone, role_id, org_id, status, is_active)
|
||||
values (#{username}, #{password}, #{phone}, #{roleId}, #{departmentId}, '1', '1')
|
||||
</insert>
|
||||
<insert id="insertroleUser">
|
||||
INSERT INTO sys_role_user(userId, roleId)
|
||||
SELECT id, #{roleId}
|
||||
FROM sys_user
|
||||
WHERE phone = #{phone}
|
||||
and is_active = '1'
|
||||
</insert>
|
||||
<insert id="insertLoginInfo">
|
||||
insert into login_logs
|
||||
(system_name, ip, address, createTime, month, is_active, userId)
|
||||
values (#{systemName}, #{ipAddress}, #{hostName}, now(), #{month}, '1', #{userId})
|
||||
</insert>
|
||||
<insert id="insertLeaderData">
|
||||
insert into sys_leader(user_id, sort, is_active,operate_id)
|
||||
values (#{userId}, #{sort}, '1',#{username})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update sys_user t
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="nickname != null">
|
||||
nickname = #{nickname},
|
||||
</if>
|
||||
<if test="headImgUrl != null">
|
||||
headImgUrl = #{headImgUrl},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="telephone != null">
|
||||
telephone = #{telephone},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email = #{email},
|
||||
</if>
|
||||
<if test="birthday != null">
|
||||
birthday = #{birthday},
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
sex = #{sex},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
updateTime = #{updateTime}
|
||||
</set>
|
||||
where t.id = #{id}
|
||||
</update>
|
||||
<update id="updateSwitchListen">
|
||||
update sys_user set status = #{status} where id = #{id}
|
||||
</update>
|
||||
<update id="updateInfo">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="roleId != null">
|
||||
role_id = #{roleId},
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
org_id = #{departmentId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateRoleUser">
|
||||
UPDATE sys_role_user
|
||||
SET
|
||||
roleId = #{roleId}
|
||||
WHERE
|
||||
userId = #{id};
|
||||
</update>
|
||||
<update id="updateMyInfo">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="roleId != null">
|
||||
role_id = #{roleId},
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
org_id = #{departmentId},
|
||||
</if>
|
||||
</set>
|
||||
where phone = #{phone}
|
||||
</update>
|
||||
<update id="resetPassword">
|
||||
update sys_user set password = #{password} where id = #{id}
|
||||
</update>
|
||||
<update id="update">
|
||||
update sys_user t
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="nickname != null">
|
||||
nickname = #{nickname},
|
||||
</if>
|
||||
<if test="headImgUrl != null">
|
||||
headImgUrl = #{headImgUrl},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="telephone != null">
|
||||
telephone = #{telephone},
|
||||
</if>
|
||||
<if test="email != null">
|
||||
email = #{email},
|
||||
</if>
|
||||
<if test="birthday != null">
|
||||
birthday = #{birthday},
|
||||
</if>
|
||||
<if test="sex != null">
|
||||
sex = #{sex},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
updateTime = #{updateTime}
|
||||
</set>
|
||||
where t.id = #{id}
|
||||
</update>
|
||||
<update id="updateSwitchListen">
|
||||
update sys_user
|
||||
set status = #{status}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateInfo">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="roleId != null">
|
||||
role_id = #{roleId},
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
org_id = #{departmentId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateRoleUser">
|
||||
UPDATE sys_role_user
|
||||
SET roleId = #{roleId}
|
||||
WHERE userId = #{id};
|
||||
</update>
|
||||
<update id="updateMyInfo">
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="username != null">
|
||||
username = #{username},
|
||||
</if>
|
||||
<if test="phone != null">
|
||||
phone = #{phone},
|
||||
</if>
|
||||
<if test="roleId != null">
|
||||
role_id = #{roleId},
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
org_id = #{departmentId},
|
||||
</if>
|
||||
</set>
|
||||
where phone = #{phone}
|
||||
</update>
|
||||
<update id="resetPassword">
|
||||
update sys_user
|
||||
set password = #{password}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="setOtherSort">
|
||||
update sys_leader set sort = sort + 1 where sort >= #{sort} and sort < #{oldSort} and is_active = '1'
|
||||
</update>
|
||||
<update id="setSort">
|
||||
update sys_leader set sort = #{sort} where id = #{id}
|
||||
</update>
|
||||
<update id="setOtherSort2">
|
||||
update sys_leader set sort = sort - 1 where sort > #{oldSort} and sort <= #{sort} and is_active = '1'
|
||||
</update>
|
||||
<update id="updateLeaderSortDown">
|
||||
update sys_leader set sort = sort - 1 where sort >= #{sort} and is_active = '1'
|
||||
</update>
|
||||
</mapper>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -23,17 +23,20 @@ var notice;
|
|||
var form;
|
||||
var util;
|
||||
var nprogress;
|
||||
|
||||
var dtree;
|
||||
var xmSelect;
|
||||
/**
|
||||
* 初始化layui
|
||||
*/
|
||||
layui.use(['layer', 'notice', 'form', 'util', 'nprogress'], function () {
|
||||
layui.use(['layer', 'notice', 'form', 'util', 'nprogress','dtree','tree','xmSelect'], function () {
|
||||
layer = layui.layer;
|
||||
notice = layui.notice;
|
||||
form = layui.form;
|
||||
util = layui.util;
|
||||
nprogress = layui.nprogress;
|
||||
|
||||
dtree = layui.dtree;
|
||||
tree = layui.tree;
|
||||
xmSelect = layui.xmSelect;
|
||||
/**
|
||||
* 页面加载进度条
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,10 +3,12 @@ var oldDepartment;
|
|||
var oldDepartmentId;
|
||||
var oldRoleId;
|
||||
var oldRoleName;
|
||||
layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
||||
layui.use(['table', 'layer', 'laydate', 'jquery', 'form','notice','layNotify'], function () {
|
||||
var table = layui.table;
|
||||
var laydate = layui.laydate;
|
||||
let form = layui.form;
|
||||
notice = layui.notice;
|
||||
layNotify = layui.layNotify;
|
||||
|
||||
//渲染table
|
||||
table.render({
|
||||
|
|
@ -62,10 +64,10 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
|||
type: 'POST',
|
||||
data: { id: value, status: status },
|
||||
success: function(res) {
|
||||
layer.msg('状态更新成功');
|
||||
thisTip('提示','状态更新成功','success')
|
||||
},
|
||||
error: function() {
|
||||
layer.msg('更新状态失败');
|
||||
thisTip('提示','状态更新失败','error')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -131,6 +133,9 @@ layui.use(['table', 'layer', 'laydate', 'jquery', 'form'], function () {
|
|||
case "addBtn":
|
||||
openForm("",'新增用户');
|
||||
break;
|
||||
case "leaderSetBtn":
|
||||
layerOpenView('公司领导设置',"./leaderSetList.html","90%","95%")
|
||||
break;
|
||||
case "resetBt":
|
||||
oldKeyWord = "";
|
||||
oldDepartment = "点击进行部门选择";
|
||||
|
|
@ -200,7 +205,7 @@ function resetPassword(id){
|
|||
btnAlign:'c',
|
||||
}, function(value, index, elem){
|
||||
if (!password_reg(value)){
|
||||
layer.msg("密码过于简单,必须包含数字,特殊符号,大写或小写!",{icon:0});
|
||||
thisTip('提示','密码过于简单,必须包含数字,特殊符号,大写或小写!','warning')
|
||||
return false;
|
||||
}
|
||||
ajaxCommonMethods('/users/resetPassword',{'id': id,'password':value},"重置成功","重置失败","1");
|
||||
|
|
@ -288,4 +293,30 @@ function clickRole(e, treeId, treeNode) {
|
|||
}
|
||||
// }
|
||||
}
|
||||
/**树的方法结束*/
|
||||
/**树的方法结束*/
|
||||
|
||||
/**
|
||||
* @param url 例:'/consRelation/recallConsById'
|
||||
* @param data 例:{'consId': consId, 'proId': proId}
|
||||
* @param success
|
||||
* @param error
|
||||
* @param type 1 父页面 2 子页面
|
||||
*/
|
||||
function ajaxCommonMethods(url, data, success, error, type) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: ctxPath + url,// 请求地址
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: data, //获取提交的表单字段
|
||||
success: function (data) {
|
||||
var resMsg = data.resMsg;
|
||||
if ("数据获取成功" == resMsg) {
|
||||
thisTip('提示', success, 'success');
|
||||
} else {
|
||||
thisTip('提示', error, 'error');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
var oldKeyWord;
|
||||
var table;
|
||||
var tableIns;
|
||||
layui.use(['table', 'layer', 'laydate', 'jquery', 'form','notice', 'layNotify'], function () {
|
||||
table = layui.table;
|
||||
var laydate = layui.laydate;
|
||||
let form = layui.form;
|
||||
notice = layui.notice;
|
||||
layNotify = layui.layNotify;
|
||||
//渲染table
|
||||
tableIns = table.render({
|
||||
elem: '#demo'
|
||||
, url: ctxPath + '/users/getLeaderList' //数据接口
|
||||
, method: 'post' //方式默认是get
|
||||
, toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
||||
, where: {} //post请求必须加where ,post请求需要的参数
|
||||
, cellMinWidth: 80
|
||||
, cols: [[ //表头
|
||||
{field: 'number', width: 100, title: '序号', align: 'center', type: 'numbers'}
|
||||
, {field: 'username', width: 200, align: 'center', title: '用户名'}
|
||||
, {field: 'phone', width: 150, align: 'center', title: '联系方式(登录名)'}
|
||||
, {field: 'roleName', width: 200, align: 'center', title: '角色'}
|
||||
, {field: 'orgName', width: 220, align: 'center', title: '组织机构'}
|
||||
, {field: 'sort', width: 220, align: 'center', title: '排序'}
|
||||
, {fixed: 'right', title: '操作', align: 'center', toolbar: '#toolsBar'}
|
||||
]]
|
||||
, id: 'menuTable'
|
||||
, page: true //开启分页
|
||||
, loading: true //数据加载中。。。
|
||||
, limits: [10, 20, 50, 100] //一页选择显示3,5或10条数据
|
||||
, limit: 10 //一页显示5条数据
|
||||
, response: {
|
||||
statusCode: 200 //规定成功的状态码,默认:0
|
||||
}, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||
let result;
|
||||
if (res.data !== '' && res.data != null && res.data !== "null") {
|
||||
if (this.page.curr) {
|
||||
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
||||
} else {
|
||||
result = res.data.slice(0, this.limit);
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.count, //解析数据长度
|
||||
"data": result, //解析数据列表
|
||||
};
|
||||
},
|
||||
toolbar: "#toolbar"
|
||||
});
|
||||
// 行工具事件
|
||||
table.on('tool(test)', function (obj) {
|
||||
var data = obj.data //获得当前行数据
|
||||
var layEvent = obj.event; //获得 lay-event 对应的值
|
||||
var id = data.id
|
||||
if (layEvent === 'sort') {
|
||||
//排序
|
||||
layer.prompt({
|
||||
formType: 0,
|
||||
value: '',
|
||||
title: '请输入排序序号',
|
||||
btn:['确定','取消'],
|
||||
btnAlign:'c',
|
||||
}, function(value, index, elem){
|
||||
if (!isPositiveInteger(value)){
|
||||
parentTip('提示',"序号必须是正整数!", "error");
|
||||
return false;
|
||||
}
|
||||
ajaxCommonMethods('/users/setSort',{'id': id,'sort':value,'oldSort':data.sort},"设置成功","设置失败","1");
|
||||
});
|
||||
} else if (layEvent === 'del') {
|
||||
del(id,data.sort);
|
||||
}
|
||||
});
|
||||
|
||||
//头监听事件 -- checkBox 选中行和选中条数
|
||||
table.on('toolbar(test)', function (obj) {
|
||||
// 获取当前表格被选中的记录对象,返回数据
|
||||
table.checkStatus(obj.config.id);
|
||||
//获取事件名,执行对应的代码
|
||||
var eventName = obj.event;
|
||||
console.log(eventName)
|
||||
switch (eventName) {
|
||||
case "searchBt":
|
||||
oldKeyWord = $("#keyWord").val();
|
||||
table.reload('menuTable', {
|
||||
url: ctxPath + '/users/getLeaderList'
|
||||
, method: 'post' //方式默认是get
|
||||
, page: true
|
||||
, where: {
|
||||
keyWord: oldKeyWord,
|
||||
} //设定异步数据接口的额外参数
|
||||
});
|
||||
/**二次赋值-- 点击搜索按钮之后会进行一次刷新操作*/
|
||||
$("#keyWord").val(oldKeyWord);
|
||||
break;
|
||||
case "addBtn":
|
||||
openForm("", '选择领导');
|
||||
break;
|
||||
case "resetBt":
|
||||
oldKeyWord = "";
|
||||
$("#keyWord").val("");
|
||||
table.reload('menuTable', {
|
||||
url: ctxPath + '/users/getLeaderList'
|
||||
, method: 'post' //方式默认是get
|
||||
, page: true
|
||||
, where: {
|
||||
keyWord: "",
|
||||
} //设定异步数据接口的额外参数
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增-修改功能
|
||||
*/
|
||||
function openForm(id, title) {
|
||||
layerOpenForm(title, "./selectLeader.html", "90%", "95%")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除功能
|
||||
*/
|
||||
function del(id,sort) {
|
||||
layer.confirm('确定要删除吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
ajaxCommonMethods('/users/delLeaderById', {'id': id,'sort':sort}, "删除成功", "删除失败", "1");
|
||||
layer.close(1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function ajaxCommonMethods(url, data, success, error, type) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: ctxPath + url,// 请求地址
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: data, //获取提交的表单字段
|
||||
success: function (data) {
|
||||
var resMsg = data.resMsg;
|
||||
if ("数据获取成功" == resMsg) {
|
||||
parentTip('提示', success, "success");
|
||||
setTimeout(function(){
|
||||
window.location.reload(); //刷新父级窗口
|
||||
},2000)
|
||||
} else {
|
||||
parentTip('提示', error, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,270 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>请假记录报表</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../../js/layui-v2.9.6/css/layui.css">
|
||||
<style>
|
||||
body {
|
||||
font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif !important;
|
||||
}
|
||||
|
||||
.layui-btn-sm {
|
||||
height: 35px;
|
||||
line-height: 30px;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.layui-table th {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.layui-form-item {
|
||||
margin-left: 0px !important;
|
||||
}
|
||||
|
||||
.layui-table-tool {
|
||||
padding: 10px 0 !important;
|
||||
}
|
||||
|
||||
.layui-form-item {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.widget-body, #demo, .layui-table-view {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.layui-input, .layui-textarea {
|
||||
display: block;
|
||||
/*width: 60%;*/
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.layui-form-label {
|
||||
position: relative;
|
||||
float: left;
|
||||
display: block;
|
||||
padding: 12px 15px;
|
||||
width: 80px;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.layui-form-select .layui-edge {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
left: 83%;
|
||||
margin-top: -3px;
|
||||
cursor: pointer;
|
||||
border-width: 6px;
|
||||
border-top-color: #c2c2c2;
|
||||
border-top-style: solid;
|
||||
transition: all .3s;
|
||||
-webkit-transition: all .3s;
|
||||
}
|
||||
|
||||
.layui-form-select dl {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
padding: 5px 0;
|
||||
z-index: 899;
|
||||
min-width: 100%;
|
||||
border: 1px solid #eee;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
box-shadow: 1px 1px 4px rgb(0 0 0 / 8%);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.layui-table-tool-self {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#orgContent {
|
||||
display: none;
|
||||
overflow: auto;
|
||||
width: 300px;
|
||||
height: 350px;
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
background-color: rgb(255 255 255);
|
||||
left: 195.875px;
|
||||
border: 1px solid #e1e1e1;
|
||||
top: 48px;
|
||||
}
|
||||
|
||||
.ztree li a.curSelectedNode {
|
||||
padding-top: 0px;
|
||||
background-color: #FFE6B0;
|
||||
color: #907244;
|
||||
height: 16px;
|
||||
border: 1px #FFB951 solid;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.ztree li a {
|
||||
padding: 1px 3px 0 0;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
height: 17px;
|
||||
color: #767272;
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
</form>
|
||||
|
||||
<div style="margin-left: 15px;margin-right: 15px;">
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline" style="margin-top: 2px;margin-left: 1%;">
|
||||
<input type="text" id="keyWord" placeholder="关键字" autocomplete="off" class="layui-input"
|
||||
style="width: 100%">
|
||||
</div>
|
||||
<div class="layui-input-inline" style="margin-top: 2px;margin-left: 1%;">
|
||||
<input type="text" class="layui-input" id="timeRange" placeholder="选择日期范围">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline" style="width: 5%;margin-top: 4px">
|
||||
<button id="searchBt" class="layui-btn layui-btn-sm" lay-event="searchBt">查询</button>
|
||||
</div>
|
||||
<div class="layui-inline" style="width: 5%;margin-top: 4px;margin-left: 10px;">
|
||||
<button id="resetBt" class="layui-btn layui-btn-sm" lay-event="resetBt">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="widget-body">
|
||||
<table id="demo" lay-filter="test" class="layui-table" lay-size="lg">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script type="text/javascript" src="../../js/jquery-3.6.0.js"></script>
|
||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||
<script type="text/javascript" src="../../js/layui-v2.9.6/layui.js"></script>
|
||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||
<script type="text/javascript" src="../../js/common_methon.js"></script>
|
||||
<script type="text/javascript" src="../../js/dict.js"></script>
|
||||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
|
||||
<script>
|
||||
var laydate;
|
||||
layui.use(['form','table','laydate'], function () {
|
||||
form = layui.form;
|
||||
table = layui.table;
|
||||
laydate = layui.laydate;
|
||||
|
||||
// 年份范围
|
||||
laydate.render({
|
||||
elem: "#timeRange",
|
||||
type: "year",
|
||||
range: true,
|
||||
shortcuts: [
|
||||
{
|
||||
text: "过去一年",
|
||||
value: function(){
|
||||
var now = new Date();
|
||||
now.setFullYear(now.getFullYear() - 1);
|
||||
return [now, new Date()];
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "未来一年",
|
||||
value: function(){
|
||||
var now = new Date();
|
||||
now.setFullYear(now.getFullYear() + 1);
|
||||
return [new Date(), now];
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "近三年",
|
||||
value: function(){
|
||||
var now = new Date();
|
||||
now.setFullYear(now.getFullYear() - 3);
|
||||
return [now, new Date()];
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
$("#searchBt").click(function () {
|
||||
let keyWord = $("#keyWord").val();
|
||||
let timeRange = $("#timeRange").val();
|
||||
table.reload('menuTable', {
|
||||
url: ctxPath + '/announcement/getAskLeaveList'
|
||||
, method: 'post' //方式默认是get
|
||||
, where: {
|
||||
keyWord: keyWord,
|
||||
startTime: timeRange.substring(0, 10),
|
||||
endTime: timeRange.substring(13, 23)
|
||||
} //设定异步数据接口的额外参数
|
||||
});
|
||||
});
|
||||
$("#resetBt").click(function () {
|
||||
$("#keyWord").val("");
|
||||
$("#timeRange").val("");
|
||||
table.reload('menuTable', {
|
||||
url: ctxPath + '/announcement/getAskLeaveList'
|
||||
, method: 'post' //方式默认是get
|
||||
, where: {
|
||||
keyWord: "",
|
||||
startTime: "",
|
||||
endTime: ""
|
||||
} //设定异步数据接口的额外参数
|
||||
});
|
||||
});
|
||||
|
||||
table.render({
|
||||
elem: '#demo'
|
||||
, url: ctxPath + '/announcement/getAskLeaveList' //数据接口
|
||||
, method: 'post' //方式默认是get
|
||||
, toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
||||
, where: {} //post请求必须加where ,post请求需要的参数
|
||||
, cellMinWidth: 80
|
||||
, cols: [[ //表头
|
||||
{field: 'number', width: 100, title: '序号', align: 'center', type: 'numbers'}
|
||||
, {field: 'name', width: 200, align: 'center', title: '请假人'}
|
||||
, {field: 'type', width: 150, align: 'center', title: '请假类型'}
|
||||
, {field: 'matter', width: 200, align: 'center', title: '请假事由'}
|
||||
, {field: 'leaveTimeRange', width: 220, align: 'center', title: '请假起止日期'}
|
||||
, {field: 'leaveDay', width: 220, align: 'center', title: '请假天数'}
|
||||
, {field: 'createTime', width: 220, align: 'center', title: '请假时间'}
|
||||
]]
|
||||
, id: 'menuTable'
|
||||
, page: true //开启分页
|
||||
, loading: true //数据加载中。。。
|
||||
, limits: [10, 20, 50, 100] //一页选择显示3,5或10条数据
|
||||
, limit: 10 //一页显示5条数据
|
||||
, response: {
|
||||
statusCode: 200 //规定成功的状态码,默认:0
|
||||
}, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||
let result;
|
||||
if (res.data !== '' && res.data != null && res.data !== "null") {
|
||||
if (this.page.curr) {
|
||||
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
||||
} else {
|
||||
result = res.data.slice(0, this.limit);
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.count, //解析数据长度
|
||||
"data": result, //解析数据列表
|
||||
};
|
||||
},
|
||||
toolbar: "#toolbar"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -196,13 +196,6 @@
|
|||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script type="text/javascript" src="../../js/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify', // 模块
|
||||
});
|
||||
|
||||
var form;
|
||||
var table;
|
||||
var newData;
|
||||
|
|
@ -221,7 +214,7 @@
|
|||
let mns = [];
|
||||
let ctrUpdateTable;
|
||||
var code = "tabid=1";
|
||||
|
||||
var treeData;
|
||||
|
||||
layui.use(['table', 'form', 'notice', 'layNotify', 'upload', 'element', 'tree', 'transfer'], function () {
|
||||
table = layui.table;
|
||||
|
|
@ -265,37 +258,10 @@
|
|||
success: function (data) {
|
||||
personType = '0';
|
||||
var result = [];
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].level == '0') {
|
||||
data[i].spread = true
|
||||
result.push(data[i])
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
result[i].children = []
|
||||
for (let j = 0; j < data.length; j++) {
|
||||
if (result[i].id == data[j].parentId) {
|
||||
data[j].spread = true
|
||||
result[i].children.push(data[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
//root
|
||||
for (let k = 0; k < result[i].children.length; k++) {
|
||||
//parent = 0
|
||||
result[i].children[k].children = []
|
||||
for (let j = 0; j < data.length; j++) {
|
||||
if (result[i].children[k].id == data[j].parentId) {
|
||||
data[j].spread = true
|
||||
result[i].children[k].children.push(data[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
treeData = getTreeList(data, '0', result)
|
||||
tree.render({
|
||||
elem: '#orgTree'
|
||||
, data: result
|
||||
, data: treeData
|
||||
, spread: true
|
||||
, showLine: false // 是否开启连接线
|
||||
, onlyIconControl: true
|
||||
|
|
@ -800,4 +766,16 @@
|
|||
data: mns
|
||||
});
|
||||
}
|
||||
function getTreeList(rootList, id, List) {
|
||||
for (let item of rootList) {
|
||||
if (item.parentId == id) {
|
||||
let newItem = Object.assign({}, item); // 创建一个新的对象,避免直接修改原始对象
|
||||
newItem.spread = true;
|
||||
newItem.children = [];
|
||||
List.push(newItem);
|
||||
getTreeList(rootList, newItem.id, newItem.children);
|
||||
}
|
||||
}
|
||||
return List;
|
||||
}
|
||||
</script>
|
||||
|
|
@ -84,12 +84,6 @@
|
|||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script type="text/javascript" src="../../js/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify', // 模块
|
||||
});
|
||||
var id = localStorage.getItem("announcementId");
|
||||
var form;
|
||||
var table;
|
||||
|
|
|
|||
|
|
@ -102,12 +102,6 @@
|
|||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script type="text/javascript" src="../../js/tinymce.min.js" referrerpolicy="origin"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify', // 模块
|
||||
});
|
||||
var id = localStorage.getItem("announcementId");
|
||||
var form;
|
||||
var table;
|
||||
|
|
|
|||
|
|
@ -70,13 +70,6 @@
|
|||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify', // 模块
|
||||
});
|
||||
|
||||
var table;
|
||||
$("#resetBt").click(function(){
|
||||
table.reload('menuTable', {
|
||||
|
|
|
|||
|
|
@ -44,13 +44,6 @@
|
|||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify', // 模块
|
||||
});
|
||||
|
||||
var form;
|
||||
var table;
|
||||
var newData;
|
||||
|
|
|
|||
|
|
@ -129,12 +129,6 @@
|
|||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script type="text/javascript">
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify', // 模块
|
||||
});
|
||||
var id = localStorage.getItem("organisationalId");
|
||||
var parentId = localStorage.getItem("parentId");
|
||||
var parentTitle = localStorage.getItem("parentTitle");
|
||||
|
|
@ -182,13 +176,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
var data = {
|
||||
title: $("#title").val(),
|
||||
level: level,
|
||||
type: selectedValue,
|
||||
personType: $("#personType").val(),
|
||||
parentId: parentId,
|
||||
id: id,
|
||||
var uploadData = {
|
||||
'title': $("#title").val(),
|
||||
'level': level,
|
||||
'type': selectedValue,
|
||||
'personType': $("#personType").val(),
|
||||
'parentId': parentId,
|
||||
'id': id,
|
||||
}
|
||||
// 加载提示
|
||||
var addLoadingMsg = top.layer.msg('数据上传中,请稍候...', {
|
||||
|
|
@ -203,7 +197,7 @@
|
|||
url: formUrl, // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: JSON.stringify(data), //获取提交的表单字段
|
||||
data: JSON.stringify(uploadData), //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if (data.resMsg == "数据获取成功") {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
|
|
|
|||
|
|
@ -50,27 +50,11 @@
|
|||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
base: '../../js/layuiModules/', // 第三方模块所在目录
|
||||
version: 'v1.6.4' // 插件版本号
|
||||
}).extend({
|
||||
soulTable: 'notice,layNotify,dtree', // 模块
|
||||
});
|
||||
var treeInstance;
|
||||
var laydate;
|
||||
var tree;
|
||||
var treeData;
|
||||
$("#addBt").click(function () {
|
||||
localStorage.setItem("id", "")
|
||||
var index = layer.open({
|
||||
title: ['新增', 'color:#3B70A1;background-color:#E8ECEB;font-size:20px'],
|
||||
type: 2,
|
||||
content: "./AnnouncementForm.html",
|
||||
area: ['90%', '95%'],
|
||||
maxmin: false,
|
||||
});
|
||||
// layerOpenFormForSencond("新增","./announcementForm.html");
|
||||
})
|
||||
|
||||
layui.use(['laydate', 'util', 'form', 'notice', 'layNotify', 'dtree'], function () {
|
||||
form = layui.form;
|
||||
laydate = layui.laydate;
|
||||
|
|
@ -111,7 +95,6 @@
|
|||
}
|
||||
|
||||
function initTree() {
|
||||
console.log("treeData:" + JSON.stringify(treeData))
|
||||
treeInstance = tree.render({
|
||||
elem: '#dataTree2',
|
||||
data: treeData, //数据
|
||||
|
|
@ -122,9 +105,6 @@
|
|||
toolbarShow: [],
|
||||
toolbarFun: {
|
||||
loadToolbarBefore: function (buttons, param, $div) {
|
||||
if (param.level === '3') {
|
||||
buttons.customAdd = ""; // 取消新增功能
|
||||
}
|
||||
return buttons; // 将按钮对象返回
|
||||
},
|
||||
},
|
||||
|
|
@ -215,7 +195,6 @@
|
|||
success: function (data) {
|
||||
var resMsg = data.resMsg;
|
||||
if ("数据获取成功" == resMsg) {
|
||||
|
||||
initData();
|
||||
reloadTip(type, success, 'success');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,24 +3,141 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>角色表单</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../../js/layui-v2.9.6/css/layui.css">
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../../js/layui-v2.9.6/css/layui.css">
|
||||
<link rel="stylesheet" href="../../css/ztree/zTreeStyle/zTreeStyle.css" type="text/css">
|
||||
<style>
|
||||
.layui-input-block {
|
||||
margin-left: 0px;
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
#commit, #commitPermission, #commitDataPermission {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
}
|
||||
/*.layui-input, .layui-textarea {*/
|
||||
/* display: block;*/
|
||||
/* width: 100% !important;*/
|
||||
/* padding-left: 10px;*/
|
||||
/*}*/
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-tab layui-tab-brief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">角色信息</li>
|
||||
<li>操作权限</li>
|
||||
<li>数据权限</li>
|
||||
<li>成员列表</li>
|
||||
<li>操作记录</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">内容-1</div>
|
||||
<div class="layui-tab-item">内容-2</div>
|
||||
<div class="layui-tab-item">内容-3</div>
|
||||
<div class="layui-tab-item">内容-4</div>
|
||||
<div class="layui-tab-item">内容-5</div>
|
||||
</div>
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">角色信息</li>
|
||||
<li>操作权限</li>
|
||||
<li>数据权限</li>
|
||||
<li>成员列表</li>
|
||||
<li>操作记录</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<form class="layui-form" action="" onsubmit="return false" style="margin-left: 22%;margin-top: 2%;">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><i class="tip-required"
|
||||
style="color: red;font-size: 20px">*</i>角色名称:</label>
|
||||
<div class="layui-input-inline" style="width:50%">
|
||||
<input type="text" id="name" name="name" autocomplete="off" class="layui-input" lay-required="true"
|
||||
placeholder="请输入角色名称">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-top: 1%;">
|
||||
<label class="layui-form-label"><i class="tip-required"
|
||||
style="color: red;font-size: 20px">*</i>类型属性:</label>
|
||||
<div class="layui-input-inline" style="border: 0px dashed dimgrey;width: 74%;">
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="status" value="1" title="启用" checked>
|
||||
<input type="radio" name="status" value="2" title="禁用">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色描述:</label>
|
||||
<div class="layui-input-inline" style="width:50%">
|
||||
<textarea class="layui-input" placeholder="输入内容" type="text" name="description" id="description"
|
||||
style="height: 94px;width: 100%;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交</button>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<form class="layui-form" onsubmit="return false">
|
||||
<div class="layui-form-item" style="max-height: 400px;">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">权限:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div style="height:500px;overflow-y: auto;width: 400px;border : 0.5px solid #dadada;">
|
||||
<ul id="treeDemo" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<button type="submit" class="layui-btn subBtn" id="commitPermission" lay-submit
|
||||
lay-filter="commitPermission">提交
|
||||
</button>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<form class="layui-form" onsubmit="return false" style="margin-left: 22%;margin-top: 2%;">
|
||||
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||
数据权限(设置该角色的用户可以操作的数据的范围)
|
||||
</blockquote>
|
||||
<div class="layui-input-inline" style="border: 0px dashed dimgrey;width: 74%;">
|
||||
<div class="layui-input-block" style="display: flex;">
|
||||
<input type="radio" name="type" value="1" title="个人(默认)" checked>
|
||||
<span style="margin-top: 9px;"
|
||||
> 只能操作自己和下属的数据</span>
|
||||
</div>
|
||||
<div class="layui-input-block" style="display: flex;">
|
||||
<input type="radio" name="type" value="2" title="所属部门">
|
||||
<span style="margin-top: 9px;"
|
||||
> 能操作自己、下属、和自己所属部门的数据</span>
|
||||
</div>
|
||||
<div class="layui-input-block" style="display: flex;">
|
||||
<input type="radio" name="type" value="3" title="所属部门及下属部门">
|
||||
<span style="margin-top: 9px;">能操作自己、下属、和自己所属部门及其下属的数据</span>
|
||||
</div>
|
||||
<div class="layui-input-block" style="display: flex;">
|
||||
<input type="radio" name="type" value="4" title="全公司">
|
||||
<span style="margin-top: 9px;"
|
||||
> 能操作全公司的数据</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<button type="submit" class="layui-btn subBtn" id="commitDataPermission" lay-submit
|
||||
lay-filter="commitDataPermission">提交
|
||||
</button>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
<div class="layui-form-item" style="margin-bottom: 0px;">
|
||||
<div class="layui-inline" style="margin-top: 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="keyWord" placeholder="请输入姓名" autocomplete="off"
|
||||
class="layui-input">
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width: 70px;margin-top: 2px">
|
||||
<button id="searchBt" class="layui-btn layui-btn-sm">查询</button>
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width: 70px;margin-top: 2px">
|
||||
<button id="addBt" class="layui-btn layui-btn-sm">添加人员</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<button id="selectAllBtn" class="layui-btn layui-btn">选择全部</button>
|
||||
<button id="reverseSelectBtn" class="layui-btn layui-btn">反向选择</button>
|
||||
<button id="delSelectBtn" class="layui-btn layui-btn">删除选择</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table id="personTable" lay-filter="test"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">内容-5</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -30,4 +147,324 @@
|
|||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||
<script type="text/javascript" src="../../js/common_methon.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
<script type="text/javascript" src="../../js/dict.js"></script>
|
||||
<script type="text/javascript" src="../../js/dict.js"></script>
|
||||
<script type="text/javascript" src="../../js/libs/jquery.ztree.all-3.5.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/ztree-menu.js"></script>
|
||||
<script>
|
||||
var token = localStorage.getItem('token')
|
||||
var id = localStorage.getItem("roleId");
|
||||
var table;
|
||||
var tableIns;
|
||||
layui.use(['form','layer', 'laydate','notice','layNotify','table'], function () {
|
||||
form = layui.form;
|
||||
notice = layui.notice;
|
||||
layNotify = layui.layNotify;
|
||||
table = layui.table;
|
||||
table = layui.table;
|
||||
form.render();
|
||||
form.verify({});
|
||||
if(id != ""){
|
||||
initData();
|
||||
}
|
||||
initPersonTable();
|
||||
// 角色信息提交
|
||||
form.on('submit(commitPermission)', function (data) {
|
||||
data.field.id = id;
|
||||
data.field.permissionIds = getCheckedMenuIds();
|
||||
addPermission(data); //新增方法
|
||||
});
|
||||
|
||||
// 验证成功后才会执行下面的操作
|
||||
form.on('submit(formDemo)', function (data) {
|
||||
data.field.id = id;
|
||||
addBasicRoleData(data); //新增方法
|
||||
});
|
||||
// 验证成功后才会执行下面的操作
|
||||
form.on('submit(commitDataPermission)', function (data) {
|
||||
data.field.id = id;
|
||||
updateLevel(data); //新增方法
|
||||
});
|
||||
$("#addBt").click(function (){
|
||||
openForm("", '添加人员');
|
||||
})
|
||||
|
||||
|
||||
//头监听事件 -- checkBox 选中行和选中条数
|
||||
table.on('toolbar(test)', function (obj) {
|
||||
// 获取当前表格被选中的记录对象,返回数据
|
||||
table.checkStatus(obj.config.id);
|
||||
//获取事件名,执行对应的代码
|
||||
var eventName = obj.event;
|
||||
console.log(eventName)
|
||||
switch (eventName) {
|
||||
case "searchBt":
|
||||
table.reload('menuTable', {
|
||||
url: ctxPath + '/users/getLeaderList'
|
||||
, method: 'post' //方式默认是get
|
||||
, page: true
|
||||
, where: {
|
||||
keyWord: $("#keyWord").val(),
|
||||
} //设定异步数据接口的额外参数
|
||||
});
|
||||
/**二次赋值-- 点击搜索按钮之后会进行一次刷新操作*/
|
||||
break;
|
||||
case "resetBt":
|
||||
$("#keyWord").val("");
|
||||
table.reload('menuTable', {
|
||||
url: ctxPath + '/users/getLeaderList'
|
||||
, method: 'post' //方式默认是get
|
||||
, page: true
|
||||
, where: {
|
||||
keyWord: "",
|
||||
} //设定异步数据接口的额外参数
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
$.fn.zTree.init($("#treeDemo"), getSettting(), getMenuTree());
|
||||
|
||||
|
||||
function openForm(id, title) {
|
||||
layerOpenForm(title, "./addUser.html", "70%", "85%")
|
||||
}
|
||||
/**
|
||||
* 角色权限
|
||||
* @param data
|
||||
*/
|
||||
function updateLevel(data) {
|
||||
var formUrl = ctxPath + "/roles/updateRoleLevel";
|
||||
var tip = '保存';
|
||||
if (id != null && id != "") {
|
||||
tip = '修改';
|
||||
}
|
||||
// 获取选中的值
|
||||
var selectedValue = '';
|
||||
var radios = document.getElementsByName('type');
|
||||
for (var i = 0; i < radios.length; i++) {
|
||||
if (radios[i].checked) {
|
||||
selectedValue = radios[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var uploadData = {
|
||||
level: selectedValue,
|
||||
id : id
|
||||
}
|
||||
// 加载提示
|
||||
var addLoadingMsg = top.layer.msg('数据上传中,请稍候...', {
|
||||
icon: 16,
|
||||
scrollbar: false,
|
||||
time: 0,
|
||||
shade: [0.8, '#393D49']
|
||||
});
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: formUrl, // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: JSON.stringify(uploadData), //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if (data.resMsg == "发起成功") {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + "提示", tip + "成功", "success");
|
||||
}else {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + "提示", tip + "失败", "error");
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传角色信息
|
||||
* @param data
|
||||
*/
|
||||
function addBasicRoleData(data){
|
||||
var formUrl = ctxPath + "/roles/addNewRoleData";
|
||||
var tip = '保存';
|
||||
if (id != null && id != "") {
|
||||
formUrl = ctxPath + "/roles/updateNewRoleData";
|
||||
tip = '修改';
|
||||
}
|
||||
// 获取选中的值
|
||||
var selectedValue = '';
|
||||
var radios = document.getElementsByName('status');
|
||||
for (var i = 0; i < radios.length; i++) {
|
||||
if (radios[i].checked) {
|
||||
selectedValue = radios[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var uploadData = {
|
||||
status: selectedValue,
|
||||
name: $("#name").val(),
|
||||
description : $("#description").val(),
|
||||
id : id
|
||||
}
|
||||
// 加载提示
|
||||
var addLoadingMsg = top.layer.msg('数据上传中,请稍候...', {
|
||||
icon: 16,
|
||||
scrollbar: false,
|
||||
time: 0,
|
||||
shade: [0.8, '#393D49']
|
||||
});
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: formUrl, // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: JSON.stringify(uploadData), //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if (data.resMsg == "发起成功") {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
localStorage.setItem("roleId",data.obj.roleId);
|
||||
id = data.obj.roleId;
|
||||
$("#commit").css("display","none");
|
||||
parentTip(tip + "提示", tip + "成功", "success");
|
||||
}else if (data.resMsg === "角色已存在") {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip, data.resMsg, 'error');
|
||||
} else {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + "提示", tip + "失败", "error");
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传权限信息
|
||||
* @param formData
|
||||
*/
|
||||
function addPermission(formData) {
|
||||
var tip = '保存';
|
||||
var formUrl = ctxPath + "/roles/uploadPermission";
|
||||
if (id != '') {
|
||||
formUrl = ctxPath + "/roles/updatePermission";
|
||||
tip = '修改';
|
||||
}
|
||||
// 加载提示
|
||||
addLoadingMsg = top.layer.msg('数据上传中,请稍候...', {
|
||||
icon: 16,
|
||||
scrollbar: false,
|
||||
time: 0,
|
||||
shade: [0.8, '#393D49']
|
||||
});
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: formUrl, // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: JSON.stringify(formData.field), //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if (data.resMsg === "发起成功") {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip, tip + '成功', 'success');
|
||||
}else {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + "提示", tip + "失败", "success");
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 初始化操作权限数据
|
||||
*/
|
||||
function initData() {
|
||||
if (id != "") {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: ctxPath + '/roles/' + id,
|
||||
async: false,
|
||||
success: function (data) {
|
||||
$("#id").val(data.id);
|
||||
$("#name").val(data.name);
|
||||
$("#description").val(data.description);
|
||||
var radio = document.getElementsByName('status');
|
||||
// 遍历单选框并根据值设置选中状态
|
||||
for (var i = 0; i < radio.length; i++) {
|
||||
if (radio[i].value === data.status) {
|
||||
radio[i].checked = true; // 设置value为2的单选框为选中状态
|
||||
}
|
||||
}
|
||||
var radios = document.getElementsByName('type');
|
||||
// 遍历单选框并根据值设置选中状态
|
||||
for (var i = 0; i < radios.length; i++) {
|
||||
if (radios[i].value === data.level){
|
||||
radios[i].checked = true; // 设置value为2的单选框为选中状态
|
||||
}
|
||||
}
|
||||
form.render();
|
||||
}
|
||||
});
|
||||
|
||||
initMenuDatas(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function initPersonTable(){
|
||||
//渲染表格
|
||||
tableIns = table.render({
|
||||
elem: '#personTable'
|
||||
, url: ctxPath + '/announcement/getAnnouncementList' //数据接口
|
||||
|
||||
, method: 'post' //方式默认是get
|
||||
, toolbar: 'default' //开启工具栏,此处显示默认图标,可以自定义模板,详见文档
|
||||
, where: {} //post请求必须加where ,post请求需要的参数
|
||||
, cellMinWidth: 80
|
||||
, cols: [[ //表头
|
||||
{type: 'checkbox'}
|
||||
,{field: 'number', width:80,title: '序号', align: 'center', type: 'numbers'}
|
||||
, {field: 'name', align: 'center', title: '姓名'}
|
||||
, {field: 'postName', align: 'center', title: '组织岗位'}
|
||||
, {field: 'createTime', align: 'center', title: '添加时间'}
|
||||
, {fixed: 'right', title: '操作', align: 'center', toolbar: '#toolsBar'}
|
||||
]]
|
||||
, id: 'menuTable'
|
||||
, page: true //开启分页
|
||||
, loading: true //数据加载中。。。
|
||||
, limits: [5, 10, 20] //一页选择显示3,5或10条数据
|
||||
, limit: 10 //一页显示5条数据
|
||||
, response: {
|
||||
statusCode: 200 //规定成功的状态码,默认:0
|
||||
}, parseData: function (res) { //将原始数据解析成 table 组件所规定的数据,res为从url中get到的数据
|
||||
let result;
|
||||
if (res.data !== '' && res.data != null && res.data !== "null") {
|
||||
if (this.page.curr) {
|
||||
result = res.data.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr);
|
||||
} else {
|
||||
result = res.data.slice(0, this.limit);
|
||||
}
|
||||
}
|
||||
return {
|
||||
"code": res.code, //解析接口状态
|
||||
"msg": res.msg, //解析提示文本
|
||||
"count": res.count, //解析数据长度
|
||||
"data": result, //解析数据列表
|
||||
};
|
||||
},
|
||||
toolbar: "#toolbar"
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>新增角色---添加人员</title>
|
||||
<link rel="stylesheet" href="../../js/layui-v2.9.6/css/layui.css" media="all"/>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
<div class="layui-form-item" style="margin-top: 3%;">
|
||||
<div class="layui-inline" style="width: 99%;">
|
||||
<label class="layui-form-label">角色名称:</label>
|
||||
<input type="text" name="roleName" lay-verify="required" style="width: 60%;"
|
||||
id="roleName" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="margin-top: 1%">
|
||||
<div class="layui-inline" style="width: 99%;">
|
||||
<label class="layui-form-label"><i class="tip-required" style="color: red;font-size: 20px">*</i>选择用户:</label>
|
||||
<div id="selectUser" class="xm-select-demo" style="width: 60%;margin-left: 10%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<div class="layui-input-block">
|
||||
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
<script src="../../js/jquery-3.6.0.js"></script>
|
||||
<script src="../../js/layui-v2.9.6/layui.js"></script>
|
||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||
<script src="../../js/common_methon.js"></script>
|
||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
|
||||
<script>
|
||||
var roleId = localStorage.getItem("roleId");
|
||||
layui.use(['form','xmSelect'], function () {
|
||||
xmSelect = layui.xmSelect;
|
||||
form = layui.form;
|
||||
|
||||
form.on('submit(formDemo)', function (data) {
|
||||
addInfo(); //新增方法
|
||||
});
|
||||
|
||||
var demo1 = xmSelect.render({
|
||||
el: '#selectUser',
|
||||
autoRow: true,
|
||||
filterable: true,
|
||||
tree: {
|
||||
show: true,
|
||||
showFolderIcon: true,
|
||||
showLine: true,
|
||||
indent: 20,
|
||||
expandedKeys: [ -3 ],
|
||||
},
|
||||
toolbar: {
|
||||
show: true,
|
||||
list: ['ALL', 'REVERSE', 'CLEAR']
|
||||
},
|
||||
filterable: true,
|
||||
height: 'auto',
|
||||
data: function(){
|
||||
return [
|
||||
{name: '销售员', value: -1, disabled: true, children: [
|
||||
{name: '张三1', value: 1, selected: true, children: []},
|
||||
{name: '李四1', value: 2, selected: true},
|
||||
{name: '王五1', value: 3, disabled: true},
|
||||
]},
|
||||
{name: '奖品', value: -2, children: [
|
||||
{name: '奖品3', value: -3, children: [
|
||||
{name: '苹果3', value: 14, selected: true},
|
||||
{name: '香蕉3', value: 15},
|
||||
{name: '葡萄3', value: 16},
|
||||
]},
|
||||
{name: '苹果2', value: 4, selected: true, disabled: true},
|
||||
{name: '香蕉2', value: 5},
|
||||
{name: '葡萄2', value: 6},
|
||||
]},
|
||||
]
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function addInfo() {
|
||||
var selectUser = xmSelect.get('#selectUser', true);
|
||||
var selectUserArr = selectUser.getValue('value');
|
||||
var data = {
|
||||
roleId : roleId,
|
||||
userId: selectUserArr.toString()
|
||||
};
|
||||
if (selectUserArr.length === 0) {
|
||||
parentTip("提示", "请选择人员", "warning");
|
||||
return false;
|
||||
}
|
||||
var tip = '保存';
|
||||
var formUrl = ctxPath + "/roles/insertRolePersonData";
|
||||
// 加载提示
|
||||
addLoadingMsg = top.layer.msg('数据上传中,请稍候...', {
|
||||
icon: 16,
|
||||
scrollbar: false,
|
||||
time: 0,
|
||||
shade: [0.8, '#393D49']
|
||||
});
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: formUrl, // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: JSON.stringify(data), //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if (data.resMsg === "发起成功") {
|
||||
parent.layer.closeAll();
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + '提示', tip + '成功', 'success');
|
||||
parent.tableIns.reload('personTable');
|
||||
}else {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + '提示', tip + '失败', 'error');
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -79,7 +79,15 @@
|
|||
, cols: [[ //表头
|
||||
{field: 'number', title: '序号', align: 'center', type: 'numbers'}
|
||||
, {field: 'name', align: 'center', title: '角色名称'}
|
||||
, {field: 'status', align: 'center', title: '状态'}
|
||||
, {
|
||||
field: 'status', align: 'center', title: '状态', template: function () {
|
||||
if (d.status === 1) {
|
||||
return '<span style="color: #5FB878;">启用</span>';
|
||||
} else {
|
||||
return '<span style="color: #FF5722;">禁用</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
, {field: 'membersNum', align: 'center', title: '成员数量'}
|
||||
, {field: 'dataPermissions', align: 'center', title: '数据权限'}
|
||||
, {field: 'description', align: 'center', title: '角色描述'}
|
||||
|
|
@ -169,6 +177,9 @@
|
|||
content: "./addNewRole.html",
|
||||
area: ['90%', '95%'],
|
||||
maxmin: false,
|
||||
end:function () {
|
||||
tableIns.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -179,11 +190,32 @@
|
|||
var index = layer.confirm('确定要删除吗?', {
|
||||
btn : [ '确定', '取消' ]
|
||||
}, function() {
|
||||
ajaxCommonMethods(url,{'id': id},"删除成功","删除失败","删除",index);
|
||||
ajaxCommonMethod(url,{'id': id},"删除成功","删除失败","删除",index);
|
||||
// 重新加载table
|
||||
table.reload('menuTable');
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function ajaxCommonMethod(url, data, success, error, type) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: ctxPath + url,// 请求地址
|
||||
contentType: "application/x-www-form-urlencoded",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: data, //获取提交的表单字段
|
||||
success: function (data) {
|
||||
var resMsg = data.resMsg;
|
||||
if ("数据获取成功" == resMsg) {
|
||||
thisTip(type, success, 'success');
|
||||
setTimeout(function () {
|
||||
tableIns.reload();
|
||||
}, 2000);
|
||||
} else {
|
||||
thisTip(type, error, "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
width: 69%;
|
||||
}
|
||||
.layui-form-select dl {
|
||||
left: 16%;
|
||||
left: 19%;
|
||||
min-width: 69%;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,157 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>用户查询--公司领导设置</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../../js/layui-v2.9.6/css/layui.css">
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../../css/publicStyles.css">
|
||||
<link rel="stylesheet" href="../../css/ztree/zTreeStyle/zTreeStyle.css" type="text/css">
|
||||
<style>
|
||||
body {
|
||||
font: 14px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif !important;
|
||||
}
|
||||
.layui-btn-sm {
|
||||
height: 35px;
|
||||
line-height: 30px;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.layui-table th{
|
||||
font-weight: bold;
|
||||
}
|
||||
.layui-form-item{
|
||||
margin-left: 0px!important;
|
||||
}
|
||||
.layui-table-tool{
|
||||
padding: 10px 0!important;
|
||||
}
|
||||
.layui-form-item{
|
||||
margin-bottom: 0px!important;
|
||||
}
|
||||
.widget-body,#demo,.layui-table-view{
|
||||
margin: 0!important;
|
||||
}
|
||||
.layui-input, .layui-textarea {
|
||||
display: block;
|
||||
/*width: 60%;*/
|
||||
padding-left: 10px;
|
||||
}
|
||||
.layui-form-label {
|
||||
position: relative;
|
||||
float: left;
|
||||
display: block;
|
||||
padding: 12px 15px;
|
||||
width: 80px;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
.layui-form-select .layui-edge {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 50%;
|
||||
left: 83%;
|
||||
margin-top: -3px;
|
||||
cursor: pointer;
|
||||
border-width: 6px;
|
||||
border-top-color: #c2c2c2;
|
||||
border-top-style: solid;
|
||||
transition: all .3s;
|
||||
-webkit-transition: all .3s;
|
||||
}
|
||||
.layui-form-select dl {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
padding: 5px 0;
|
||||
z-index: 899;
|
||||
min-width: 100%;
|
||||
border: 1px solid #eee;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
box-shadow: 1px 1px 4px rgb(0 0 0 / 8%);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.layui-table-tool-self{
|
||||
display: none;
|
||||
}
|
||||
#orgContent{
|
||||
display:none;
|
||||
overflow: auto;
|
||||
width: 300px;
|
||||
height: 350px;
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
background-color: rgb(255 255 255);
|
||||
left: 195.875px;
|
||||
border: 1px solid #e1e1e1;
|
||||
top: 48px;
|
||||
}
|
||||
.ztree li a.curSelectedNode {
|
||||
padding-top: 0px;
|
||||
background-color: #FFE6B0;
|
||||
color: #907244;
|
||||
height: 16px;
|
||||
border: 1px #FFB951 solid;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.ztree li a {
|
||||
padding: 1px 3px 0 0;
|
||||
margin: 0;
|
||||
cursor: pointer;
|
||||
height: 17px;
|
||||
color: #767272;
|
||||
background-color: transparent;
|
||||
text-decoration: none;
|
||||
vertical-align: top;
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
</form>
|
||||
|
||||
<div style="margin-left: 15px;margin-right: 15px;">
|
||||
<div class="widget-body">
|
||||
<table id="demo" lay-filter="test" class="layui-table" lay-size="lg">
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script type="text/javascript" src="../../js/jquery-3.6.0.js"></script>
|
||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||
<script type="text/javascript" src="../../js/layui-v2.9.6/layui.js"></script>
|
||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||
<script type="text/javascript" src="../../js/common_methon.js"></script>
|
||||
<script type="text/javascript" src="../../js/dict.js"></script>
|
||||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script src="../../css/ztree/3.5/jquery.ztree.all.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/work/user/leaderSetList.js" defer="defer"></script>
|
||||
<script type="text/html" id="toolsBar">
|
||||
<a lay-event="sort" style="color: #009688;cursor: pointer;font-size: 16px">排序设置</a>
|
||||
<span> | </span>
|
||||
<a lay-event="del" style="color: #009688;cursor: pointer;font-size: 16px">删除</a>
|
||||
</script>
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="layui-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline" style="margin-top: 2px;margin-left: 1%;">
|
||||
<input type="text" id="keyWord" placeholder="用户名" autocomplete="off" class="layui-input" style="width: 100%">
|
||||
</div>
|
||||
<div class="layui-inline" style="width: 5%;margin-top: 4px">
|
||||
<button id="searchBt" class="layui-btn layui-btn-sm" lay-event="searchBt">查询</button>
|
||||
</div>
|
||||
<div class="layui-inline" style="width: 5%;margin-top: 4px;margin-left: 10px;">
|
||||
<button id="resetBt" class="layui-btn layui-btn-sm" lay-event="resetBt">重置</button>
|
||||
</div>
|
||||
<div class="layui-inline" style="width: 5%;margin-top: 4px;margin-left: 10px;">
|
||||
<button id="addBtn" class="layui-btn layui-btn-sm" lay-event="addBtn" style="width:120px
|
||||
!important">添加公司领导</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
|
@ -0,0 +1,342 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>选择领导</title>
|
||||
<link rel="stylesheet" href="../../js/layui-v2.9.6/css/layui.css" media="all"/>
|
||||
<style>
|
||||
.disabled-span {
|
||||
pointer-events: none; /* 禁用点击事件 */
|
||||
color: red; /* 可以添加其他样式表示禁用状态 */
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="" onsubmit="return false">
|
||||
<div class="layui-form-item" style="margin-top: 1%">
|
||||
<div class="layui-container">
|
||||
<div class="layui-col-md3" style="overflow: auto; height: 500px">
|
||||
<!-- 左侧组织架构树 -->
|
||||
<div id="ID-tree-demo"></div>
|
||||
</div>
|
||||
<div class="layui-col-md4">
|
||||
<div class="layui-card-header">
|
||||
<span style="margin-left: 30px">已选择人员</span>
|
||||
<span
|
||||
id="upSort"
|
||||
style="margin-left: 30px; cursor: pointer"
|
||||
onclick="upSort()"
|
||||
>升序</span
|
||||
>
|
||||
<span
|
||||
id="downSort"
|
||||
style="margin-left: 30px; cursor: pointer"
|
||||
onclick="downSort()"
|
||||
>降序</span
|
||||
>
|
||||
<span
|
||||
onclick="clean()"
|
||||
style="color: #17baaa; float: right; cursor: pointer;margin-right: 50px;"
|
||||
>清空</span
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
class="layui-card-body"
|
||||
id="personDiv"
|
||||
style="overflow-y: auto; height: 500px"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<div class="layui-input-block">
|
||||
<button type="submit" class="layui-btn subBtn" id="commit" lay-submit lay-filter="formDemo">提交
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
<script src="../../js/jquery-3.6.0.js"></script>
|
||||
<script src="../../js/layui-v2.9.6/layui.js"></script>
|
||||
<script type="text/javascript" src="../../js/jq.js"></script>
|
||||
<script src="../../js/common_methon.js"></script>
|
||||
<script type="text/javascript" src="../../js/publicJs.js"></script>
|
||||
<script type="text/javascript" src="../../js/select.js"></script>
|
||||
<script type="text/javascript" src="../../js/my/permission.js"></script>
|
||||
|
||||
<script>
|
||||
var tree;
|
||||
var layer;
|
||||
var util;
|
||||
var rightId = [];
|
||||
var rightData = [];
|
||||
var treeData;
|
||||
var form;
|
||||
layui.use(function () {
|
||||
tree = layui.tree;
|
||||
layer = layui.layer;
|
||||
util = layui.util;
|
||||
form = layui.form;
|
||||
// 验证成功后才会执行下面的操作
|
||||
form.on('submit(formDemo)', function (data) {
|
||||
addInfo(); //新增方法
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* 加载左侧公司-分公司-项目部树
|
||||
*/
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: ctxPath + '/announcement/tree',//数据接口
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
async: true,
|
||||
data: {},
|
||||
success: function (data) {
|
||||
var result = [];
|
||||
treeData = getTreeList(data, '0', result);
|
||||
// 渲染
|
||||
tree.render({
|
||||
elem: "#ID-tree-demo",
|
||||
data: treeData,
|
||||
showCheckbox: true, // 是否显示复选框
|
||||
onlyIconControl: true, // 是否仅允许节点左侧图标控制展开收缩
|
||||
id: "demo-id-1",
|
||||
oncheck: function (obj) {
|
||||
var checkedData = tree.getChecked("demo-id-1"); // 获取选中节点的数据
|
||||
rightData = [];
|
||||
rightId = [];
|
||||
getChild(JSON.stringify(checkedData));
|
||||
},
|
||||
});
|
||||
},
|
||||
error: function (err) {
|
||||
console.log("获取工程下拉列表出错:", err);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 清除
|
||||
**/
|
||||
function clean() {
|
||||
tree.reload("demo-id-1", {});
|
||||
$("#personDiv").empty();
|
||||
rightData = [];
|
||||
}
|
||||
/**
|
||||
* 升序
|
||||
**/
|
||||
window.upSort = function () {
|
||||
debugger
|
||||
if(rightId.length == 0){
|
||||
return;
|
||||
}
|
||||
// 获取元素在数组中的索引位置
|
||||
var index = rightId.indexOf(upId);
|
||||
// 如果元素存在于数组中,则将其从数组中删除并插入到目标位置
|
||||
if (index > 0) {
|
||||
var oldObj = rightData[index];
|
||||
rightId.splice(index, 1); // 从数组中删除元素
|
||||
rightData.splice(index, 1); // 从数组中删除元素
|
||||
rightId.splice(index - 1, 0, upId); // 插入到目标位置
|
||||
rightData.splice(index - 1, 0, oldObj);
|
||||
}
|
||||
$("#personDiv").empty();
|
||||
updatePerson();
|
||||
$("#" + upId).removeClass(); // 通过 ID 选择器找到对应的元素并移除
|
||||
$("#" + upId).addClass("layui-btn layui-btn-primary layui-border-red");
|
||||
};
|
||||
/**
|
||||
* 降序
|
||||
**/
|
||||
window.downSort = function () {
|
||||
debugger
|
||||
// 获取元素在数组中的索引位置
|
||||
if(rightId.length == 0){
|
||||
return;
|
||||
}
|
||||
var index = rightId.indexOf(downId);
|
||||
// 如果元素存在于数组中且不在数组的最后一个位置,则将其从数组中删除并插入到索引位置加一的位置上
|
||||
if (index > -1 && index < rightId.length - 1) {
|
||||
var oldObj = rightData[index];
|
||||
rightId.splice(index, 1); // 从数组中删除元素
|
||||
rightId.splice(index + 1, 0, downId); // 插入到目标位置
|
||||
rightData.splice(index, 1); // 从数组中删除元素
|
||||
rightData.splice(index + 1, 0, oldObj); // 插入到目标位置
|
||||
}
|
||||
|
||||
$("#personDiv").empty();
|
||||
updatePerson();
|
||||
$("#" + downId).removeClass(); // 通过 ID 选择器找到对应的元素并移除
|
||||
$("#" + downId).addClass(
|
||||
"layui-btn layui-btn-primary layui-border-red"
|
||||
);
|
||||
};
|
||||
/**
|
||||
* 更新已选择人员
|
||||
**/
|
||||
function updatePerson() {
|
||||
//更新右侧人员列表
|
||||
window.updatePerson = function () {
|
||||
let personDiv = $("#personDiv");
|
||||
personDiv.empty();
|
||||
if (rightData.length != 0) {
|
||||
let html = "";
|
||||
rightData.forEach(function (item) {
|
||||
html +=
|
||||
'<button id="' +
|
||||
item.id +
|
||||
'" class="layui-btn layui-btn-primary layui-border-green" onclick="selectThis(this)" value="' +
|
||||
item.id +
|
||||
'" ' +
|
||||
'style="margin-left: 2px;margin-right: 2px;margin-bottom: 4px;width:250px"><i class="layui-icon" style="color: #17BAAA;float: left"></i> ' +
|
||||
item.title +
|
||||
' <i class="layui-icon" ' +
|
||||
'style="color:#17BAAA;float:right" onclick="deletePersonBtn('+item.id+')">ဆ</i></button>';
|
||||
});
|
||||
personDiv.append(html);
|
||||
}
|
||||
};
|
||||
}
|
||||
var upId = "";
|
||||
var downId = "";
|
||||
/**
|
||||
* 更改选择人员的颜色
|
||||
**/
|
||||
window.selectThis = function (obj) {
|
||||
var id = obj.getAttribute("value"); // 获取按钮的 value 属性,即 item.id
|
||||
var index = rightId.indexOf(parseInt(id));
|
||||
if (index == rightId.length - 1) {
|
||||
$("#downSort").addClass("disabled-span");
|
||||
} else {
|
||||
$("#downSort").removeClass();
|
||||
}
|
||||
if (index == 0) {
|
||||
$("#upSort").addClass("disabled-span");
|
||||
} else {
|
||||
$("#upSort").removeClass();
|
||||
}
|
||||
upId = id;
|
||||
downId = id;
|
||||
$("#personDiv").empty();
|
||||
updatePerson();
|
||||
$("#" + id).removeClass(); // 通过 ID 选择器找到对应的元素并移除
|
||||
$("#" + id).addClass("layui-btn layui-btn-primary layui-border-red");
|
||||
};
|
||||
|
||||
//右侧按钮组--删除事件
|
||||
window.deletePersonBtn = function (obj) {
|
||||
//获取当前选中的下标
|
||||
let index = rightData.findIndex((item) => item.id == obj);
|
||||
//从数组中根据下标移除,删除的长度为1
|
||||
rightData.splice(index, 1);
|
||||
rightId.splice(index, 1);
|
||||
console.log(rightId)
|
||||
$("#personDiv").empty();
|
||||
updatePerson();
|
||||
tree.reload("demo-id-1", {});
|
||||
tree.setChecked("demo-id-1", rightId);
|
||||
};
|
||||
|
||||
/**
|
||||
* 递归获取选中的所有人员
|
||||
**/
|
||||
function getChild(jsonArray) {
|
||||
jsonArray = JSON.parse(jsonArray);
|
||||
for (let i = 0; i < jsonArray.length; i++) {
|
||||
let childJson = jsonArray[i];
|
||||
try {
|
||||
var tf = hasChildren(childJson);
|
||||
if (tf && childJson.children.length > 0) {
|
||||
let children = childJson.children;
|
||||
getChild(JSON.stringify(children));
|
||||
} else {
|
||||
let title = childJson.title;
|
||||
let id = childJson.id;
|
||||
if (!rightData.some((item) => item.id === id)) {
|
||||
rightData.push({
|
||||
id: id,
|
||||
title: title,
|
||||
});
|
||||
if (!rightId.includes(id)) {
|
||||
rightId.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$("#personDiv").empty();
|
||||
updatePerson();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点chlidren
|
||||
**/
|
||||
function hasChildren(obj) {
|
||||
return obj.hasOwnProperty("children");
|
||||
}
|
||||
|
||||
|
||||
function getTreeList(rootList, id, List) {
|
||||
for (let item of rootList) {
|
||||
if (item.parentId == id) {
|
||||
let newItem = Object.assign({}, item); // 创建一个新的对象,避免直接修改原始对象
|
||||
newItem.spread = true;
|
||||
newItem.children = [];
|
||||
List.push(newItem);
|
||||
getTreeList(rootList, newItem.id, newItem.children);
|
||||
}
|
||||
}
|
||||
return List;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addInfo(){
|
||||
if (rightId.length === 0) {
|
||||
parentTip("提示", "请选择人员", "warning");
|
||||
return false;
|
||||
}
|
||||
var tip = '保存';
|
||||
var formUrl = ctxPath + "/users/insertLeaderData";
|
||||
// 加载提示
|
||||
addLoadingMsg = top.layer.msg('数据上传中,请稍候...', {
|
||||
icon: 16,
|
||||
scrollbar: false,
|
||||
time: 0,
|
||||
shade: [0.8, '#393D49']
|
||||
});
|
||||
|
||||
var formData = {
|
||||
userId: rightId.toString(),
|
||||
};
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
async: false, // 默认异步true,false表示同步
|
||||
url: formUrl, // 请求地址
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: 'json', // 服务器返回数据类型
|
||||
data: JSON.stringify(formData), //获取提交的表单字段
|
||||
success: function (data) {
|
||||
if (data.resMsg === "发起成功") {
|
||||
parent.layer.closeAll();
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + '提示', tip + '成功', 'success');
|
||||
parent.tableIns.reload('demo');
|
||||
}else {
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
parentTip(tip + '提示', tip + '失败', 'error');
|
||||
}
|
||||
},
|
||||
error: function (XMLHttpRequest, textStatus, e) {
|
||||
layer.msg('数据请求发生异常,请稍后重试', {icon: 16, scrollbar: false});
|
||||
top.layer.close(addLoadingMsg); //再执行关闭
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
@ -166,6 +166,11 @@
|
|||
<div class="layui-inline" style="width: 5%;margin-top: 4px;margin-left: 10px;">
|
||||
<button id="addBtn" class="layui-btn layui-btn-sm" lay-event="addBtn">新 增</button>
|
||||
</div>
|
||||
<div class="layui-inline" style="width: 10%;margin-top: 4px;margin-left: 10px;">
|
||||
<button id="leaderSetBtn" class="layui-btn layui-btn-sm" lay-event="leaderSetBtn" style="width:120px
|
||||
!important">公司领导设置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
Loading…
Reference in New Issue