From e74403cc7340bf0e2721573cf907a16f27ea957b Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期日, 23 六月 2024 10:11:27 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/system/entity/PdaResource.java                  |  127 ++++++++++
 src/main/webapp/static/js/pdaResource/pdaResource.js                 |  252 +++++++++++++++++++++
 src/main/java/com/zy/system/mapper/PdaResourceMapper.java            |   12 +
 src/main/webapp/static/js/role/role.js                               |    1 
 src/main/java/com/zy/common/CodeBuilder.java                         |    6 
 src/main/java/com/zy/system/controller/PdaResourceController.java    |  143 +++++++++++
 src/main/java/com/zy/common/web/AuthController.java                  |   45 +++
 src/main/resources/mapper/PdaResourceMapper.xml                      |   18 +
 src/main/java/com/zy/system/service/PdaResourceService.java          |    8 
 src/main/webapp/views/pdaResource/pdaResource.html                   |   35 +-
 src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java       |   10 
 src/main/webapp/static/js/role/rolePower.js                          |    4 
 src/main/java/com/zy/system/service/impl/PdaResourceServiceImpl.java |   12 +
 13 files changed, 647 insertions(+), 26 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java
index c7ac287..9a622e8 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvWorkServiceImpl.java
@@ -458,6 +458,11 @@
         //妫�绱㈠簱浣嶏紝閫夋嫨鍚堥�傜殑搴撲綅
         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);
@@ -492,6 +497,11 @@
             //鏇存柊婧愮珯鐐圭姸鎬�
             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);
diff --git a/src/main/java/com/zy/common/CodeBuilder.java b/src/main/java/com/zy/common/CodeBuilder.java
index 6d26ba3..364a52e 100644
--- a/src/main/java/com/zy/common/CodeBuilder.java
+++ b/src/main/java/com/zy/common/CodeBuilder.java
@@ -17,11 +17,11 @@
 //        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();
     }
diff --git a/src/main/java/com/zy/common/web/AuthController.java b/src/main/java/com/zy/common/web/AuthController.java
index ee8c27d..e311882 100644
--- a/src/main/java/com/zy/common/web/AuthController.java
+++ b/src/main/java/com/zy/common/web/AuthController.java
@@ -44,6 +44,8 @@
     @Autowired
     private ResourceService resourceService;
     @Autowired
+    private PdaResourceService pdaResourceService;
+    @Autowired
     private RoleResourceService roleResourceService;
     @Autowired
     private PermissionService permissionService;
@@ -230,18 +232,45 @@
 
         // 鍔熻兘妯″潡
         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);
 
