From 541b77a7b469854fbf0877081b3e8c378b3478a1 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 31 七月 2023 16:49:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/zycrm' into zycrm

---
 src/main/webapp/static/js/priOnline/priOnline.js |   84 +++++++++++++++++++++++++++++++++++++----
 1 files changed, 75 insertions(+), 9 deletions(-)

diff --git a/src/main/webapp/static/js/priOnline/priOnline.js b/src/main/webapp/static/js/priOnline/priOnline.js
index 9ba71ad..8344899 100644
--- a/src/main/webapp/static/js/priOnline/priOnline.js
+++ b/src/main/webapp/static/js/priOnline/priOnline.js
@@ -1,5 +1,6 @@
 var pageCurr;
 var admin;
+var treeCond;
 layui.config({
     base: baseUrl + "/static/layui/lay/modules/"
 }).extend({
@@ -9,8 +10,66 @@
     var $ = layui.jquery;
     var layer = layui.layer;
     var layDate = layui.laydate;
+    var tree = layui.tree;
     var form = layui.form;
+    var dropdown = layui.dropdown;
     admin = layui.admin;
+
+    $('#organization').html(localStorage.getItem('nickname') + ' <i class="layui-icon">&#xe61a;</i>');
+
+    // 閮ㄩ棬浜哄憳 绛涢��
+    dropdown.render({
+        elem: '#organization'
+        ,content: ['<div id="organizationTree" style="height: calc(100vh - 525px);border: none"></div>'].join('')
+        ,style: 'width: 370px; height: 350px; padding: 0 15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);'
+        ,ready: function(){
+            loadTree();
+        }
+    });
+
+    // 鏍戝舰鍥�
+    var organizationTree;
+    window.loadTree = function(condition){
+        var loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/dept/user/tree/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                'condition': condition
+            },
+            method: 'POST',
+            success: function (res) {
+                layer.close(loadIndex);
+                if (res.code === 200){
+                    organizationTree = tree.render({
+                        elem: '#organizationTree',
+                        id: 'organizationTree',
+                        onlyIconControl: true,
+                        data: res.data,
+                        click: function (obj) {
+                            treeCond = {
+                                key: obj.data.key,
+                                val: obj.data.id
+                            }
+                            $('#organization').html(obj.data.title + ' <i class="layui-icon">&#xe61a;</i>');
+                            $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
+                            $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
+                            clearFormVal($('#search-box'));
+                            tableIns.reload({
+                                where: {[obj.data.key]: obj.data.id},
+                                page: {curr: 1}
+                            });
+                        }
+                    });
+                    treeData = res.data;
+                } else if (res.code === 403){
+                    top.location.href = baseUrl+"/";
+                } else {
+                    layer.msg(res.msg)
+                }
+            }
+        })
+    }
 
     // 鏁版嵁娓叉煋
     tableIns = table.render({
@@ -215,7 +274,7 @@
             case "upload":
                 $.ajax({
                     type:"get",
-                    url: "/priOnline/viewCheck/" + data.id + "/auth",
+                    url: baseUrl+"/priOnline/viewCheck/" + data.id + "/auth",
                     dataType:"json",
                     headers: {'token': localStorage.getItem('token')},
                     success:function(res) {
@@ -248,16 +307,23 @@
                             return;
                         }
 
+                        let formData = new FormData($("#uploadFile")[0]);
+                        formData.append("id", data.id);
+                        formData.append("checkData", zip(exportJson.sheets));
                         $.ajax({
-                            url: "/priOnline/uploadCheck/auth",
+                            url: baseUrl+"/priOnline/uploadCheck/auth",
                             headers: {'token': localStorage.getItem('token')},
-                            data: JSON.stringify({
-                                id: data.id,
-                                checkData: zip(exportJson.sheets)
-                            }),
+                            data: formData,
+                            // data: JSON.stringify({
+                            //     id: data.id,
+                            //     checkData: zip(exportJson.sheets)
+                            // }),
+                            // dataType: "json",
                             method: 'POST',
-                            dataType: "json",
-                            contentType:'application/json;charset=UTF-8',
+                            cache: false,
+                            processData: false,
+                            contentType: false,
+                            // contentType:'application/json;charset=UTF-8',
                             success: function (res) {
                                 if (res.code == 200) {
                                     layer.msg('涓婁紶鎴愬姛',{time:1000},() => {
@@ -277,7 +343,7 @@
                 //鏌ョ湅璇环
                 $.ajax({
                     type:"get",
-                    url: "/priOnline/viewCheck/" + data.id + "/auth",
+                    url: baseUrl+"/priOnline/viewCheck/" + data.id + "/auth",
                     dataType:"json",
                     headers: {'token': localStorage.getItem('token')},
                     success:function(res) {

--
Gitblit v1.9.1