From a0f4d01559785001e7b16b21025cc6a42e65d167 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期五, 05 十二月 2025 17:36:31 +0800
Subject: [PATCH] 添加ai事件管理页面

---
 fzzy-igdss-web/src/main/resources/static/inout/inout-handle.js |  386 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 386 insertions(+), 0 deletions(-)

diff --git a/fzzy-igdss-web/src/main/resources/static/inout/inout-handle.js b/fzzy-igdss-web/src/main/resources/static/inout/inout-handle.js
new file mode 100644
index 0000000..07f088f
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/inout/inout-handle.js
@@ -0,0 +1,386 @@
+//绉伴噸-鍖呮嫭绌鸿溅鍜屾弧杞︾О閲�
+var layer;
+var form;
+var table;
+var upload;
+var recordData = null;// 涓氬姟鏁版嵁淇℃伅
+var img1, img2, img3;// 椤甸潰涓殑鍥剧墖涓婁紶鍚嶇О
+
+$(function () {
+    layui.use(['layer', 'laydate', 'form','table', 'upload'], function () {
+        upload = layui.upload;
+        layer = layui.layer;
+        form = layui.form;
+        table = layui.table;
+
+        //鐩戝惉閫夋嫨鏁版嵁浜嬩欢
+        table.on('tool(tableListProgressData)', function (obj) {
+            var data = obj.data;
+            if (obj.event === 'select') {
+                //娓呯┖琛ㄥ崟
+                resetForm();
+                flushData(data.id, null);
+                $("#listProgressData").css("display", "none");
+                layer.closeAll();
+            }
+        });
+
+        //涓婁紶
+        upload.render({
+            elem: '#kccz-r-btn1',
+            url: '/basic/file/update-file', //涓婁紶鎺ュ彛
+            size: 4 * 1024, //闄愬埗鏂囦欢澶у皬锛屽崟浣岾B, 鏈�澶т笂浼�4MB
+            accept: 'images',
+            before: function (obj) {
+                var plateNum = $("#plateNum").val();
+                this.data = {"plateNum": plateNum, "type": "1"};//鎼哄甫鍙傛暟
+                //棰勮鏈湴鏂囦欢绀轰緥锛屼笉鏀寔ie8
+                obj.preview(function (index, file, result) {
+                    $('#kccz-r-img1').attr('src', result); //鍥剧墖閾炬帴锛坆ase64锛�
+                });
+            },
+            done: function (res) {
+                //濡傛灉涓婁紶澶辫触
+                if (res.code > 0) {
+                    layer.msg("鍥剧墖涓婁紶澶辫触锛�");
+                }
+                //涓婁紶鎴愬姛
+                img1 = res.msg;
+                layer.msg("鍥剧墖涓婁紶鎴愬姛锛�");
+                //console.log(img1);
+            }
+        });
+        upload.render({
+            elem: '#kccz-r-btn2',
+            url: '/basic/file/update-file', //涓婁紶鎺ュ彛
+            size: 4 * 1024, //闄愬埗鏂囦欢澶у皬锛屽崟浣岾B, 鏈�澶т笂浼�4MB
+            accept: 'images',
+            before: function (obj) {
+                var plateNum = $("#plateNum").val();
+                this.data = {"plateNum": plateNum, "type": "1"};//鎼哄甫鍙傛暟
+                //棰勮鏈湴鏂囦欢绀轰緥锛屼笉鏀寔ie8
+                obj.preview(function (index, file, result) {
+                    $('#kccz-r-img2').attr('src', result); //鍥剧墖閾炬帴锛坆ase64锛�
+                });
+            },
+            done: function (res) {
+                //濡傛灉涓婁紶澶辫触
+                if (res.code > 0) {
+                    layer.msg("鍥剧墖涓婁紶澶辫触锛�");
+                }
+                //涓婁紶鎴愬姛
+                img2 = res.msg;
+                layer.msg("鍥剧墖涓婁紶鎴愬姛锛�");
+                // console.log(img2);
+            }
+        });
+        upload.render({
+            elem: '#kccz-r-btn3',
+            url: '/basic/file/update-file', //涓婁紶鎺ュ彛
+            size: 4 * 1024, //闄愬埗鏂囦欢澶у皬锛屽崟浣岾B, 鏈�澶т笂浼�4MB
+            accept: 'images',
+            before: function (obj) {
+                var plateNum = $("#plateNum").val();
+                this.data = {"plateNum": plateNum}; //鎼哄甫鍙傛暟
+                //棰勮鏈湴鏂囦欢绀轰緥锛屼笉鏀寔ie8
+                obj.preview(function (index, file, result) {
+                    $('#kccz-r-img3').attr('src', result); //鍥剧墖閾炬帴锛坆ase64锛�
+                });
+            },
+            done: function (res) {
+                //濡傛灉涓婁紶澶辫触
+                if (res.code > 0) {
+                    layer.msg("鍥剧墖涓婁紶澶辫触锛�");
+                }
+                //涓婁紶鎴愬姛
+                img3 = res.msg;
+                layer.msg("鍥剧墖涓婁紶鎴愬姛锛�");
+            }
+        });
+
+    });
+
+    //鏄剧ず娴佺▼鐜妭
+    updateEditAndProgress();
+});
+
+/**
+ * 鎵嬪姩閫夋嫨锛岃幏鍙栧緟绉伴噸鐨勬暟鎹紝寮瑰嚭閫夋嫨
+ */
+function selectByHand() {
+    var param = {
+        deptId: deptId,
+        type: type,
+        progress: curProgress,
+        timer: Math.random()
+    };
+    $.ajax({
+        type: "POST",
+        url: "/basic/inout/list-handle-data",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(param),
+        success: function (result) {
+            if (result.code != "0000") {
+                layer.msg(result.msg);
+            } else {
+                renderTableProgressData(result.data);
+            }
+        },
+        error: function () {
+            layer.msg("绯荤粺鑾峰彇鏁版嵁鍑虹幇寮傚父锛岄噸鏂板皾璇�");
+        }
+    });
+}
+
+
+/**
+ * 杞﹁締閫夋嫨寮圭獥
+ * @param list
+ */
+function renderTableProgressData(list) {
+    // 娓呯┖鏁版嵁
+    $("#tableListProgressData").empty();
+    layer.open({
+        type: 1,
+        title: "閫夋嫨鍊间粨涓溅杈�",
+        offset: ['240px', '100px'],
+        area: ['1000px', '560px'],
+        cancel: function (index, layero) {
+            $("#listProgressData").css("display", "none");
+        },
+        shade: 0,
+        scrollbar: 0,
+        content: $('#listProgressData'),
+        closeBtn: 1
+    });
+    table.render({
+        elem: '#tableListProgressData',
+        data: list,
+        page: false,
+        even: true,
+        cols: [[
+            {
+                type: 'numbers',
+                title: '搴忓彿'
+            }, {
+                field: 'id',
+                title: '鍗曟嵁鍙�',
+                align: 'center'
+            }, {
+                field: 'userName',
+                title: '鎵胯繍浜�',
+                align: 'center'
+            }, {
+                field: 'plateNum',
+                title: '杞︾墝鍙�',
+                align: 'center'
+            }, {
+                field: 'progress',
+                title: '娴佺▼杩涘害',
+                align: 'center',
+                style: 'font-weight: bold',
+                templet: function (item) {
+                    return INOUT_PROGRESS_MSG(item.progress);
+                }
+            }, {
+                fixed: 'right',
+                title: '閫夋嫨鎿嶄綔',
+                align: 'center',
+                toolbar: '#barSelectProgress'
+            }
+        ]]
+    });
+    $("thead tr").css({
+        "border-bottom": "2px solid #53adce",
+        "background": "#eff4f6"
+    });
+}
+
+// 琛ㄥ崟娓呯┖
+function resetForm() {
+    $("#form-data")[0].reset();
+    $('#kccz-r-img1').removeAttr('src');
+    $('#kccz-r-img2').removeAttr('src');
+    $('#kccz-r-img3').removeAttr('src');
+    form.render();
+    recordData = null;
+    $("#text-param").val(null);
+}
+
+/**
+ * 椤甸潰鍒锋柊
+ */
+function flushPage() {
+    layer.confirm('纭畾瑕佸埛鏂伴〉闈㈠悧锛�', {icon: 3, title: '鎻愮ず'}, function (index) {
+        resetForm();
+        layer.close(index);
+    });
+}
+
+/**
+ * 鏌ヨ鏁版嵁
+ * @param id
+ * @param plateNum
+ */
+function flushData(id, plateNum) {
+    var index = layer.load();
+    var param = {
+        type: type,
+        progress: curProgress,
+        id: id,
+        plateNum: plateNum
+    };
+    $.ajax({
+        type: "POST",
+        url: "/basic/inout/inout-query",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(param),
+        success: function (result) {
+            layer.close(index);
+            if (result.code != "0000") {
+                notifyProgress(result.msg, result.data);
+            } else {
+                recordData = result.data;
+
+                // 杩斿洖鐨勬暟鎹繘琛岃祴鍊�
+                form.val("form-data", recordData);
+                form.render();
+
+                updateEditAndProgress();
+            }
+        },
+        error: function () {
+            layer.close(index);
+            alertError("鏌ヨ澶辫触锛岃閲嶆柊灏濊瘯");
+        }
+    });
+}
+
+// 褰撳墠瀹屾垚
+function submit() {
+    if (!recordData) {
+        alertError("娌℃湁涓氬姟鏁版嵁淇℃伅锛屾墽琛岃鎷掔粷");
+        return;
+    }
+    var data = form.val("form-data");
+    //鍚堝苟鏁版嵁
+    Object.assign(recordData, data);
+    // 鑾峰彇鐓х墖
+    var files = [{
+        fileName: img1
+    }, {
+        fileName: img2
+    }, {
+        fileName: img3
+    }];
+    recordData.files = files;
+
+    var index = layer.load();
+    $.ajax({
+        type: "POST",
+        url: "/basic/inout/submit-handle",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify(recordData),
+        success: function (result) {
+            layer.close(index);
+            if (result.code != "0000") {
+                notify(result.msg, result.data);
+            } else {
+                notify("鏁版嵁鎻愪氦鎴愬姛", result.data);
+                resetForm();
+            }
+        },
+        error: function () {
+            layer.close(index);
+            alertError("鎻愪氦澶辫触锛岃閲嶆柊灏濊瘯");
+        }
+    });
+}
+
+/**
+ * 鏍规嵁涓氬姟鏁版嵁鏇存柊椤甸潰涓殑鐘舵��
+ */
+function updateEditAndProgress() {
+    //鏄剧ず褰撳墠娴佺▼
+    if (type === "IN") {
+        $("#rk-progress-register").addClass("active");
+        $("#rk-progress-fullWeight").addClass("active");
+        $("#rk-progress-hand").addClass("active");
+        $("#rk-progress-emptyWeight").removeClass("active");
+    }
+    if (type === "OUT") {
+        $("#ck-progress-register").addClass("active");
+        $("#ck-progress-emptyWeight").addClass("active");
+        $("#ck-progress-hand").addClass("active");
+        $("#ck-progress-fullWeight").removeClass("active");
+    }
+    //娴佺▼鏄剧ず
+    if (inoutProgress) {
+        if (inoutProgress.indexOf("REGISTER") === -1) {
+            $("#rk-progress-register").css("display", "none");
+            $("#ck-progress-register").css("display", "none");
+        }
+        if (inoutProgress.indexOf("WEIGHT_FULL") === -1) {
+            $("#rk-progress-fullWeight").css("display", "none");
+            $("#ck-progress-fullWeight").css("display", "none");
+        }
+        if (inoutProgress.indexOf("HANDLE") === -1) {
+            $("#rk-progress-hand").css("display", "none");
+            $("#ck-progress-hand").css("display", "none");
+        }
+        if (inoutProgress.indexOf("WEIGHT_EMPTY") === -1) {
+            $("#rk-progress-emptyWeight").css("display", "none");
+            $("#ck-progress-emptyWeight").css("display", "none");
+        }
+        if (inoutProgress.indexOf("CARD_BACK") === -1) {
+            $("#rk-progress-cardBack").css("display", "none");
+            $("#ck-progress-cardBack").css("display", "none");
+        }
+
+        if (type === "IN") {
+            $("#rk_progress").css("display", "block");
+            $("#ck_progress").css("display", "none");
+        }
+        if (type === "OUT") {
+            $("#ck_progress").css("display", "block");
+            $("#rk_progress").css("display", "none");
+        }
+    }
+}
+
+/**
+ * 寮瑰嚭鎻愰啋妗�
+ * @param msg 鎻愰啋淇℃伅
+ * @param data 鏁版嵁淇℃伅锛屽彲鑳戒负绌�
+ */
+function notify(msg, data) {
+    if (data) {
+        //璧嬪��
+        $("#resultMsg").text(msg);
+        $("#resultUserName").text(data.userName);
+        $("#resultPlateNum").text(data.plateNum);
+        if ("IN" == data.type) {
+            $("#resultType").text("鍏ュ簱-" + INOUT_PROGRESS_MSG(data.progress));
+        } else {
+            $("#resultType").text("鍑哄簱-" + INOUT_PROGRESS_MSG(data.progress));
+        }
+
+        layer.open({
+            type: 1,
+            offset: ['150px', '200px'],
+            area: '450px;',
+            shade: 0.8,
+            id: 'dialog_notify_info',
+            btn: ['纭畾'],
+            content: $('#dialog-from-notify'),
+            yes: function (index) {
+                layer.closeAll();
+            }
+        });
+    } else {
+        layer.alert(msg, {offset: ['300px', '300px']});
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3