834 lines
37 KiB
HTML
834 lines
37 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/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>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">
|
||
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';
|
||
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 phone-bg-w">
|
||
<div class="content-auto" data-id="3">
|
||
<div class="con-tit font-20 pc-block phone-top-0">
|
||
文件上传
|
||
<a href="upload.html" class="back">< 返回</a>
|
||
</div>
|
||
<div class="con-list bg-w top20 add-list phone-top-0">
|
||
<form class="layui-form" id="data-form">
|
||
<div class="layui-form-item add-border phone-layui-tit">
|
||
<label class="layui-form-label">文件类型:</label>
|
||
<div class="layui-input-block">
|
||
<input type="radio" name="isPublic" value="1" title="公共文件" lay-filter='isPublic' checked="">
|
||
<input type="radio" name="isPublic" value="0" title="内部文件" lay-filter='isPublic'>
|
||
</div>
|
||
</div>
|
||
<!---->
|
||
<div class="add-list-tow">
|
||
<div class="layui-form-item list">
|
||
<label class="layui-form-label">文件名称:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" name="name" lay-verify="required" lay-reqtext="请填写文件名称"
|
||
placeholder="请填写文件名称" autocomplete="off" value="" class="layui-input">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item list">
|
||
<label class="layui-form-label">文件号:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" name="number" lay-verify="required" lay-reqtext="请填写文件号"
|
||
placeholder="请填写文件号" autocomplete="off" value="" class="layui-input">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item list">
|
||
<label class="layui-form-label">拟稿人:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" name="createUser" lay-verify="required" lay-reqtext="请填写拟稿人"
|
||
placeholder="请填写拟稿人" autocomplete="off" value="" class="layui-input">
|
||
</div>
|
||
</div>
|
||
<div class="layui-form-item list">
|
||
<label class="layui-form-label">发布时间:</label>
|
||
<div class="layui-input-block">
|
||
<input type="text" name="createTime" lay-verify="date" value="" placeholder="请选择时间"
|
||
autocomplete="off" class="layui-input layui-time">
|
||
</div>
|
||
</div>
|
||
<!--div class="layui-form-item list renew-list">
|
||
<label class="layui-form-label">主管部门:</label>
|
||
<div class="layui-input-block">
|
||
<select name="deptId" lay-filter="aihao" xm-select="select" xm-select-show-count="3">
|
||
<option value="">请选择</option>
|
||
</select>
|
||
</div>
|
||
</div-->
|
||
</div>
|
||
<!---->
|
||
<div class="add-path add-border">
|
||
<div class="layui-form-item list">
|
||
<label class="layui-form-label">文件路径:</label>
|
||
<div class="layui-input-block">
|
||
<a href="javascript:;" class="click-history">选择文件路径</a>
|
||
</div>
|
||
</div>
|
||
<ul class="path-list"></ul>
|
||
</div>
|
||
<!---->
|
||
<div class="add-list-upload">
|
||
<div class="layui-form-item list">
|
||
<label class="layui-form-label">上传文件:</label>
|
||
<div class="layui-input-block">
|
||
<div class="layui-upload">
|
||
<button type="button" class="upload-btn" id="uploadFile">上传文件</button>
|
||
<div id="uploadFileList"></div>
|
||
<div class="layui-upload-list"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!---->
|
||
|
||
<!--保存-->
|
||
<div class="upload-form">
|
||
<button class="flie-btn" lay-submit lay-filter="formDemo">保存</button>
|
||
<button type="reset" class="flie-btn flie-btn-primary">重置</button>
|
||
</div>
|
||
</form>
|
||
</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">全部文件</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" lay-submit lay-filter="formFile">保存</button>
|
||
<button type="reset" class="flie-btn flie-btn-primary">重置</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<link rel="stylesheet" type="text/css" href="js/layui/formSelects-v4.css" />
|
||
<!--多选-->
|
||
<script src="js/layui/formSelects-v4.min.js" type="text/javascript" charset="utf-8"></script>
|
||
<script>
|
||
var fileAjaxData = {
|
||
current: '',
|
||
isPublic: 1,
|
||
parentFolderId: 0,
|
||
size: '',
|
||
isUpload: 1
|
||
}
|
||
let pressw = ''
|
||
var folderIds = []
|
||
|
||
$(function() {
|
||
|
||
$(".click-history").click(function() {
|
||
$('.upload').show()
|
||
getFileList(fileAjaxData)
|
||
});
|
||
var this_code = "";
|
||
getDingCode();
|
||
//获取免登授权码
|
||
function getDingCode() {
|
||
dd.runtime.permission.requestAuthCode({
|
||
corpId: corpId,
|
||
onSuccess: function(result) {
|
||
this_code = result.code;
|
||
},
|
||
onFail: function(err) {
|
||
console.log(err)
|
||
}
|
||
});
|
||
}
|
||
|
||
layui.use(['form', 'formSelects', 'upload', 'jquery', 'element', 'layer'], function() {
|
||
var form = layui.form;
|
||
var formSelects = layui.formSelects;
|
||
var upload = layui.upload;
|
||
var element = layui.element;
|
||
var layer = layui.layer;
|
||
var uploadaddIntervalScript = setInterval(function() {
|
||
var tmpHaveLogin = localStorage['haveLogin'] || false;
|
||
if (tmpHaveLogin) {
|
||
clearInterval(uploadaddIntervalScript);
|
||
getMainDeptList(fileAjaxData.isPublic)
|
||
}
|
||
}, 500);
|
||
|
||
form.on('radio(isPublic)', function(data) {
|
||
fileAjaxData.isPublic = data.value
|
||
getMainDeptList(fileAjaxData.isPublic)
|
||
});
|
||
|
||
var uploadNum = 0
|
||
var percent = ''
|
||
var uploadTime;
|
||
var uploadUrl = ''
|
||
//上传文件
|
||
upload.render({
|
||
elem: '#uploadFile',
|
||
url: host + '/ding/file/uploadFile',
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' + localStorage.accessToken
|
||
},
|
||
field: 'file',
|
||
data: {
|
||
code: this_code
|
||
},
|
||
accept: 'file'
|
||
// ,acceptMime: '.docx,.doc,.xlsx,.xls,.pdf,.ppt,pptx,.png,.jpg,.jpeg,.gif,.csv'
|
||
,
|
||
acceptMime: '*',
|
||
multiple: false //多文件
|
||
,
|
||
number: 1,
|
||
before: function(obj) {
|
||
this.data.code = this_code;
|
||
getDingCode();
|
||
obj.preview(function(index, file, result) {
|
||
uploadNum++
|
||
pressw = ''
|
||
var html = '<div class="list">' +
|
||
'<p>' + file.name + '</p>' +
|
||
'<span class="del" data-id="' + uploadNum +
|
||
'" onclick="uploadDel(this)">x</span>' +
|
||
'<i class="progress' + uploadNum + '" id="press"></i>' +
|
||
'</div>'
|
||
//$('.layui-upload-list').append(html)
|
||
$('.layui-upload-list').html(html)
|
||
var n = 0
|
||
var that = $('.layui-upload-list .list')
|
||
uploadTime = setInterval(
|
||
function() { //按照时间随机生成一个小于95的进度,具体数值可以自己调整
|
||
n = n + Math.random() * 10 | 0;
|
||
if (n > 95) {
|
||
n = 95;
|
||
clearInterval(uploadTime);
|
||
}
|
||
that.eq(uploadNum - 1).find('i').css('width',
|
||
n + '%')
|
||
}, 50 + Math.random() * 100);
|
||
});
|
||
},
|
||
done: function(res, index, upload) {
|
||
if (res.code == 200) {
|
||
pressw = ''
|
||
let fileInput = '<input type="hidden" name="files[]" id="for-del-' +
|
||
uploadNum + '" class="fileUpload" data-id="' + res.data.id +
|
||
'" data-filename="' + res.data.name + '" data-filesize="' + res
|
||
.data.size + '" data-spaceid="' + res.data.spaceId +
|
||
'" value="' + res.data.url + '" />';
|
||
clearInterval(uploadTime);
|
||
$('.progress' + uploadNum).css('width', '100%');
|
||
let wi = document.getElementById("press")
|
||
pressw = wi.style.width
|
||
//$('#uploadFileList').append(fileInput);
|
||
$('#uploadFileList').html(fileInput);
|
||
$('.list').addClass('list-cg');
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
time: 1500
|
||
});
|
||
}
|
||
},
|
||
allDone: function(obj) {
|
||
clearInterval(uploadTime);
|
||
$('.layui-upload-list .list i').css('width', '100%')
|
||
}
|
||
});
|
||
|
||
//选择文件夹
|
||
form.on('submit(formFile)', function(data) {
|
||
$('.list-content#Chart ul li').each(function() {
|
||
if ($(this).attr('class') ==
|
||
'list upload_selection upload_list_acive') {
|
||
folderIds.push({
|
||
id: $(this).attr('data-id'),
|
||
name: $(this).attr('data-name'),
|
||
})
|
||
var html = '<li>部门名称>' + $(this).attr('data-name') +
|
||
'<span class="path-del" onclick="folderDel(this)" data-id="' +
|
||
$(this).attr('data-id') + '">x</span></li>'
|
||
$('.path-list').append(html)
|
||
}
|
||
})
|
||
$('.history.upload').hide()
|
||
|
||
return false
|
||
})
|
||
|
||
layui.$('#data-form').on('submit', function(e) {
|
||
e.preventDefault();
|
||
});
|
||
|
||
//监听提交
|
||
form.on('submit(formDemo)', function(data) {
|
||
// console.log('宽度:'+pressw);
|
||
if(pressw!='100%') {
|
||
// console.log('不等于100%');
|
||
return false
|
||
} else {
|
||
// console.log('等于100%');
|
||
var files = [];
|
||
if (folderIds.length == 0) {
|
||
layer.msg("请选择文件路径", {
|
||
icon: 5,
|
||
shift: 6
|
||
}, function() {
|
||
$(".click-history").click();
|
||
});
|
||
return false;
|
||
}
|
||
$('.fileUpload').each(function() {
|
||
files.push({
|
||
url: $(this).val(),
|
||
dingFileId: $(this).data('id'),
|
||
dingFileName: $(this).data('filename'),
|
||
dingFileSize: $(this).data('filesize'),
|
||
dingSpaceId: $(this).data('spaceid')
|
||
});
|
||
});
|
||
|
||
|
||
var ajaxData = {
|
||
createTime: data.field.createTime + " 00:00:00",
|
||
createUser: '',
|
||
deptId: parseInt(data.field.deptId),
|
||
drafter: data.field.createUser,
|
||
folderIds: folderIds.map(function(item) {
|
||
return item.id
|
||
}),
|
||
// groupId: "",
|
||
// id: '',
|
||
// isDeleted:'',
|
||
// isHistory: "",
|
||
// isNew: '',
|
||
isPublic: data.field.isPublic,
|
||
isUpdate: 0,
|
||
name: data.field.name,
|
||
number: data.field.number,
|
||
// status: '',
|
||
// type: "",
|
||
// updFileId: '',
|
||
// updateTime: "",
|
||
// updateUser: "",
|
||
// url: data.field.files[0],
|
||
dingFileDetails: files
|
||
}
|
||
|
||
|
||
$.ajax({
|
||
url: host + '/ding/file/addFile' + '?timetmp=' + Date.parse(
|
||
new Date()).toString().substr(0, 10),
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' + localStorage.accessToken
|
||
},
|
||
data: JSON.stringify(ajaxData),
|
||
type: "post",
|
||
contentType: "application/json",
|
||
dataType: "json",
|
||
success: function(data) {
|
||
if (data.code == 200) {
|
||
window.location = 'upload.html';
|
||
//window.location.reload()
|
||
} else {
|
||
layer.msg(data.responseJSON.msg)
|
||
}
|
||
},
|
||
error: function(data) {
|
||
layer.msg(data.responseJSON.msg)
|
||
}
|
||
});
|
||
|
||
return false;
|
||
}
|
||
});
|
||
|
||
|
||
//获取主管部门
|
||
function getMainDeptList(isPublic) {
|
||
$.ajax({
|
||
url: host + '/ding/file/getMainDeptList' + '?timetmp=' + Date.parse(
|
||
new Date()).toString().substr(0, 10),
|
||
headers: {
|
||
'Blade-Auth': 'bearer ' + localStorage.accessToken
|
||
},
|
||
data: {
|
||
isPublic: isPublic
|
||
},
|
||
type: "get",
|
||
contentType: "application/x-www-form-urlencoded",
|
||
dataType: "json",
|
||
success: function(data) {
|
||
if (data.code == 200) {
|
||
$('.renew-list select').empty()
|
||
if (data.data.length > 0) {
|
||
data.data.forEach(function(item) {
|
||
$('.renew-list select').append(
|
||
'<option value="' + item.id + '">' +
|
||
item.name + '</option>')
|
||
})
|
||
}
|
||
formSelects.render();
|
||
} else {
|
||
layer.msg(data.msg)
|
||
}
|
||
},
|
||
error: function(data) {
|
||
console.log(data);
|
||
}
|
||
});
|
||
}
|
||
|
||
});
|
||
});
|
||
|
||
//删除文件路径
|
||
function folderDel(obj) {
|
||
folderIds.forEach(function(item, i) {
|
||
if (item.id == $(obj).attr('data-id')) {
|
||
folderIds.splice(i, 1)
|
||
}
|
||
})
|
||
$(obj).parent().remove();
|
||
}
|
||
|
||
//删除上传
|
||
function uploadDel(that) {
|
||
pressw = ''
|
||
var id = $(that).data('id');
|
||
$('#for-del-' + id).remove();
|
||
$(that).parent().remove() //删除当前
|
||
}
|
||
|
||
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 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') + '"> > ' + $(obj).text() + '</a>')
|
||
}
|
||
|
||
//文件夹选择
|
||
function choiceFolder(that) {
|
||
$(that).toggleClass('upload_list_acive');
|
||
}
|
||
|
||
//文件列表
|
||
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 upload_selection" ondblclick="openFolder(this)" onclick="choiceFolder(this)" data-id="' +
|
||
item.id + '" data-name="' + item.name + '">' +
|
||
'<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) {
|
||
$('.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);
|
||
}
|
||
});
|
||
}
|
||
</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>
|