From 7166110979799e03630cfeeef79aa4e9c1e774ed Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 31 八月 2023 10:46:05 +0800
Subject: [PATCH] #上传下载优化

---
 src/main/webapp/static/js/reimburseOnline/reimburseOnline.js |  182 +++++++++++++++++---------------------------
 1 files changed, 71 insertions(+), 111 deletions(-)

diff --git a/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js b/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
index 41ebe1e..88ea097 100644
--- a/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
+++ b/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
@@ -4,6 +4,7 @@
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).extend({
+    steps: 'steps/steps',
     cascader: 'cascader/cascader',
 }).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown'], function(){
     var table = layui.table;
@@ -86,8 +87,9 @@
             {field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide: true}
             ,{field: 'templateName', align: 'center',title: '鎶ラ攢绫诲瀷',hide: false}
             ,{field: 'checkData', align: 'center',title: '鏄惁鍐茶处',hide: false}
-            ,{field: 'orderNum', align: 'center',title: '鎶ラ攢鍗曞彿',width: 320, hide:false}
-            ,{field: 'itemId', align: 'center',title: '椤圭洰鍙�',hide: false}
+            ,{field: 'orderNum', align: 'center',title: '鎶ラ攢鍗曞彿',width: 320, style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
+            ,{field: 'planId$', align: 'center',title: '椤圭洰鍙�',hide: false}
+            ,{field: 'settle', align: 'center',title: '杩涘害',hide: false}
             ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: false}
             ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿',hide: false}
             ,{field: 'status$', align: 'center',title: '鐘舵��',hide: false}
