| | |
| | | //检索库位,选择合适的库位 |
| | | AgvLocMast agvLocMast = new AgvLocMast(); |
| | | |
| | | //查询库存 |
| | | AgvLocMast locMast = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("barcode", containerCode)); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("当前货架已在库存中,无法进行入库"); |
| | | } |
| | | |
| | | //查询入库通知档 |
| | | List<AgvWaitPakin> agvWaitPakinList = agvWaitPakinService.selectByContainerCode(containerCode); |
| | |
| | | //更新源站点状态 |
| | | updateAgvBasDevp(agvBasDevp,"R",containerType); |
| | | }else { |
| | | //查询工作档 |
| | | AgvWrkMast agvWrkMast1 = agvWrkMastService.selectByContainerCode(containerCode); |
| | | if (Cools.isEmpty(agvWrkMast1)) { |
| | | throw new CoolException("当前货架已有入库任务,无法进行入库"); |
| | | } |
| | | agvLocMast = agvCommonService.getLocNo(locType,agvBasDevp.getFloor(),true,true); |
| | | // 生成工作档 10.空板入库 |
| | | createWrkMast(10,201L,agvBasDevp.getDevNo(),agvLocMast.getLocNo(),containerCode,now,userId,containerType); |
| | |
| | | // generator.table="sys_host"; |
| | | // sqlserver |
| | | generator.sqlOsType = SqlOsType.SQL_SERVER; |
| | | generator.url="192.168.4.15:1433;databasename=phyzasrs"; |
| | | generator.url="127.0.0.1:1433;databasename=phyzasrs"; |
| | | generator.username="sa"; |
| | | generator.password="sa@123"; |
| | | generator.table="agv_wrk_mast_execute_log"; |
| | | generator.packagePath="com.zy.asrs"; |
| | | generator.table="sys_pda_resource"; |
| | | generator.packagePath="com.zy.system"; |
| | | generator.sql = false; |
| | | generator.build(); |
| | | } |
| | |
| | | @Autowired |
| | | private ResourceService resourceService; |
| | | @Autowired |
| | | private PdaResourceService pdaResourceService; |
| | | @Autowired |
| | | private RoleResourceService roleResourceService; |
| | | @Autowired |
| | | private PermissionService permissionService; |
| | |
| | | |
| | | // 功能模块 |
| | | Map<String, Object> functions = new HashMap<>(); |
| | | functions.put("title", "指定功能"); |
| | | functions.put("title", "pda功能"); |
| | | functions.put("id", "function"); |
| | | functions.put("spread", true); |
| | | functions.put("checked", false); |
| | | List<Map> funcs = new ArrayList<>(); |
| | | functions.put("children", funcs); |
| | | List<Permission> permissions = permissionService.selectList(new EntityWrapper<Permission>().eq("status", 1)); |
| | | for (Permission permission : permissions) { |
| | | Map<String, Object> func = new HashMap<>(); |
| | | func.put("title", permission.getName()); |
| | | func.put("id", permission.getAction()); |
| | | func.put("spread", true); |
| | | funcs.add(func); |
| | | List<PdaResource> oneLevs = pdaResourceService.selectList(new EntityWrapper<PdaResource>().eq("level", 1).eq("status", 1).orderBy("sort")); |
| | | // 一级 |
| | | for (PdaResource oneLev : oneLevs) { |
| | | List<Map> twoLevelsList = new ArrayList<>(); |
| | | Map<String, Object> oneLevelMap = new HashMap<>(); |
| | | oneLevelMap.put("title", oneLev.getName()); |
| | | oneLevelMap.put("id", oneLev.getId()); |
| | | oneLevelMap.put("spread", true); |
| | | oneLevelMap.put("checked", true); |
| | | oneLevelMap.put("children", twoLevelsList); |
| | | |
| | | List<PdaResource> twoLevels = pdaResourceService.selectList(new EntityWrapper<PdaResource>().eq("resource_id", oneLev.getId()).eq("level", 2).eq("status", 1).orderBy("sort")); |
| | | // 二级 |
| | | for (PdaResource twoLevel : twoLevels){ |
| | | Map<String, Object> twoLevelMap = new HashMap<>(); |
| | | twoLevelMap.put("title", twoLevel.getName()); |
| | | twoLevelMap.put("id", twoLevel.getId()); |
| | | twoLevelMap.put("spread", false); |
| | | twoLevelMap.put("checked", true); |
| | | List<Map> threeLevelsList = new ArrayList<>(); |
| | | twoLevelMap.put("children", threeLevelsList); |
| | | // 三级 |
| | | List<PdaResource> threeLevels = pdaResourceService.selectList(new EntityWrapper<PdaResource>().eq("resource_id", twoLevel.getId()).eq("level", 3).eq("status", 1).orderBy("sort")); |
| | | for (PdaResource threeLevel : threeLevels){ |
| | | Map<String, Object> threeLevelMap = new HashMap<>(); |
| | | threeLevelMap.put("title", threeLevel.getName()); |
| | | threeLevelMap.put("id", threeLevel.getId()); |
| | | threeLevelMap.put("checked", true); |
| | | threeLevelsList.add(threeLevelMap); |
| | | } |
| | | twoLevelsList.add(twoLevelMap); |
| | | } |
| | | funcs.add(oneLevelMap); |
| | | } |
| | | result.add(functions); |
| | | |
New file |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.system.entity.PdaResource; |
| | | import com.zy.system.entity.Resource; |
| | | import com.zy.system.service.PdaResourceService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class PdaResourceController extends BaseController { |
| | | |
| | | @Autowired |
| | | private PdaResourceService pdaResourceService; |
| | | |
| | | @RequestMapping(value = "/pdaResource/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(pdaResourceService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<PdaResource> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(PdaResource.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(pdaResourceService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/add/auth") |
| | | @ManagerAuth(memo = "菜单添加") |
| | | public R add(PdaResource pdaResource) { |
| | | pdaResourceService.insert(pdaResource); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/update/auth") |
| | | @ManagerAuth |
| | | public R update(PdaResource pdaResource){ |
| | | if (Cools.isEmpty(pdaResource) || null==pdaResource.getId()){ |
| | | return R.error(); |
| | | } |
| | | pdaResourceService.updateById(pdaResource); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | pdaResourceService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<PdaResource> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("pdaResource")); |
| | | convert(map, wrapper); |
| | | List<PdaResource> list = pdaResourceService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResourceQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<PdaResource> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("name", condition); |
| | | Page<PdaResource> page = pdaResourceService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (PdaResource pdaResource : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", pdaResource.getId()); |
| | | map.put("value", pdaResource.getId()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<PdaResource> wrapper = new EntityWrapper<PdaResource>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != pdaResourceService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(PdaResource.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/pdaResource/tree/auth") |
| | | @ManagerAuth |
| | | public R tree(@RequestParam(defaultValue = "1")Integer curr, |
| | | @RequestParam(defaultValue = "10")Integer limit, |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<PdaResource> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | else { |
| | | wrapper.orderBy("sort"); |
| | | } |
| | | return R.parse("0-操作成功").add(pdaResourceService.selectList(wrapper)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.ResourceService; |
| | | import com.zy.system.entity.Resource; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("sys_pda_resource") |
| | | public class PdaResource implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 菜单编码 |
| | | */ |
| | | @ApiModelProperty(value= "菜单编码") |
| | | private String code; |
| | | |
| | | /** |
| | | * 菜单名称 |
| | | */ |
| | | @ApiModelProperty(value= "菜单名称") |
| | | private String name; |
| | | |
| | | /** |
| | | * 菜单标题 |
| | | */ |
| | | @ApiModelProperty(value= "菜单标题") |
| | | private String title; |
| | | |
| | | /** |
| | | * 父级菜单 |
| | | */ |
| | | @ApiModelProperty(value= "父级菜单") |
| | | @TableField("resource_id") |
| | | private Long resourceId; |
| | | |
| | | /** |
| | | * 菜单等级 1: 一级菜单 2: 二级菜单 |
| | | */ |
| | | @ApiModelProperty(value= "菜单等级 1: 一级菜单 2: 二级菜单 ") |
| | | private Short level; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @ApiModelProperty(value= "排序") |
| | | private Integer sort; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | private Short status; |
| | | |
| | | public PdaResource() {} |
| | | |
| | | public PdaResource(String code,String name,String title,Long resourceId,Short level,Integer sort,Short status) { |
| | | this.code = code; |
| | | this.name = name; |
| | | this.title = title; |
| | | this.resourceId = resourceId; |
| | | this.level = level; |
| | | this.sort = sort; |
| | | this.status = status; |
| | | } |
| | | |
| | | // PdaResource pdaResource = new PdaResource( |
| | | // null, // 菜单编码[非空] |
| | | // null, // 菜单名称[非空] |
| | | // null, // 菜单标题[非空] |
| | | // null, // 父级菜单 |
| | | // null, // 菜单等级[非空] |
| | | // null, // 排序 |
| | | // null // 状态[非空] |
| | | // ); |
| | | |
| | | public String getResourceId$(){ |
| | | ResourceService service = SpringUtils.getBean(ResourceService.class); |
| | | Resource resource = service.selectById(this.resourceId); |
| | | if (!Cools.isEmpty(resource)){ |
| | | return String.valueOf(resource.getName()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getLevel$(){ |
| | | if (null == this.level){ return null; } |
| | | switch (this.level){ |
| | | case 1: |
| | | return "一级菜单"; |
| | | case 2: |
| | | return "二级菜单"; |
| | | default: |
| | | return String.valueOf(this.level); |
| | | } |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "禁用"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.zy.system.entity.PdaResource; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface PdaResourceMapper extends BaseMapper<PdaResource> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.zy.system.entity.PdaResource; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface PdaResourceService extends IService<PdaResource> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.zy.system.mapper.PdaResourceMapper; |
| | | import com.zy.system.entity.PdaResource; |
| | | import com.zy.system.service.PdaResourceService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("pdaResourceService") |
| | | public class PdaResourceServiceImpl extends ServiceImpl<PdaResourceMapper, PdaResource> implements PdaResourceService { |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.system.mapper.PdaResourceMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.system.entity.PdaResource"> |
| | | <id column="id" property="id" /> |
| | | <result column="code" property="code" /> |
| | | <result column="name" property="name" /> |
| | | <result column="title" property="title" /> |
| | | <result column="resource_id" property="resourceId" /> |
| | | <result column="level" property="level" /> |
| | | <result column="sort" property="sort" /> |
| | | <result column="status" property="status" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
New file |
| | |
| | | var pageCurr; |
| | | 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; |
| | | |
| | | // 数据渲染 |
| | | tableIns = table.render({ |
| | | elem: '#pdaResource', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/pdaResource/list/auth', |
| | | page: true, |
| | | limit: 15, |
| | | limits: [15, 30, 50, 100, 200, 500], |
| | | toolbar: '#toolbar', |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: '编号'} |
| | | ,{field: 'code', align: 'center',title: '菜单编码'} |
| | | ,{field: 'name', align: 'center',title: '菜单名称'} |
| | | ,{field: 'title', align: 'center',title: '菜单标题'} |
| | | ,{field: 'resourceId$', align: 'center',title: '父级菜单'} |
| | | ,{field: 'level$', align: 'center',title: '菜单等级'} |
| | | ,{field: 'sort', align: 'center',title: '排序'} |
| | | ,{field: 'status$', align: 'center',title: '状态'} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | ]], |
| | | 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 |
| | | }, |
| | | done: function(res, curr, count) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | limit(); |
| | | } |
| | | }); |
| | | |
| | | // 监听排序事件 |
| | | table.on('sort(pdaResource)', function (obj) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | searchData['orderByField'] = obj.field; |
| | | searchData['orderByType'] = obj.type; |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: 1} |
| | | }); |
| | | }); |
| | | |
| | | // 监听头工具栏事件 |
| | | table.on('toolbar(pdaResource)', function (obj) { |
| | | var checkStatus = table.checkStatus(obj.config.id).data; |
| | | switch(obj.event) { |
| | | case 'addData': |
| | | showEditModel(); |
| | | break; |
| | | case 'deleteData': |
| | | if (checkStatus.length === 0) { |
| | | layer.msg('请选择要删除的数据', {icon: 2}); |
| | | return; |
| | | } |
| | | del(checkStatus.map(function (d) { |
| | | return d.id; |
| | | })); |
| | | break; |
| | | case 'exportData': |
| | | admin.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'pdaResource': exportData, |
| | | 'fields': fields |
| | | }; |
| | | $.ajax({ |
| | | url: baseUrl+"/pdaResource/export/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(pdaResource)', function(obj){ |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'edit': |
| | | showEditModel(data); |
| | | break; |
| | | case "del": |
| | | del([data.id]); |
| | | break; |
| | | } |
| | | }); |
| | | |
| | | /* 弹窗 - 新增、修改 */ |
| | | function showEditModel(mData) { |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '订单状态', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | layDateRender(mData); |
| | | form.val('detail', mData); |
| | | form.on('submit(editSubmit)', function (data) { |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pdaResource/"+(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}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | }else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /* 删除 */ |
| | | function del(ids) { |
| | | layer.confirm('确定要删除选中数据吗?', { |
| | | skin: 'layui-layer-admin', |
| | | shade: .1 |
| | | }, function (i) { |
| | | layer.close(i); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/pdaResource/delete/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: {ids: ids}, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | if (res.code === 200){ |
| | | layer.msg(res.msg, {icon: 1}); |
| | | tableReload(); |
| | | } else if (res.code === 403){ |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 搜索 |
| | | form.on('submit(search)', function (data) { |
| | | pageCurr = 1; |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 重置 |
| | | form.on('submit(reset)', function (data) { |
| | | pageCurr = 1; |
| | | clearFormVal($('#search-box')); |
| | | tableReload(false); |
| | | }); |
| | | |
| | | // 时间选择器 |
| | | function layDateRender(data) { |
| | | setTimeout(function () { |
| | | layDate.render({ |
| | | elem: '.layui-laydate-range' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | }); |
| | | |
| | | }, 300); |
| | | } |
| | | layDateRender(); |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |
| | | $(document).on('click','#data-detail-close', function () { |
| | | parent.layer.closeAll(); |
| | | }); |
| | | |
| | | function tableReload(child) { |
| | | var searchData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | searchData[this.name] = this.value; |
| | | }); |
| | | tableIns.reload({ |
| | | where: searchData, |
| | | page: {curr: pageCurr} |
| | | }); |
| | | } |
| | |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'GET', |
| | | success: function (res) { |
| | | console.log(res) |
| | | if (res.code === 200){ |
| | | powerTreeData = res.data; |
| | | } else if (res.code === 403){ |
| | |
| | | data: parent.powerTreeData, |
| | | isJump: true |
| | | }); |
| | | |
| | | console.log(parent.powerTreeData) |
| | | loadPower(); |
| | | function loadPower(){ |
| | | $.ajax({ |
| | |
| | | console.log(checkData) |
| | | checkData.map(function (obj) { |
| | | obj.children.map(function (resource) { |
| | | console.log(resource) |
| | | //console.log(resource) |
| | | var childrens = []; |
| | | if (resource.children) { |
| | | resource.children.map(function (resource) { |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">状态</label> |
| | | <div class="layui-input-block"> |
| | | <select name="status" lay-vertype="tips" lay-verify="required" required=""> |
| | | <option value="">请选择状态</option> |
| | | <option value="1">正常</option> |
| | | <option value="0">禁用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-col-md6"> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">菜单标题</label> |
| | | <div class="layui-input-block"> |
| | | <input name="title" placeholder="请输入菜单标题" class="layui-input" lay-vertype="tips" lay-verify="required" required=""> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">菜单名称</label> |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label layui-form-required">状态</label> |
| | | <div class="layui-input-block"> |
| | | <select name="status" lay-vertype="tips" lay-verify="required" required=""> |
| | | <option value="">请选择状态</option> |
| | | <option value="1">正常</option> |
| | | <option value="0">禁用</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | var insTb = treeTable.render({ |
| | | elem: '#resource', |
| | | url: baseUrl+'/resource/tree/auth', |
| | | url: baseUrl+'/pdaResource/tree/auth', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | height: 'full-200', |
| | | toolbar: ['<p>', |
| | |
| | | {type: 'checkbox', fixed: 'left'} |
| | | ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80, hide: true} |
| | | ,{field: 'name', align: 'left',title: '菜单名称'} |
| | | ,{field: 'title', align: 'left',title: '菜单标题'} |
| | | ,{field: 'code', align: 'center',title: '菜单编码'} |
| | | // ,{field: 'resourceName', align: 'center',title: '父级菜单'} |
| | | // ,{field: 'level$', align: 'center',title: '菜单等级'} |
| | |
| | | admin.open({ |
| | | type: 1, |
| | | area: '600px', |
| | | title: (mData ? '修改' : '添加') + '权限', |
| | | title: (mData ? '修改' : '添加') + '菜单', |
| | | content: $('#editDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | // 回显表单数据 |
| | |
| | | data.field.resourceId = insXmSel.getValue('valueStr'); |
| | | var loadIndex = layer.load(2); |
| | | $.ajax({ |
| | | url: baseUrl+"/resource/"+(mData?'update':'add')+"/auth", |
| | | url: baseUrl+"/pdaResource/"+(mData?'update':'add')+"/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: data.field, |
| | | method: 'POST', |