From b97ab3e077df3665663eb3a5b0c23d54c83a5548 Mon Sep 17 00:00:00 2001
From: tzsk <Administrator@qq.com>
Date: 星期五, 31 五月 2024 12:02:25 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/basSte/basSte.js |   63 +++++++++++++++++++++++++------
 1 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/src/main/webapp/static/js/basSte/basSte.js b/src/main/webapp/static/js/basSte/basSte.js
index 9da1e05..45397a8 100644
--- a/src/main/webapp/static/js/basSte/basSte.js
+++ b/src/main/webapp/static/js/basSte/basSte.js
@@ -1,4 +1,5 @@
 var pageCurr;
+var tableData;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).use(['table','laydate', 'form', 'admin'], function(){
@@ -23,26 +24,28 @@
         cols: [[
             {type: 'checkbox'}
             ,{field: 'steNo', align: 'center',title: '绌挎杞﹀彿'}
-            ,{field: 'inEnable', align: 'center',title: '鍙叆'}
-            ,{field: 'outEnable', align: 'center',title: '鍙嚭'}
-            ,{field: 'steSts', align: 'center',title: '浣滀笟鎬�'}
+            ,{field: 'inEnable', align: 'center',title: '鍙叆', templet: '#inEnableTpl'}
+            ,{field: 'outEnable', align: 'center',title: '鍙嚭', templet: '#outEnableTpl'}
+            ,{field: 'pakMk', align: 'center',title: '浣滀笟鏍囪', hide: false}
+            // ,{field: 'steSts', align: 'center',title: '浣滀笟鎬�'}
             ,{field: 'wrkNo', align: 'center',title: '浠诲姟鍙�'}
             ,{field: 'crnNo', align: 'center',title: '鍫嗗灈鏈哄彿'}
             ,{field: 'row', align: 'center',title: '鎺�'}
             ,{field: 'bay', align: 'center',title: '鍒�'}
             ,{field: 'lev', align: 'center',title: '灞�'}
-            ,{field: 'hisRow', align: 'center',title: '鍘嗗彶鎺�'}
-            ,{field: 'hisBay', align: 'center',title: '鍘嗗彶鍒�'}
-            ,{field: 'hisLev', align: 'center',title: '鍘嗗彶灞�'}
+            ,{field: 'hisRow', align: 'center',title: '鍘嗗彶鎺�', hide: true}
+            ,{field: 'hisBay', align: 'center',title: '鍘嗗彶鍒�', hide: true}
+            ,{field: 'hisLev', align: 'center',title: '鍘嗗彶灞�', hide: true}
             ,{field: 'idleLoc', align: 'center',title: '鏆傚瓨搴撲綅'}
             ,{field: 'steErr', align: 'center',title: '閿欒鐮�'}
-            ,{field: 'pakMk', align: 'center',title: '鏍囪'}
-            ,{field: 'status$', align: 'center',title: '鐘舵��'}
-            ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳'}
-            ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-            ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
-            ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
-            ,{field: 'memo', align: 'center',title: '澶囨敞'}
+            ,{field: 'chargeLine', align: 'center',title: '鏈�浣庣數閲�%'}
+            ,{field: 'autoCharge', align: 'center',title: '鑷姩鍏呯數', templet: '#autoChargeTpl'}
+            // ,{field: 'status$', align: 'center',title: '鐘舵��'}
+            // ,{field: 'createBy$', align: 'center',title: '娣诲姞浜哄憳'}
+            // ,{field: 'createTime$', align: 'center',title: '娣诲姞鏃堕棿'}
+            // ,{field: 'updateBy$', align: 'center',title: '淇敼浜哄憳'}
+            // ,{field: 'updateTime$', align: 'center',title: '淇敼鏃堕棿'}
+            ,{field: 'memo', align: 'center',title: '澶囨敞', hide: true}
 
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120}
         ]],
@@ -65,6 +68,7 @@
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
+            tableData = table.cache.basSte;
             pageCurr=curr;
             limit();
         }
@@ -83,6 +87,33 @@
             page: {curr: 1}
         });
     });
+
+    form.on('switch(inEnableSwitch)', function (obj) {
+        let index  = obj.othis.parents('tr').attr("data-index");
+        let data = tableData[index];
+        data[this.name] = obj.elem.checked?'Y':'N';
+        http.post(baseUrl+"/basSte/update/auth", {steNo: data.steNo, inEnable: data[this.name]}, function (res) {
+            layer.msg(res.msg, {icon: 1});
+        })
+    })
+
+    form.on('switch(outEnableSwitch)', function (obj) {
+        let index  = obj.othis.parents('tr').attr("data-index");
+        let data = tableData[index];
+        data[this.name] = obj.elem.checked?'Y':'N';
+        http.post(baseUrl+"/basSte/update/auth", {steNo: data.steNo, outEnable: data[this.name]}, function (res) {
+            layer.msg(res.msg, {icon: 1});
+        })
+    })
+
+    form.on('switch(autoChargeSwitch)', function (obj) {
+        let index  = obj.othis.parents('tr').attr("data-index");
+        let data = tableData[index];
+        data[this.name] = obj.elem.checked?'Y':'N';
+        http.post(baseUrl+"/basSte/update/auth", {steNo: data.steNo, autoCharge: data[this.name]}, function (res) {
+            layer.msg(res.msg, {icon: 1});
+        })
+    })
 
     // 鐩戝惉澶村伐鍏锋爮浜嬩欢
     table.on('toolbar(basSte)', function (obj) {
@@ -165,6 +196,12 @@
                 layDateRender(mData);
                 form.val('detail', mData);
                 form.on('submit(editSubmit)', function (data) {
+                    if (!isEmpty(data.field.idleLoc)) {
+                        if (data.field.idleLoc.length !== 7) {
+                            layer.msg("鏆傚瓨搴撳瓨涓嶅悎娉�", {icon: 2});
+                            return false;
+                        }
+                    }
                     var loadIndex = layer.load(2);
                     $.ajax({
                         url: baseUrl+"/basSte/"+(mData?'update':'add')+"/auth",

--
Gitblit v1.9.1