From e89a0bdd6041774d77408744993ba3b98a1e1c97 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期二, 22 八月 2023 14:32:02 +0800 Subject: [PATCH] #报销完善 --- src/main/webapp/static/js/priOnline/priOnline.js | 94 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 80 insertions(+), 14 deletions(-) diff --git a/src/main/webapp/static/js/priOnline/priOnline.js b/src/main/webapp/static/js/priOnline/priOnline.js index 9ba71ad..1a53bac 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"></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({ @@ -24,10 +83,10 @@ 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: 'itemId$', align: 'center',title: '椤圭洰鍚�'} + ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide: true} + ,{field: 'templateName', align: 'center',title: '鏍镐环鍚�',hide: false} + ,{field: 'orderNum', align: 'center',title: '鏍镐环鍗曞彿'} + ,{field: 'planId$', align: 'center',title: '瑙勫垝鍗曞彿'} ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿'} ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿'} ,{field: 'status$', align: 'center',title: '鐘舵��'} @@ -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) { @@ -328,7 +394,7 @@ maxmin: true, area: [top.detailWidth, top.detailHeight], shadeClose: false, - content: 'priOnline_detail.html?item_id=' + data.field.itemId + "&pri_id=" + data.field.priId, + content: 'priOnline_detail.html?item_id=' + data.field.planId + "&pri_id=" + data.field.priId, success: function(layero, index){ clearFormVal(layer.getChildFrame('#detail', index)); // layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"}); -- Gitblit v1.9.1