| | |
| | | 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; |
| | |
| | | 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({ |
| | |
| | | ,{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: 'businessPeersId', align: 'center',title: '同行人ID',hide: true} |
| | | ,{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: '时间戳',hide: true} |
| | | ,{field: 'carNumber', align: 'center',title: '自驾私家车车牌号',hide: false} |
| | | ,{field: 'kilometers', align: 'center',title: '自驾私家车行程明细及公里数',hide: false} |
| | | ,{field: 'userId$', align: 'center',title: '申请人',hide: false} |
| | |
| | | ,{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', |
| | |
| | | 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; |
| | |
| | | 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) { |
| | |
| | | }); |
| | | } |
| | | |
| | | 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}); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | }); |
| | | |
| | | // 关闭动作 |