|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.common.sys.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.sys.entity.Host; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.sql.Wrapper; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/host/add/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R add(Host host) { | 
|---|
|  |  |  | host.setStatus(1); | 
|---|
|  |  |  | host.setCreateTime(new Date()); | 
|---|
|  |  |  | hostService.save(host); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (Cools.isEmpty(host) || null==host.getId()){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | host.setUpdateTime(new Date()); | 
|---|
|  |  |  | hostService.updateById(host); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/host/delete/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R delete(Integer[] ids){ | 
|---|
|  |  |  | if (Cools.isEmpty(ids)){ | 
|---|
|  |  |  | public R delete(@RequestParam(value = "ids[]") Integer[] ids) { | 
|---|
|  |  |  | if (Cools.isEmpty(ids)) { | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hostService.removeByIds(Arrays.asList(ids)); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/host/delete/one/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R deleteOne(@RequestParam String param){ | 
|---|
|  |  |  | if (getUserId() != 9527) { | 
|---|
|  |  |  | if (getUser().getRoleId() != 2) { | 
|---|
|  |  |  | return R.error("权限不足"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Host host = JSONArray.parseObject(param, Host.class); | 
|---|
|  |  |  | if (Cools.isEmpty(host)){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | hostService.removeById(host.getId()); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(User::getHostId, param.get("host_id")); | 
|---|
|  |  |  | wrapper.orderByDesc(User::getId); | 
|---|
|  |  |  | if (9527 == getUserId()) { | 
|---|
|  |  |  | return R.ok(userService.page(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/user/add/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "系统用户添加") | 
|---|
|  |  |  | public R add(User user) { | 
|---|
|  |  |  | User one = userService.getOne(new LambdaQueryWrapper<User>().eq(User::getUsername, user.getUsername())); | 
|---|
|  |  |  | if (one != null) { | 
|---|
|  |  |  | return R.error("账号已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | user.setStatus(1); | 
|---|
|  |  |  | user.setCreateTime(new Date()); | 
|---|
|  |  |  | userService.save(user); | 
|---|
|  |  |  | 
|---|
|  |  |  | private String name; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 标识 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String flag; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private Date createTime; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Host() {} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Host(String name,String flag,Date createTime,Date updateTime,Integer status) { | 
|---|
|  |  |  | public Host(String name,Date createTime,Date updateTime,Integer status) { | 
|---|
|  |  |  | this.name = name; | 
|---|
|  |  |  | this.flag = flag; | 
|---|
|  |  |  | this.createTime = createTime; | 
|---|
|  |  |  | this.updateTime = updateTime; | 
|---|
|  |  |  | this.status = status; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.common.sys.service.UserService; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.SpringUtils; | 
|---|
|  |  |  | import io.swagger.annotations.ApiModelProperty; | 
|---|
|  |  |  | import lombok.Data; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.Serializable; | 
|---|
|  |  |  | 
|---|
|  |  |  | private Long id; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 仓库 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ApiModelProperty(value= "仓库") | 
|---|
|  |  |  | private Long hostId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 员工 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private Long userId; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Repository | 
|---|
|  |  |  | public interface HostMapper extends BaseMapper<Host> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Host selectTop1(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface HostService extends IService<Host> { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Host getTop1(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @Service("hostService") | 
|---|
|  |  |  | public class HostServiceImpl extends ServiceImpl<HostMapper, Host> implements HostService { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Host getTop1() { | 
|---|
|  |  |  | return this.baseMapper.selectTop1(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | private ResourceService resourceService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RoleResourceService roleResourceService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private HostService hostService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/login.action") | 
|---|
|  |  |  | @ManagerAuth(value = ManagerAuth.Auth.NONE, memo = "登录") | 
|---|
|  |  |  | 
|---|
|  |  |  | userLogin.setToken(token); | 
|---|
|  |  |  | userLogin.setCreateTime(new Date()); | 
|---|
|  |  |  | userLogin.setSystem(system); | 
|---|
|  |  |  | if (user.getRoleId() == 2) { | 
|---|
|  |  |  | userLogin.setHostId(hostService.getTop1().getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | userLoginService.save(userLogin); | 
|---|
|  |  |  | Map<String, Object> res = new HashMap<>(); | 
|---|
|  |  |  | res.put("username", user.getUsername()); | 
|---|
|  |  |  | res.put("token", token); | 
|---|
|  |  |  | return R.ok(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/show/host.action") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R showHosts() { | 
|---|
|  |  |  | Long hostId = getHostId(); | 
|---|
|  |  |  | String hostName = null; | 
|---|
|  |  |  | if (hostId != null) { | 
|---|
|  |  |  | Host host = hostService.getById(hostId); | 
|---|
|  |  |  | if (host != null) { | 
|---|
|  |  |  | hostName = host.getName(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok().add(Cools | 
|---|
|  |  |  | .add("root", getUser().getRoleId() == 2) | 
|---|
|  |  |  | .add("host", getHostId() == null) | 
|---|
|  |  |  | .add("hostName", hostName) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/root/change/host/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R rootChangeHost(@RequestParam Long hostId) { | 
|---|
|  |  |  | UserLogin userLogin = userLoginService.getOne(new LambdaQueryWrapper<UserLogin>().eq(UserLogin::getUserId, getUserId()).eq(UserLogin::getSystem, String.valueOf(LoginSystemType.WMS))); | 
|---|
|  |  |  | if (userLogin != null) { | 
|---|
|  |  |  | userLogin.setHostId(hostId); | 
|---|
|  |  |  | if (!userLoginService.updateById(userLogin)) { | 
|---|
|  |  |  | throw new CoolException("修改商户失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/code/switch.action") | 
|---|
|  |  |  | 
|---|
|  |  |  | oneLevel = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getLevel, 1).orderByAsc(Resource::getSort)); | 
|---|
|  |  |  | resourceWrapper = new LambdaQueryWrapper<Resource>().eq(Resource::getLevel, 2).eq(Resource::getStatus, 1).orderByAsc(Resource::getSort); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 激活码验证 | 
|---|
|  |  |  | if (!SystemProperties.SYSTEM_ACTIVATION) { | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oneLevel = resourceService.list(new LambdaQueryWrapper<Resource>().eq(Resource::getLevel, 1).eq(Resource::getStatus, 1).orderByAsc(Resource::getSort)); | 
|---|
|  |  |  | // 获取当前用户的所有二级菜单 | 
|---|
|  |  |  | user = userService.getById(getUserId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | // 是否拥有查看权限 | 
|---|
|  |  |  | if (getUserId() != 9527) { | 
|---|
|  |  |  | Resource view = resourceService.getOne(new LambdaQueryWrapper<Resource>().eq(Resource::getResourceId, resource.getId()).like(Resource::getCode, "#view")); | 
|---|
|  |  |  | if (!Cools.isEmpty(view)){ | 
|---|
|  |  |  | if (!Cools.isEmpty(view)) { | 
|---|
|  |  |  | RoleResource param = new RoleResource(); | 
|---|
|  |  |  | param.setResourceId(view.getId()); | 
|---|
|  |  |  | param.setRoleId(user.getRoleId()); | 
|---|
|  |  |  | if (null == roleResourceService.getOne(new LambdaQueryWrapper<>(param))){ | 
|---|
|  |  |  | if (null == roleResourceService.getOne(new LambdaQueryWrapper<>(param))) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.common.web; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.sys.entity.User; | 
|---|
|  |  |  | import com.zy.asrs.common.sys.entity.UserLogin; | 
|---|
|  |  |  | import com.zy.asrs.common.sys.service.UserLoginService; | 
|---|
|  |  |  | import com.zy.asrs.common.sys.service.UserService; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.BaseRes; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | 
|---|
|  |  |  | protected HttpServletRequest request; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UserService userService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UserLoginService userLoginService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected Long getHostId(){ | 
|---|
|  |  |  | if (getUserId() == 9527) { | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | User user = getUser(); | 
|---|
|  |  |  | if (user.getRoleId() == 2) { | 
|---|
|  |  |  | String hostId = String.valueOf(request.getAttribute("hostId")); | 
|---|
|  |  |  | if (Cools.isEmpty(hostId)) { | 
|---|
|  |  |  | UserLogin userLogin = userLoginService.getOne(new LambdaQueryWrapper<UserLogin>().eq(UserLogin::getUserId, user.getId())); | 
|---|
|  |  |  | if (userLogin != null) { | 
|---|
|  |  |  | return userLogin.getHostId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return Long.parseLong(hostId); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return user.getHostId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected Long getUserId(){ | 
|---|
|  |  |  | return Long.parseLong(String.valueOf(request.getAttribute("userId"))); | 
|---|
|  |  |  | 
|---|
|  |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.zy.asrs.common.sys.mapper.HostMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectTop1" resultType="com.zy.asrs.common.sys.entity.Host"> | 
|---|
|  |  |  | select top 1 * from sys_host where 1=1 order by id | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 请求缓存 | 
|---|
|  |  |  | request.setAttribute("userId", user.getId()); | 
|---|
|  |  |  | request.setAttribute("hostId", userLogin.getHostId()); | 
|---|
|  |  |  | // 更新 token 有效期 | 
|---|
|  |  |  | userLogin.setCreateTime(new Date()); | 
|---|
|  |  |  | userLoginService.updateById(userLogin); | 
|---|
|  |  |  | // 操作日志 | 
|---|
|  |  |  | if (!Cools.isEmpty(memo)) { | 
|---|
|  |  |  | // 进行激活判断 | 
|---|
|  |  |  | if (!SystemProperties.SYSTEM_ACTIVATION) { | 
|---|
|  |  |  | Http.response(response, BaseRes.NO_ACTIVATION); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 记录操作日志 | 
|---|
|  |  |  | OperateLog operateLog = new OperateLog(); | 
|---|
|  |  |  | operateLog.setAction(Cools.isEmpty(memo)?request.getRequestURI():memo); | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/"  // 配置模块所在的目录 | 
|---|
|  |  |  | }).use(['table','laydate', 'form',  'admin'], function() { | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var layDate = layui.laydate; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | var admin = layui.admin; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /****************************************** 左边表 *************************************************/ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var insTb = table.render({ | 
|---|
|  |  |  | elem: '#originTable', | 
|---|
|  |  |  | url: baseUrl + '/host/list/auth', | 
|---|
|  |  |  | height: 'full-100', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | parseData: function (res) { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | 'code': res.code, | 
|---|
|  |  |  | 'msg': res.msg, | 
|---|
|  |  |  | 'count': res.data.total, | 
|---|
|  |  |  | 'data': res.data.records | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | response: { | 
|---|
|  |  |  | statusCode: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | toolbar: ['<p>', | 
|---|
|  |  |  | '<button lay-event="add" class="layui-btn layui-btn-sm icon-btn"><i class="layui-icon"></i>添加</button> ', | 
|---|
|  |  |  | '<button lay-event="edit" class="layui-btn layui-btn-sm layui-btn-warm icon-btn"><i class="layui-icon"></i>修改</button> ', | 
|---|
|  |  |  | '<button lay-event="del" class="layui-btn layui-btn-sm layui-btn-danger icon-btn"><i class="layui-icon"></i>删除</button>', | 
|---|
|  |  |  | '</p>'].join(''), | 
|---|
|  |  |  | defaultToolbar: [], | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {field: 'id', title: '编号', width: 70, align: 'center'}, | 
|---|
|  |  |  | {field: 'name', title: '项目名称'} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | done: function (res, curr, count) { | 
|---|
|  |  |  | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 表格搜索 */ | 
|---|
|  |  |  | form.on('submit(originTableSearch)', function (data) { | 
|---|
|  |  |  | insTb.reload({where: {name: data.field.name}}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 表格搜索 */ | 
|---|
|  |  |  | form.on('submit(originTbReset)', function (data) { | 
|---|
|  |  |  | insTb.reload(); | 
|---|
|  |  |  | insTb2.reload({where: {host_id: null}, page: {curr: 1}}); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 表格头工具栏点击事件 */ | 
|---|
|  |  |  | table.on('toolbar(originTable)', function (obj) { | 
|---|
|  |  |  | if (obj.event === 'add') { // 添加 | 
|---|
|  |  |  | showEdit(); | 
|---|
|  |  |  | } else if (obj.event === 'edit') { // 修改 | 
|---|
|  |  |  | if (selObj == null) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | showEdit(selObj.data); | 
|---|
|  |  |  | } else if (obj.event === 'del') { // 删除 | 
|---|
|  |  |  | if (selObj == null) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | doDel(selObj); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 监听行单击事件 */ | 
|---|
|  |  |  | var selObj; | 
|---|
|  |  |  | table.on('row(originTable)', function (obj) { | 
|---|
|  |  |  | selObj = obj; | 
|---|
|  |  |  | obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click'); | 
|---|
|  |  |  | insTb2.reload({where: {host_id: obj.data.id}, page: {curr: 1}}); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 显示表单弹窗 */ | 
|---|
|  |  |  | function showEdit(mData) { | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: (mData ? '修改' : '添加') + '项目', | 
|---|
|  |  |  | content: $('#hostEditDialog').html(), | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | // 回显表单数据 | 
|---|
|  |  |  | form.val('hostEditForm', mData); | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(hostEditSubmit)', function (data) { | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/host/"+(mData?'update':'add')+"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: data.field, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | selObj = null; | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.close(dIndex); | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | insTb.reload(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 删除 */ | 
|---|
|  |  |  | function doDel(obj) { | 
|---|
|  |  |  | layer.confirm('确定要删除此单据类型吗?', { | 
|---|
|  |  |  | skin: 'layui-layer-admin', | 
|---|
|  |  |  | shade: .1 | 
|---|
|  |  |  | }, function (i) { | 
|---|
|  |  |  | layer.close(i); | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/host/delete/one/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: {param: JSON.stringify(obj.data)}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | selObj = null; | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.closeAll(); | 
|---|
|  |  |  | insTb.reload(); | 
|---|
|  |  |  | $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | 
|---|
|  |  |  | height: 'full-100', | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {type: 'checkbox'} | 
|---|
|  |  |  | // ,{field: 'hostName', align: 'center',title: '授权商户', templet: '#hostTpl', width: 140} | 
|---|
|  |  |  | ,{field: 'hostName', align: 'center',title: '授权商户', templet: '#hostTpl', width: 140} | 
|---|
|  |  |  | // ,{field: 'nickname', align: 'center',title: '用户名'} | 
|---|
|  |  |  | ,{field: 'username', align: 'center',title: '登录账户'} | 
|---|
|  |  |  | ,{field: 'mobile', align: 'center',title: '手机号'} | 
|---|
|  |  |  | ,{field: 'username', align: 'center',title: '用户名'} | 
|---|
|  |  |  | // ,{field: 'deptName', align: 'center',title: '所属部门'} | 
|---|
|  |  |  | ,{field: 'roleName', align: 'center',title: '角色'} | 
|---|
|  |  |  | ,{field: 'email', align: 'center',title: '邮箱'} | 
|---|
|  |  |  | // ,{field: 'sex$', align: 'center',title: '性别'} | 
|---|
|  |  |  | ,{field: 'sex$', align: 'center',title: '性别'} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '注册时间', hide: true} | 
|---|
|  |  |  | ,{field: 'status$', align: 'center',title: '状态', templet: '#statusTpl', width: 120, unresize: true} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 表格2头工具栏点击事件 */ | 
|---|
|  |  |  | table.on('toolbar(userTable)', function (obj) { | 
|---|
|  |  |  | var checkStatus = table.checkStatus(obj.config.id).data; | 
|---|
|  |  |  | if (obj.event === 'add') { // 添加 | 
|---|
|  |  |  | showEditModel() | 
|---|
|  |  |  | } else if (obj.event === 'del') { // 删除 | 
|---|
|  |  |  | if (checkStatus.length === 0) { | 
|---|
|  |  |  | var checkRows = table.checkStatus('userTable'); | 
|---|
|  |  |  | if (checkRows.data.length === 0) { | 
|---|
|  |  |  | layer.msg('请选择要删除的数据', {icon: 2}); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | del(checkStatus.map(function (d) { | 
|---|
|  |  |  | var ids = checkRows.data.map(function (d) { | 
|---|
|  |  |  | return d.id; | 
|---|
|  |  |  | })); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | doDelUser({ids: ids}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // 删除 | 
|---|
|  |  |  | case 'del': | 
|---|
|  |  |  | del([data.id]); | 
|---|
|  |  |  | var ids = [obj.id]; | 
|---|
|  |  |  | doDelUser({ids: ids}); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | // 重置密码 | 
|---|
|  |  |  | case 'resetPwd': | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 删除订单 */ | 
|---|
|  |  |  | function del(ids) { | 
|---|
|  |  |  | function doDelUser(obj) { | 
|---|
|  |  |  | layer.confirm('确定要删除选中数据吗?', { | 
|---|
|  |  |  | skin: 'layui-layer-admin', | 
|---|
|  |  |  | shade: .1 | 
|---|
|  |  |  | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/user/delete/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: {ids: ids}, | 
|---|
|  |  |  | data: {ids: obj.ids}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | 
|---|
|  |  |  | <!DOCTYPE html> | 
|---|
|  |  |  | <html lang="en"> | 
|---|
|  |  |  | <head> | 
|---|
|  |  |  | <meta charset="utf-8"> | 
|---|
|  |  |  | <title></title> | 
|---|
|  |  |  | <meta name="renderer" content="webkit"> | 
|---|
|  |  |  | <meta charset="UTF-8"> | 
|---|
|  |  |  | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 
|---|
|  |  |  | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | 
|---|
|  |  |  | <title>仓库管理</title> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/cool.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/common.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all"> | 
|---|
|  |  |  | <!--[if lt IE 9]> | 
|---|
|  |  |  | <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> | 
|---|
|  |  |  | <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | 
|---|
|  |  |  | <![endif]--> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | /** 查看详情弹窗样式 */ | 
|---|
|  |  |  | .paper-info-group { | 
|---|
|  |  |  | padding: 15px 25px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .paper-info-group h3 { | 
|---|
|  |  |  | font-weight: bold; | 
|---|
|  |  |  | color: #000000; | 
|---|
|  |  |  | padding-bottom: 8px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .paper-info-group p { | 
|---|
|  |  |  | color: #666; | 
|---|
|  |  |  | padding-bottom: 12px; | 
|---|
|  |  |  | font-size: 16px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .paper-info-group .paper-info-group-imgs { | 
|---|
|  |  |  | padding-top: 5px; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .paper-info-group .paper-info-group-imgs img { | 
|---|
|  |  |  | margin-right: 15px; | 
|---|
|  |  |  | margin-bottom: 15px; | 
|---|
|  |  |  | cursor: zoom-in; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .paper-info-group .paper-info-group-imgs img:last-child { | 
|---|
|  |  |  | margin-right: 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 日期组件不显示秒 */ | 
|---|
|  |  |  | .laydate-time-list li:last-child { | 
|---|
|  |  |  | display: none; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .laydate-time-list li { | 
|---|
|  |  |  | width: 50% !important; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | .laydate-time-list ol li { | 
|---|
|  |  |  | padding-left: 55px !important; | 
|---|
|  |  |  | width: 100% !important; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </head> | 
|---|
|  |  |  | <body> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 搜索栏 --> | 
|---|
|  |  |  | <div id="search-box" class="layui-form layui-card-header"> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <div class="layui-input-inline"> | 
|---|
|  |  |  | <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off"> | 
|---|
|  |  |  | <!-- 正文开始 --> | 
|---|
|  |  |  | <div class="layui-fluid"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body"> | 
|---|
|  |  |  | <button id="eDialogAddBtn" class="layui-btn">添加仓库</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 待添加 --> | 
|---|
|  |  |  | <div id="data-search-btn" class="layui-btn-container layui-form-item"> | 
|---|
|  |  |  | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> | 
|---|
|  |  |  | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-header">仓库 - 数据列表</div> | 
|---|
|  |  |  | <div class="layui-card-body"> | 
|---|
|  |  |  | <table id="hostTable" lay-filter="hostTable"></table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表格 --> | 
|---|
|  |  |  | <table class="layui-hide" id="host" lay-filter="host"></table> | 
|---|
|  |  |  | <script type="text/html" id="toolbar"> | 
|---|
|  |  |  | <div class="layui-btn-container"> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <script type="text/html" id="editDialog"> | 
|---|
|  |  |  | <form id="detail" lay-filter="detail" class="layui-form model-form layui-row"> | 
|---|
|  |  |  | <input name="id" type="hidden"/> | 
|---|
|  |  |  | <div class="layui-col-md12"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">仓库名称</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="name" placeholder="请输入仓库名称" lay-verType="tips" lay-verify="required" required/> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">备注</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input class="layui-input" name="memo" placeholder="请输入备注"/> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item text-right"> | 
|---|
|  |  |  | <button class="layui-btn" lay-filter="editSubmit" lay-submit>保存</button> | 
|---|
|  |  |  | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script type="text/html" id="operate"> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a> | 
|---|
|  |  |  | <!-- 表格操作列 --> | 
|---|
|  |  |  | <script type="text/html" id="eDialogTbBar"> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-sm layui-btn-primary" lay-event="edit"><i class="layui-icon"></i>修改</a> | 
|---|
|  |  |  | <a class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delete"><i class="layui-icon"></i>删除</a> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- js部分 --> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/host/host.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | layui.config({ | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).use(['table','laydate', 'form', 'util', 'admin'], function(){ | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var admin = layui.admin; | 
|---|
|  |  |  | var form = layui.form; | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  | var laydate = layui.laydate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> | 
|---|
|  |  |  | // 添加 | 
|---|
|  |  |  | $('#eDialogAddBtn').click(function () { | 
|---|
|  |  |  | showEditModel(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 渲染表格 | 
|---|
|  |  |  | var insTb = table.render({ | 
|---|
|  |  |  | elem: '#hostTable', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | url: baseUrl+'/host/list/auth', | 
|---|
|  |  |  | page: true, | 
|---|
|  |  |  | limit: 16, | 
|---|
|  |  |  | limits: [16, 30, 50, 100, 200, 500], | 
|---|
|  |  |  | cellMinWidth: 50, | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {field: 'id', title: '#'} | 
|---|
|  |  |  | // ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80} | 
|---|
|  |  |  | ,{field: 'name', align: 'center',title: '仓库名称'} | 
|---|
|  |  |  | // ,{field: 'flag', align: 'center',title: '标识'} | 
|---|
|  |  |  | // ,{field: 'createTime$', align: 'center',title: '添加时间'} | 
|---|
|  |  |  | // ,{field: 'status$', align: 'center',title: '状态'} | 
|---|
|  |  |  | // ,{field: 'createTime$', align: 'center',title: '添加时间'} | 
|---|
|  |  |  | // ,{field: 'createBy$', align: 'center',title: '添加人员'} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '修改时间'} | 
|---|
|  |  |  | ,{field: 'updateBy$', align: 'center',title: '修改人员'} | 
|---|
|  |  |  | ,{field: 'memo', align: 'center',title: '备注'} | 
|---|
|  |  |  | ,{align: 'center', toolbar: '#eDialogTbBar', title: '操作', minWidth: 80} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | parseData: function (res) { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | 'code': res.code, | 
|---|
|  |  |  | 'msg': res.msg, | 
|---|
|  |  |  | 'count': res.data.total, | 
|---|
|  |  |  | 'data': res.data.records | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | response: { | 
|---|
|  |  |  | statusCode: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | size: 'lg' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 工具条点击事件 | 
|---|
|  |  |  | table.on('tool(hostTable)', function (obj) { | 
|---|
|  |  |  | var data = obj.data; | 
|---|
|  |  |  | if (obj.event === 'delete') { | 
|---|
|  |  |  | var ids = [data.id]; | 
|---|
|  |  |  | doDel({ids: ids}); | 
|---|
|  |  |  | } else if (obj.event === 'edit') { | 
|---|
|  |  |  | showEditModel(data); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* 显示表单弹窗 */ | 
|---|
|  |  |  | function showEditModel(mData) { | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: (mData ? '修改' : '添加') + '项目', | 
|---|
|  |  |  | area: '500px', | 
|---|
|  |  |  | content: $('#editDialog').html(), | 
|---|
|  |  |  | success: function (layero, dIndex) { | 
|---|
|  |  |  | // 回显表单数据 | 
|---|
|  |  |  | form.val('detail', mData); | 
|---|
|  |  |  | // 表单提交事件 | 
|---|
|  |  |  | form.on('submit(editSubmit)', function (data) { | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/host/"+(mData?'update':'add')+"/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: data.field, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.close(dIndex); | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | $(".layui-laypage-btn")[0].click(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function doDel(obj) { | 
|---|
|  |  |  | layer.confirm('确定删除数据吗?', { | 
|---|
|  |  |  | skin: 'layui-layer-admin', | 
|---|
|  |  |  | shade: .1 | 
|---|
|  |  |  | }, function (i) { | 
|---|
|  |  |  | layer.close(i); | 
|---|
|  |  |  | var loadIndex = layer.load(2); | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/host/delete/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: {ids: obj.ids}, | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | layer.close(loadIndex); | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 1}); | 
|---|
|  |  |  | $(".layui-laypage-btn")[0].click(); | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | </body> | 
|---|
|  |  |  | </html> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <link rel="stylesheet" href="../static/layui/css/layui.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../static/css/admin.css?v=318" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../static/css/loader.css" media="all"> | 
|---|
|  |  |  | <link rel="stylesheet" href="../static/css/originTable.css" media="all"> | 
|---|
|  |  |  | <style> | 
|---|
|  |  |  | .layui-logo img { | 
|---|
|  |  |  | width: 25px; | 
|---|
|  |  |  | 
|---|
|  |  |  | </ul> | 
|---|
|  |  |  | <ul class="layui-nav layui-layout-right"> | 
|---|
|  |  |  | <li class="layui-nav-item" lay-unselect> | 
|---|
|  |  |  | <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a> | 
|---|
|  |  |  | <a id="hostName"></a> | 
|---|
|  |  |  | </li> | 
|---|
|  |  |  | <!--      <li class="layui-nav-item" lay-unselect>--> | 
|---|
|  |  |  | <!--        <a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>--> | 
|---|
|  |  |  | <!--      </li>--> | 
|---|
|  |  |  | <li class="layui-nav-item layui-hide-xs" lay-unselect> | 
|---|
|  |  |  | <a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a> | 
|---|
|  |  |  | </li> | 
|---|
|  |  |  | 
|---|
|  |  |  | base: baseUrl + "/static/layui/lay/modules/" | 
|---|
|  |  |  | }).extend({ | 
|---|
|  |  |  | notice: 'notice/notice', | 
|---|
|  |  |  | }).use(['index', 'element', 'layer', 'admin', 'notice'], function () { | 
|---|
|  |  |  | }).use(['index', 'element', 'layer', 'admin', 'notice', 'table'], function () { | 
|---|
|  |  |  | var $ = layui.jquery; | 
|---|
|  |  |  | var index = layui.index; | 
|---|
|  |  |  | var element = layui.element; | 
|---|
|  |  |  | var layer = layui.layer; | 
|---|
|  |  |  | var admin = layui.admin; | 
|---|
|  |  |  | var notice = layui.notice; | 
|---|
|  |  |  | var table = layui.table; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var easywebIframeMsg = localStorage.getItem("easyweb-iframe"); | 
|---|
|  |  |  | if (!isEmpty(easywebIframeMsg)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 检测是否为超级管理员 | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl + "/show/host.action", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | if (!isEmpty(res.data.hostName)) { | 
|---|
|  |  |  | $('#hostName').text(res.data.hostName); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (res.data.root) { | 
|---|
|  |  |  | showHost(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl + "/login"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 默认加载主页 | 
|---|
|  |  |  | index.loadHome({ | 
|---|
|  |  |  | menuPath: baseUrl+'/views/home/navigation.html', | 
|---|
|  |  |  | menuPath: baseUrl + '/views/home/navigation.html', | 
|---|
|  |  |  | menuName: '<i class="layui-icon layui-icon-home"></i>' | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $('#username').text(localStorage.getItem('username')); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | $(document).on('click','#logout', function () { | 
|---|
|  |  |  | $(document).on('click', '#logout', function () { | 
|---|
|  |  |  | window.location.href = "login.html"; | 
|---|
|  |  |  | localStorage.removeItem('token'); | 
|---|
|  |  |  | localStorage.removeItem('username'); | 
|---|
|  |  |  | 
|---|
|  |  |  | var url = logout.getAttribute('href'); | 
|---|
|  |  |  | logout.setAttribute('href', baseUrl + "/login"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 多仓库模式 | 
|---|
|  |  |  | function showHost() { | 
|---|
|  |  |  | // var dele = layer.msg('正在删除', {icon: 16, time: 10000}, function(){ | 
|---|
|  |  |  | //     layer.msg('成功删除', {icon: 1}) | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | admin.open({ | 
|---|
|  |  |  | type: 1, | 
|---|
|  |  |  | title: '仓库选择', | 
|---|
|  |  |  | area: '250px', | 
|---|
|  |  |  | offset: 'r', | 
|---|
|  |  |  | shade: false, | 
|---|
|  |  |  | shadeClose: true, | 
|---|
|  |  |  | content: '<table id="originTable" lay-filter="originTable"></table>', | 
|---|
|  |  |  | success: function (layero) { | 
|---|
|  |  |  | var insTb = table.render({ | 
|---|
|  |  |  | elem: '#originTable', | 
|---|
|  |  |  | url: baseUrl + '/host/list/auth', | 
|---|
|  |  |  | height: 'full-600', | 
|---|
|  |  |  | headers: {token: localStorage.getItem('token')}, | 
|---|
|  |  |  | request: { | 
|---|
|  |  |  | pageName: 'curr', | 
|---|
|  |  |  | pageSize: 'limit' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | parseData: function (res) { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | 'code': res.code, | 
|---|
|  |  |  | 'msg': res.msg, | 
|---|
|  |  |  | 'count': res.data.total, | 
|---|
|  |  |  | 'data': res.data.records | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | response: { | 
|---|
|  |  |  | statusCode: 200 | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | defaultToolbar: [], | 
|---|
|  |  |  | cols: [[ | 
|---|
|  |  |  | {field: 'id', title: '编号', width: 70, align: 'center'}, | 
|---|
|  |  |  | {field: 'name', title: '项目名称'} | 
|---|
|  |  |  | ]], | 
|---|
|  |  |  | done: function (res, curr, count) { | 
|---|
|  |  |  | $('.layui-table, .layui-table-view').css("margin", 0); | 
|---|
|  |  |  | // $('#originTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | /* 监听行单击事件 */ | 
|---|
|  |  |  | table.on('row(originTable)', function (obj) { | 
|---|
|  |  |  | obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click'); | 
|---|
|  |  |  | // 检测是否为超级管理员 | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl + "/root/change/host/auth?hostId=" + obj.data.id, | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | window.location.reload(); | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl + "/login"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg, {icon: 2}); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <script type="text/html" id="menuTpl"> | 
|---|
|  |  |  | 
|---|
|  |  |  | <!-- 正文开始 --> | 
|---|
|  |  |  | <div class="layui-fluid" style="padding-bottom: 0;"> | 
|---|
|  |  |  | <div class="layui-row layui-col-space15"> | 
|---|
|  |  |  | <div class="layui-col-md12"> | 
|---|
|  |  |  | <div class="layui-col-md3" id="left-table"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body" style="padding: 10px;"> | 
|---|
|  |  |  | <form class="layui-form toolbar"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <div class="layui-inline" style="max-width: 140px;"> | 
|---|
|  |  |  | <input name="name" class="layui-input" placeholder="输入项目名称"/> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-inline"> | 
|---|
|  |  |  | <button class="layui-btn icon-btn" lay-filter="originTableSearch" lay-submit> | 
|---|
|  |  |  | <i class="layui-icon"></i>搜索 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | <button class="layui-btn icon-btn" lay-filter="originTbReset" lay-submit> | 
|---|
|  |  |  | <i class="layui-icon"></i>重置 | 
|---|
|  |  |  | </button> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </form> | 
|---|
|  |  |  | <table id="originTable" lay-filter="originTable"></table> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-col-md9"> | 
|---|
|  |  |  | <div class="layui-card"> | 
|---|
|  |  |  | <div class="layui-card-body" style="padding: 10px;"> | 
|---|
|  |  |  | <form class="layui-form toolbar"> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-col-md6"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">登录账户</label> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">手机号</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input name="username" placeholder="请输入登录账户" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | <input name="mobile" placeholder="请输入手机号" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">所属项目: </label> | 
|---|
|  |  |  | <div class="layui-input-block cool-auto-complete"> | 
|---|
|  |  |  | <input name="hostId" class="layui-input" style="display: none"> | 
|---|
|  |  |  | <input id="hostName" name="hostName" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="请选择所属项目" onfocus=this.blur()> | 
|---|
|  |  |  | <div class="cool-auto-complete-window"> | 
|---|
|  |  |  | <input class="cool-auto-complete-window-input" data-key="hostQueryByhostId" onkeyup="autoLoad(this.getAttribute('data-key'))"> | 
|---|
|  |  |  | <select class="cool-auto-complete-window-select" data-key="hostQueryByhostIdSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple"> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-col-md6"> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">手机号</label> | 
|---|
|  |  |  | <label class="layui-form-label layui-form-required">用户名</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input name="mobile" placeholder="请输入手机号" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | <input name="username" placeholder="请输入用户名" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">邮箱</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <input name="email" placeholder="请输入邮箱" class="layui-input"> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <div class="layui-form-item"> | 
|---|
|  |  |  | <label class="layui-form-label">性别</label> | 
|---|
|  |  |  | <div class="layui-input-block"> | 
|---|
|  |  |  | <select name="sex"> | 
|---|
|  |  |  | <option value="2" style="display: none">未知</option> | 
|---|
|  |  |  | <option value="0">男</option> | 
|---|
|  |  |  | <option value="1">女</option> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/tools/md5.js"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/user/user.js" charset="utf-8"></script> | 
|---|
|  |  |  | <script type="text/javascript" src="../../static/js/hostTable.js" charset="utf-8"></script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 项目编辑窗口 --> | 
|---|
|  |  |  | <script type="text/html" id="hostEditDialog"> | 
|---|