diff --git a/src/main/java/com/zy/system/controller/PdaResourceController.java b/src/main/java/com/zy/system/controller/PdaResourceController.java
new file mode 100644
index 0000000..25fee84
--- /dev/null
+++ b/src/main/java/com/zy/system/controller/PdaResourceController.java
@@ -0,0 +1,143 @@
+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));
+    }
+
+}
diff --git a/src/main/java/com/zy/system/entity/PdaResource.java b/src/main/java/com/zy/system/entity/PdaResource.java
new file mode 100644
index 0000000..61e9d57
--- /dev/null
+++ b/src/main/java/com/zy/system/entity/PdaResource.java
@@ -0,0 +1,127 @@
+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: 姝e父  0: 绂佺敤  
+     */
+    @ApiModelProperty(value= "鐘舵�� 1: 姝e父  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 "姝e父";
+            case 0:
+                return "绂佺敤";
+            default:
+                return String.valueOf(this.status);
+        }
+    }
+
+
+}
diff --git a/src/main/java/com/zy/system/mapper/PdaResourceMapper.java b/src/main/java/com/zy/system/mapper/PdaResourceMapper.java
new file mode 100644
index 0000000..175bd36
--- /dev/null
+++ b/src/main/java/com/zy/system/mapper/PdaResourceMapper.java
@@ -0,0 +1,12 @@
+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> {
+
+}
diff --git a/src/main/java/com/zy/system/service/PdaResourceService.java b/src/main/java/com/zy/system/service/PdaResourceService.java
new file mode 100644
index 0000000..3ade2ee
--- /dev/null
+++ b/src/main/java/com/zy/system/service/PdaResourceService.java
@@ -0,0 +1,8 @@
+package com.zy.system.service;
+
+import com.zy.system.entity.PdaResource;
+import com.baomidou.mybatisplus.service.IService;
+
+public interface PdaResourceService extends IService<PdaResource> {
+
+}
diff --git a/src/main/java/com/zy/system/service/impl/PdaResourceServiceImpl.java b/src/main/java/com/zy/system/service/impl/PdaResourceServiceImpl.java
new file mode 100644
index 0000000..bfda87e
--- /dev/null
+++ b/src/main/java/com/zy/system/service/impl/PdaResourceServiceImpl.java
@@ -0,0 +1,12 @@
+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 {
+
+}
diff --git a/src/main/resources/mapper/PdaResourceMapper.xml b/src/main/resources/mapper/PdaResourceMapper.xml
new file mode 100644
index 0000000..139aab8
--- /dev/null
+++ b/src/main/resources/mapper/PdaResourceMapper.xml
@@ -0,0 +1,18 @@
+<?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>
diff --git a/src/main/webapp/static/js/pdaResource/pdaResource.js b/src/main/webapp/static/js/pdaResource/pdaResource.js
new file mode 100644
index 0000000..023dc6d
--- /dev/null
+++ b/src/main/webapp/static/js/pdaResource/pdaResource.js
@@ -0,0 +1,252 @@
+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}
+     });
+}
diff --git a/src/main/webapp/static/js/role/role.js b/src/main/webapp/static/js/role/role.js
index 3bdce29..f117ca0 100644
--- a/src/main/webapp/static/js/role/role.js
+++ b/src/main/webapp/static/js/role/role.js
@@ -7,6 +7,7 @@
         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){
diff --git a/src/main/webapp/static/js/role/rolePower.js b/src/main/webapp/static/js/role/rolePower.js
index e4a35fb..bf7cd8d 100644
--- a/src/main/webapp/static/js/role/rolePower.js
+++ b/src/main/webapp/static/js/role/rolePower.js
@@ -12,7 +12,7 @@
         data: parent.powerTreeData,
         isJump: true
     });
-
+    console.log(parent.powerTreeData)
     loadPower();
     function loadPower(){
         $.ajax({
@@ -42,7 +42,7 @@
         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) {
diff --git a/src/main/webapp/views/pdaResource/pdaResource.html b/src/main/webapp/views/pdaResource/pdaResource.html
index 92c2330..b9e9e45 100644
--- a/src/main/webapp/views/pdaResource/pdaResource.html
+++ b/src/main/webapp/views/pdaResource/pdaResource.html
@@ -73,9 +73,27 @@
                     </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">姝e父</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>
@@ -91,16 +109,6 @@
                     </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">姝e父</option>
-                            <option value="0">绂佺敤</option>
-                        </select>
-                    </div>
-                </div>
 
             </div>
         </div>
@@ -139,7 +147,7 @@
 
         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>',
@@ -156,6 +164,7 @@
                 {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: '鑿滃崟绛夌骇'}
@@ -207,7 +216,7 @@
             admin.open({
                 type: 1,
                 area: '600px',
-                title: (mData ? '淇敼' : '娣诲姞') + '鏉冮檺',
+                title: (mData ? '淇敼' : '娣诲姞') + '鑿滃崟',
                 content: $('#editDialog').html(),
                 success: function (layero, dIndex) {
                     // 鍥炴樉琛ㄥ崟鏁版嵁
@@ -217,7 +226,7 @@
                         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',

--
Gitblit v1.9.1