From 8e943b7104561c3b14cf223016698709c5ade4b5 Mon Sep 17 00:00:00 2001
From: lty <876263681@qq.com>
Date: 星期二, 03 二月 2026 15:37:26 +0800
Subject: [PATCH] #pda料箱组托和换码

---
 src/main/webapp/static/js/basLocSts/basLocSts.js |  249 +++++++++++++++++--------------------------------
 1 files changed, 85 insertions(+), 164 deletions(-)

diff --git a/src/main/webapp/static/js/basLocSts/basLocSts.js b/src/main/webapp/static/js/basLocSts/basLocSts.js
index 47ac4ca..1ef68bc 100644
--- a/src/main/webapp/static/js/basLocSts/basLocSts.js
+++ b/src/main/webapp/static/js/basLocSts/basLocSts.js
@@ -6,6 +6,44 @@
     var layDate = layui.laydate;
     var form = layui.form;
 
+    var doneCallback = function(res, curr, count) {
+        if (res.code === 403) {
+            top.location.href = baseUrl+"/";
+        }
+        pageCurr=curr;
+        limit();
+        if (typeof I18n !== 'undefined') {
+            I18n.updatePage();
+            I18n.updateLayuiPagination();
+        }
+    };
+
+    function getCol() {
+        return [[
+            {type: 'checkbox', fixed: 'left'}
+//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
+            ,{field: 'locSts', align: 'center',sort:true,title: I18n.t('loc_status_code')}
+            ,{field: 'locDesc', align: 'center',sort: true,title: I18n.t('loc_status_desc'), templet: function(d) {
+                var key = 'loc_status_' + d.locSts;
+                var text = I18n.t(key);
+                return text === key ? d.locDesc : text;
+            }}
+            ,{field: 'modiUser$', align: 'center',title: I18n.t('modifier')}
+            ,{field: 'modiTime$', align: 'center',title: I18n.t('modify_time')}
+            // ,{field: 'appeUser$', align: 'center',title: '鍒涘缓鑰�',event: 'appeUser', style: 'text-decoration: underline;cursor:pointer'}
+            // ,{field: 'appeTime$', align: 'center',title: '娣诲姞鏃堕棿'}
+
+            ,{fixed: 'right', title: I18n.t('operation'), align: 'center', toolbar: '#operate', width:150}
+        ]];
+    }
+
+    $(document).on('i18n:languageChanged', function() {
+        tableIns.reload({
+            cols: getCol(),
+            done: doneCallback
+        });
+    });
+
     // 鏁版嵁娓叉煋
     tableIns = table.render({
         elem: '#basLocSts',
@@ -17,18 +55,7 @@
         even: true,
         toolbar: '#toolbar',
         cellMinWidth: 50,
-        cols: [[
-            {type: 'checkbox', fixed: 'left'}
-//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
-            ,{field: 'locSts', align: 'center',sort:true,title: '搴撲綅鐘舵�佷唬鍙�'}
-            ,{field: 'locDesc', align: 'center',sort: true,title: '搴撲綅鐘舵�佹弿杩�'}
-            ,{field: 'modiUser$', align: 'center',title: '淇敼浜哄憳'}
-            ,{field: 'modiTime$', align: 'center',title: '淇敼鏃堕棿'}
-            // ,{field: 'appeUser$', align: 'center',title: '鍒涘缓鑰�',event: 'appeUser', style: 'text-decoration: underline;cursor:pointer'}
-            // ,{field: 'appeTime$', align: 'center',title: '娣诲姞鏃堕棿'}
-
-            ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:150}
-        ]],
+        cols: getCol(),
         request: {
             pageName: 'curr',
             pageSize: 'limit'
@@ -44,13 +71,7 @@
         response: {
             statusCode: 200
         },
-        done: function(res, curr, count) {
-            if (res.code === 403) {
-                top.location.href = baseUrl+"/";
-            }
-            pageCurr=curr;
-            limit();
-        }
+        done: doneCallback
     });
 
     // 鐩戝惉鎺掑簭浜嬩欢
@@ -66,13 +87,8 @@
             page: {
                 curr: 1
             },
-            done: function (res, curr, count) {
-                if (res.code === 403) {
-                    top.location.href = baseUrl+"/";
-                }
-                pageCurr=curr;
-                limit();
-            }
+            cols: getCol(),
+            done: doneCallback
         });
     });
 
