From 29cfba4aa2e41fb15cacb500c3e2d9ae7c652d08 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 21 十一月 2023 08:57:20 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/priQuoteBudget/priQuoteBudget.js |  147 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 141 insertions(+), 6 deletions(-)

diff --git a/src/main/webapp/static/js/priQuoteBudget/priQuoteBudget.js b/src/main/webapp/static/js/priQuoteBudget/priQuoteBudget.js
index 24af213..78dc2df 100644
--- a/src/main/webapp/static/js/priQuoteBudget/priQuoteBudget.js
+++ b/src/main/webapp/static/js/priQuoteBudget/priQuoteBudget.js
@@ -11,6 +11,64 @@
     var layDate = layui.laydate;
     var form = layui.form;
     admin = layui.admin;
+    var tree = layui.tree;
+    var dropdown = layui.dropdown;
+
+    $('#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({
@@ -24,15 +82,18 @@
         cellMinWidth: 150,
         cols: [[
             {type: 'checkbox', fixed: 'left'}
-            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
-            ,{field: 'templateName', align: 'center',title: '妯℃澘鍚�'}
-            ,{field: 'orderNum', align: 'center',title: '浜у搧璐圭敤鏄庣粏鍗曞彿'}
+            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide : true}
+            ,{field: 'templateName', align: 'center',title: '瀹㈡埛鍚嶇О', style: 'color: #1890ff;cursor:pointer', event: 'moreCstmr', width: 350,hide: false}
+            ,{field: 'cstmrId$', align: 'center',title: '瀹㈡埛id',hide: true}
             ,{field: 'inOrderNum', align: 'center',title: '棰勭畻缂栧彿'}
-            ,{field: 'itemId$', align: 'center',title: '椤圭洰鍚�'}
+            ,{field: 'orderNum', align: 'center',title: '浜у搧璐圭敤鏄庣粏鍗曞彿'}
+            ,{field: 'planId$', align: 'center',title: '瑙勫垝鍗曞彿', style: 'color: #1890ff;cursor:pointer', event: 'morePlan'}
+            ,{field: 'itemId', align: 'center',title: '瑙勫垝鍗曞彿', hide: true}
             ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿'}
             ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿'}
             ,{field: 'memberId$', align: 'center',title: '涓氬姟鍛�'}
-            ,{field: 'userId$', align: 'center',title: '鍒涘缓浜哄憳'}
+            ,{field: 'settle$', align: 'center',title: '杩涘害', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
+            // ,{field: 'userId$', align: 'center',title: '鍒涘缓浜哄憳'}
             ,{field: 'updateUserId$', align: 'center',title: '鏇存柊浜哄憳'}
             ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:200}
         ]],
@@ -173,6 +234,53 @@
     table.on('tool(priQuoteBudget)', function(obj){
         var data = obj.data;
         switch (obj.event) {
+            case 'approval':
+                layer.confirm('瀹℃壒閫氳繃锛�', {
+                    skin: 'layui-layer-admin',
+                    shade: .1,
+                    offset: '200px',
+                    title: data.name
+                }, function (i) {
+                    layer.close(i);
+                    approval(data.id);
+                });
+                break;
+            case 'more':
+                top.priQuoteBudgetByMore = data.id;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "priQuoteBudget_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
+            case 'moreCstmr':
+                top.cstmrByMore = data.cstmrId$;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "../cstmr/cstmr_more.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
+            case 'morePlan':
+                top.planByMore = data.itemId;
+                admin.popupRight({
+                    type: 1,
+                    window: "top",
+                    area: "1250px",
+                    url: "../plan/plan_more_other.html",
+                    end: function () {
+                        // $(".layui-laypage-btn")[0].click();
+                    }
+                })
+                break;
             case "quoteBudget":
                 layer.open({
                     type: 2,
@@ -296,6 +404,33 @@
         });
     }
 
+    function approval(priQuoteBudgetId, plannerId, dIdx) {
+        let loadIndex = layer.load(2);
+        $.ajax({
+            url: baseUrl+"/priQuoteBudget/approval/auth",
+            headers: {'token': localStorage.getItem('token')},
+            data: {
+                priQuoteBudgetId: priQuoteBudgetId,
+                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});
+                }
+            }
+        })
+    }
+
 });
 
 // 鍏抽棴鍔ㄤ綔
@@ -384,7 +519,7 @@
         success: function (res) {
             console.log(res)
             if (res.code === 200){
-                $("#itemName").val(res.data.itemId$)
+                $("#planId").val(res.data.planId$)
                 $("#priOrderNum").val(res.data.orderNum)
             } else if (res.code === 403){
                 top.location.href = baseUrl+"/";

--
Gitblit v1.9.1