设备绑定,设备信息管理

Conflicts:
	src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceManageController.java
	src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceGroupServiceImpl.java
	src/main/kotlin/com/supwisdom/dlpay/migration.kt
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeviceSearchBean.java b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeviceSearchBean.java
index 24dc7e3..d9985c0 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeviceSearchBean.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/bean/DeviceSearchBean.java
@@ -48,4 +48,15 @@
     public void setFactoryid(String factoryid) {
         this.factoryid = factoryid;
     }
+
+    @Override
+    public String toString() {
+        return "DeviceSearchBean{" +
+                "id=" + id +
+                ", devicename='" + devicename + '\'' +
+                ", factoryid='" + factoryid + '\'' +
+                ", devgroupid=" + devgroupid +
+                ", devphyid='" + devphyid + '\'' +
+                '}';
+    }
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceManageController.java b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceManageController.java
index 898052d..53f4ef0 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceManageController.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/controller/DeviceManageController.java
@@ -2,10 +2,12 @@
 
 
 import com.supwisdom.dlpay.api.bean.JsonResult;
-import com.supwisdom.dlpay.restaurant.bean.DeviceSearchBean;
-import com.supwisdom.dlpay.restaurant.domain.TDevice;
-import com.supwisdom.dlpay.restaurant.service.DeviceService;
-import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.device.bean.DeviceSearchBean;
+import com.supwisdom.dlpay.device.domain.TDevice;
+import com.supwisdom.dlpay.device.domain.TDeviceGroup;
+import com.supwisdom.dlpay.device.service.DeviceGroupService;
+import com.supwisdom.dlpay.device.service.DeviceService;
+import com.supwisdom.dlpay.framework.util.ExportExcel;import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.framework.util.WebConstant;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -14,6 +16,9 @@
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 @Controller
 @RequestMapping("/devicemanage")
 public class DeviceManageController {
@@ -21,6 +26,10 @@
     @Autowired
     private DeviceService deviceService;
 
+    @Autowired
+    private DeviceGroupService groupService;
+
+
     @RequestMapping("/index")
     public String indexView(ModelMap model) {
 
@@ -31,8 +40,8 @@
     @PreAuthorize("hasPermission('/devicemanage/index','')")
     @ResponseBody
     public PageResult<TDevice> getDataList(@RequestParam("page") Integer pageNo,
-                                         @RequestParam("limit") Integer pageSize,
-                                         @RequestParam(value = "id", required = false) Integer id,
+                                           @RequestParam("limit") Integer pageSize,
+                                           @RequestParam(value = "id", required = false) Integer id,
                                            @RequestParam(value = "devphyid", required = false) String devphyid,
                                            @RequestParam(value = "factoryid", required = false) String factoryid,
                                            @RequestParam(value = "devicename", required = false) String devicename) {
@@ -57,9 +66,9 @@
     @GetMapping("/loadupdate")
     @PreAuthorize("hasPermission('/devicemanage/loadupdate','')")
     public String loadadd(Model model) {
-        return "restaurant/device/form";
-    }
-
+    List<TDeviceGroup> list = groupService.findAll();
+        model.addAttribute("grouplist", list);
+        return "devicemanage/form";    }
 
 
     @PostMapping("/update")
@@ -67,7 +76,7 @@
     @ResponseBody
     public JsonResult updatestate(@RequestBody TDevice device) {
         if (device != null) {
-            return deviceService.saveDevice(device);
+            return deviceService.updateDevice(device);
         } else {
             return JsonResult.error("失败");
         }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java
index 897e6ed..14d13db 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/dao/DeviceDao.java
@@ -7,6 +7,7 @@
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
 @Repository
@@ -18,9 +19,12 @@
 
 
     @Query("select count(*) from TDevice t where t.devgroupid =:id and t.state=1")
-    Integer countByDevgroupid(Integer Devgroupid);
+    Integer countByDevgroupid(@Param("id") Integer Devgroupid);
 
     Integer countByDevphyid(String devphyid);
 
     TDevice findByDevicename(String devicename);
+
+
+    TDevice findTDeviceById(Integer id);
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java
index 040fcdc..86810aa 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDevice.java
@@ -103,4 +103,19 @@
     public void setLastsaved(String lastsaved) {
         this.lastsaved = lastsaved;
     }
+
+    @Override
+    public String toString() {
+        return "TDevice{" +
+                "id=" + id +
+                ", devicename='" + devicename + '\'' +
+                ", devphyid='" + devphyid + '\'' +
+                ", shopid=" + shopid +
+                ", factoryid='" + factoryid + '\'' +
+                ", state=" + state +
+                ", operid='" + operid + '\'' +
+                ", devgroupid=" + devgroupid +
+                ", lastsaved='" + lastsaved + '\'' +
+                '}';
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDeviceGroup.java b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDeviceGroup.java
index 5588eec..930a3f6 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDeviceGroup.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/domain/TDeviceGroup.java
@@ -10,6 +10,7 @@
     private Integer devgroupid;
     private String groupname;
     private Integer pid;
+    private String operid;
 
     @Id
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_DEVGROUP")
@@ -39,4 +40,15 @@
     public void setPid(Integer pid) {
         this.pid = pid;
     }
+
+
+    @Column(name = "operid", length = 100)
+    public String gerOperid() {
+        return operid;
+    }
+
+    public void setOperid(String operid) {
+        this.operid = operid;
+    }
+
 }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceService.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceService.java
index 6fc0d98..0eee4e7 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceService.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/DeviceService.java
@@ -30,6 +30,10 @@
     JsonResult saveDevice(TDevice device);
 
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
+    JsonResult updateDevice(TDevice device);
+
+
+    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     boolean updateState(Integer id,Integer state);
 
 
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceGroupServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceGroupServiceImpl.java
index 7565003..42ee894 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceGroupServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceGroupServiceImpl.java
@@ -5,6 +5,7 @@
 import com.supwisdom.dlpay.restaurant.dao.DeviceGroupDao;
 import com.supwisdom.dlpay.restaurant.domain.TDeviceGroup;
 import com.supwisdom.dlpay.restaurant.service.DeviceGroupService;
+import com.supwisdom.dlpay.framework.security.OperUtil;
 import com.supwisdom.dlpay.framework.util.PageResult;
 import com.supwisdom.dlpay.system.bean.ZTreeNode;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +51,7 @@
 
     @Override
     public JsonResult saveGroup(TDeviceGroup device){
+        device.setOperid(OperUtil.getCurrentOperid());
         groupDao.save(device);
         return JsonResult.ok("成功");
     }
diff --git a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java
index 0ba218d..a38c246 100644
--- a/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/restaurant/service/impl/DeviceServiceImpl.java
@@ -100,14 +100,34 @@
         if (null == device.getState()) {
             device.setState(1);
         }
+        String operid=OperUtil.getCurrentOperid();
+        device.setOperid(operid);
 
-        TDevice d = deviceDao.save(device);
+      /*  TDevice d = deviceDao.save(device);
         TShopDevice shopDevice = new TShopDevice();
         shopDevice.setDeviceid(d.getId());
         shopDevice.setShopid(d.getShopid());
-        shopDevice.setOperid(OperUtil.getCurrentOperid());
-        shopDeviceDao.save(shopDevice);
+        shopDevice.setOperid(operid);
+        shopDeviceDao.save(shopDevice);*/
+        deviceDao.save(device);
+        return JsonResult.ok("成功");
+    }
 
+    @Override
+    public JsonResult updateDevice(TDevice device) {
+
+        TDevice d = deviceDao.findTDeviceById(device.getId());
+        d.setDevicename(device.getDevicename());
+        d.setDevgroupid(device.getDevgroupid());
+        String operid=OperUtil.getCurrentOperid();
+        device.setOperid(operid);
+        deviceDao.save( d);
+
+        TShopDevice shopDevice = new TShopDevice();
+        shopDevice.setDeviceid(d.getId());
+        shopDevice.setShopid(d.getShopid());
+        shopDevice.setOperid(operid);
+        shopDeviceDao.save(shopDevice);
         return JsonResult.ok("成功");
     }
 
diff --git a/src/main/kotlin/com/supwisdom/dlpay/migration.kt b/src/main/kotlin/com/supwisdom/dlpay/migration.kt
index c1992b3..4124f99 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/migration.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/migration.kt
@@ -1,32 +1,64 @@
-//package com.supwisdom.dlpay
-//
-//import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer
-//import org.flywaydb.core.Flyway
-//import org.springframework.context.annotation.Bean
-//import org.springframework.context.annotation.Configuration
-//import org.springframework.context.annotation.DependsOn
-//
-//
-//@Configuration
-//class MigrationConfiguration {
-//
-//    /**
-//     * Override default flyway initializer to do nothing
-//     */
-//    @Bean
-//    fun flywayInitializer(flyway: Flyway): FlywayMigrationInitializer {
-//        return FlywayMigrationInitializer(flyway) { }
-//    }
-//
-//
-//    /**
-//     * Create a second flyway initializer to run after jpa has created the schema
-//     */
-//    @Bean
-//    @DependsOn("entityManagerFactory")
-//    fun delayedFlywayInitializer(flyway: Flyway): FlywayMigrationInitializer {
-//        return FlywayMigrationInitializer(flyway, null)
-//    }
-//
-//
-//}
\ No newline at end of file
+package com.supwisdom.dlpay
+
+import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer
+import org.flywaydb.core.Flyway
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.DependsOn
+
+
+@Configuration
+class MigrationConfiguration {
+
+    /**
+     * Override default flyway initializer to do nothing
+     */
+    @Bean
+    fun flywayInitializer(flyway: Flyway): FlywayMigrationInitializer {
+        return FlywayMigrationInitializer(flyway) { f -> }
+    }
+
+
+    /**
+     * Create a second flyway initializer to run after jpa has created the schema
+     */
+    @Bean
+    @DependsOn("entityManagerFactory")
+    fun delayedFlywayInitializer(flyway: Flyway): FlywayMigrationInitializer {
+        return FlywayMigrationInitializer(flyway, null)
+    }
+
+
+}
+package com.supwisdom.dlpay
+
+import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer
+import org.flywaydb.core.Flyway
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.DependsOn
+
+
+@Configuration
+class MigrationConfiguration {
+
+   /* *//**
+     * Override default flyway initializer to do nothing
+     *//*
+    @Bean
+    fun flywayInitializer(flyway: Flyway): FlywayMigrationInitializer {
+        return FlywayMigrationInitializer(flyway) { f -> }
+    }
+
+
+    *//**
+     * Create a second flyway initializer to run after jpa has created the schema
+     *//*
+    @Bean
+    @DependsOn("entityManagerFactory")
+    fun delayedFlywayInitializer(flyway: Flyway): FlywayMigrationInitializer {
+        return FlywayMigrationInitializer(flyway, null)
+    }*/
+
+
+}
\ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index c1ec200..cc97724 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -8,6 +8,8 @@
 spring.flyway.locations=classpath:db/migration
 spring.flyway.baseline-version=0
 spring.flyway.baseline-on-migrate=true
+#禁用flyway,需要修改migration.kt
+spring.flyway.enabled=false
 # logging
 logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
 logging.level.org.hibernate.SQL=debug
diff --git a/src/main/resources/templates/devicemanage/form.html b/src/main/resources/templates/devicemanage/form.html
new file mode 100644
index 0000000..58e6535
--- /dev/null
+++ b/src/main/resources/templates/devicemanage/form.html
@@ -0,0 +1,86 @@
+
+<form id="form" lay-filter="form" class="layui-form model-form">
+    <input name="id" id="id" type="hidden"/>
+    <div class="layui-form-item">
+        <label class="layui-form-label">设备名称</label>
+        <div class="layui-input-block">
+            <input name="devicename" placeholder="建议采用带有地理坐标的名称" type="text" class="layui-input" maxlength="20"
+                   lay-verify="required|devphyid" required/>
+        </div>
+    </div>
+    <div class="layui-form-item">
+        <label class="layui-form-label">设备组</label>
+        <div class="layui-input-block">
+            <select name="devgroupid" id="devgroupid" lay-verify="required">
+                <option th:each="group : ${grouplist}" th:value="${group.devgroupid}">[[${group.groupname}]]</option>
+            </select>
+        </div>
+    </div>
+
+
+
+    <div class="layui-form-item model-form-footer">
+        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
+        <button class="layui-btn" lay-filter="form-submit" lay-submit id="submitbtn">保存</button>
+    </div>
+</form>
+
+<script>
+    layui.use(['layer', 'admin', 'form', 'formSelects'], function () {
+        var layer = layui.layer;
+        var admin = layui.admin;
+        var form = layui.form;
+        form.render('select');
+        form.render('radio');
+
+
+        var url = '/devicemanage/update';
+        // 回显user数据
+        var dev = admin.getTempData('t_dev');
+        if (dev) {
+            $('input[name="id"]').attr('readonly', 'readonly');
+            form.val('form', dev);
+        }
+       /* let fid = admin.getTempData("fid");
+        if (fid) {
+            form.val('form', {"fid": fid});
+        }*/
+        // 表单提交事件
+        form.on('submit(form-submit)', function (data) {
+            console.log(data);
+            layer.load(2);
+            let token = $("meta[name='_csrf_token']").attr("value");
+            $.ajax({
+                type: "POST",
+                dataType: "json",
+                url: url,
+                headers: {
+                    'Accept': 'application/json',
+                    'Content-Type': 'application/json',
+                    'X-CSRF-TOKEN': token,
+                },
+                data: JSON.stringify(data.field),
+                success: function (result) {
+                    layer.closeAll('loading');
+                    if (result.code == 200) {
+                        layer.msg(result.msg, {icon: 1});
+                        admin.finishPopupCenter();
+                    } else if (result.code == 401) {
+                        layer.msg(result.msg, {icon: 2, time: 1500}, function () {
+                            location.replace('/login');
+                        }, 1000);
+                        return;
+                    } else {
+                        console.log('err:' + result.code);
+                        layer.msg(result.msg, {icon: 2});
+                    }
+                },
+                error: function () {
+                    layer.closeAll('loading');
+                    layer.msg("请求服务器失败!", {icon: 2});
+                }
+            });
+            return false;
+        });
+    });
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/home/theme.html b/src/main/resources/templates/home/theme.html
index 67cb12a..4a0477d 100755
--- a/src/main/resources/templates/home/theme.html
+++ b/src/main/resources/templates/home/theme.html
@@ -1,7 +1,7 @@
 <div class="layui-card-header">

     <h2 class="header-title">多标签:</h2>

     <div class="pull-right layui-form">

-        <input type="checkbox" lay-skin="switch" lay-text="ON|OFF" id="set-tab" lay-filter="set-tab" checked/>

+        <input type="checkbox" lay-skin="switch" lay-text="ON|OFF" id="set-tab" lay-filter="set-tab" />

     </div>

 </div>

 

diff --git a/src/main/resources/templates/restaurant/device/form.html b/src/main/resources/templates/restaurant/device/form.html
index 5540300..9426e9b 100644
--- a/src/main/resources/templates/restaurant/device/form.html
+++ b/src/main/resources/templates/restaurant/device/form.html
@@ -73,6 +73,7 @@
         }*/
         // 表单提交事件
         form.on('submit(form-submit)', function (data) {
+            console.log(data);
             layer.load(2);
             let token = $("meta[name='_csrf_token']").attr("value");
             $.ajax({
diff --git a/src/main/resources/templates/restaurant/devicegroup/index.html b/src/main/resources/templates/restaurant/devicegroup/index.html
index c716fea..cf967a2 100644
--- a/src/main/resources/templates/restaurant/devicegroup/index.html
+++ b/src/main/resources/templates/restaurant/devicegroup/index.html
@@ -54,10 +54,11 @@
             page: true,
             cols: [
                 [
-                    {field: 'id', title: '终端编号', sort: true},
-                    {field: 'devphyid', sort: true, width: 200, title: '设备物理id'},
-                    {field: 'shopid', sort: true, width: 200, title: '商户id'},
-                    {field: 'factoryid', sort: true, width: 200, title: '设备厂商'},
+                    {field: 'id', title: '终端编号',width: 100, sort: true},
+                    {field: 'devicename', title: '设备名称',width: 160, sort: true},
+                    {field: 'devphyid', sort: true, width: 120, title: '设备物理id'},
+                    {field: 'shopid', sort: true, width: 100, title: '商户id'},
+                    {field: 'factoryid', sort: true, width: 150, title: '设备厂商'},
                     {field: 'state', title: '状态', sort: true, width: 100, templet: '#dev-tpl-state'},
                 ]
             ]
diff --git a/src/main/resources/templates/restaurant/devicemanage/index.html b/src/main/resources/templates/restaurant/devicemanage/index.html
index 1948862..5c71735 100644
--- a/src/main/resources/templates/restaurant/devicemanage/index.html
+++ b/src/main/resources/templates/restaurant/devicemanage/index.html
@@ -1,15 +1,23 @@
 <div class="layui-card">
     <div class="layui-card-header">
-        <h2 class="header-title">设备注册</h2>
+        <h2 class="header-title">设备信息管理</h2>
         <span class="layui-breadcrumb pull-right">
-          <a href="#">设备注册</a>
-          <a><cite>设备注册</cite></a>
+          <a href="#">设备信息管理</a>
+          <a><cite>设备信息管理</cite></a>
         </span>
     </div>
     <div class="layui-card-body">
         <div class="layui-form toolbar">
-            搜索:
-            <input id="search-value" class="layui-input search-input" type="text" placeholder="输入终端编号"/>&emsp;
+            设备名称:
+            <input id="devicename" class="layui-input search-input" type="text"/>&emsp;
+            终端ID:
+            <input id="termid" class="layui-input search-input" type="text" />&emsp;
+            设备物理ID:
+            <input id="devphyid" class="layui-input search-input" type="text" />&emsp;
+              设备厂商:
+            <select name="factoryid" id="factoryid" lay-verify="required">
+                <option  value="XKP">新开普</option>
+            </select>
             <button id="btn-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon">&#xe615;</i>搜索
             </button>
 
@@ -34,18 +42,19 @@
         // 渲染表格
         table.render({
             elem: '#table',
-            url: '/device/list',
+            url: '/devicemanage/list',
             page: true,
             cols: [
                 [
                     {field: 'id', title: '终端编号', sort: true},
+                    {field: 'devicename', title: '设备名称', width:200},
                     {field: 'devphyid', sort: true, width: 200, title: '设备物理id'},
-                    {field: 'shopid', sort: true, width: 200, title: '商户id'},
+                    {field: 'shopid', sort: true, width: 150, title: '商户id'},
                     {field: 'factoryid', sort: true, width: 200, title: '设备厂商'},
                     {field: 'state', title: '状态', sort: true, width: 100, templet: '#dev-tpl-state'},
                     {
                         field: 'id', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
-                            return ' <a class="layui-btn  layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ';
+                            return ' <a class="layui-btn  layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>修改</a> ';
                         }
                     }
                 ]
@@ -53,30 +62,24 @@
         });
         // 搜索按钮点击事件
         $('#btn-search').click(function () {
-            let key = $('#search-value').val();
-            table.reload('table', {where: {searchkey: key}, page: {curr: 1}});
+            let devphyid = $('#devphyid').val();
+            let id = $('#termid').val();
+            let factoryid = $('#factoryid').val();
+            let devicename = $('#devicename').val();
+            table.reload('table', {where: {
+                devphyid: devphyid,
+                id:id,
+                factoryid:factoryid,
+                devicename:devicename}, page: {curr: 1}});
         });
-        $('#btn-add').click(function () {
-            showModel();
-        });
-        $('#btn-import').click(function () {
-            showDownload();
-        });
-        let showDownload = function () {
-            let title ='导入';
-            admin.popupCenter({
-                title: title,
-                path: '/device/loadimport',
-                finish: function () {
-                }
-            });
-        };
+
+
         let showModel = function (data) {
-            let title = data ? '修改设备' : '添加设备';
+            let title = data ? '修改设备信息' : '添加设备';
             admin.putTempData('t_dev', data);
             admin.popupCenter({
                 title: title,
-                path: '/device/loadadd',
+                path: '/devicemanage/loadupdate',
                 finish: function () {
                     table.reload('table', {});
                 }
@@ -95,35 +98,6 @@
                 showDelete(data);
             }
         });
-        let showDelete = function (data) {
-            layer.confirm('确定要删除吗?', function (i) {
-                layer.close(i);
-                layer.load(2);
-                let token = $("meta[name='_csrf_token']").attr("value");
-                admin.go('/device/delete', {
-                    id: data.id,
-                    _csrf: token
-                }, function (data) {
-                    console.log(data.code);
-                    layer.closeAll('loading');
-                    if (data.code == 200) {
-                        layer.msg(data.msg, {icon: 1});
-                    } else if (data.code == 401) {
-                        layer.msg(data.msg, {icon: 2, time: 1500}, function () {
-                            location.replace('/login');
-                        }, 1000);
-                        return;
-                    } else {
-                        layer.msg(data.msg, {icon: 2});
-                    }
-                    table.reload('table', {});
-                }, function (ret) {
-                    console.log(ret);
-                    layer.closeAll('loading');
-                    layer.msg('请求失败了,请稍后再试', {icon: 2});
-                });
-            });
-        };
 
         form.on('switch(dev-tpl-state)', function (obj) {
             layer.load(2);