From 371462edc6b3ee1de97c235d4a019b544badda0d Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期六, 14 二月 2026 22:09:37 +0800
Subject: [PATCH] AGV工作档界面和逻辑调整

---
 src/main/webapp/static/js/taskLog/taskLog.js |  108 +++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 91 insertions(+), 17 deletions(-)

diff --git a/src/main/webapp/static/js/taskLog/taskLog.js b/src/main/webapp/static/js/taskLog/taskLog.js
index 231f2bb..4163ad4 100644
--- a/src/main/webapp/static/js/taskLog/taskLog.js
+++ b/src/main/webapp/static/js/taskLog/taskLog.js
@@ -1,6 +1,7 @@
 var pageCurr;
 var wrkNo;
 var ioTime;
+var tableIns;
 layui.use(['table', 'laydate', 'form'], function () {
     var table = layui.table;
     var $ = layui.jquery;
@@ -8,22 +9,75 @@
     var layDate = layui.laydate;
     var form = layui.form;
 
-    // 鏁版嵁娓叉煋
-    tableIns = table.render({
-        elem: '#taskLog',
-        headers: { token: localStorage.getItem('token') },
-        url: baseUrl + '/taskLog/list/auth',
-        page: true,
-        limit: 16,
-        limits: [16, 30, 50, 100, 200, 500],
+    // AGV宸ヤ綔妗f棩蹇楋細宸ヤ綔鐘舵�佸閫夛紙涓嶢GV浠诲姟绠$悊涓�鑷达級锛岄粯璁� 7銆�8銆�9
+    function updateTaskLogWrkStsFromCheckbox() {
+        var ids = [], texts = [];
+        $('#taskLogWrkStsCheckboxWrap input:checkbox:checked').each(function () {
+            var $input = $(this);
+            ids.push($input.val());
+            var text = $input.data('text') || $input.closest('label').clone().children().remove().end().text().trim() || $input.val();
+            texts.push(text);
+        });
+        $('#taskLogWrkSts').val(ids.join(','));
+        $('#taskLogWrkStsDisp').val(texts.join(', '));
+    }
+    $(document).on('change', '#taskLogWrkStsCheckboxWrap input:checkbox', updateTaskLogWrkStsFromCheckbox);
+
+    function initTaskLogWrkStsThenTable() {
+        $.ajax({
+            url: baseUrl + '/basWrkStatusQueryAgv/auth',
+            headers: { token: localStorage.getItem('token') },
+            data: { condition: '' },
+            method: 'POST',
+            traditional: true,
+            success: function (res) {
+                var $wrap = $('#taskLogWrkStsCheckboxWrap');
+                $wrap.empty();
+                var defaultIds = { '7': true, '8': true, '9': true };
+                if (res.code === 200 && res.data && res.data.length) {
+                    res.data.forEach(function (item) {
+                        var id = String(item.id);
+                        var text = item.value || id;
+                        var checked = defaultIds[id] ? ' checked' : '';
+                        $wrap.append(
+                            '<label class="taskLog-wrksts-cb-label" style="display: inline-block; margin: 4px 12px 4px 0; cursor: pointer;"><input type="checkbox" value="' + id + '" data-text="' + (text.replace(/"/g, '&quot;')) + '"' + checked + '> ' + text + '</label>'
+                        );
+                    });
+                    updateTaskLogWrkStsFromCheckbox();
+                }
+                $('#taskLogWrkStsDisp').off('click').on('click', function () {
+                    $('#taskLogWrkStsWindow').toggle();
+                });
+                var initialWhere = {};
+                $.each($('#search-box [name]').serializeArray(), function () {
+                    initialWhere[this.name] = this.value;
+                });
+                renderTaskLogTable(initialWhere);
+            },
+            error: function () {
+                renderTaskLogTable({});
+            }
+        });
+    }
+
+    function renderTaskLogTable(initialWhere) {
+        tableIns = table.render({
+            elem: '#taskLog',
+            headers: { token: localStorage.getItem('token') },
+            url: baseUrl + '/taskLog/list/auth',
+            where: initialWhere || {},
+            page: true,
+            limit: 15,
+        limits: [15, 30, 50, 100, 200, 500],
         even: true,
         toolbar: '#toolbar',
         cellMinWidth: 50,
+        height: 'full-120',
         cols: [[
-            // {field: 'id', align: 'center', title: 'id'}
             { field: 'wrkNo', align: 'center', title: '宸ヤ綔鍙�', sort: true, width: 105 }
-            , { field: 'ioTime$', align: 'center', title: '宸ヤ綔鏃堕棿', }
-            , { field: 'wrkSts$', align: 'center', title: '宸ヤ綔鐘舵��', }
+            , { field: 'agvWrkNo', align: 'center', title: 'AGV宸ヤ綔鍙�', width: 180 }
+            , { field: 'ioTime$', align: 'center', title: '宸ヤ綔鏃堕棿', width: 160 }
+            , { field: 'wrkSts$', align: 'center', title: '宸ヤ綔鐘舵��', width: 150 }
             , { field: 'ioType$', align: 'center', title: '鍏ュ嚭搴撶被鍨�', width: 150 }
             , { field: 'ioPri', align: 'center', title: '浼樺厛绾�', width: 80 }
             , { field: 'taskType$', align: 'center', title: '浠诲姟绫诲瀷', width: 120 }
@@ -33,22 +87,34 @@
             , { field: 'staNo$', align: 'center', title: '鐩爣绔�', width: 120 }
             , { field: 'locNo', align: 'center', title: '鐩爣搴撲綅', width: 120 }
             , { field: 'barcode', align: 'center', title: '鏉$爜', width: 110 }
+            , { field: 'errorMemo', align: 'center', title: 'AGV鍥炲鎶ユ枃', width: 200, hide: true }
+            , { field: 'errorMemo2', align: 'center', title: 'AGV鍥炲鎶ユ枃2', width: 200, hide: true }
+            , { field: 'errorTime$', align: 'center', title: '閿欒鏃堕棿', width: 160, hide: true }
             , { field: 'preHave', align: 'center', title: '鍏堝叆鍝�', hide: true }
             , { field: 'takeNone', align: 'center', title: '绌烘搷浣�', hide: true }
             , { field: 'modiUser$', align: 'center', title: '淇敼浜哄憳', hide: true }
             , { field: 'modiTime$', align: 'center', title: '淇敼鏃堕棿', hide: true, width: 160 }
-            , { fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 200 }
+            , { fixed: 'right', title: '鎿嶄綔', align: 'center', toolbar: '#operate', width: 250 }
         ]],
         request: {
             pageName: 'curr',
             pageSize: 'limit'
         },
         parseData: function (res) {
+            // 瀹夊叏妫�鏌ワ紝闃叉res.data涓簎ndefined
+            if (!res || !res.data) {
+                return {
+                    'code': res ? res.code : 500,
+                    'msg': res ? res.msg : '鏁版嵁鏍煎紡閿欒',
+                    'count': 0,
+                    'data': []
+                };
+            }
             return {
                 'code': res.code,
                 'msg': res.msg,
-                'count': res.data.total,
-                'data': res.data.records
+                'count': res.data.total || 0,
+                'data': res.data.records || []
             }
         },
         response: {
@@ -69,7 +135,10 @@
                 }
             });
         }
-    });
+        });
+    }
+
+    initTaskLogWrkStsThenTable();
 
     // 鐩戝惉鎺掑簭浜嬩欢
     table.on('sort(taskLog)', function (obj) {
@@ -241,6 +310,9 @@
     form.on('submit(reset)', function (data) {
         pageCurr = 1;
         clearFormVal($('#search-box'));
+        $('#taskLogWrkStsCheckboxWrap input:checkbox').prop('checked', false);
+        $('#taskLogWrkSts').val('');
+        $('#taskLogWrkStsDisp').val('');
         tableReload(false);
     });
 
@@ -307,11 +379,13 @@
 });
 
 function tableReload(child) {
+    var ins = child ? parent.tableIns : tableIns;
+    if (!ins) return;
     var searchData = {};
     $.each($('#search-box [name]').serializeArray(), function () {
         searchData[this.name] = this.value;
     });
-    (child ? parent.tableIns : tableIns).reload({
+    ins.reload({
         where: searchData,
         page: {
             curr: pageCurr
@@ -322,7 +396,7 @@
             }
             pageCurr = curr;
             if (res.data.length === 0 && count !== 0) {
-                tableIns.reload({
+                ins.reload({
                     where: searchData,
                     page: {
                         curr: pageCurr - 1

--
Gitblit v1.9.1