@@ -235,20 +237,45 @@
     table.on('tool(reimburseOnline)', function(obj){
         var data = obj.data;
         switch (obj.event) {
-            // 鏍镐环
-            case 'check':
-                layer.open({
-                    type: 2,
-                    title: '鏍镐环',
-                    maxmin: true,
-                    area: [top.detailWidth, top.detailHeight],
-                    shadeClose: false,
-                    content: 'reimburseOnline_detail.html?id=' + data.id,
-                    success: function(layero, index){
-                        // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                    }
+            case 'approval2':
+                layer.confirm('瀹℃壒閫氳繃锛�', {
+                    skin: 'layui-layer-admin',
+                    shade: .1,
+                    offset: '200px',
+                    title: data.name
+                }, function (i) {
+                    layer.close(i);
+                    approval2(data.id);
                 });
                 break;
+            case 'more':
+                top.reimburseOnlineByMore=data.id;
+                console.log(top.reimburseOnlineByMore)
+
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "reimburseOnline_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
+            // // 鏍镐环
+            // case 'check':
+            //     layer.open({
+            //         type: 2,
+            //         title: '鏍镐环',
+            //         maxmin: true,
+            //         area: [top.detailWidth, top.detailHeight],
+            //         shadeClose: false,
+            //         content: 'reimburseOnline_detail.html?id=' + data.id,
+            //         success: function(layero, index){
+            //             // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
+            //         }
+            //     });
+            //     break;
             case 'del':
                 layer.confirm('纭畾鍒犻櫎杩欐潯鏁版嵁鍚�', function(){
                     $.ajax({
@@ -273,110 +300,16 @@
             case "edit":
                 showEditForm(data);
                 break;
-            case "upload":
-                $.ajax({
-                    type:"get",
-                    url: baseUrl+"/reimburseOnline/viewCheck/" + data.id + "/auth",
-                    dataType:"json",
-                    headers: {'token': localStorage.getItem('token')},
-                    success:function(res) {
-                        if (res.code == 200) {
-                            layer.confirm('褰撳墠宸插瓨鍦ㄦ暟鎹紝缁х画涓婁紶灏嗕細瑕嗙洊鏃ф暟鎹紝鏄惁涓婁紶锛�', function(){
-                                $("#uploadQuote").click()
-                            });
-                        }else{
-                            $("#uploadQuote").click()
-                        }
-                    }
-                });
-
-                $("#uploadQuote").on("change",(evt) => {
-                    var files = evt.target.files;
-                    if(files==null || files.length==0){
-                        alert("No files wait for import");
-                        return;
-                    }
-
-                    let name = files[0].name;
-                    let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
-                    if(suffix!="xlsx"){
-                        alert("Currently only supports the import of xlsx files");
-                        return;
-                    }
-                    LuckyExcel.transformExcelToLucky(files[0], function(exportJson, luckysheetfile){
-                        if(exportJson.sheets==null || exportJson.sheets.length==0){
-                            alert("Failed to read the content of the excel file, currently does not support xls files!");
-                            return;
-                        }
-
-                        let formData = new FormData($("#uploadFile")[0]);
-                        formData.append("id", data.id);
-                        formData.append("checkData", zip(exportJson.sheets));
-                        $.ajax({
-                            url: baseUrl+"/reimburseOnline/uploadCheck/auth",
-                            headers: {'token': localStorage.getItem('token')},
-                            data: formData,
-                            // data: JSON.stringify({
-                            //     id: data.id,
-                            //     checkData: zip(exportJson.sheets)
-                            // }),
-                            // dataType: "json",
-                            method: 'POST',
-                            cache: false,
-                            processData: false,
-                            contentType: false,
-                            // contentType:'application/json;charset=UTF-8',
-                            success: function (res) {
-                                if (res.code == 200) {
-                                    layer.msg('涓婁紶鎴愬姛',{time:1000},() => {
-                                        parent.location.reload()
-                                    })
-                                }else{
-                                    layer.msg(res.msg,{time:1000},() => {
-                                        parent.location.reload()
-                                    })
-                                }
-                            }
-                        })
-                    });
-                })
-                break;
-            case "viewCheck":
-                //鏌ョ湅璇环
-                $.ajax({
-                    type:"get",
-                    url: baseUrl+"/reimburseOnline/viewCheck/" + data.id + "/auth",
-                    dataType:"json",
-                    headers: {'token': localStorage.getItem('token')},
-                    success:function(res) {
-                        if (res.code == 200) {
-                            layer.open({
-                                type: 2,
-                                title: '鏌ョ湅璇环',
-                                maxmin: true,
-                                area: [top.detailWidth, top.detailHeight],
-                                shadeClose: false,
-                                content: 'reimburseOnline_check.html?id=' + data.id,
-                                success: function(layero, index){
-                                    // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
-                                }
-                            });
-                        }else{
-                            layer.msg(res.msg,{time:1000})
-                        }
-                    }
-                });
-                break;
             case "look":
                 var $a = $(obj.tr).find('a[lay-event="look"]');
                 var offset = $a.offset();
-                var top = offset.top;
+                var top2 = offset.top;
                 var left = offset.left;
                 layer.open({
                     type: 1,
                     title: false,
                     area: '2100px',
-                    offset: [top + 'px', (left - 1730 + $a.outerWidth()) + 'px'],
+                    offset: [top2 + 'px', (left - 1730 + $a.outerWidth()) + 'px'],
                     shade: .01,
                     shadeClose: true,
                     fixed: false,
@@ -697,6 +630,33 @@
         });
     }
 
+    function approval2(planId, plannerId, dIdx) {
+        let loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/reimburseOnline/approval2/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                planId: planId,
+                plannerId: plannerId
+            },
+            method: 'POST',
+            success: function (res) {
+                if (dIdx) {
+                    layer.close(dIdx);
+                }
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    layer.msg(res.msg, {icon: 1});
+                    tableReload();
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg, {icon: 2});
+                }
+            }
+        })
+    }
+
     /* 寮圭獥 - 鏂板銆佷慨鏀� */
     // function showEditModel(mData) {
     //     admin.open({
@@ -730,7 +690,7 @@
     //     });
     // }
 
-    //鏇存柊form
+    // 鏇存柊form
     function showEditForm(mData) {
         admin.open({
             type: 1,

--
Gitblit v1.9.1