|  |  |  | 
|---|
|  |  |  | 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"></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: 'templateName', align: 'center',title: '模板名'} | 
|---|
|  |  |  | ,{field: 'orderNum', align: 'center',title: '核价订单号'} | 
|---|
|  |  |  | ,{field: 'inOrderNum', align: 'center',title: '明细编号'} | 
|---|
|  |  |  | ,{field: 'itemId$', align: 'center',title: '项目名'} | 
|---|
|  |  |  | ,{field: 'planId$', align: 'center',title: '项目名'} | 
|---|
|  |  |  | ,{field: 'createTime$', align: 'center',title: '创建时间'} | 
|---|
|  |  |  | ,{field: 'updateTime$', align: 'center',title: '更新时间'} | 
|---|
|  |  |  | ,{field: 'memberId$', align: 'center',title: '业务员'} | 
|---|
|  |  |  | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | console.log(res) | 
|---|
|  |  |  | if (res.code === 200){ | 
|---|
|  |  |  | $("#itemName").val(res.data.itemId$) | 
|---|
|  |  |  | $("#planId").val(res.data.planId$) | 
|---|
|  |  |  | } else if (res.code === 403){ | 
|---|
|  |  |  | top.location.href = baseUrl+"/"; | 
|---|
|  |  |  | } else { | 
|---|