From 0976fe8b38980ae61957b76dccac40e0f9674bd6 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 19 六月 2020 15:57:44 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/LocMastController.java |    9 ++++
 src/main/java/com/zy/common/entity/Parameter.java           |   11 +++++
 src/main/webapp/static/js/common.js                         |   12 ++++-
 src/main/webapp/static/js/locMast/locMast.js                |   34 +++++++++-------
 4 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocMastController.java b/src/main/java/com/zy/asrs/controller/LocMastController.java
index 8ece97a..7244906 100644
--- a/src/main/java/com/zy/asrs/controller/LocMastController.java
+++ b/src/main/java/com/zy/asrs/controller/LocMastController.java
@@ -13,6 +13,7 @@
 import com.zy.asrs.entity.LocMast;
 import com.zy.asrs.entity.param.LocMastInitParam;
 import com.zy.asrs.service.LocMastService;
+import com.zy.common.entity.Parameter;
 import com.zy.common.model.Shelves;
 import com.zy.common.web.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +27,14 @@
     @Autowired
     private LocMastService locMastService;
 
+    @RequestMapping(value = "/locMast/init/pwd")
+    public R locMastInitPwd(@RequestParam(required = false) String pwd) {
+        if (Cools.isEmpty(pwd)) {
+            return R.error("璇疯緭鍏ュ彛浠�");
+        }
+        return R.ok().add(Parameter.get().getLocMastInitPwd().equals(pwd));
+    }
+
     @RequestMapping(value = "/locMast/{id}/auth")
     @ManagerAuth
     public R get(@PathVariable("id") String id) {
diff --git a/src/main/java/com/zy/common/entity/Parameter.java b/src/main/java/com/zy/common/entity/Parameter.java
index e290983..91e7c65 100644
--- a/src/main/java/com/zy/common/entity/Parameter.java
+++ b/src/main/java/com/zy/common/entity/Parameter.java
@@ -59,4 +59,15 @@
     public void setCodeSwitch(String codeSwitch) {
         this.codeSwitch = codeSwitch;
     }
+
+    // 搴撲綅鍒濆鍖栧彛浠�
+    private String locMastInitPwd;
+
+    public String getLocMastInitPwd() {
+        return locMastInitPwd;
+    }
+
+    public void setLocMastInitPwd(String locMastInitPwd) {
+        this.locMastInitPwd = locMastInitPwd;
+    }
 }
diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js
index 3e2e453..d3d2813 100644
--- a/src/main/webapp/static/js/common.js
+++ b/src/main/webapp/static/js/common.js
@@ -104,11 +104,17 @@
                 url: url,
                 data: data,
                 dataType: 'json',
-                header: {'Content-Type': 'application/json'},
+                header: {'token': localStorage.getItem('token')},
                 timeout: 10000,
                 cache: false,
-                success: function (result) {
-                    callback(result);
+                success: function (res) {
+                    if (res.code === 200){
+                        callback(res);
+                    } else if (res.code === 403){
+                        top.location.href = baseUrl+"/";
+                    }  else {
+                        layer.msg(res.msg);
+                    }
                 },
                 error: function (res, type) {
 
diff --git a/src/main/webapp/static/js/locMast/locMast.js b/src/main/webapp/static/js/locMast/locMast.js
index 3c0a7d3..d0f4dc5 100644
--- a/src/main/webapp/static/js/locMast/locMast.js
+++ b/src/main/webapp/static/js/locMast/locMast.js
@@ -204,22 +204,25 @@
                 break;
             case "init":
                 layer.prompt({title: '璇疯緭鍏ュ彛浠わ紝骞堕噸缃簱浣�', formType: 1,   shadeClose: true}, function(pass, idx){
-                    if (pass === "123456") {
-                        layer.open({
-                            type: 1,
-                            title: '鍒濆鍖栧簱浣�',
-                            area: ["400px"],
-                            maxmin: true,
-                            shadeClose: true,
-                            content: $("#resetLocDiv"),
-                            success: function (layero, index) {
+                    http.get(baseUrl+"/locMast/init/pwd", {pwd: pass}, function (res) {
+                        if (res.data) {
+                            layer.open({
+                                type: 1,
+                                title: '鍒濆鍖栧簱浣�',
+                                area: ["400px"],
+                                maxmin: true,
+                                shadeClose: true,
+                                content: $("#resetLocDiv"),
+                                success: function (layero, index) {
 
-                            }
-                        })
-                    } else {
-                        layer.msg("鍙d护閿欒");
-                    }
-                    layer.close(idx);
+                                }
+                            })
+                        } else {
+                            layer.msg("鍙d护閿欒");
+                        }
+                        layer.close(idx);
+                    })
+
                 });
                 break;
         }
@@ -430,6 +433,7 @@
                 if (res.code === 200){
                     layer.msg(res.msg);
                     layer.closeAll();
+                    tableReload(false);
                 } else if (res.code === 403){
                     parent.location.href = "/";
                 }else {

--
Gitblit v1.9.1