From 4a93670e28238f0e5f19b1f0a5f20080cea55414 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期一, 28 八月 2023 16:32:25 +0800 Subject: [PATCH] #出差审批完善 --- src/main/webapp/static/js/businessTrip/businessTrip.js | 124 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 116 insertions(+), 8 deletions(-) diff --git a/src/main/webapp/static/js/businessTrip/businessTrip.js b/src/main/webapp/static/js/businessTrip/businessTrip.js index 18dabfd..ac361ca 100644 --- a/src/main/webapp/static/js/businessTrip/businessTrip.js +++ b/src/main/webapp/static/js/businessTrip/businessTrip.js @@ -3,7 +3,7 @@ base: baseUrl + "/static/layui/lay/modules/" }).extend({ cascader: 'cascader/cascader', -}).use(['table','laydate', 'form', 'admin', 'cascader'], function(){ +}).use(['table','laydate', 'form', 'admin', 'cascader', 'tree', 'dropdown'], function(){ var table = layui.table; var $ = layui.jquery; var layer = layui.layer; @@ -11,6 +11,64 @@ var form = layui.form; var admin = layui.admin; var cascader = layui.cascader; + var tree = layui.tree; + var dropdown = layui.dropdown; + + $('#organization').html(localStorage.getItem('nickname') + ' <i class="layui-icon"></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"></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({ @@ -35,9 +93,9 @@ ,{field: 'businessEndAddr$', align: 'center',title: '鐩殑鍦�',hide: false} ,{field: 'businessStartTimeDay$', align: 'center',title: '鍑哄彂鏃ユ湡',hide: false,width: 165} ,{field: 'businessEndTimeDay$', align: 'center',title: '缁撴潫鏃ユ湡',hide: false,width: 165} - ,{field: 'businessDuration', align: 'center',title: '鍑哄樊鏃堕暱',hide: false} - ,{field: 'businessTripDays', align: 'center',title: '鍑哄樊澶╂暟',hide: false} - ,{field: 'businessPeers', align: 'center',title: '鍑鸿浜�',hide: false} + ,{field: 'businessDuration$', align: 'center',title: '鍑哄樊鏃堕暱',hide: false} + ,{field: 'businessTripDays$', align: 'center',title: '鍑哄樊澶╂暟',hide: false} + ,{field: 'businessPeers', align: 'center',title: '鍚岃浜�',hide: false} ,{field: 'businessPeersId', align: 'center',title: '鍚岃浜篒D',hide: true} ,{field: 'carNumber', align: 'center',title: '鑷┚绉佸杞﹁溅鐗屽彿',hide: false} ,{field: 'kilometers', align: 'center',title: '鑷┚绉佸杞﹁绋嬫槑缁嗗強鍏噷鏁�',hide: false} @@ -47,12 +105,12 @@ ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: false,width: 125} ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿',hide: false,width: 125} ,{field: 'updateId$', align: 'center',title: '鏇存柊浜哄憳',hide: false} - ,{field: 'settle$', align: 'center',title: '杩涘害',hide: false} + ,{field: 'settle$', align: 'center',title: '杩涘害', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false} ,{field: 'status$', align: 'center',title: '鐘舵��',hide: false} ,{field: 'businessTripType', align: 'center',title: '绫诲瀷',hide: true} ,{field: 'businessNotes', align: 'center',title: '鍑哄樊澶囨敞',hide: false} - ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:120} + ,{fixed: 'right', title:'鎿嶄綔', align: 'center', toolbar: '#operate', width:180} ]], request: { pageName: 'curr', @@ -153,6 +211,29 @@ table.on('tool(businessTrip)', 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.businessTripByMore = data.id; + admin.popupRight({ + type: 1, + window: "top", + area: "1250px", + url: "businessTrip_more.html", + end: function () { + // $(".layui-laypage-btn")[0].click(); + } + }) + break; case 'edit': showEditModel(data); break; @@ -166,8 +247,8 @@ function showEditModel(mData) { admin.open({ type: 1, - area: ["95%", "90%"], - title: (mData ? '淇敼' : '娣诲姞') + '璁㈠崟鐘舵��', + area: ["95%", "75%"], + title: (mData ? '淇敼' : '娣诲姞') + '鍑哄樊鐢宠', content: $('#editDialog').html(), success: function (layero, dIndex) { if (mData) { @@ -303,6 +384,33 @@ }); } + function approval(planId, plannerId, dIdx) { + let loadIndex = layer.load(2); + $.ajax({ + url: baseUrl+"/businessTrip/approval/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}); + } + } + }) + } + }); // 鍏抽棴鍔ㄤ綔 -- Gitblit v1.9.1