@@ -83,7 +99,7 @@
             case 'addData':
                 layer.open({
                     type: 2,
-                    title: '鏂板',
+                    title: I18n.t('add'),
                     maxmin: true,
                     area: ['500px', top.detailHeight],
                     shadeClose: false,
@@ -99,16 +115,18 @@
                 tableIns.reload({
                     page: {
                         curr: pageCurr
-                    }
+                    },
+                    cols: getCol(),
+                    done: doneCallback
                 });
                 limit();
                 break;
             case 'deleteData':
                 var data = checkStatus.data;
                 if (data.length === 0){
-                    layer.msg('璇烽�夋嫨鏁版嵁');
+                    layer.msg(I18n.t('select_data_alert') || '璇烽�夋嫨鏁版嵁');
                 } else {
-                    layer.confirm('纭畾鍒犻櫎'+(data.length===1?'姝�':data.length)+'鏉℃暟鎹悧', function(){
+                    layer.confirm(I18n.t('confirm_delete_alert') || '纭畾鍒犻櫎閫変腑鐨勬暟鎹悧', function(){
                         $.ajax({
                             url: baseUrl+"/basLocSts/delete/auth",
                             headers: {'token': localStorage.getItem('token')},
@@ -118,11 +136,11 @@
                             success: function (res) {
                                 if (res.code === 200){
                                     layer.closeAll();
-                                    tableReload(false);
+                                    tableIns.reload({cols: getCol(), done: doneCallback});
                                 } else if (res.code === 403){
                                     top.location.href = baseUrl+"/";
                                 } else {
-                                    layer.msg(res.msg)
+                                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                 }
                             }
                         })
@@ -130,7 +148,7 @@
                 }
                 break;
             case 'exportData':
-                layer.confirm('纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
+                layer.confirm(I18n.t('confirm_export') || '纭畾瀵煎嚭Excel鍚�', {shadeClose: true}, function(){
                     var titles=[];
                     var fields=[];
                     obj.config.cols[0].map(function (col) {
@@ -161,7 +179,7 @@
                             } else if (res.code === 403) {
                                 top.location.href = baseUrl+"/";
                             } else {
-                                layer.msg(res.msg)
+                                layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                             }
                         }
                     });
@@ -178,7 +196,7 @@
             case 'detail':
                 layer.open({
                     type: 2,
-                    title: '璇︽儏',
+                    title: I18n.t('detail'),
                     maxmin: true,
                     area: [top.detailWidth, top.detailHeight],
                     shadeClose: false,
@@ -197,7 +215,7 @@
             case 'edit':
                 layer.open({
                     type: 2,
-                    title: '淇敼',
+                    title: I18n.t('modify'),
                     maxmin: true,
                     area: ['500px', top.detailHeight],
                     shadeClose: false,
@@ -219,7 +237,7 @@
                 } else {
                    layer.open({
                        type: 2,
-                       title: '淇敼璇︽儏',
+                       title: I18n.t('modify_detail'),
                        maxmin: true,
                        area: [top.detailWidth, top.detailHeight],
                        shadeClose: false,
@@ -240,7 +258,7 @@
                                    } else if (res.code === 403){
                                        parent.location.href = "/";
                                    }else {
-                                       layer.msg(res.msg)
+                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                    }
                                }
                            })
@@ -255,7 +273,7 @@
                 } else {
                    layer.open({
                        type: 2,
-                       title: '鍒涜鎯�',
+                       title: I18n.t('create_detail'),
                        maxmin: true,
                        area: [top.detailWidth, top.detailHeight],
                        shadeClose: false,
@@ -275,7 +293,7 @@
                                    } else if (res.code === 403){
                                        parent.location.href = "/";
                                    }else {
-                                       layer.msg(res.msg)
+                                       layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                                    }
                                }
                            })
@@ -298,143 +316,46 @@
 
     // 鏁版嵁淇敼鍔ㄤ綔
     form.on('submit(edit)', function () {
-        method("update")
+        if (banMsg != null){
+            layer.msg(banMsg);
+            return;
+        }
+        method("edit");
     });
 
-    function method(name){
-        var index = layer.load(1, {
-            shade: [0.5,'#000'] //0.1閫忔槑搴︾殑鑳屾櫙
+    function method(key) {
+        var data = {};
+        $.each($('#detail [name]').serializeArray(), function() {
+            data[this.name] = this.value;
         });
-        var data = {
-//            id: $('#id').val(),
-            locSts: $('#locSts').val(),
-            locDesc: $('#locDesc').val(),
-            modiUser: $('#modiUser').val(),
-            modiTime: top.strToDate($('#modiTime\\$').val()),
-            appeUser: $('#appeUser').val(),
-            appeTime: top.strToDate($('#appeTime\\$').val()),
+        $.each($('#detail .layui-input').serializeArray(), function() {
+            data[this.name] = this.value;
+        });
 
-        };
+        var url = "";
+        if (key === "add") url = baseUrl+"/basLocSts/add/auth";
+        else if (key === "edit") url = baseUrl+"/basLocSts/update/auth";
+
         $.ajax({
-            url: baseUrl+"/basLocSts/"+name+"/auth",
+            url: url,
             headers: {'token': localStorage.getItem('token')},
-            data: top.reObject(data),
+            data: JSON.stringify(data),
+            contentType: "application/json;charset=UTF-8",
             method: 'POST',
             success: function (res) {
                 if (res.code === 200){
-                    parent.layer.closeAll();
-                    tableReload(true);
-                    $("#data-detail :input").each(function () {
-                        $(this).val("");
-                    });
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2});
+                    setTimeout(function () {
+                        var index = parent.layer.getFrameIndex(window.name);
+                        parent.layer.close(index);
+                        parent.tableIns.reload({cols: parent.getCol(), done: parent.doneCallback});
+                    }, 1000)
                 } else if (res.code === 403){
                     top.location.href = baseUrl+"/";
-                }else {
-                    layer.msg(res.msg)
+                } else {
+                    layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
                 }
-                layer.close(index);
             }
         })
-    }
-
-    // 鎼滅储鏍忔悳绱簨浠�
-    form.on('submit(search)', function (data) {
-        pageCurr = 1;
-        tableReload(false);
-    });
-
-    // 鎼滅储鏍忛噸缃簨浠�
-    form.on('submit(reset)', function (data) {
-        pageCurr = 1;
-        clearFormVal($('#search-box'));
-        tableReload(false);
-    });
-
-    // 鏃堕棿閫夋嫨鍣�
-    layDate.render({
-        elem: '#modiTime\\$',
-        type: 'datetime'
-    });
-    layDate.render({
-        elem: '#appeTime\\$',
-        type: 'datetime'
-    });
-
-
-});
-
-// 鍏抽棴鍔ㄤ綔
-$(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;
-    });
-    (child ? parent.tableIns : tableIns).reload({
-        where: searchData,
-        page: {
-            curr: pageCurr
-        },
-        done: function (res, curr, count) {
-            if (res.code === 403) {
-                top.location.href = baseUrl+"/";
-            }
-            pageCurr=curr;
-            if (res.data.length === 0 && count !== 0) {
-                tableIns.reload({
-                    where: searchData,
-                    page: {
-                        curr: pageCurr-1
-                    }
-                });
-                pageCurr -= 1;
-            }
-            limit(child);
-        }
-    });
-}
-
-function setFormVal(el, data, showImg) {
-    for (var val in data) {
-        var find = el.find(":input[id='" + val + "']");
-        find.val(data[val]);
-        if (showImg){
-            var next = find.next();
-            if (next.get(0)){
-                if (next.get(0).localName === "img") {
-                    find.hide();
-                    next.attr("src", data[val]);
-                    next.show();
-                }
-            }
-        }
-    }
-}
-
-function clearFormVal(el) {
-    $(':input', el)
-        .val('')
-        .removeAttr('checked')
-        .removeAttr('selected');
-}
-
-function detailScreen(index) {
-    var detail = layer.getChildFrame('#data-detail', index);
-    var height = detail.height()+60;
-    if (height > ($(window).height()*0.9)) {
-        height = ($(window).height()*0.9);
-    }
-    layer.style(index, {
-//        top: (($(window).height()-height)/3)+"px",
-        height: height+'px'
-    });
-}
-
-$('body').keydown(function () {
-    if (event.keyCode === 13) {
-        $("#search").click();
     }
 });

--
Gitblit v1.9.1