1203 lines
52 KiB
HTML
1203 lines
52 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<title id="title"></title>
|
||
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
||
<meta name="format-detection" content="telephone=no" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||
<meta name="Keywords" content="">
|
||
<meta name="description" content="">
|
||
<link rel="shortcut icon" type="image/ico" href="/favicon.ico">
|
||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
|
||
<link href="js/layui/css/layui.css" rel="stylesheet" type="text/css" />
|
||
<link rel="stylesheet" type="text/css" href="css/style.css?v=4" />
|
||
<link rel="stylesheet" type="text/css" media="screen and (max-width: 768px)" href="css/mobile.css?v=5" />
|
||
<script src="js/jquery-3.4.1.min.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="js/jquery-ui.min.js"></script>
|
||
<script src="js/dx_bootstrap.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="js/dingtalk.open.js" type="text/javascript" charset="utf-8"></script>
|
||
<script src="js/layui/layui.js" type="text/javascript" charset="utf-8"></script>
|
||
|
||
<script src="js/script.js?v=2" type="text/javascript" charset="utf-8"></script>
|
||
</head>
|
||
|
||
<body class="w-100 p-40">
|
||
<div class="head p-25">
|
||
<div class="head-tit f-l">
|
||
<span class="color-w font-18">文件池管理</span>
|
||
</div>
|
||
<div class="head-other f-r">
|
||
<div class="head-news f-l">
|
||
<!-- <div class="head-news-icon">
|
||
<img src="image/icon_02.png">
|
||
<span class="color-w"></span>
|
||
</div> -->
|
||
<div class="head-drop-down">
|
||
<ul class="down-ul">
|
||
<li data-id="1">系统通知(<i>0</i>)</li>
|
||
<li data-id="2">下载告警(<i>0</i>)</li>
|
||
</ul>
|
||
<div class="down-con">
|
||
<div>
|
||
<ul class="down-list list1">
|
||
</ul>
|
||
<ul class="down-list">
|
||
<li class="down-list-center">
|
||
<a href="notice.html" class="color-g6 font-14 t-c">查看全部</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div>
|
||
<ul class="down-list list2">
|
||
</ul>
|
||
<ul class="down-list">
|
||
<li class="down-list-center">
|
||
<a href="notice.html" class="color-g6 font-14 t-c">查看全部</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="operation font-14">
|
||
<div class="f-l operation-list operation-icon">全部已读</div>
|
||
<div class="f-r operation-list"><a href="#" class="color-b">历史通知</a></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="head-name f-r">
|
||
<div class="img f-l">
|
||
<img src="image/img_01.png">
|
||
</div>
|
||
<div class="name color-w f-l">钉钉用户名称</div>
|
||
<div class="xr">
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">
|
||
$(".xr").html(`
|
||
<div class="qh">
|
||
<p onclick="changeUser(3)"> 管理员</p>
|
||
<p onclick="changeUser(6)">员工</p>
|
||
</div>
|
||
`)
|
||
window.onload = function () {
|
||
// alert(localStorage.getItem('pubilc')+'2')
|
||
let title = localStorage.getItem('pubilc')
|
||
$('#title').html(title)
|
||
|
||
|
||
}
|
||
</script>
|
||
<div class="f-l nav">
|
||
<ul class="layui-nav layui-nav-tree" lay-filter="test" id="forMenu">
|
||
<!-- <li class="layui-nav-item" data-id="1">
|
||
<a href="index.html" class="nav-icon-public">公共文件</a>
|
||
</li>
|
||
<li class="layui-nav-item" data-id="2"><a href="inside.html" class="nav-icon-inside">内部文件</a></li>
|
||
<li class="layui-nav-item" data-id="3"><a href="upload.html" class="nav-icon-upload">文件上传</a></li>
|
||
<li class="layui-nav-item" data-id="4"><a href="renew.html" class="nav-icon-renew">文件更新</a></li>
|
||
<li class="layui-nav-item" data-id="5">
|
||
<a href="javascript:;" class="nav-icon-set">设置</a>
|
||
<dl class="layui-nav-child">
|
||
<dd><a href="organization.html">组织设置</a></dd>
|
||
<dd><a href="Administration.html">主管理设置</a></dd>
|
||
<dd><a href="field.html">自定义字段</a></dd>
|
||
<dd><a href="record.html">操作记录</a></dd>
|
||
</dl>
|
||
</li>
|
||
<li class="layui-nav-item" data-id="6"><a href="notice.html" class="nav-icon-notice">通知</a></li> -->
|
||
</ul>
|
||
</div>
|
||
<script type="text/javascript">
|
||
|
||
layui.use(['element', 'layer'], function () {
|
||
|
||
var element = layui.element;
|
||
// $(window).on("load", function() {
|
||
$('.nav .layui-nav-tree .layui-nav-item').each(function (i) {
|
||
|
||
var that = $(this)
|
||
var newNum = $('.content-auto').attr('data-id')
|
||
|
||
|
||
if (newNum == that.attr('data-id')) {
|
||
$('.nav .layui-nav-tree .layui-nav-item').removeClass('layui-nav-itemed').eq(i).addClass('layui-nav-itemed')
|
||
$('.nav .layui-nav-tree .layui-nav-item .layui-nav-child dd').each(function () {
|
||
if ($(this).index() + 1 == $('.content-auto').attr('data-two')) {
|
||
$(this).find('a').addClass('active')
|
||
}
|
||
})
|
||
}
|
||
});
|
||
var menuUrl = {};
|
||
menuUrl['menu1'] = 'index.html';
|
||
menuUrl['menu2'] = 'inside.html';
|
||
menuUrl['menu3'] = 'upload.html';
|
||
menuUrl['menu4'] = 'renew.html';
|
||
menuUrl['menu5'] = 'index.html';
|
||
menuUrl['menu6'] = 'notice.html';
|
||
menuUrl['menu7'] = 'organization.html';
|
||
menuUrl['menu8'] = 'Administration.html';
|
||
menuUrl['menu9'] = 'field.html';
|
||
menuUrl['menu10'] = 'record.html';
|
||
menuUrl['menu11'] = 'hidefile.html';
|
||
menuUrl['menu12'] = 'file.html';
|
||
var menuClass = {};
|
||
menuClass['menu1'] = 'nav-icon-public';
|
||
menuClass['menu2'] = 'nav-icon-inside';
|
||
menuClass['menu3'] = 'nav-icon-upload';
|
||
menuClass['menu4'] = 'nav-icon-renew';
|
||
menuClass['menu5'] = 'nav-icon-set';
|
||
menuClass['menu6'] = 'nav-icon-notice';
|
||
menuClass['menu11'] = 'nav-icon-public';
|
||
|
||
var menuIcon = {};
|
||
menuIcon['menu1'] = 'inco_app08';
|
||
menuIcon['menu2'] = 'inco_app08';
|
||
menuIcon['menu3'] = 'inco_app07';
|
||
menuIcon['menu4'] = 'inco_app06';
|
||
menuIcon['menu5'] = 'inco_app08';
|
||
menuIcon['menu6'] = 'inco_app12';
|
||
menuIcon['menu7'] = 'inco_app08';
|
||
menuIcon['menu8'] = 'inco_app09';
|
||
menuIcon['menu9'] = 'inco_app11';
|
||
menuIcon['menu10'] = 'inco_app10';
|
||
menuIcon['menu11'] = 'inco_app08';
|
||
|
||
var haveLogin = localStorage['haveLogin'] || false;
|
||
var loginIntervalLefter = setInterval(function () {
|
||
var tmpHaveLogin = localStorage['haveLogin'] || false;
|
||
if (tmpHaveLogin) {
|
||
clearInterval(loginIntervalLefter);
|
||
getMenu();
|
||
}
|
||
}, 500);
|
||
// if(haveLogin){
|
||
// getMenu();
|
||
// }else{
|
||
// var loginIntervalLefter = setInterval(function(){
|
||
// var tmpHaveLogin = localStorage['haveLogin'] || false;
|
||
// if(tmpHaveLogin){
|
||
// clearInterval(loginIntervalLefter);
|
||
// getMenu();
|
||
// }
|
||
// }, 500);
|
||
// }
|
||
|
||
function getMenu() {
|
||
|
||
var url = host + '/ding/menu/getMenuList';
|
||
dxtcRequest('get', url, {}, function (data) {
|
||
console.log(data)
|
||
var newNum = $('.content-auto').attr('data-id');
|
||
if (data.code == 200) {
|
||
if (data.data.length > 0) {
|
||
var html = '';
|
||
var phoneHtml = '';
|
||
var funcSectionBase = '';
|
||
var funcSectionConfig = '';
|
||
var funcSectionNotice = '';
|
||
var extHtml = '<div class="wh76"></div>';
|
||
data.data.forEach(function (item) {
|
||
|
||
var classStr = '';
|
||
if (item.id == newNum) {
|
||
classStr = 'layui-nav-itemed';
|
||
}
|
||
|
||
html += '<li class="layui-nav-item ' + classStr + '" data-id="' + item.id + '">';
|
||
if (item.hasChildren) {
|
||
|
||
var childMenuId = $('.content-auto').attr('data-two')
|
||
html += '<a href="javascript:;" class="' + menuClass['menu' + item.id] + '" >' + item.name + '</a>';
|
||
html += '<dl class="layui-nav-child">';
|
||
item.children.forEach(function (child) {
|
||
var activeClass = '';
|
||
if (child.sort == childMenuId) {
|
||
activeClass = 'active';
|
||
}
|
||
html += '<dd><a href="' + menuUrl['menu' + child.id] + '" data-id="' + child.name + '" onclick="secondary(this)" class="' + activeClass + '">' + child.name + '</a></dd>';
|
||
});
|
||
html += '</dl>';
|
||
} else {
|
||
//var title=item.id`
|
||
//html += '<a href="'+menuUrl['menu'+item.id]+'" class="'+menuClass['menu'+item.id]+'" onclick="a('+item.name+')">'+item.name+'</a>';
|
||
html += '<a href="' + menuUrl['menu' + item.id] + '" class="' + menuClass['menu' + item.id] + '" data-id="' + item.name + '" onclick="sidebar(this)">' + item.name + '</a>';
|
||
|
||
}
|
||
html += '</li>';
|
||
|
||
// 手机版文件夹 只取id<=2
|
||
if (item.id <= 2 || item.id == 11) {
|
||
let activeStr = '';
|
||
let urlStr = `${menuUrl['menu' + item.id]}`;
|
||
if (item.id == newNum) {
|
||
classStr = 'active';
|
||
urlStr = 'javascript:;';
|
||
}
|
||
phoneHtml += `<a href="${urlStr}" class="${classStr}">${item.name}</a>`;
|
||
}
|
||
|
||
// 手机版功能区 基本区域
|
||
if ($.inArray(item.id, [3, 4]) >= 0) {
|
||
funcSectionBase += `<div class="wh76 ">
|
||
<a href="${menuUrl['menu' + item.id]}" class="flexcolumn">
|
||
<img src="image/icon-app/${menuIcon['menu' + item.id]}.png" class="wh50" alt="">
|
||
<div class="displayCenter fontS12 margitt7">${item.name}</div>
|
||
</a>
|
||
</div>`;
|
||
}
|
||
|
||
// 手机版功能区 设置区域
|
||
if (item.id === 5) {
|
||
item.children.forEach(function (it) {
|
||
funcSectionConfig += `<div class="wh76 ">
|
||
<a href="${menuUrl['menu' + it.id]}" class="flexcolumn">
|
||
<img src="image/icon-app/${menuIcon['menu' + it.id]}.png" class="wh50" alt="">
|
||
<div class="displayCenter fontS12 margitt7">${it.name}</div>
|
||
</a>
|
||
</div>`;
|
||
});
|
||
}
|
||
// 手机版功能区 通知区域
|
||
if (item.id === 6) {
|
||
funcSectionNotice += `<div class="wh76 ">
|
||
<a href="${menuUrl['menu' + item.id]}" class="flexcolumn">
|
||
<img src="image/icon-app/${menuIcon['menu' + item.id]}.png" class="wh50" alt="">
|
||
<div class="displayCenter fontS12 margitt7">${item.name}</div>
|
||
</a>
|
||
</div>`;
|
||
}
|
||
});
|
||
|
||
let baseCount = $(funcSectionBase).find('a').length;
|
||
let configCount = $(funcSectionConfig).find('a').length;
|
||
let noticeCount = $(funcSectionNotice).find('a').length;
|
||
funcSectionBase += baseCount > 0 ? extHtml.repeat(4 - baseCount) : '';
|
||
funcSectionConfig += configCount > 0 ? extHtml.repeat(4 - configCount) : '';
|
||
funcSectionNotice += noticeCount > 0 ? extHtml.repeat(4 - noticeCount) : '';
|
||
$('#forMenu').html(html);
|
||
|
||
$('#phone-menu').html(phoneHtml);
|
||
$('#func-section').find('.base').html(funcSectionBase);
|
||
$('#func-section').find('.config').html(funcSectionConfig);
|
||
$('#func-section').find('.notice').html(funcSectionNotice);
|
||
|
||
|
||
element.init();
|
||
}
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
});
|
||
}
|
||
})
|
||
function sidebar(obj) {
|
||
localStorage.setItem('pubilc', $(obj).data('id'))
|
||
}
|
||
function secondary(data) {
|
||
localStorage.setItem('pubilc', $(data).data('id'))
|
||
}
|
||
</script>
|
||
<!--内容-->
|
||
<div class="f-r content ">
|
||
<div class="content-auto" data-id="5" data-two="1">
|
||
<div class="con-tit font-20 pc-block">
|
||
设置
|
||
</div>
|
||
<div class="con-seclevel font-18 bg-w top20 phone-top-0 ">
|
||
<span class="pc-block">组织设置</span>
|
||
<div class="form-control__dept wf100 deptBtn">
|
||
<div class="form-control__input">
|
||
<div class="js_party_select_result">
|
||
<div class="js_party_select_result_list"></div>
|
||
<button class="mobileGroup" onclick="mobileGroup(this)">移动组织</button>
|
||
<a id="addDept" class="js_show_party_selector add" href="javascript:;">+添加组织</a>
|
||
<input id="deptInput" class="form-input" type="hidden" name="policy_dept_ids" value="" style="display: none;">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="con-content top20 ">
|
||
<div class="con-mune bg-w">
|
||
<div class="name add-border " onclick="remoce_active()">
|
||
<!-- <img src="image/img_01.png"> -->
|
||
<span class="font-14">巴音孟克组织列表</span>
|
||
</div>
|
||
<ul class="org-menu-list"></ul>
|
||
</div>
|
||
<div class="con-text bg-w hide-mobile">
|
||
<div class="name add-border">
|
||
<input type="text" name="" value="组织名称01" data-id="" id="folder-name" disabled="disabled" class="name-input">
|
||
<div class="name-btn name-btn-none">
|
||
<button class="btn-edit btn-edit-op"><img src="image/icon_32.png"></button>
|
||
</div>
|
||
<div class="name-btn name-btn-active">
|
||
<button class="btn-edit btn-keep" id="saveFolder"><img src="image/icon_34.png"></button>
|
||
<button class="btn-edit btn-close"><img src="image/icon_33.png"></button>
|
||
</div>
|
||
</div>
|
||
<!--管理-->
|
||
<div class="org-list">
|
||
<ul class="org-ul " role="tablist">
|
||
<li role="presentation" class="active">
|
||
<a href="#Admin" aria-controls="Admin" role="tab" data-toggle="tab" data-role-id="3" class="tab-menu-admin">管理员</a>
|
||
</li>
|
||
<li role="presentation">
|
||
<a href="#opera" aria-controls="opera" role="tab" data-toggle="tab" data-role-id="5" class="tab-menu-opera">操作员</a>
|
||
</li>
|
||
<li role="presentation">
|
||
<a href="#look" aria-controls="look" role="tab" data-toggle="tab" data-role-id="6" class="tab-menu-look">查看员</a>
|
||
</li>
|
||
</ul>
|
||
<div class="tab-content org-con top20">
|
||
<div role="tabpanel" class="tab-pane active" id="Admin">
|
||
<div class="org-remarks">
|
||
<p>管理员权限</p>
|
||
<p>1. 可查看、添加和下载授权组织内部文件、公共文件; </p>
|
||
<p>2. 创建和修改授权组织 “操作员”</p>
|
||
<p>3. 创建授权组织内部文件分类</p>
|
||
<a href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="3" onclick="choosePeople(this, 'Admin')">
|
||
+添加人员
|
||
</a>
|
||
</div>
|
||
<div class="org-list org-content-list list-content">
|
||
<img src="image/img_02.jpg">
|
||
</div>
|
||
</div>
|
||
<div role="tabpanel" class="tab-pane" id="opera">
|
||
<div class="org-remarks">
|
||
<p>操作员权限</p>
|
||
<p>1. 可查看、添加和下载授权组织内部文件、公共文件; </p>
|
||
<a href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="5" onclick="choosePeople(this, 'opera')">
|
||
+添加人员
|
||
</a>
|
||
</div>
|
||
<div class="org-list org-content-list list-content">
|
||
<img src="image/img_02.jpg">
|
||
</div>
|
||
</div>
|
||
<div role="tabpanel" class="tab-pane" id="look">
|
||
<div class="org-remarks">
|
||
<p>查看员权限</p>
|
||
<p>1. 可查看和下载授权组织内部文件、公共文件; </p>
|
||
<a href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="6" onclick="choosePeople(this, 'look')">
|
||
+添加人员
|
||
</a>
|
||
</div>
|
||
<div class="org-list org-content-list list-content">
|
||
<img src="image/img_02.jpg">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- <div class="organization-con">
|
||
<div class="organization-con-data">
|
||
|
||
</div>
|
||
</div> -->
|
||
</div>
|
||
<div class="history upload">
|
||
<div class="center-center download-hight">
|
||
<div class="history-content bg-w">
|
||
<div class="on-name">
|
||
<h3 class="font-14">选择文件路径</h3>
|
||
</div>
|
||
<a href="javascript:;" class="close"> </a>
|
||
<form class="p-25 layui-form">
|
||
<!-- <div class="con-search upload-search add-border">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">主管部门:</label>
|
||
<div class="layui-input-block">
|
||
<select name="city">
|
||
<option value="">全部类型</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">文件名称:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" class="layui-input" placeholder="文件名称 ">
|
||
</div>
|
||
</div>
|
||
</div> -->
|
||
<!--文件夹-->
|
||
<div class="con-list bg-w top20 add-border">
|
||
<div class="name">
|
||
<span class="font-14" id="folder-navigation"><i class="icon-back"></i><a data-id="0" data-name="全部文件">文件可选择路径</a></span>
|
||
<input type="hidden" id="navigation" value="0">
|
||
</div>
|
||
<div class="con-list-cn">
|
||
<div class="list-content" id="Chart">
|
||
<ul></ul>
|
||
</div>
|
||
</div>
|
||
<!-- 无内容 -->
|
||
<div class="no-con-list" style="display: none;">
|
||
<img src="image/img_02.jpg">
|
||
</div>
|
||
</div>
|
||
<!--保存-->
|
||
<div class="upload-form t-r">
|
||
<button class="flie-btn" type="button" onclick="determineMobileGroup()">移动</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="make-Tc">
|
||
<div>
|
||
<p class="tit-name">添加组织</p>
|
||
<div> <input type="text"></div>
|
||
<div class="make-con">
|
||
|
||
</div>
|
||
<div><button>确定</button><button>取消</button></div>
|
||
</div>
|
||
</div>
|
||
<script type="text/html" id="modal-tpl">
|
||
<div class="con-content">
|
||
<div class="con-mune bg-w">
|
||
<div class="name add-border">
|
||
<span class="font-14 text-gray down-arrow">{{d.name}}</span>
|
||
<a href="javascript:;" class="model-add" data-folder-id="{{d.folderId}}" data-role-id="{{d.roleId}}"
|
||
onclick="choosePeople(this, '{{d.type}}')">+ 添加人员</a>
|
||
</div>
|
||
</div>
|
||
<div style="clear:both"></div>
|
||
<div>
|
||
<ul class="list-group list-people">
|
||
{{# layui.each(d.users, function(idx, user) { }}
|
||
<li class="list-group-item font-14"><img src="image/img_01.png" class="avatar"> {{user.name}}
|
||
<a href="javascript:;" data-id="{{user.userId}}" data-folder-id="{{d.folderId}}"
|
||
data-role-id="{{d.roleId}}" onclick="delUser(this, '{{d.type}}', '{{d.name}}')"
|
||
class="list-del layui-layer-ico"> </a>
|
||
</li>
|
||
{{# }); }}
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
</script>
|
||
|
||
<script type="text/html" id="modal-selector-tpl">
|
||
<div class="switch">
|
||
<div class="list-group">
|
||
<a href="javascript:void(0);" data-role-id="3" data-type="Admin"
|
||
class="list-group-item{{d.roleId == 3 ? ' active' : ''}}">管理员</a>
|
||
<a href="javascript:void(0);" data-role-id="5" data-type="opera"
|
||
class="list-group-item{{d.roleId == 5 ? ' active' : ''}}">操作员</a>
|
||
<a href="javascript:void(0);" data-role-id="6" data-type="look"
|
||
class="list-group-item{{d.roleId == 6 ? ' active' : ''}}">查看员</a>
|
||
</div>
|
||
</div>
|
||
</script>
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" href="js/orgTree/orgTree.css" />
|
||
<script src="js/orgTree/orgTree.js" type="text/javascript" charset="utf-8"></script>
|
||
<script>
|
||
var fileAjaxData = {
|
||
current: '',
|
||
isPublic: 1,
|
||
parentFolderId: 0,
|
||
size: '',
|
||
isUpload: 1
|
||
}
|
||
let dataOrganization = {
|
||
state: false,
|
||
data: [],
|
||
dataIndex: {
|
||
},
|
||
id: "",
|
||
thisId: "",
|
||
}
|
||
//修改名称
|
||
$(".btn-edit-op").click(function () {
|
||
$(".name-btn-active").show();
|
||
$(".name-input").addClass("name-input-edit");
|
||
$(".name-input").attr("disabled", false);
|
||
});
|
||
$(".btn-close,.btn-keep").click(function () {
|
||
$(".name-btn-active").hide();
|
||
$(".name-input").removeClass("name-input-edit");
|
||
$(".name-input").attr("disabled", "disabled");
|
||
});
|
||
let zuId = 0
|
||
let shangId = 0
|
||
$('body').on('click', '.tab-menu-admin, .tab-menu-opera, .tab-menu-look', function () {
|
||
let that = $(this);
|
||
// let folderId = $('.org-menu-list li a.active').data('folder-id');
|
||
// console.log('组织ID:'+zuId)
|
||
let roleId = that.data('role-id');
|
||
let type = that.attr('aria-controls');
|
||
getDeptUsers(type, zuId, roleId);
|
||
})
|
||
//添加组织
|
||
$("#addDept").click(function () {
|
||
if ($(".org-menu-list a.active").length == 0) {
|
||
layer.confirm('确认添加组织?', {
|
||
btn: ['确认', '取消'] //可以无限个按钮
|
||
}, function (index, layero) {
|
||
//按钮【按钮一】的回调
|
||
var parentId = shangId;
|
||
// console.log('组织ID1:'+parentId);
|
||
layer.closeAll();
|
||
addDept(parentId)
|
||
}, function (index) {
|
||
//按钮【按钮二】的回调
|
||
layer.closeAll();
|
||
});
|
||
|
||
} else {
|
||
// var parentId = $(".org-menu-list a.active").attr("data-id");
|
||
console.log('组织ID2:' + shangId);
|
||
addDept(shangId)
|
||
}
|
||
});
|
||
|
||
function addDept(parentId) {
|
||
// console.log(parentId);
|
||
layer.prompt(function (value, index, elem) {
|
||
layer.alert(value); //得到value
|
||
layer.close(index);
|
||
var data = {
|
||
name: value,
|
||
parentId: parentId
|
||
}
|
||
$.ajax({
|
||
url: host + '/ding/dept/addDept' + '?timetmp=' + Date.parse(new Date()).toString()
|
||
.substr(0, 10),
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' + localStorage.accessToken
|
||
},
|
||
data: JSON.stringify(data),
|
||
type: "post",
|
||
contentType: "application/json",
|
||
dataType: "json",
|
||
success: function (data) {
|
||
if (data.code == 200) {
|
||
layer.msg("添加成功", function () {
|
||
location.reload();
|
||
})
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
},
|
||
error: function (data) {
|
||
layer.msg(data.responseJSON.msg)
|
||
}
|
||
});
|
||
|
||
});
|
||
}
|
||
|
||
function remoce_active() {
|
||
$(".org-menu-list a.active").removeClass('active');
|
||
clearId()
|
||
}
|
||
function clearId() {//把上级组织ID设为0
|
||
shangId = 0
|
||
console.log("shangId:" + shangId);
|
||
}
|
||
|
||
|
||
var tckd = ['620px', '542px'];
|
||
if ($(window).width() <= 425) {
|
||
tckd = ['90%', '90%'];
|
||
}
|
||
|
||
layui.use(['element', 'form', 'laydate', 'laypage', 'laytpl'], function () {
|
||
var laypage = layui.laypage;
|
||
var element = layui.element;
|
||
var form = layui.form;
|
||
var laydate = layui.laydate;
|
||
|
||
// return false;
|
||
var organizationIntervalScript = setInterval(function () {
|
||
var tmpHaveLogin = localStorage['haveLogin'] || false;
|
||
if (tmpHaveLogin) {
|
||
clearInterval(organizationIntervalScript);
|
||
getDeptList();
|
||
//getDingDeptList(); //不再使用钉钉组织架构
|
||
}
|
||
}, 500);
|
||
//获取组织架构 不再使用钉钉组织架构
|
||
function getDingDeptList() {
|
||
$.ajax({
|
||
url: host + '/ding/dept/getDingDeptList' + '?timetmp=' + Date.parse(new Date())
|
||
.toString().substr(0, 10),
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' + localStorage.accessToken
|
||
},
|
||
data: {},
|
||
type: "get",
|
||
dataType: "json",
|
||
success: function (data) {
|
||
if (data.code == 200) {
|
||
if (data.data.length > 0) {
|
||
$('.deptBtn').orgTree({
|
||
all: false, //true人物组织都开启 false只开启组织
|
||
area: tckd, //弹窗框宽高
|
||
search: true, //开启搜索
|
||
radio: true, //是否单选
|
||
form: true, //是否提交
|
||
inputId: 'deptInput',
|
||
defaultName: '请选择',
|
||
defaultTitle: '请选择',
|
||
defaultButton: '+添加组织',
|
||
jsonData: data.data,
|
||
custom: function (event) {
|
||
// form属性为true才会生效
|
||
var data = {
|
||
parentId: event[0].id,
|
||
name: event[0].name
|
||
}
|
||
$.ajax({
|
||
url: host + '/ding/dept/addDept' +
|
||
'?timetmp=' + Date.parse(new Date())
|
||
.toString().substr(0, 10),
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' +
|
||
localStorage
|
||
.accessToken
|
||
},
|
||
data: JSON.stringify(data),
|
||
type: "post",
|
||
contentType: "application/json",
|
||
dataType: "json",
|
||
success: function (data) {
|
||
if (data.code == 200) {
|
||
getDeptList()
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
},
|
||
error: function (data) {
|
||
layer.msg(data.responseJSON.msg)
|
||
}
|
||
});
|
||
},
|
||
});
|
||
}
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
},
|
||
error: function (data) {
|
||
// console.log(data);
|
||
}
|
||
});
|
||
}
|
||
})
|
||
var modalTpl = $('#modal-tpl').html(),
|
||
modalSelectorTpl = $('#modal-selector-tpl').html();
|
||
let chuFolderId = 0
|
||
function getDeptList() {
|
||
let url = host + '/ding/dept/getDeptList';
|
||
let type = "get";
|
||
let data = {};
|
||
let roleId = $('.org-list .org-ul li.active a').data('role-id');
|
||
dxtcRequest(type, url, data, function (data) {
|
||
console.log(data.data);
|
||
dataOrganization.data = data.data
|
||
if (data.code == 200) {
|
||
let html = '';
|
||
let active = '';
|
||
$.each(data.data, function (index, value) {
|
||
if (index === 0) {
|
||
active = 'active';
|
||
$('#folder-name').val(value.deptName).attr('data-id', value.id);
|
||
// console.log('初始组织名称:'+value.deptName);
|
||
chuFolderId = value.folderId
|
||
// console.log("chuFolderId:"+chuFolderId);
|
||
if (!MobileLib.isMobile()) getDeptUsers('Admin', value.folderId, roleId);
|
||
} else {
|
||
active = '';
|
||
}
|
||
})
|
||
// console.log(data.data)
|
||
var htmls = menu_list_html(data.data);
|
||
$('.org-menu-list').html(htmls);
|
||
} else {
|
||
layer.msg(data.msg);
|
||
}
|
||
});
|
||
}
|
||
function queryId(data, id, indexParent = []) {
|
||
for (let index = 0; index < data.length; index++) {
|
||
if (id == data[index].id) {
|
||
indexParent.unshift(index)
|
||
dataOrganization.dataIndex = {
|
||
index: index,
|
||
indexParent: indexParent
|
||
}
|
||
return true
|
||
}
|
||
if (data[index].children) {
|
||
let ifFor = queryId(data[index].children, id, indexParent)
|
||
if (ifFor) {
|
||
indexParent.unshift(index)
|
||
return true
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
function menu_list_html(data, id, index = 0) {
|
||
var html = "";
|
||
var null_str = ""
|
||
$.each(data, function (index, value) {
|
||
// html += '<li class="add-border" ><a href="javascript:;" data-id="' + value.id +
|
||
0 // '" data-folder-id="' + value.folderId + '" data-role-id="' + roleId +
|
||
// '" data-folder-name="' + value.deptName + '" onclick="changeDept(this)">' + value.deptName +
|
||
// '</a><span class="float-right hide-wide">设置人员</span>';
|
||
// console.log('data:'+JSON.stringify(value));
|
||
html += '<li class="add-border" ><a href="javascript:;" data-id="' + value.id +
|
||
'" data-folder-id="' + value.folderId + '" data-folder-name="' + value.deptName + '" onclick="change(this)">' + value.deptName +
|
||
'</a><span class="float-right hide-wide" onclick="changeDept(this)" data-id="' + value.id +
|
||
'" data-folder-id="' + value.folderId + '" data-role-id="' + roleId +
|
||
'" data-folder-name="' + value.deptName + '">设置人员</span>';
|
||
if (value.hasChildren) {
|
||
html += '<span onclick="PutAway(this)" class=" PutAway float-right">展开</span>';
|
||
html += "<ul class='org-menu-lis-children'>" + menu_list_html(value.children) + "</ul>";
|
||
}
|
||
html += "</li>";
|
||
});
|
||
|
||
return html;
|
||
}
|
||
|
||
function init() {
|
||
//返回事件
|
||
$('.con-list .name span .icon-back').off("click").click(function () {
|
||
var that = $(this)
|
||
if ($("#navigation").val() != 0) {
|
||
fileAjaxData.parentFolderId = $('.con-list .name span a').eq(-2).attr('data-id')
|
||
$("#navigation").val($('.con-list .name span a').eq(-2).attr('data-id'))
|
||
$('.con-list .name span a').eq(-1).remove()
|
||
getFileList(fileAjaxData)
|
||
}
|
||
});
|
||
//路由事件
|
||
$('#folder-navigation a').off("click").click(function () {
|
||
var that = $(this)
|
||
fileAjaxData.parentFolderId = that.attr('data-id')
|
||
$('.con-list .name span a').each(function () {
|
||
if ($(this).index() >= that.index()) {
|
||
$('.con-list .name span a').eq($(this).index()).remove()
|
||
}
|
||
})
|
||
$("#navigation").val(that.attr('data-id'))
|
||
getFileList(fileAjaxData)
|
||
})
|
||
}
|
||
|
||
//选择组织,更改显示内容
|
||
function mobileGroup(params) {
|
||
if (dataOrganization.state) {
|
||
$(params).html("移动组织")
|
||
|
||
} else {
|
||
$(params).html("取消")
|
||
|
||
|
||
}
|
||
|
||
dataOrganization.state = !dataOrganization.state
|
||
console.log(dataOrganization.state);
|
||
}
|
||
function changeDept(obj) {
|
||
|
||
var id = $(obj).data('id');
|
||
zuId = $(obj).data('folder-id');
|
||
var roleId = $(obj).data('role-id');
|
||
// var folderName = $(obj).data('folder-name');
|
||
// $('#folder-name').val(folderName).attr('data-id', id);
|
||
$('.org-menu-list li a.active').removeClass('active');
|
||
$(obj).addClass('active');
|
||
$('.tab-menu-admin').click();
|
||
}
|
||
// 选中组织
|
||
function change(obj) {
|
||
if (dataOrganization.state) {
|
||
dataOrganization.thisId = `${$(obj).data('folder-id')}`
|
||
|
||
$('.upload').show()
|
||
getFileList(fileAjaxData)
|
||
// layer.confirm('请选择升降级', {
|
||
// btn: ['升级',平级拖动, '降级'] //可以无限个按钮
|
||
// }, function (params) {
|
||
|
||
// // $('.upload').show()
|
||
// // getFileList(fileAjaxData)
|
||
// queryId(dataOrganization.data, $(obj).attr("data-id"))
|
||
// let dataIin;
|
||
// if (dataOrganization.dataIndex.indexParent.length > 1) {
|
||
// for (let index = 0; index < dataOrganization.dataIndex.indexParent.length - 2; index++) {
|
||
// if (index == 0) {
|
||
// dataIin = dataOrganization.data[dataOrganization.dataIndex.indexParent[index]]
|
||
// } else if (index == dataIndex.indexParent.length - 1) {
|
||
// dataIin = dataIin.children[dataOrganization.dataIndex.indexParent[index]]
|
||
// } else {
|
||
// dataIin = dataIin.children[dataOrganization.dataIndex.indexParent[index]]
|
||
// }
|
||
// }
|
||
// dataOrganization.id=dataIin.folderId
|
||
// determineMobileGroup()
|
||
|
||
|
||
// } else {
|
||
// layer.mag("顶层不能移动")
|
||
// layer.closeAll();
|
||
// return
|
||
|
||
// }
|
||
// layer.closeAll();
|
||
// return
|
||
|
||
// }, function (params) {
|
||
// $('.upload').show()
|
||
// getFileList(fileAjaxData)
|
||
// layer.closeAll();
|
||
// return
|
||
|
||
// })
|
||
|
||
}
|
||
shangId = $(obj).data('id');
|
||
zuId = $(obj).data('folder-id');
|
||
chuFolderId = zuId
|
||
var folderName = $(obj).data('folder-name');
|
||
$('#folder-name').val(folderName).attr('data-id', shangId);
|
||
// console.log('顶级组织ID:' + shangId);
|
||
// console.log('当前组织ID:' + zuId);
|
||
let roleId = $('.org-list .org-ul li.active a').data('role-id');
|
||
// console.log('roleId:' + roleId);
|
||
getDeptUsers('Admin', zuId, roleId);
|
||
}
|
||
//收起
|
||
function PutAway(obj) {
|
||
// console.log($(obj).hasClass('active'))
|
||
//收起
|
||
if ($(obj).hasClass('active')) {
|
||
$(obj).next(".org-menu-lis-children").hide();
|
||
$(obj).removeClass('active');
|
||
$(obj).text("展开");
|
||
} else { // 展开
|
||
$(obj).next(".org-menu-lis-children").show();
|
||
$(obj).addClass('active');
|
||
$(obj).text("收起");
|
||
|
||
}
|
||
clearId()
|
||
|
||
}
|
||
|
||
//获取用户列表
|
||
function getDeptUsers(type, folderId, roleId, roleName) {
|
||
let url = host + '/ding/dept/getDeptInUserList';
|
||
folderId == 0 ? folderId = chuFolderId : folderId = folderId
|
||
let data = {
|
||
'folderId': folderId,
|
||
'roleId': roleId
|
||
};
|
||
$('.org-remarks-add').attr('data-folder-id', folderId);
|
||
dxtcRequest('get', url, data, function (data) {
|
||
if (data.code == 200) {
|
||
if (MobileLib.isMobile()) {
|
||
layer.closeAll();
|
||
MobileLib.modal({
|
||
//title: $('.org-menu-list li.active > a').data('folder-name'),//原来的
|
||
title: $('.org-menu-list li a.active').data('folder-name'),
|
||
body: layui.laytpl(modalTpl).render({
|
||
folderId: folderId,
|
||
roleId: roleId,
|
||
name: roleName || '管理员',
|
||
type: type,
|
||
users: data.data.userList || []
|
||
}),
|
||
success: function ($p, idx1) {
|
||
$p.find('.name > span').on('click', function () {
|
||
MobileLib.actionSheet({
|
||
body: layui.laytpl(modalSelectorTpl).render({
|
||
roleId: roleId
|
||
}),
|
||
success: function ($el, idx2) {
|
||
$el.find('a.list-group-item').on(
|
||
'click',
|
||
function (el) {
|
||
layer.close(idx2)
|
||
layer.close(idx1)
|
||
var data = $(el.target)
|
||
.data()
|
||
getDeptUsers(data.type,
|
||
folderId, data
|
||
.roleId, el.target
|
||
.innerText)
|
||
})
|
||
}
|
||
})
|
||
})
|
||
}
|
||
})
|
||
return
|
||
}
|
||
|
||
let html = '<img src="image/img_02.jpg">';
|
||
if (data.data.userList.length > 0) {
|
||
html = `
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th>人员</th>
|
||
<th>操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
`;
|
||
$.each(data.data.userList, function (index, value) {
|
||
html += `
|
||
<tr>
|
||
<td>
|
||
<div class="list-img"><img src="image/img_01.png"><span>${value.name}</span></div>
|
||
</td>
|
||
<td>
|
||
<a href="javascript:;" data-id="${value.userId}" data-folder-id="${folderId}" data-role-id="${roleId}" onclick="delUser(this, '${type}')" class="color-r">移除</a>
|
||
</td>
|
||
</tr>
|
||
`;
|
||
});
|
||
html += `
|
||
</tbody>
|
||
</table>
|
||
`;
|
||
}
|
||
$('#' + type).children('.org-content-list').html(html);
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
});
|
||
}
|
||
|
||
//添加人员
|
||
function choosePeople(obj, type) {
|
||
var folderId = $('.org-menu-list li a.active').data('folder-id');
|
||
folderId == undefined ? folderId = chuFolderId : folderId = folderId
|
||
console.log("folderId2:" + folderId);
|
||
var roleId = $(obj).data('role-id');
|
||
dd.biz.contact.complexPicker({
|
||
title: "添加人员", //标题
|
||
corpId: corpId, //企业的corpId
|
||
multiple: true, //是否多选
|
||
limitTips: "超出了", //超过限定人数返回提示
|
||
maxUsers: 1000, //最大可选人数
|
||
pickedUsers: [], //已选用户
|
||
pickedDepartments: [], //已选部门
|
||
disabledUsers: [], //不可选用户
|
||
disabledDepartments: [], //不可选部门
|
||
requiredUsers: [], //必选用户(不可取消选中状态)
|
||
requiredDepartments: [], //必选部门(不可取消选中状态)
|
||
appId: agentId, //微应用Id,企业内部应用查看AgentId
|
||
permissionType: "GLOBAL", //可添加权限校验,选人权限,目前只有GLOBAL这个参数
|
||
responseUserOnly: false, //返回人,或者返回人和部门
|
||
startWithDepartmentId: 0, //仅支持0和-1
|
||
onSuccess: function (result) {
|
||
/**
|
||
{
|
||
selectedCount:1, //选择人数
|
||
users:[{"name":"","avatar":"","userid":""}],//返回选人的列表,列表中的对象包含name(用户名),avatar(用户头像),emplId(用户工号)三个字段
|
||
departments:[{"id":,"name":"","number":}]//返回已选部门列表,列表中每个对象包含id(部门id)、name(部门名称)、number(部门人数)
|
||
}
|
||
*/
|
||
var arr = []
|
||
result.users.forEach(function (item) {
|
||
arr.push(item.emplId)
|
||
})
|
||
var ajaxdata = {
|
||
"folderId": folderId,
|
||
"roleId": roleId,
|
||
"toBossUserId": "",
|
||
"userIds": arr
|
||
}
|
||
var url = host + '/ding/dept/addUser';
|
||
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
|
||
if (data.code == 200) {
|
||
getDeptUsers(type, folderId, roleId);
|
||
} else {
|
||
layer.msg(data.responseJSON.msg)
|
||
}
|
||
}, 'application/json');
|
||
},
|
||
onFail: function (err) {
|
||
|
||
}
|
||
});
|
||
}
|
||
|
||
//删除用户
|
||
function delUser(obj, type, roleName) {
|
||
var folderId = $(obj).data('folder-id');
|
||
var roleId = $(obj).data('role-id');
|
||
var userId = $(obj).data('id');
|
||
var arr = []
|
||
arr.push(userId);
|
||
var ajaxdata = {
|
||
"folderId": folderId,
|
||
"roleId": roleId,
|
||
"toBossUserId": "",
|
||
"userIds": arr
|
||
}
|
||
var url = host + '/ding/dept/delUser';
|
||
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
|
||
if (data.code == 200) {
|
||
getDeptUsers(type, folderId, roleId, roleName);
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
}, 'application/json');
|
||
}
|
||
//修改组织名称
|
||
$('body').on('click', '#saveFolder', function () {
|
||
var that = $('#folder-name');
|
||
var id = $('.org-menu-list li a.active').data('id');
|
||
var name = that.val();
|
||
var ajaxdata = {
|
||
"id": id,
|
||
"name": name
|
||
}
|
||
var url = host + '/ding/dept/updName';
|
||
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
|
||
if (data.code == 200) {
|
||
$('.org-menu-list li a.active').html(name);
|
||
$('.org-menu-list li a.active').data('folder-name', name);
|
||
layer.alert('成功');
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
}, 'application/json');
|
||
})
|
||
|
||
|
||
function openFolder(obj) {
|
||
fileAjaxData.parentFolderId = $(obj).attr('data-id')
|
||
getFileList(fileAjaxData)
|
||
$("#navigation").val($(obj).attr('data-id'))
|
||
$('#folder-navigation').append('<a data-id="' + $(obj).attr('data-id') + '" data-name="' + $(obj).text() +
|
||
'"> > ' + $(obj).text() + '</a>')
|
||
}
|
||
function getFileList(fileAjaxData) {
|
||
$('.list-content#Chart ul').empty()
|
||
$('.list-content#tab tbody').empty()
|
||
$.ajax({
|
||
url: host + '/ding/file/getFileList' + '?timetmp=' + Date.parse(new Date()).toString().substr(0,
|
||
10),
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' + localStorage.accessToken
|
||
},
|
||
data: fileAjaxData,
|
||
type: "get",
|
||
contentType: "application/x-www-form-urlencoded",
|
||
dataType: "json",
|
||
success: function (data) {
|
||
if (data.code == 200) {
|
||
init()
|
||
if (data.data.folders.length > 0) {
|
||
data.data.folders.forEach(function (item) {
|
||
var html1 =
|
||
'<li class="list pr" onclick="openFolder(this)" ondblclick="openFolder(this)" data-id="' +
|
||
item.id + '" data-name="' + item.name + '">' +
|
||
'<div class="onClickImg" data-id="' + item.id + '" onclick="onClickImg(this)"><img src="image/icon_30.png"></div>' +
|
||
'<div class="img"><img src="image/' + (item.folderType == "0" ?
|
||
"icon_11.png" : "icon_11_2.png") + '"></div>' +
|
||
'<div class="text-two-hide list-hight">' + item.name + '</div>' +
|
||
'</li>'
|
||
$('.list-content#Chart ul').append(html1)
|
||
})
|
||
}
|
||
|
||
if (data.data.folders.length == 0 && data.data.files.length == 0) {
|
||
$('.no-con-list').show()
|
||
$('.con-list-cn').hide()
|
||
} else {
|
||
$('.no-con-list').hide()
|
||
$('.con-list-cn').show()
|
||
}
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
},
|
||
error: function (data) {
|
||
console.log(data);
|
||
}
|
||
});
|
||
}
|
||
|
||
function onClickImg(obj) {
|
||
$(".onClickImg img").css("display", "none")
|
||
event.stopPropagation()
|
||
$(obj).children().show()
|
||
dataOrganization.id = $(obj).attr("data-id")
|
||
}
|
||
function getId(obj) {
|
||
$('.list-content#Chart ul li').css("background", "rgba(0,0,0,0)")
|
||
dataOrganization.id = $(obj).attr("data-id")
|
||
$(obj).css("background", "#f5f6ff")
|
||
}
|
||
function determineMobileGroup(params) {
|
||
|
||
// let contentType = "application/json"
|
||
let arrData = {
|
||
targetFolderId: dataOrganization.id,
|
||
thisFolderId: dataOrganization.thisId
|
||
}
|
||
let url = host + '/ding/dept/moveDept'
|
||
dxtcRequest('get', url, arrData, function name(data) {
|
||
if (data.code == 200) {
|
||
console.log(data);
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
})
|
||
$('.upload').toggle()
|
||
|
||
|
||
}
|
||
|
||
</script>
|
||
|
||
<script>
|
||
layui.use(['element', 'form', 'laydate', 'layer'], function () {
|
||
var element = layui.element;
|
||
var form = layui.form;
|
||
var laydate = layui.laydate;
|
||
var layer = layui.layer;
|
||
//单时间
|
||
laydate.render({
|
||
elem: '.layui-time',
|
||
theme: '#3e5afa',
|
||
type: 'date',
|
||
format: 'yyyy-MM-dd',
|
||
max: 0
|
||
});
|
||
//时间段
|
||
laydate.render({
|
||
elem: '.layui-time-time',
|
||
range: true,
|
||
theme: '#3e5afa'
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
|
||
</html> |