钉钉修改

master
tangyi 2021-12-08 18:12:10 +08:00
parent 5ba09c9c14
commit 3bc8a21c49
14 changed files with 1844 additions and 542 deletions

103
dist/css/style.css vendored
View File

@ -1842,7 +1842,7 @@ a.color-b:hover {
background-color: rgba(0, 0, 0, .4);
}
.list-img {
.onClickList .list-img {
position: absolute;
right: 30px;
display: none;
@ -1850,6 +1850,8 @@ a.color-b:hover {
width: 25px;
}
.file-tit-btn {
width: 100px;
height: 30px;
@ -1999,6 +2001,105 @@ a.color-b:hover {
width: 100%;
}
.nameMake {
width: 100%;
height: 100%;
display: flex;
align-items: center;
position: absolute;
left: 0px;
display: none;
top: 0px;
z-index: 3;
}
.nameMake-con {
width: 100%;
height: 100%;
margin: auto;
background-color: #fff;
}
.nameMake-con .tit-name {
font-size: 26px;
font-weight: bold;
padding-top: 20px;
text-align: center;
}
.nameMake-cona {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 60px;
}
.nameMake-cona p {
display: flex;
margin-bottom: 30px;
align-items: center;
}
.nameMake-cona span {
display: inline-block;
font-size: 20px;
margin-right: 10px;
margin-left: 10px;
}
.nameMake-btn {
display: flex;
justify-content: center;
}
.nameMake-btn button {
width: 150px;
height: 40px;
color: #fff;
margin: 40px 20px;
background-color: #397cdd;
display: flex;
align-items: center;
font-size: 20px;
border: none;
justify-content: center;
}
.nameMake-cona input {
width: 300px;
height: 30px;
}
.mobileGroup {
position: absolute;
right: 160px;
top: 15px;
font-weight: 400;
font-size: 12px;
color: #fff;
text-decoration: none;
background: #3d59f8;
display: inline-block;
position: absolute;
padding: 0 20px;
height: 30px;
line-height: 30px;
text-align: center;
border: none;
border-radius: 5px;
}
.organization-con {
width: 100%;
left: 0px;
z-index: 10;
top: 0px;
height: 100%;
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
}
.listBtn {
position: absolute;
right: 200px;

422
dist/hidefile.html vendored
View File

@ -292,7 +292,7 @@
</script>
<!--内容-->
<div class="f-r content content-pd-50">
<div class="content-auto" data-id="11" >
<div class="content-auto" data-id="11">
<div class="con-tit font-20 pc-block">
隐藏文件
</div>
@ -343,8 +343,29 @@
</form>
</div>
<!--内容-->
<div class="con-list bg-w top20 phone-bg-none phone-top-0">
<div class="con-list bg-w top20 phone-bg-none phone-top-0 pr">
<!--手机-->
<div class="nameMake">
<div class="nameMake-con">
<p class="tit-name">修改文件夹名称</p>
<div class="nameMake-cona">
<p>
<span>文件1</span>
<input type="text">
</p>
</div>
<div class="nameMake-btn">
<button onclick="nameMakeConfirm()">确定修改</button><button>取消修改</button>
</div>
</div>
</div>
<div class="phone-tit phone-block">
<div class="name" id="phone-menu">
<!-- <a href="javascript:;" class="active">公共文件</a>
@ -368,17 +389,24 @@
</div>
<!--pc-->
<div class="name">
<span class="font-14" id="folder-navigation"><i class="icon-back"></i><a href="hidefile.html"
data-id="0">全部文件</a></span>
<span class="font-14" id="folder-navigation"><i class="icon-back"></i><a href="hidefile.html" data-id="0">全部文件</a></span>
<input type="hidden" id="navigation" value="">
<ul class="con-list-mero pc-block" role="tablist">
<li role="presentation" class="active">
<a class="img-list" href="#Chart" aria-controls="Chart" role="tab" data-toggle="tab">&nbsp;</a>
</li>
<li role="presentation">
<a href="#tab" aria-controls="tab" role="tab" data-toggle="tab" class="tab-list">&nbsp;</a>
</li>
</ul>
<div>
<div class="listBtn">
<button type="button" onclick="editorName()">修改名字</button>
<button type="button" onclick="hgiddenFiles()">显示文件</button>
<button type="button " onclick="editorButton(this)">编辑文件</button>
</div>
<ul class="con-list-mero pc-block" role="tablist">
<li role="presentation" class="active">
<a class="img-list" href="#Chart" aria-controls="Chart" role="tab" data-toggle="tab">&nbsp;</a>
</li>
<li role="presentation">
<a href="#tab" aria-controls="tab" role="tab" data-toggle="tab" class="tab-list">&nbsp;</a>
</li>
</ul>
</div>
</div>
<div class="con-list-cn tab-content">
<div class="list-content active tab-pane" role="tabpanel" id="Chart">
@ -421,7 +449,7 @@
<h3>文件名称</h3>
<p></p>
<a href="#" class="btn1" id="preview-button" onclick="previewBtn(this)">预览</a>
<a onclick="downloadfile(this)" id="download" class="btn2" download="">下载</a>
<a onclick="downloadfile(this)" id="download" class="btn2" download="">下载</a>
</div>
</div>
</div>
@ -464,31 +492,49 @@
startTime: '',
type: ''
}
let dataEditor = {
editorIf: true,
editorData: [],
rows: []
}
function editorButton(obj) {
if (dataEditor.editorIf) {
$(obj).html("取消编辑")
} else {
$(obj).html("编辑文件")
$(".onClickListOne").attr("data-click", "1")
$(".onClickListOne").children(".list-img").css("display", "none")
$(".onClickListOne").css("background", "rgba(0,0,0,0)")
$(".onClickListTwo").parent().css("background", "rgba(0,0,0,0)")
$(".onClickListTwo").attr("data-click", "1")
$(".onClickListTwo").prev().css("display", "none")
}
dataEditor.editorIf = !dataEditor.editorIf
}
var serch_flag = false;
$(function() {
$(function () {
layui.use(['form', 'upload', 'element', 'layer'], function() {
layui.use(['form', 'upload', 'element', 'layer'], function () {
var form = layui.form;
var upload = layui.upload;
var element = layui.element;
var layer = layui.layer;
//var haveLogin = localStorage['haveLogin'] || false;
var loginInterval = setInterval(function() {
var loginInterval = setInterval(function () {
var tmpHaveLogin = localStorage['haveLogin'] || false;
if (tmpHaveLogin) {
clearInterval(loginInterval);
pageInit();
}
}, 500);
function pageInit() {
getFileType();
getFileList(ajaxData);
}
$('#toggle-filter').on('click', function() {
$('#toggle-filter').on('click', function () {
layer.open({
type: 1,
title: ['文件过滤', 'font-size:18px;padding:0;text-align:center'],
@ -497,8 +543,8 @@
area: ['100%', '100%'],
closeBtn: 1,
skin: 'file-filter-layer',
success: function(dom, index) {
dom.find('.layui-btn[lay-submit]').on('click', function() {
success: function (dom, index) {
dom.find('.layui-btn[lay-submit]').on('click', function () {
layer.close(index);
});
}
@ -506,7 +552,7 @@
});
//搜索
form.on('submit(formDemo)', function(data) {
form.on('submit(formDemo)', function (data) {
ajaxData = {
createUser: data.field.createUser,
drafter: data.field.drafter,
@ -529,23 +575,23 @@
//文件类型
function getFileType() {
$.ajax({
url: host + '/ding/file/getFileType'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/getFileType' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + accessToken,
},
data: {},
type: "get",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
if (data.data.length > 0) {
data.data.forEach(function(item) {
data.data.forEach(function (item) {
$('.con-search select[name=type]').append(
'<option value="' + item + '">' + item +
'</option>')
})
form.render()
}
}
// else {
// layer.msg('暂无记录')
// }
@ -553,7 +599,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -563,11 +609,11 @@
})
function init() {
$('.con-list .name span .icon-back').off("click").click(function() {
$('.con-list .name span .icon-back').off("click").click(function () {
var that = $(this);
if (serch_flag) {
$("#search-form")[0].reset();
layui.use(['form'], function() {
layui.use(['form'], function () {
var form = layui.form;
form.render();
})
@ -605,12 +651,12 @@
serch_flag = false;
});
//路由事件
$('#folder-navigation a').off("click").click(function() {
$('#folder-navigation a').off("click").click(function () {
var that = $(this)
console.log(that.attr('data-id'), 'parentFolderId');
ajaxData.parentFolderId = that.attr('data-id')
ajaxData.name = '';
$('.con-list .name span a').each(function() {
$('.con-list .name span a').each(function () {
if ($(this).index() >= that.index()) {
$('.con-list .name span a').eq($(this).index()).remove()
}
@ -624,7 +670,7 @@
//历史记录
function getHistory(obj) {
$.ajax({
url: host + '/ding/file/getHistory'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/getHistory' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + accessToken,
},
@ -633,18 +679,18 @@
},
type: "get",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
if (data.data.length > 0) {
var html = '';
data.data.forEach(function(item) {
data.data.forEach(function (item) {
html += '<tr>' +
'<td><div class="list-img click-download" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
'" data-dingname="' + item.dingFileName + '" data-dingsize="' + item
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
'"><img src="image/icon_22.png"><span>' + item.name +
'</span></div></td>'
html += '<td>';
@ -659,7 +705,7 @@
})
$(".history .table tbody").html(html)
$(".history").show();
}
}
// else {
// layer.msg('暂无记录')
// }
@ -667,7 +713,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -675,7 +721,57 @@
}
//打开文件夹
function openIf(data) {
if (dataEditor.editorIf) {
if ($(data).attr("data-if") == 1) {
openFolder(data)
} else {
openFile(data)
}
} else {
if ($(data).attr("data-click") == "1") {
if ($(data).attr("data-if") == 1) {
$(data).children(".list-img").css("display", "block")
$(data).css("background", "#f5f6ff")
dataEditor.editorData.push({
id: $(data).attr("data-id"),
folder: true
})
} else {
$(data).prev().css("display", "block")
$(data).parent().css("background", "#f5f6ff")
dataEditor.editorData.push({
id: $(data).attr("data-id"),
folder: false
})
}
$(data).attr("data-click", "0")
} else {
if ($(data).attr("data-if") == 1) {
$(data).children(".list-img").css("display", "none")
$(data).css("background", "#fff")
let ina = screening(dataEditor.editorData, $(data).attr("data-id"))
dataEditor.editorData.splice(ina, 1)
} else {
$(data).prev().css("display", "none")
$(data).parent().css("background", "#fff")
let ina = screening(dataEditor.editorData, $(data).attr("data-id"))
dataEditor.editorData.splice(ina, 1)
}
$(data).attr("data-click", "1")
}
console.log(dataEditor.editorData);
}
}
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'));
@ -687,7 +783,7 @@
function downloadfile(obj) {
var id = $(obj).data('fileid');
$.ajax({
url: host + '/ding/file/downLoadFile'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/downLoadFile' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
@ -697,17 +793,17 @@
type: "get",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
$(obj).attr('data', data.data);
console.log(data.data);
window.open(data.data);
window.open(data.data);
} else {
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -766,52 +862,167 @@
// }
// });
}
//隐藏文件
function hideFile(obj){
layer.confirm('确认显示这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function(index, layero){
//按钮【按钮一】的回调
$.ajax({
url: host + '/ding/file/disPlayFile'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
data: {
fileId:$(obj).attr("data-id"),
isShow:1
},
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
if(data.code==200){
layer.msg('显示成功')
getFileList(ajaxData)
}else{
layer.msg(data.msg)
}
},
error: function(data) {
console.log(data);
}
})
}, function(index){
//按钮【按钮二】的回调
layer.closeAll();
function hgiddenFiles(obj) {
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
console.log(arr2);
if (arr2) {
layer.msg("不能显示文件夹")
return
}
layer.confirm('确认显示这些文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let objD = {
fileIds: [],
isShow: 1
}
for (let index = 0; index < dataEditor.editorData.length; index++) {
objD.fileIds.push(dataEditor.editorData[index].id)
}
let contentType = "application/json"
let url = host + '/ding/file/disPlayFiles'
dxtcRequest('post', url, JSON.stringify(objD), function name(data) {
if (data.code == 200) {
console.log(data);
layer.msg('显示成功')
getFileList(ajaxData)
} else {
layer.msg(data.msg)
}
}, contentType)
layer.closeAll();
}, function (index) {
//按钮【按钮二】的回调
layer.closeAll();
});
return false;
}
function hideFile(obj) {
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
//按钮【按钮一】的回调
$.ajax({
url: host + '/ding/file/disPlayFile' + '?timetmp=' + Date.parse(new Date()).toString()
.substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
data: {
fileId: $(obj).attr("data-id"),
isShow: 0
},
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (data) {
if (data.code == 200) {
layer.msg('隐藏成功')
getFileList(ajaxData)
} else {
layer.msg(data.msg)
}
},
error: function (data) {
console.log(data);
layer.msg(data.responseJSON.msg)
}
})
}, function (index) {
//按钮【按钮二】的回调
layer.closeAll();
});
return false;
}
//修改文件名
function editorName() {
console.log(dataEditor.rows, "--------------");
console.log(dataEditor.editorData, "--------------");
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能重命名文件夹")
return
}
let editorNameData = []
for (let index = 0; index < dataEditor.editorData.length; index++) {
for (let k = 0; k < dataEditor.rows.files.length; k++) {
if (dataEditor.editorData[index].id == dataEditor.rows.files[k].id) {
editorNameData.push(dataEditor.rows.files[k])
}
}
}
$(".nameMake").css("display", "flex")
let str = editorNameData.map((v, i) => ` <p>
<span>文件${i + 1}</span>
<input value='${v.name}' data-id="${v.id}" type="text">
</p>`).join("")
$(".nameMake-cona").html(str)
}
function modifyName(data) {
let contentType = "application/json"
let url = host + '/ding/file/updateFile'
dxtcRequest('post', url, JSON.stringify(data), function name(data) {
if (data.code == 200) {
console.log(data);
} else {
layer.msg(data.msg)
}
}, contentType)
}
function nameMakeConfirm(params) {
layer.confirm('确认修改这些文件名嘛?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let arr = []
for (let index = 0; index < $(".nameMake-cona input").length; index++) {
arr.push({
name: $($(".nameMake-cona input")[index]).val(),
id: $($(".nameMake-cona input")[index]).attr("data-id")
})
}
for (let index = 0; index < arr.length; index++) {
modifyName(arr[index])
}
getFileList(ajaxData)
$(".nameMake").css("display", "none")
layer.closeAll();
}, function (index) {
layer.closeAll();
});
}
//影藏文件列表
function getFileList(ajaxData) {
console.log(ajaxData, 'getFileList');
$('.list-content#Chart ul').empty()
$('.list-content#tab tbody').empty()
$.ajax({
url: host + '/ding/file/getDisplayFile'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/getDisplayFile' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
@ -819,21 +1030,22 @@
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
success: function (data) {
dataEditor.rows = data.data
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function(item) {
data.data.folders.forEach(function (item) {
var html1 =
'<li class="list" onclick="openFolder(this)" ondblclick="openFolder(this)" data-id="' +
item.id + '">' +
'<div class="img"><img src="image/'+(item.folderType=="0"?"icon_11.png":"icon_11_2.png")+'"></div>' +
'<li class="list onClickListOne onClickList" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' + item.id + '">' +
'<img class="list-img" src="./image/icon_30.png">' +
'<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)
var html2 = '<tr>' +
'<td><div class="list-img" onclick="openFolder(this)" ondblclick ="openFolder(this)" data-id="' +
item.id + '"><img src="image/'+(item.folderType=="0"?"icon_11.png":"icon_11_2.png")+'"><span>' + item.name +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick ="openIf(this)" data-id="' +
item.id + '"><img src="image/' + (item.folderType == "0" ? "icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'</span></div></td>' +
'<td></td>' +
'<td></td>' +
@ -848,30 +1060,28 @@
})
}
if (data.data.files.length > 0) {
data.data.files.forEach(function(item) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list click-download" >'
+ '<div class="more">'
+ '<span>...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">显示</div>'
+ '</div>'+
'<div class="img" onclick="openFile(this)" data-id="' +
'<li class="list click-download ps onClickList" >'
+ (item.isPublic == "0" ?
"<span class='internal'></span>" : "") +
'<img class="list-img" src="./image/icon_30.png">' +
'<div class="img onClickListTwo" data-if="2" data-click="1" onclick="openIf(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
'" data-dingname="' + item.dingFileName + '" data-dingsize="' + item
.dingFileSize + '" data-spaceid="' + item.dingSpaceId + '"><img src="image/icon-file/icon_' + item.type +
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
'"><img src="image/icon-file/icon_' + item.type +
'.png"></div>' +
'<div class="text-two-hide list-hight">' + item.name + '</div>' +
'</li>'
$('.list-content#Chart ul').append(html1)
var html2 = '<tr>' +
'<td>'
+ '<div class="more">'
+ '<span>...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">显示</div>'
@ -879,8 +1089,8 @@
+
'<div class="list-img" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" ><img src="image/icon-file/icon_' + item.type +
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" ><img src="image/icon-file/icon_' + item.type +
'.png"><span>' + item.name + '</span></div></td>' +
'<td>' + item.number + '</td>' +
'<td><div class="list-img"><span>' + item.drafter +
@ -908,7 +1118,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -964,4 +1174,4 @@
$('#2').click(function(){
localStorage.setItem('pubilc','功能区')
})
</script>
</script>

119
dist/index.html vendored
View File

@ -343,8 +343,30 @@
</form>
</div>
<!--内容-->
<div class="con-list bg-w top20 phone-bg-none phone-top-0">
<div class="con-list bg-w top20 phone-bg-none phone-top-0 pr">
<!--手机-->
<div class="nameMake">
<div class="nameMake-con">
<p class="tit-name">修改文件夹名称</p>
<div class="nameMake-cona">
<p>
<span>文件1</span>
<input type="text">
</p>
</div>
<div class="nameMake-btn">
<button onclick="nameMakeConfirm()">确定修改</button><button>取消修改</button>
</div>
</div>
</div>
<div class="phone-tit phone-block">
<div class="name" id="phone-menu">
<!-- <a href="javascript:;" class="active">公共文件</a>
@ -378,7 +400,7 @@
<input type="hidden" id="navigation" value="">
<div>
<div class="listBtn">
<button type="button"></button>
<button type="button" onclick="editorName()">修改名字</button>
<button type="button" onclick="hgiddenFiles()">隐藏文件</button>
<button type="button " onclick="editorButton(this)">编辑文件</button>
</div>
@ -478,6 +500,7 @@
let dataEditor = {
editorIf: true,
editorData: [],
rows: []
}
function editorButton(obj) {
if (dataEditor.editorIf) {
@ -708,7 +731,13 @@
function openIf(data) {
if (dataEditor.editorIf) {
openFolder(data)
if ($(data).attr("data-if") == 1) {
openFolder(data)
} else {
openFile(data)
}
} else {
if ($(data).attr("data-click") == "1") {
if ($(data).attr("data-if") == 1) {
@ -752,6 +781,7 @@
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'));
@ -846,13 +876,84 @@
// });
}
// 文件夹重命名
function editorName() {
console.log(dataEditor.rows);
console.log(dataEditor.editorData);
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能重命名文件夹")
return
}
let editorNameData = []
for (let index = 0; index < dataEditor.editorData.length; index++) {
for (let k = 0; k < dataEditor.rows.files.length; k++) {
if (dataEditor.editorData[index].id == dataEditor.rows.files[k].id) {
editorNameData.push(dataEditor.rows.files[k])
}
}
}
$(".nameMake").css("display", "flex")
let str = editorNameData.map((v, i) => ` <p>
<span>文件${i + 1}</span>
<input value='${v.name}' data-id="${v.id}" type="text">
</p>`).join("")
$(".nameMake-cona").html(str)
}
function modifyName(data) {
let contentType = "application/json"
let url = host + '/ding/file/updateFile'
dxtcRequest('post', url, JSON.stringify(data), function name(data) {
if (data.code == 200) {
console.log(data);
} else {
layer.msg(data.msg)
}
}, contentType)
}
function nameMakeConfirm(params) {
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let arr = []
for (let index = 0; index < $(".nameMake-cona input").length; index++) {
arr.push({
name: $($(".nameMake-cona input")[index]).val(),
id: $($(".nameMake-cona input")[index]).attr("data-id")
})
}
for (let index = 0; index < arr.length; index++) {
modifyName(arr[index])
}
getFileList(ajaxData)
$(".nameMake").css("display", "none")
layer.closeAll();
}, function (index) {
layer.closeAll();
});
}
//隐藏文件
function hgiddenFiles(obj) {
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能隐藏文件夹")
return
}
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
@ -948,12 +1049,13 @@
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (data) {
dataEditor.rows = data.data
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function (item) {
var html1 =
'<li class="list onClickListOne" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' +
'<li class="list onClickListOne onClickList" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' +
item.id + '">' +
'<img class="list-img" src="./image/icon_30.png">' +
'<div class="img"> <img src="image/' + (item.folderType == "0" ?
@ -962,7 +1064,7 @@
'</li>'
$('.list-content#Chart ul').append(html1)
var html2 = '<tr>' +
'<td><div class="list-img" onclick="openIf(this)" ondblclick ="openIf(this)" data-id="' +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick ="openIf(this)" data-id="' +
item.id + '"><img src="image/' + (item.folderType == "0" ?
"icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'</span></div></td>' +
@ -979,17 +1081,12 @@
})
$(".onClickList").on("click", () => {
})
$(".onClickList").on("ondblclick", () => {
})
}
if (data.data.files.length > 0) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list click-download ps" >'
'<li class="list click-download ps onClickList" >'
+ (item.isPublic == "0" ?
"<span class='internal'></span>" : "") +

139
dist/inside.html vendored
View File

@ -344,8 +344,23 @@
</form>
</div>
<!--内容-->
<div class="con-list bg-w top20 phone-bg-none phone-top-0">
<div class="con-list bg-w top20 phone-bg-none phone-top-0 pr">
<!--手机-->
<div class="nameMake">
<div class="nameMake-con">
<p class="tit-name">修改文件夹名称</p>
<div class="nameMake-cona">
<p>
<span>文件1</span>
<input type="text">
</p>
</div>
<div class="nameMake-btn">
<button onclick="nameMakeConfirm()">确定修改</button><button>取消修改</button>
</div>
</div>
</div>
<div class="phone-tit phone-block">
<div class="name" id="phone-menu">
<!-- <a href=" index.html">公共文件</a>
@ -373,7 +388,7 @@
<input type="hidden" id="navigation" value="">
<div>
<div class="listBtn">
<button type="button"></button>
<button type="button" onclick="editorName()">修改名字</button>
<button type="button" onclick="hgiddenFiles()">隐藏文件</button>
<button type="button " onclick="editorButton(this)">编辑文件</button>
</div>
@ -474,6 +489,7 @@
let dataEditor = {
editorIf: true,
editorData: [],
rows: []
}
function editorButton(obj) {
if (dataEditor.editorIf) {
@ -707,6 +723,9 @@
//打开文件夹
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
console.log(obj);
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'))
@ -744,9 +763,15 @@
}
function openIf(data) {
console.log(data);
if (dataEditor.editorIf) {
openFolder(data)
if ($(data).attr("data-if") == 1) {
openFolder(data)
} else {
openFile(data)
}
} else {
if ($(data).attr("data-click") == "1") {
if ($(data).attr("data-if") == 1) {
@ -787,15 +812,75 @@
}
}
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'));
$('#folder-navigation').append('<a data-id="' + $(obj).attr('data-id') + '"> > ' + $(obj).text() + '</a>');
serch_flag = false;
// 文件夹重命名
function editorName() {
console.log(dataEditor.rows, "--------------");
console.log(dataEditor.editorData, "--------------");
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能重命名文件夹")
return
}
let editorNameData = []
for (let index = 0; index < dataEditor.editorData.length; index++) {
for (let k = 0; k < dataEditor.rows.files.length; k++) {
if (dataEditor.editorData[index].id == dataEditor.rows.files[k].id) {
editorNameData.push(dataEditor.rows.files[k])
}
}
}
$(".nameMake").css("display", "flex")
let str = editorNameData.map((v, i) => ` <p>
<span>文件${i + 1}</span>
<input value='${v.name}' data-id="${v.id}" type="text">
</p>`).join("")
$(".nameMake-cona").html(str)
}
function modifyName(data) {
let contentType = "application/json"
let url = host + '/ding/file/updateFile'
dxtcRequest('post', url, JSON.stringify(data), function name(data) {
if (data.code == 200) {
console.log(data);
} else {
layer.msg(data.msg)
}
}, contentType)
}
function nameMakeConfirm(params) {
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let arr = []
for (let index = 0; index < $(".nameMake-cona input").length; index++) {
arr.push({
name: $($(".nameMake-cona input")[index]).val(),
id: $($(".nameMake-cona input")[index]).attr("data-id")
})
}
for (let index = 0; index < arr.length; index++) {
modifyName(arr[index])
}
getFileList(ajaxData)
$(".nameMake").css("display", "none")
layer.closeAll();
}, function (index) {
layer.closeAll();
});
}
//文件下载
function downloadfile(obj) {
var id = $(obj).data('fileid');
@ -872,6 +957,7 @@
});
if (arr2) {
layer.msg("不能隐藏文件夹")
return
}
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
@ -880,7 +966,7 @@
let objD = {
fileIds: [],
isShow: 0
isShow: 1
}
for (let index = 0; index < dataEditor.editorData.length; index++) {
@ -926,20 +1012,22 @@
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (data) {
dataEditor.rows = data.data
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function (item) {
console.log("======" + item.id + '=====');
var html1 =
'<li class="list" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this) data-id="' +
item.id + '">' +
'<li class="list onClickListOne onClickList" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' + item.id + '">' +
'<img class="list-img" src="./image/icon_30.png">' +
'<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)
var html2 = '<tr>' +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this) data-id="' +
item.id + '"><img src="image/' + (item.folderType == "0" ? "icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' + item.id + '"><img src="image/' + (item.folderType == "0" ? "icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'</span></div></td>' +
'<td></td>' +
'<td></td>' +
@ -956,19 +1044,16 @@
if (data.data.files.length > 0) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list click-download" >'
+ '<div class="more">'
+ '<span>...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">隐藏</div>'
+ '</div>' +
'<div class="img" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
'<li class="list click-download ps onClickList" >'
+
'<img class="list-img" src="./image/icon_30.png">' +
'<div class="img onClickListTwo" data-if="2" data-click="1" onclick="openIf(this)" data-id="' + item.id +
'" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
'" data-dingname="' + item.dingFileName + '" data-dingsize="' + item
.dingFileSize + '" data-spaceid="' + item.dingSpaceId + '" ><img src="image/icon-file/icon_' + item.type +
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
'"><img src="image/icon-file/icon_' + item.type +
'.png"></div>' +
'<div class="text-two-hide list-hight">' + item.name + '</div>' +
'</li>'
@ -980,8 +1065,6 @@
+ '<span onclick="showBtn(this)" >...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">隐藏</div>'
+ '</div>'
+ '<div class="list-img" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item

3
dist/js/script.js vendored
View File

@ -82,6 +82,7 @@ $(document).contextmenu(function (e) {
})
//判断是否在钉钉内
console.log(dd);
if (dd.env.platform !== "notInDingTalk") {
console.log('进入钉钉了');
// var host = 'http://192.168.0.184:12306'
@ -438,7 +439,7 @@ function dxtcRequest(type, url, data, successFunction, contentType = 'applicatio
function screening(arr, num) {
console.log(arr);
for (let index = 0; index < arr.length; index++) {
if (arr[index].id == num) {
return index
}

285
dist/organization.html vendored
View File

@ -302,9 +302,9 @@
<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;">
<input id="deptInput" class="form-input" type="hidden" name="policy_dept_ids" value="" style="display: none;">
</div>
</div>
</div>
@ -319,8 +319,7 @@
</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">
<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>
@ -333,16 +332,13 @@
<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>
<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>
<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>
<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">
@ -352,8 +348,7 @@
<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 href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="3" onclick="choosePeople(this, 'Admin')">
+添加人员
</a>
</div>
@ -365,8 +360,7 @@
<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 href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="5" onclick="choosePeople(this, 'opera')">
+添加人员
</a>
</div>
@ -378,8 +372,7 @@
<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 href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="6" onclick="choosePeople(this, 'look')">
+添加人员
</a>
</div>
@ -392,8 +385,61 @@
</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">&nbsp;</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" lay-submit lay-filter="formFile">保存</button>
<button type="reset" class="flie-btn flie-btn-primary">重置</button>
</div>
</form>
</div>
</div>
</div>
<script type="text/html" id="modal-tpl">
<div class="con-content">
<div class="con-mune bg-w">
@ -415,6 +461,8 @@
{{# }); }}
</ul>
</div>
</div>
</script>
@ -434,20 +482,30 @@
<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
}
//修改名称
$(".btn-edit-op").click(function() {
$(".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() {
$(".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() {
$('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)
@ -456,31 +514,31 @@
getDeptUsers(type, zuId, roleId);
})
//添加组织
$("#addDept").click(function() {
$("#addDept").click(function () {
if ($(".org-menu-list a.active").length == 0) {
layer.confirm('确认添加组织?', {
btn: ['确认', '取消'] //可以无限个按钮
}, function(index, layero) {
}, function (index, layero) {
//按钮【按钮一】的回调
var parentId = shangId;
// console.log('组织ID1'+parentId);
layer.closeAll();
addDept(parentId)
}, function(index) {
}, function (index) {
//按钮【按钮二】的回调
layer.closeAll();
});
} else {
// var parentId = $(".org-menu-list a.active").attr("data-id");
console.log('组织ID2'+shangId);
console.log('组织ID2' + shangId);
addDept(shangId)
}
});
function addDept(parentId) {
// console.log(parentId);
layer.prompt(function(value, index, elem) {
layer.prompt(function (value, index, elem) {
layer.alert(value); //得到value
layer.close(index);
var data = {
@ -497,16 +555,16 @@
type: "post",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
layer.msg("添加成功", function() {
layer.msg("添加成功", function () {
location.reload();
})
} else {
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
layer.msg(data.responseJSON.msg)
}
});
@ -518,9 +576,9 @@
$(".org-menu-list a.active").removeClass('active');
clearId()
}
function clearId(){//把上级组织ID设为0
function clearId() {//把上级组织ID设为0
shangId = 0
console.log("shangId:"+shangId);
console.log("shangId:" + shangId);
}
@ -529,14 +587,14 @@
tckd = ['90%', '90%'];
}
layui.use(['element', 'form', 'laydate', 'laypage', 'laytpl'], function() {
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 organizationIntervalScript = setInterval(function () {
var tmpHaveLogin = localStorage['haveLogin'] || false;
if (tmpHaveLogin) {
clearInterval(organizationIntervalScript);
@ -555,7 +613,7 @@
data: {},
type: "get",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
if (data.data.length > 0) {
$('.deptBtn').orgTree({
@ -569,7 +627,7 @@
defaultTitle: '请选择',
defaultButton: '+添加组织',
jsonData: data.data,
custom: function(event) {
custom: function (event) {
// form属性为true才会生效
var data = {
parentId: event[0].id,
@ -578,24 +636,24 @@
$.ajax({
url: host + '/ding/dept/addDept' +
'?timetmp=' + Date.parse(new Date())
.toString().substr(0, 10),
.toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' +
localStorage
.accessToken
.accessToken
},
data: JSON.stringify(data),
type: "post",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
getDeptList()
} else {
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
layer.msg(data.responseJSON.msg)
}
});
@ -606,7 +664,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
// console.log(data);
}
});
@ -620,15 +678,15 @@
let type = "get";
let data = {};
let roleId = $('.org-list .org-ul li.active a').data('role-id');
dxtcRequest(type, url, data, function(data) {
dxtcRequest(type, url, data, function (data) {
if (data.code == 200) {
let html = '';
let active = '';
$.each(data.data, function(index, value) {
$.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);
$('#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);
@ -647,7 +705,7 @@
function menu_list_html(data, index = 0) {
var html = "";
var null_str = ""
$.each(data, function(index, value) {
$.each(data, function (index, value) {
// html += '<li class="add-border" ><a href="javascript:;" data-id="' + value.id +
// '" data-folder-id="' + value.folderId + '" data-role-id="' + roleId +
// '" data-folder-name="' + value.deptName + '" onclick="changeDept(this)">' + value.deptName +
@ -660,7 +718,7 @@
'" 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 += "<ul class='org-menu-lis-children'>" + menu_list_html(value.children, { num: 0, id: value.id }) + "</ul>";
}
html += "</li>";
});
@ -668,8 +726,44 @@
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');
@ -681,6 +775,12 @@
}
// 选中组织
function change(obj) {
console.log(dataOrganization.state);
if (dataOrganization.state) {
$('.upload').show()
getFileList(fileAjaxData)
return
}
shangId = $(obj).data('id');
zuId = $(obj).data('folder-id');
chuFolderId = zuId
@ -689,7 +789,7 @@
// console.log('顶级组织ID' + shangId);
// console.log('当前组织ID' + zuId);
let roleId = $('.org-list .org-ul li.active a').data('role-id');
// console.log('roleId' + roleId);
// console.log('roleId' + roleId);
getDeptUsers('Admin', zuId, roleId);
}
//收起
@ -719,7 +819,7 @@
'roleId': roleId
};
$('.org-remarks-add').attr('data-folder-id', folderId);
dxtcRequest('get', url, data, function(data) {
dxtcRequest('get', url, data, function (data) {
if (data.code == 200) {
if (MobileLib.isMobile()) {
layer.closeAll();
@ -733,16 +833,16 @@
type: type,
users: data.data.userList || []
}),
success: function($p, idx1) {
$p.find('.name > span').on('click', function() {
success: function ($p, idx1) {
$p.find('.name > span').on('click', function () {
MobileLib.actionSheet({
body: layui.laytpl(modalSelectorTpl).render({
roleId: roleId
}),
success: function($el, idx2) {
success: function ($el, idx2) {
$el.find('a.list-group-item').on(
'click',
function(el) {
function (el) {
layer.close(idx2)
layer.close(idx1)
var data = $(el.target)
@ -772,7 +872,7 @@
</thead>
<tbody>
`;
$.each(data.data.userList, function(index, value) {
$.each(data.data.userList, function (index, value) {
html += `
<tr>
<td>
@ -800,7 +900,7 @@
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);
console.log("folderId2" + folderId);
var roleId = $(obj).data('role-id');
dd.biz.contact.complexPicker({
title: "添加人员", //标题
@ -818,7 +918,7 @@
permissionType: "GLOBAL", //可添加权限校验选人权限目前只有GLOBAL这个参数
responseUserOnly: false, //返回人,或者返回人和部门
startWithDepartmentId: 0, //仅支持0和-1
onSuccess: function(result) {
onSuccess: function (result) {
/**
{
selectedCount:1, //选择人数
@ -827,7 +927,7 @@
}
*/
var arr = []
result.users.forEach(function(item) {
result.users.forEach(function (item) {
arr.push(item.emplId)
})
var ajaxdata = {
@ -837,7 +937,7 @@
"userIds": arr
}
var url = host + '/ding/dept/addUser';
dxtcRequest('post', url, JSON.stringify(ajaxdata), function(data) {
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
if (data.code == 200) {
getDeptUsers(type, folderId, roleId);
} else {
@ -845,7 +945,7 @@
}
}, 'application/json');
},
onFail: function(err) {
onFail: function (err) {
}
});
@ -865,7 +965,7 @@
"userIds": arr
}
var url = host + '/ding/dept/delUser';
dxtcRequest('post', url, JSON.stringify(ajaxdata), function(data) {
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
if (data.code == 200) {
getDeptUsers(type, folderId, roleId, roleName);
} else {
@ -874,7 +974,7 @@
}, 'application/json');
}
//修改组织名称
$('body').on('click', '#saveFolder', function() {
$('body').on('click', '#saveFolder', function () {
var that = $('#folder-name');
var id = $('.org-menu-list li a.active').data('id');
var name = that.val();
@ -883,7 +983,7 @@
"name": name
}
var url = host + '/ding/dept/updName';
dxtcRequest('post', url, JSON.stringify(ajaxdata), function(data) {
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);
@ -893,10 +993,70 @@
}
}, 'application/json');
})
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" onclick="openFolder(this)" ondblclick="openFolder(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.files.length > 0) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list upload_selection" onclick="choiceFolder(this)" data-id="' +
item.id + '" data-name="' + item.name + '">' +
'<div class="img"><img src="image/icon-file/icon_' + item.type +
'.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);
}
});
}
</script>
<script>
layui.use(['element', 'form', 'laydate', 'layer'], function() {
layui.use(['element', 'form', 'laydate', 'layer'], function () {
var element = layui.element;
var form = layui.form;
var laydate = layui.laydate;
@ -918,4 +1078,5 @@
});
</script>
</body>
</html>
</html>

32
dist/record.html vendored
View File

@ -323,6 +323,8 @@
<option value="1">文件上传</option>
<option value="2">文件下载</option>
<option value="3">文件更新</option>
<option value="4">文件隐藏</option>
<option value="5">文件显示</option>
</select>
</div>
</div>
@ -343,12 +345,12 @@
<div class="list-content">
<table class="table">
<thead>
<tr>
<th>账号</th>
<th>操作类型</th>
<th>文件名称</th>
<th>操作时间</th>
</tr>
<tr>
<th>账号</th>
<th>操作类型</th>
<th>文件名称</th>
<th>操作时间</th>
</tr>
</thead>
<tbody>
</tbody>
@ -439,6 +441,7 @@
logsData.scope = data.field.fileType
logsData.startTime = data.field.times.split(' - ')[0] || ''
logsData.endTime = data.field.times.split(' - ')[1] || ''
console.log(logsData);
getLogs()
return false;
});
@ -461,7 +464,7 @@
title: '操作记录',
body: $('.con-search'),
success: function ($el, idx) {
$el.find('.layui-form').css({padding: '20px'})
$el.find('.layui-form').css({ padding: '20px' })
$el.find('.font-18').hide()
$el.find('button[lay-submit]').on('click', function () {
layer.close(idx)
@ -497,13 +500,19 @@
case '3':
item.type = '文件更新';
break;
case '4':
item.type = '文件隐藏';
break;
case '5':
item.type = '文件显示';
break;
default:
item.type = '未知类型';
break;
}
return item
})
$items.html(layui.laytpl(itemTpl).render({items: items}))
$items.html(layui.laytpl(itemTpl).render({ items: items }))
return
}
@ -511,6 +520,7 @@
if (data.data.records.length > 0) {
var html = '';
data.data.records.forEach(function (item, i) {
html += '<tr>';
html += '<td><div class="list-img"><img src="image/img_01.png"><span>' + item.username + '</span></div></td>';
html += '<td>';
@ -520,6 +530,10 @@
html += '文件下载';
} else if (item.type == 3) {
html += '文件更新';
} else if (item.type == 4) {
html += '文件隐藏';
} else if (item.type == 5) {
html += '文件显示';
}
html += '</td>';
html += '<td>' + item.fileName + '</td>';
@ -605,4 +619,4 @@
});
</script>
</body>
</html>
</html>

143
dist/renewadd.html vendored
View File

@ -333,29 +333,31 @@
<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" class="layui-input">
<input type="text" name="name" lay-verify="required" lay-reqtext="请填写文件名称" placeholder="请填写文件名称" autocomplete="off" 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" class="layui-input">
<input type="text" name="number" lay-verify="required" lay-reqtext="请填写文件号" placeholder="请填写文件号" autocomplete="off" 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" class="layui-input">
<input type="text" name="createUser" lay-verify="required" lay-reqtext="请填写拟稿人" placeholder="请填写拟稿人" autocomplete="off" 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="datetime" placeholder="请选择时间"
autocomplete="off" class="layui-input layui-time">
<input type="text" name="createTime" lay-verify="datetime" placeholder="请选择时间" autocomplete="off" class="layui-input layui-time">
</div>
</div>
<div class="layui-form-item list">
<label class="layui-form-label">文件备注:</label>
<div class="layui-input-block">
<textarea name="note" maxlength="200" placeholder="请输入内容" class="layui-textarea"></textarea>
</div>
</div>
</div>
@ -381,6 +383,7 @@
<div class="upload-form">
<button class="flie-btn" lay-submit lay-filter="formDemo">保存</button>
<button type="reset" class="flie-btn flie-btn-primary">重置</button>
<button type="button" onclick="ddFile()">重置</button>
</div>
</form>
</div>
@ -415,8 +418,7 @@
<!--文件夹-->
<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>
<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">
@ -454,9 +456,9 @@
var folderIds = []
var filesIds = []
$(function() {
$(function () {
$(".click-history").click(function() {
$(".click-history").click(function () {
$('.upload').show()
getFileList(fileAjaxData)
});
@ -467,22 +469,22 @@
function getDingCode() {
dd.runtime.permission.requestAuthCode({
corpId: corpId,
onSuccess: function(result) {
onSuccess: function (result) {
this_code = result.code;
},
onFail: function(err) {
onFail: function (err) {
console.log(err)
}
});
}
layui.use(['form', 'formSelects', 'upload', 'element', 'layer'], function() {
layui.use(['form', 'formSelects', 'upload', 'element', 'layer'], function () {
var form = layui.form;
var formSelects = layui.formSelects;
var upload = layui.upload;
var element = layui.element;
var layer = layui.layer;
var renewaddIntervalScript = setInterval(function() {
var renewaddIntervalScript = setInterval(function () {
var tmpHaveLogin = localStorage['haveLogin'] || false;
if (tmpHaveLogin) {
clearInterval(renewaddIntervalScript);
@ -490,7 +492,7 @@
}
}, 500);
form.on('radio(isPublic)', function(data) {
form.on('radio(isPublic)', function (data) {
fileAjaxData.isPublic = data.value
getMainDeptList(fileAjaxData.isPublic)
});
@ -508,16 +510,18 @@
},
field: 'file',
accept: 'file'
// ,acceptMime: '.docx,.doc,.xlsx,.xls,.pdf,.ppt,pptx,.png,.jpg,.jpeg,.gif,.csv'
,
// ,acceptMime: '.docx,.doc,.xlsx,.xls,.pdf,.ppt,pptx,.png,.jpg,.jpeg,.gif,.csv'
,
acceptMime: '*',
multiple: false //多文件
,
,
number: 1,
before: function(obj) {
before: function (obj) {
this.data.code = this_code;
console.log(this.data.code);
getDingCode();
obj.preview(function(index, file, result) {
obj.preview(function (index, file, result) {
uploadNum++
pressw = ''
// console.log('清空当前进度1' + pressw);
@ -532,18 +536,18 @@
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);
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) {
done: function (res, index, upload) {
if (res.code == 200) {
pressw = ''
// console.log('清空当前进度2' + pressw);
@ -552,7 +556,7 @@
uploadNum + '" data-id="' + res.data.id + '" data-filename="' +
res.data.name + '" data-filesize="' + res.data.size +
'" data-spaceid="' + res.data.spaceId + '" value="' + res.data
.url + '" />';
.url + '" />';
clearInterval(uploadTime);
$('.progress' + uploadNum).css('width', '100%');
@ -568,16 +572,16 @@
});
}
},
allDone: function(obj) {
allDone: function (obj) {
clearInterval(uploadTime);
$('.layui-upload-list .list i').css('width', '100%')
}
});
//选择文件夹
form.on('submit(formFile)', function(data) {
form.on('submit(formFile)', function (data) {
var navName = ''
$('#folder-navigation a').each(function() {
$('#folder-navigation a').each(function () {
if ($(this).attr('data-id') == $('#navigation').val()) {
navName = $(this).attr('data-name')
folderIds.push({
@ -586,7 +590,7 @@
})
}
})
$('.list-content#Chart ul li').each(function() {
$('.list-content#Chart ul li').each(function () {
if ($(this).attr('class') ==
'list upload_selection upload_list_acive') {
filesIds.push({
@ -604,7 +608,8 @@
})
//监听提交
form.on('submit(formDemo)', function(data) {
form.on('submit(formDemo)', function (data) {
console.log(data);
// console.log('提交时当前进度:' + pressw);
if (pressw != '100%') {
// console.log('不等于:' + pressw);
@ -618,23 +623,25 @@
var dingFileName = that.data('filename');
var dingFileSize = that.data('filesize');
var dingSpaceId = that.data('spaceid');
filesIds.forEach(function(item) {
filesIds.forEach(function (item) {
arr2.push(item.id)
})
if (folderIds.length == 0) {
layer.msg("请选择需要更新的文件", {
icon: 5,
shift: 6
}, function() {
}, function () {
$(".click-history").click();
});
return false;
}
var ajaxData = {
createTime: data.field.createTime + " 00:00:00",
createUser: '',
deptId: data.field.deptId,
drafter: data.field.createUser,
note: data.field.note,
//folderIds: folderIds.map(function(item){ return item.id }),
// groupId: "",
// id: '',
@ -666,7 +673,7 @@
type: "post",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
window.location = 'renew.html';
//window.location.reload()
@ -674,7 +681,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
layer.msg(data.responseJSON.msg)
}
@ -698,11 +705,11 @@
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
$('.renew-list select').empty()
if (data.data.length > 0) {
data.data.forEach(function(item) {
data.data.forEach(function (item) {
$('.renew-list select').append(
'<option value="' + item.id + '">' +
item.name + '</option>')
@ -713,7 +720,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -724,7 +731,7 @@
//删除文件路径
function folderDel(obj) {
folderIds.forEach(function(item, i) {
folderIds.forEach(function (item, i) {
if (item.id == $(obj).attr('data-id')) {
folderIds.splice(i, 1)
}
@ -743,7 +750,7 @@
function init() {
//返回事件
$('.con-list .name span .icon-back').off("click").click(function() {
$('.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')
@ -753,10 +760,10 @@
}
});
//路由事件
$('#folder-navigation a').off("click").click(function() {
$('#folder-navigation a').off("click").click(function () {
var that = $(this)
fileAjaxData.parentFolderId = that.attr('data-id')
$('.con-list .name span a').each(function() {
$('.con-list .name span a').each(function () {
if ($(this).index() >= that.index()) {
$('.con-list .name span a').eq($(this).index()).remove()
}
@ -794,11 +801,11 @@
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function(item) {
data.data.folders.forEach(function (item) {
var html1 =
'<li class="list" onclick="openFolder(this)" ondblclick="openFolder(this)" data-id="' +
item.id + '" data-name="' + item.name + '">' +
@ -810,7 +817,7 @@
})
}
if (data.data.files.length > 0) {
data.data.files.forEach(function(item) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list upload_selection" onclick="choiceFolder(this)" data-id="' +
item.id + '" data-name="' + item.name + '">' +
@ -832,11 +839,39 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
}
function ddFile(params) {
dd.biz.util.uploadAttachment({
types: ["photo"],
image: { "multiple": true, "compress": false, "max": 9, "spaceId": "12345" },
compress: true,
multiple: false,
max: 9,
isCopy: 0,
spaceId: "123",
space: { "corpId": "xxx3020", "spaceId": "12345", "isCopy": 1, "max": 9 },
file: { "spaceId": "12345", "max": 1 },
onSuccess: function (res) {
// 调用成功时回调
console.log(res)
},
onFail: function (err) {
// 调用失败时回调
console.log(err)
}
});
}
</script>
<script>
@ -862,4 +897,4 @@
});
</script>
</body>
</html>
</html>

View File

@ -2,7 +2,7 @@
<include src="./lefter.html"></include>
<!--内容-->
<div class="f-r content content-pd-50">
<div class="content-auto" data-id="11" >
<div class="content-auto" data-id="11">
<div class="con-tit font-20 pc-block">
隐藏文件
</div>
@ -53,8 +53,29 @@
</form>
</div>
<!--内容-->
<div class="con-list bg-w top20 phone-bg-none phone-top-0">
<div class="con-list bg-w top20 phone-bg-none phone-top-0 pr">
<!--手机-->
<div class="nameMake">
<div class="nameMake-con">
<p class="tit-name">修改文件夹名称</p>
<div class="nameMake-cona">
<p>
<span>文件1</span>
<input type="text">
</p>
</div>
<div class="nameMake-btn">
<button onclick="nameMakeConfirm()">确定修改</button><button>取消修改</button>
</div>
</div>
</div>
<div class="phone-tit phone-block">
<div class="name" id="phone-menu">
<!-- <a href="javascript:;" class="active">公共文件</a>
@ -78,17 +99,24 @@
</div>
<!--pc-->
<div class="name">
<span class="font-14" id="folder-navigation"><i class="icon-back"></i><a href="hidefile.html"
data-id="0">全部文件</a></span>
<span class="font-14" id="folder-navigation"><i class="icon-back"></i><a href="hidefile.html" data-id="0">全部文件</a></span>
<input type="hidden" id="navigation" value="">
<ul class="con-list-mero pc-block" role="tablist">
<li role="presentation" class="active">
<a class="img-list" href="#Chart" aria-controls="Chart" role="tab" data-toggle="tab">&nbsp;</a>
</li>
<li role="presentation">
<a href="#tab" aria-controls="tab" role="tab" data-toggle="tab" class="tab-list">&nbsp;</a>
</li>
</ul>
<div>
<div class="listBtn">
<button type="button" onclick="editorName()">修改名字</button>
<button type="button" onclick="hgiddenFiles()">显示文件</button>
<button type="button " onclick="editorButton(this)">编辑文件</button>
</div>
<ul class="con-list-mero pc-block" role="tablist">
<li role="presentation" class="active">
<a class="img-list" href="#Chart" aria-controls="Chart" role="tab" data-toggle="tab">&nbsp;</a>
</li>
<li role="presentation">
<a href="#tab" aria-controls="tab" role="tab" data-toggle="tab" class="tab-list">&nbsp;</a>
</li>
</ul>
</div>
</div>
<div class="con-list-cn tab-content">
<div class="list-content active tab-pane" role="tabpanel" id="Chart">
@ -131,7 +159,7 @@
<h3>文件名称</h3>
<p></p>
<a href="#" class="btn1" id="preview-button" onclick="previewBtn(this)">预览</a>
<a onclick="downloadfile(this)" id="download" class="btn2" download="">下载</a>
<a onclick="downloadfile(this)" id="download" class="btn2" download="">下载</a>
</div>
</div>
</div>
@ -174,31 +202,49 @@
startTime: '',
type: ''
}
let dataEditor = {
editorIf: true,
editorData: [],
rows: []
}
function editorButton(obj) {
if (dataEditor.editorIf) {
$(obj).html("取消编辑")
} else {
$(obj).html("编辑文件")
$(".onClickListOne").attr("data-click", "1")
$(".onClickListOne").children(".list-img").css("display", "none")
$(".onClickListOne").css("background", "rgba(0,0,0,0)")
$(".onClickListTwo").parent().css("background", "rgba(0,0,0,0)")
$(".onClickListTwo").attr("data-click", "1")
$(".onClickListTwo").prev().css("display", "none")
}
dataEditor.editorIf = !dataEditor.editorIf
}
var serch_flag = false;
$(function() {
$(function () {
layui.use(['form', 'upload', 'element', 'layer'], function() {
layui.use(['form', 'upload', 'element', 'layer'], function () {
var form = layui.form;
var upload = layui.upload;
var element = layui.element;
var layer = layui.layer;
//var haveLogin = localStorage['haveLogin'] || false;
var loginInterval = setInterval(function() {
var loginInterval = setInterval(function () {
var tmpHaveLogin = localStorage['haveLogin'] || false;
if (tmpHaveLogin) {
clearInterval(loginInterval);
pageInit();
}
}, 500);
function pageInit() {
getFileType();
getFileList(ajaxData);
}
$('#toggle-filter').on('click', function() {
$('#toggle-filter').on('click', function () {
layer.open({
type: 1,
title: ['文件过滤', 'font-size:18px;padding:0;text-align:center'],
@ -207,8 +253,8 @@
area: ['100%', '100%'],
closeBtn: 1,
skin: 'file-filter-layer',
success: function(dom, index) {
dom.find('.layui-btn[lay-submit]').on('click', function() {
success: function (dom, index) {
dom.find('.layui-btn[lay-submit]').on('click', function () {
layer.close(index);
});
}
@ -216,7 +262,7 @@
});
//搜索
form.on('submit(formDemo)', function(data) {
form.on('submit(formDemo)', function (data) {
ajaxData = {
createUser: data.field.createUser,
drafter: data.field.drafter,
@ -239,23 +285,23 @@
//文件类型
function getFileType() {
$.ajax({
url: host + '/ding/file/getFileType'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/getFileType' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + accessToken,
},
data: {},
type: "get",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
if (data.data.length > 0) {
data.data.forEach(function(item) {
data.data.forEach(function (item) {
$('.con-search select[name=type]').append(
'<option value="' + item + '">' + item +
'</option>')
})
form.render()
}
}
// else {
// layer.msg('暂无记录')
// }
@ -263,7 +309,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -273,11 +319,11 @@
})
function init() {
$('.con-list .name span .icon-back').off("click").click(function() {
$('.con-list .name span .icon-back').off("click").click(function () {
var that = $(this);
if (serch_flag) {
$("#search-form")[0].reset();
layui.use(['form'], function() {
layui.use(['form'], function () {
var form = layui.form;
form.render();
})
@ -315,12 +361,12 @@
serch_flag = false;
});
//路由事件
$('#folder-navigation a').off("click").click(function() {
$('#folder-navigation a').off("click").click(function () {
var that = $(this)
console.log(that.attr('data-id'), 'parentFolderId');
ajaxData.parentFolderId = that.attr('data-id')
ajaxData.name = '';
$('.con-list .name span a').each(function() {
$('.con-list .name span a').each(function () {
if ($(this).index() >= that.index()) {
$('.con-list .name span a').eq($(this).index()).remove()
}
@ -334,7 +380,7 @@
//历史记录
function getHistory(obj) {
$.ajax({
url: host + '/ding/file/getHistory'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/getHistory' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + accessToken,
},
@ -343,18 +389,18 @@
},
type: "get",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
if (data.data.length > 0) {
var html = '';
data.data.forEach(function(item) {
data.data.forEach(function (item) {
html += '<tr>' +
'<td><div class="list-img click-download" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
'" data-dingname="' + item.dingFileName + '" data-dingsize="' + item
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
'"><img src="image/icon_22.png"><span>' + item.name +
'</span></div></td>'
html += '<td>';
@ -369,7 +415,7 @@
})
$(".history .table tbody").html(html)
$(".history").show();
}
}
// else {
// layer.msg('暂无记录')
// }
@ -377,7 +423,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -385,7 +431,57 @@
}
//打开文件夹
function openIf(data) {
if (dataEditor.editorIf) {
if ($(data).attr("data-if") == 1) {
openFolder(data)
} else {
openFile(data)
}
} else {
if ($(data).attr("data-click") == "1") {
if ($(data).attr("data-if") == 1) {
$(data).children(".list-img").css("display", "block")
$(data).css("background", "#f5f6ff")
dataEditor.editorData.push({
id: $(data).attr("data-id"),
folder: true
})
} else {
$(data).prev().css("display", "block")
$(data).parent().css("background", "#f5f6ff")
dataEditor.editorData.push({
id: $(data).attr("data-id"),
folder: false
})
}
$(data).attr("data-click", "0")
} else {
if ($(data).attr("data-if") == 1) {
$(data).children(".list-img").css("display", "none")
$(data).css("background", "#fff")
let ina = screening(dataEditor.editorData, $(data).attr("data-id"))
dataEditor.editorData.splice(ina, 1)
} else {
$(data).prev().css("display", "none")
$(data).parent().css("background", "#fff")
let ina = screening(dataEditor.editorData, $(data).attr("data-id"))
dataEditor.editorData.splice(ina, 1)
}
$(data).attr("data-click", "1")
}
console.log(dataEditor.editorData);
}
}
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'));
@ -397,7 +493,7 @@
function downloadfile(obj) {
var id = $(obj).data('fileid');
$.ajax({
url: host + '/ding/file/downLoadFile'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/downLoadFile' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
@ -407,17 +503,17 @@
type: "get",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
$(obj).attr('data', data.data);
console.log(data.data);
window.open(data.data);
window.open(data.data);
} else {
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -476,52 +572,167 @@
// }
// });
}
//隐藏文件
function hideFile(obj){
layer.confirm('确认显示这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function(index, layero){
//按钮【按钮一】的回调
$.ajax({
url: host + '/ding/file/disPlayFile'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
data: {
fileId:$(obj).attr("data-id"),
isShow:1
},
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
if(data.code==200){
layer.msg('显示成功')
getFileList(ajaxData)
}else{
layer.msg(data.msg)
}
},
error: function(data) {
console.log(data);
}
})
}, function(index){
//按钮【按钮二】的回调
layer.closeAll();
function hgiddenFiles(obj) {
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
console.log(arr2);
if (arr2) {
layer.msg("不能显示文件夹")
return
}
layer.confirm('确认显示这些文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let objD = {
fileIds: [],
isShow: 1
}
for (let index = 0; index < dataEditor.editorData.length; index++) {
objD.fileIds.push(dataEditor.editorData[index].id)
}
let contentType = "application/json"
let url = host + '/ding/file/disPlayFiles'
dxtcRequest('post', url, JSON.stringify(objD), function name(data) {
if (data.code == 200) {
console.log(data);
layer.msg('显示成功')
getFileList(ajaxData)
} else {
layer.msg(data.msg)
}
}, contentType)
layer.closeAll();
}, function (index) {
//按钮【按钮二】的回调
layer.closeAll();
});
return false;
}
function hideFile(obj) {
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
//按钮【按钮一】的回调
$.ajax({
url: host + '/ding/file/disPlayFile' + '?timetmp=' + Date.parse(new Date()).toString()
.substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
data: {
fileId: $(obj).attr("data-id"),
isShow: 0
},
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (data) {
if (data.code == 200) {
layer.msg('隐藏成功')
getFileList(ajaxData)
} else {
layer.msg(data.msg)
}
},
error: function (data) {
console.log(data);
layer.msg(data.responseJSON.msg)
}
})
}, function (index) {
//按钮【按钮二】的回调
layer.closeAll();
});
return false;
}
//修改文件名
function editorName() {
console.log(dataEditor.rows, "--------------");
console.log(dataEditor.editorData, "--------------");
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能重命名文件夹")
return
}
let editorNameData = []
for (let index = 0; index < dataEditor.editorData.length; index++) {
for (let k = 0; k < dataEditor.rows.files.length; k++) {
if (dataEditor.editorData[index].id == dataEditor.rows.files[k].id) {
editorNameData.push(dataEditor.rows.files[k])
}
}
}
$(".nameMake").css("display", "flex")
let str = editorNameData.map((v, i) => ` <p>
<span>文件${i + 1}</span>
<input value='${v.name}' data-id="${v.id}" type="text">
</p>`).join("")
$(".nameMake-cona").html(str)
}
function modifyName(data) {
let contentType = "application/json"
let url = host + '/ding/file/updateFile'
dxtcRequest('post', url, JSON.stringify(data), function name(data) {
if (data.code == 200) {
console.log(data);
} else {
layer.msg(data.msg)
}
}, contentType)
}
function nameMakeConfirm(params) {
layer.confirm('确认修改这些文件名嘛?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let arr = []
for (let index = 0; index < $(".nameMake-cona input").length; index++) {
arr.push({
name: $($(".nameMake-cona input")[index]).val(),
id: $($(".nameMake-cona input")[index]).attr("data-id")
})
}
for (let index = 0; index < arr.length; index++) {
modifyName(arr[index])
}
getFileList(ajaxData)
$(".nameMake").css("display", "none")
layer.closeAll();
}, function (index) {
layer.closeAll();
});
}
//影藏文件列表
function getFileList(ajaxData) {
console.log(ajaxData, 'getFileList');
$('.list-content#Chart ul').empty()
$('.list-content#tab tbody').empty()
$.ajax({
url: host + '/ding/file/getDisplayFile'+'?timetmp='+ Date.parse( new Date() ).toString().substr(0,10),
url: host + '/ding/file/getDisplayFile' + '?timetmp=' + Date.parse(new Date()).toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' + localStorage.accessToken
},
@ -529,21 +740,22 @@
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
success: function (data) {
dataEditor.rows = data.data
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function(item) {
data.data.folders.forEach(function (item) {
var html1 =
'<li class="list" onclick="openFolder(this)" ondblclick="openFolder(this)" data-id="' +
item.id + '">' +
'<div class="img"><img src="image/'+(item.folderType=="0"?"icon_11.png":"icon_11_2.png")+'"></div>' +
'<li class="list onClickListOne onClickList" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' + item.id + '">' +
'<img class="list-img" src="./image/icon_30.png">' +
'<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)
var html2 = '<tr>' +
'<td><div class="list-img" onclick="openFolder(this)" ondblclick ="openFolder(this)" data-id="' +
item.id + '"><img src="image/'+(item.folderType=="0"?"icon_11.png":"icon_11_2.png")+'"><span>' + item.name +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick ="openIf(this)" data-id="' +
item.id + '"><img src="image/' + (item.folderType == "0" ? "icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'</span></div></td>' +
'<td></td>' +
'<td></td>' +
@ -558,30 +770,28 @@
})
}
if (data.data.files.length > 0) {
data.data.files.forEach(function(item) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list click-download" >'
+ '<div class="more">'
+ '<span>...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">显示</div>'
+ '</div>'+
'<div class="img" onclick="openFile(this)" data-id="' +
'<li class="list click-download ps onClickList" >'
+ (item.isPublic == "0" ?
"<span class='internal'></span>" : "") +
'<img class="list-img" src="./image/icon_30.png">' +
'<div class="img onClickListTwo" data-if="2" data-click="1" onclick="openIf(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
'" data-dingname="' + item.dingFileName + '" data-dingsize="' + item
.dingFileSize + '" data-spaceid="' + item.dingSpaceId + '"><img src="image/icon-file/icon_' + item.type +
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
'"><img src="image/icon-file/icon_' + item.type +
'.png"></div>' +
'<div class="text-two-hide list-hight">' + item.name + '</div>' +
'</li>'
$('.list-content#Chart ul').append(html1)
var html2 = '<tr>' +
'<td>'
+ '<div class="more">'
+ '<span>...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">显示</div>'
@ -589,8 +799,8 @@
+
'<div class="list-img" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" ><img src="image/icon-file/icon_' + item.type +
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" ><img src="image/icon-file/icon_' + item.type +
'.png"><span>' + item.name + '</span></div></td>' +
'<td>' + item.number + '</td>' +
'<td><div class="list-img"><span>' + item.drafter +
@ -618,7 +828,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -628,4 +838,4 @@
<include src="./footer.html"></include>
<!--appfooter-->
<include src="./appFooter.html"></include>
<include src="./appFooter.html"></include>

View File

@ -53,8 +53,30 @@
</form>
</div>
<!--内容-->
<div class="con-list bg-w top20 phone-bg-none phone-top-0">
<div class="con-list bg-w top20 phone-bg-none phone-top-0 pr">
<!--手机-->
<div class="nameMake">
<div class="nameMake-con">
<p class="tit-name">修改文件夹名称</p>
<div class="nameMake-cona">
<p>
<span>文件1</span>
<input type="text">
</p>
</div>
<div class="nameMake-btn">
<button onclick="nameMakeConfirm()">确定修改</button><button>取消修改</button>
</div>
</div>
</div>
<div class="phone-tit phone-block">
<div class="name" id="phone-menu">
<!-- <a href="javascript:;" class="active">公共文件</a>
@ -88,7 +110,7 @@
<input type="hidden" id="navigation" value="">
<div>
<div class="listBtn">
<button type="button"></button>
<button type="button" onclick="editorName()">修改名字</button>
<button type="button" onclick="hgiddenFiles()">隐藏文件</button>
<button type="button " onclick="editorButton(this)">编辑文件</button>
</div>
@ -188,6 +210,7 @@
let dataEditor = {
editorIf: true,
editorData: [],
rows: []
}
function editorButton(obj) {
if (dataEditor.editorIf) {
@ -418,7 +441,13 @@
function openIf(data) {
if (dataEditor.editorIf) {
openFolder(data)
if ($(data).attr("data-if") == 1) {
openFolder(data)
} else {
openFile(data)
}
} else {
if ($(data).attr("data-click") == "1") {
if ($(data).attr("data-if") == 1) {
@ -462,6 +491,7 @@
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'));
@ -556,13 +586,84 @@
// });
}
// 文件夹重命名
function editorName() {
console.log(dataEditor.rows);
console.log(dataEditor.editorData);
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能重命名文件夹")
return
}
let editorNameData = []
for (let index = 0; index < dataEditor.editorData.length; index++) {
for (let k = 0; k < dataEditor.rows.files.length; k++) {
if (dataEditor.editorData[index].id == dataEditor.rows.files[k].id) {
editorNameData.push(dataEditor.rows.files[k])
}
}
}
$(".nameMake").css("display", "flex")
let str = editorNameData.map((v, i) => ` <p>
<span>文件${i + 1}</span>
<input value='${v.name}' data-id="${v.id}" type="text">
</p>`).join("")
$(".nameMake-cona").html(str)
}
function modifyName(data) {
let contentType = "application/json"
let url = host + '/ding/file/updateFile'
dxtcRequest('post', url, JSON.stringify(data), function name(data) {
if (data.code == 200) {
console.log(data);
} else {
layer.msg(data.msg)
}
}, contentType)
}
function nameMakeConfirm(params) {
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let arr = []
for (let index = 0; index < $(".nameMake-cona input").length; index++) {
arr.push({
name: $($(".nameMake-cona input")[index]).val(),
id: $($(".nameMake-cona input")[index]).attr("data-id")
})
}
for (let index = 0; index < arr.length; index++) {
modifyName(arr[index])
}
getFileList(ajaxData)
$(".nameMake").css("display", "none")
layer.closeAll();
}, function (index) {
layer.closeAll();
});
}
//隐藏文件
function hgiddenFiles(obj) {
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能隐藏文件夹")
return
}
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
@ -658,12 +759,13 @@
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (data) {
dataEditor.rows = data.data
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function (item) {
var html1 =
'<li class="list onClickListOne" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' +
'<li class="list onClickListOne onClickList" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' +
item.id + '">' +
'<img class="list-img" src="./image/icon_30.png">' +
'<div class="img"> <img src="image/' + (item.folderType == "0" ?
@ -672,7 +774,7 @@
'</li>'
$('.list-content#Chart ul').append(html1)
var html2 = '<tr>' +
'<td><div class="list-img" onclick="openIf(this)" ondblclick ="openIf(this)" data-id="' +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick ="openIf(this)" data-id="' +
item.id + '"><img src="image/' + (item.folderType == "0" ?
"icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'</span></div></td>' +
@ -689,17 +791,12 @@
})
$(".onClickList").on("click", () => {
})
$(".onClickList").on("ondblclick", () => {
})
}
if (data.data.files.length > 0) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list click-download ps" >'
'<li class="list click-download ps onClickList" >'
+ (item.isPublic == "0" ?
"<span class='internal'></span>" : "") +

View File

@ -54,8 +54,23 @@
</form>
</div>
<!--内容-->
<div class="con-list bg-w top20 phone-bg-none phone-top-0">
<div class="con-list bg-w top20 phone-bg-none phone-top-0 pr">
<!--手机-->
<div class="nameMake">
<div class="nameMake-con">
<p class="tit-name">修改文件夹名称</p>
<div class="nameMake-cona">
<p>
<span>文件1</span>
<input type="text">
</p>
</div>
<div class="nameMake-btn">
<button onclick="nameMakeConfirm()">确定修改</button><button>取消修改</button>
</div>
</div>
</div>
<div class="phone-tit phone-block">
<div class="name" id="phone-menu">
<!-- <a href=" index.html">公共文件</a>
@ -83,7 +98,7 @@
<input type="hidden" id="navigation" value="">
<div>
<div class="listBtn">
<button type="button"></button>
<button type="button" onclick="editorName()">修改名字</button>
<button type="button" onclick="hgiddenFiles()">隐藏文件</button>
<button type="button " onclick="editorButton(this)">编辑文件</button>
</div>
@ -184,6 +199,7 @@
let dataEditor = {
editorIf: true,
editorData: [],
rows: []
}
function editorButton(obj) {
if (dataEditor.editorIf) {
@ -417,6 +433,9 @@
//打开文件夹
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
console.log(obj);
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'))
@ -454,9 +473,15 @@
}
function openIf(data) {
console.log(data);
if (dataEditor.editorIf) {
openFolder(data)
if ($(data).attr("data-if") == 1) {
openFolder(data)
} else {
openFile(data)
}
} else {
if ($(data).attr("data-click") == "1") {
if ($(data).attr("data-if") == 1) {
@ -497,15 +522,75 @@
}
}
function openFolder(obj) {
dataEditor.editorData = []
dataEditor.editorIf = true
ajaxData.parentFolderId = $(obj).attr('data-id')
getFileList(ajaxData)
$("#navigation").val($(obj).attr('data-id'));
$('#folder-navigation').append('<a data-id="' + $(obj).attr('data-id') + '"> > ' + $(obj).text() + '</a>');
serch_flag = false;
// 文件夹重命名
function editorName() {
console.log(dataEditor.rows, "--------------");
console.log(dataEditor.editorData, "--------------");
var arr2 = dataEditor.editorData.some(function (v) {
return v.folder == true;
});
if (arr2) {
layer.msg("不能重命名文件夹")
return
}
let editorNameData = []
for (let index = 0; index < dataEditor.editorData.length; index++) {
for (let k = 0; k < dataEditor.rows.files.length; k++) {
if (dataEditor.editorData[index].id == dataEditor.rows.files[k].id) {
editorNameData.push(dataEditor.rows.files[k])
}
}
}
$(".nameMake").css("display", "flex")
let str = editorNameData.map((v, i) => ` <p>
<span>文件${i + 1}</span>
<input value='${v.name}' data-id="${v.id}" type="text">
</p>`).join("")
$(".nameMake-cona").html(str)
}
function modifyName(data) {
let contentType = "application/json"
let url = host + '/ding/file/updateFile'
dxtcRequest('post', url, JSON.stringify(data), function name(data) {
if (data.code == 200) {
console.log(data);
} else {
layer.msg(data.msg)
}
}, contentType)
}
function nameMakeConfirm(params) {
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
,
}, function (index, layero) {
let arr = []
for (let index = 0; index < $(".nameMake-cona input").length; index++) {
arr.push({
name: $($(".nameMake-cona input")[index]).val(),
id: $($(".nameMake-cona input")[index]).attr("data-id")
})
}
for (let index = 0; index < arr.length; index++) {
modifyName(arr[index])
}
getFileList(ajaxData)
$(".nameMake").css("display", "none")
layer.closeAll();
}, function (index) {
layer.closeAll();
});
}
//文件下载
function downloadfile(obj) {
var id = $(obj).data('fileid');
@ -582,6 +667,7 @@
});
if (arr2) {
layer.msg("不能隐藏文件夹")
return
}
layer.confirm('确认隐藏这个文件吗?', {
btn: ['确认', '取消'] //可以无限个按钮
@ -590,7 +676,7 @@
let objD = {
fileIds: [],
isShow: 0
isShow: 1
}
for (let index = 0; index < dataEditor.editorData.length; index++) {
@ -636,20 +722,22 @@
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function (data) {
dataEditor.rows = data.data
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function (item) {
console.log("======" + item.id + '=====');
var html1 =
'<li class="list" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this) data-id="' +
item.id + '">' +
'<li class="list onClickListOne onClickList" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' + item.id + '">' +
'<img class="list-img" src="./image/icon_30.png">' +
'<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)
var html2 = '<tr>' +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this) data-id="' +
item.id + '"><img src="image/' + (item.folderType == "0" ? "icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'<td><div class="list-img" data-if="1" data-click="1" onclick="openIf(this)" ondblclick="openIf(this)" data-id="' + item.id + '"><img src="image/' + (item.folderType == "0" ? "icon_11.png" : "icon_11_2.png") + '"><span>' + item.name +
'</span></div></td>' +
'<td></td>' +
'<td></td>' +
@ -666,19 +754,16 @@
if (data.data.files.length > 0) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list click-download" >'
+ '<div class="more">'
+ '<span>...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">隐藏</div>'
+ '</div>' +
'<div class="img" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
'<li class="list click-download ps onClickList" >'
+
'<img class="list-img" src="./image/icon_30.png">' +
'<div class="img onClickListTwo" data-if="2" data-click="1" onclick="openIf(this)" data-id="' + item.id +
'" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item
.createTime + '" data-dingid="' + item.dingFileId +
'" data-dingname="' + item.dingFileName + '" data-dingsize="' + item
.dingFileSize + '" data-spaceid="' + item.dingSpaceId + '" ><img src="image/icon-file/icon_' + item.type +
.dingFileSize + '" data-spaceid="' + item.dingSpaceId +
'"><img src="image/icon-file/icon_' + item.type +
'.png"></div>' +
'<div class="text-two-hide list-hight">' + item.name + '</div>' +
'</li>'
@ -690,8 +775,6 @@
+ '<span onclick="showBtn(this)" >...</span>'
+ '<div class="more-edit" onclick="hideFile(this)" data-id="' + item.id + '" data-name="' + item.name + '">隐藏</div>'
+ '</div>'
+ '<div class="list-img" onclick="openFile(this)" data-id="' +
item.id + '" data-name="' + item.name + '" data-type="' + item
.type + '" data-url="' + item.url + '" data-time="' + item

View File

@ -12,9 +12,9 @@
<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;">
<input id="deptInput" class="form-input" type="hidden" name="policy_dept_ids" value="" style="display: none;">
</div>
</div>
</div>
@ -29,8 +29,7 @@
</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">
<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>
@ -43,16 +42,13 @@
<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>
<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>
<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>
<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">
@ -62,8 +58,7 @@
<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 href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="3" onclick="choosePeople(this, 'Admin')">
+添加人员
</a>
</div>
@ -75,8 +70,7 @@
<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 href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="5" onclick="choosePeople(this, 'opera')">
+添加人员
</a>
</div>
@ -88,8 +82,7 @@
<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 href="javascript:;" class="org-remarks-add" data-folder-id="" data-role-id="6" onclick="choosePeople(this, 'look')">
+添加人员
</a>
</div>
@ -102,8 +95,61 @@
</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">&nbsp;</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" lay-submit lay-filter="formFile">保存</button>
<button type="reset" class="flie-btn flie-btn-primary">重置</button>
</div>
</form>
</div>
</div>
</div>
<script type="text/html" id="modal-tpl">
<div class="con-content">
<div class="con-mune bg-w">
@ -125,6 +171,8 @@
{{# }); }}
</ul>
</div>
</div>
</script>
@ -144,20 +192,30 @@
<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
}
//修改名称
$(".btn-edit-op").click(function() {
$(".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() {
$(".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() {
$('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)
@ -166,31 +224,31 @@
getDeptUsers(type, zuId, roleId);
})
//添加组织
$("#addDept").click(function() {
$("#addDept").click(function () {
if ($(".org-menu-list a.active").length == 0) {
layer.confirm('确认添加组织?', {
btn: ['确认', '取消'] //可以无限个按钮
}, function(index, layero) {
}, function (index, layero) {
//按钮【按钮一】的回调
var parentId = shangId;
// console.log('组织ID1'+parentId);
layer.closeAll();
addDept(parentId)
}, function(index) {
}, function (index) {
//按钮【按钮二】的回调
layer.closeAll();
});
} else {
// var parentId = $(".org-menu-list a.active").attr("data-id");
console.log('组织ID2'+shangId);
console.log('组织ID2' + shangId);
addDept(shangId)
}
});
function addDept(parentId) {
// console.log(parentId);
layer.prompt(function(value, index, elem) {
layer.prompt(function (value, index, elem) {
layer.alert(value); //得到value
layer.close(index);
var data = {
@ -207,16 +265,16 @@
type: "post",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
layer.msg("添加成功", function() {
layer.msg("添加成功", function () {
location.reload();
})
} else {
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
layer.msg(data.responseJSON.msg)
}
});
@ -228,9 +286,9 @@
$(".org-menu-list a.active").removeClass('active');
clearId()
}
function clearId(){//把上级组织ID设为0
function clearId() {//把上级组织ID设为0
shangId = 0
console.log("shangId:"+shangId);
console.log("shangId:" + shangId);
}
@ -239,14 +297,14 @@
tckd = ['90%', '90%'];
}
layui.use(['element', 'form', 'laydate', 'laypage', 'laytpl'], function() {
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 organizationIntervalScript = setInterval(function () {
var tmpHaveLogin = localStorage['haveLogin'] || false;
if (tmpHaveLogin) {
clearInterval(organizationIntervalScript);
@ -265,7 +323,7 @@
data: {},
type: "get",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
if (data.data.length > 0) {
$('.deptBtn').orgTree({
@ -279,7 +337,7 @@
defaultTitle: '请选择',
defaultButton: '+添加组织',
jsonData: data.data,
custom: function(event) {
custom: function (event) {
// form属性为true才会生效
var data = {
parentId: event[0].id,
@ -288,24 +346,24 @@
$.ajax({
url: host + '/ding/dept/addDept' +
'?timetmp=' + Date.parse(new Date())
.toString().substr(0, 10),
.toString().substr(0, 10),
headers: {
'Blade-Auth': 'bearer ' +
localStorage
.accessToken
.accessToken
},
data: JSON.stringify(data),
type: "post",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
getDeptList()
} else {
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
layer.msg(data.responseJSON.msg)
}
});
@ -316,7 +374,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
// console.log(data);
}
});
@ -330,15 +388,15 @@
let type = "get";
let data = {};
let roleId = $('.org-list .org-ul li.active a').data('role-id');
dxtcRequest(type, url, data, function(data) {
dxtcRequest(type, url, data, function (data) {
if (data.code == 200) {
let html = '';
let active = '';
$.each(data.data, function(index, value) {
$.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);
$('#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);
@ -357,7 +415,7 @@
function menu_list_html(data, index = 0) {
var html = "";
var null_str = ""
$.each(data, function(index, value) {
$.each(data, function (index, value) {
// html += '<li class="add-border" ><a href="javascript:;" data-id="' + value.id +
// '" data-folder-id="' + value.folderId + '" data-role-id="' + roleId +
// '" data-folder-name="' + value.deptName + '" onclick="changeDept(this)">' + value.deptName +
@ -370,7 +428,7 @@
'" 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 += "<ul class='org-menu-lis-children'>" + menu_list_html(value.children, { num: 0, id: value.id }) + "</ul>";
}
html += "</li>";
});
@ -378,8 +436,44 @@
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');
@ -391,6 +485,12 @@
}
// 选中组织
function change(obj) {
console.log(dataOrganization.state);
if (dataOrganization.state) {
$('.upload').show()
getFileList(fileAjaxData)
return
}
shangId = $(obj).data('id');
zuId = $(obj).data('folder-id');
chuFolderId = zuId
@ -399,7 +499,7 @@
// console.log('顶级组织ID' + shangId);
// console.log('当前组织ID' + zuId);
let roleId = $('.org-list .org-ul li.active a').data('role-id');
// console.log('roleId' + roleId);
// console.log('roleId' + roleId);
getDeptUsers('Admin', zuId, roleId);
}
//收起
@ -429,7 +529,7 @@
'roleId': roleId
};
$('.org-remarks-add').attr('data-folder-id', folderId);
dxtcRequest('get', url, data, function(data) {
dxtcRequest('get', url, data, function (data) {
if (data.code == 200) {
if (MobileLib.isMobile()) {
layer.closeAll();
@ -443,16 +543,16 @@
type: type,
users: data.data.userList || []
}),
success: function($p, idx1) {
$p.find('.name > span').on('click', function() {
success: function ($p, idx1) {
$p.find('.name > span').on('click', function () {
MobileLib.actionSheet({
body: layui.laytpl(modalSelectorTpl).render({
roleId: roleId
}),
success: function($el, idx2) {
success: function ($el, idx2) {
$el.find('a.list-group-item').on(
'click',
function(el) {
function (el) {
layer.close(idx2)
layer.close(idx1)
var data = $(el.target)
@ -482,7 +582,7 @@
</thead>
<tbody>
`;
$.each(data.data.userList, function(index, value) {
$.each(data.data.userList, function (index, value) {
html += `
<tr>
<td>
@ -510,7 +610,7 @@
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);
console.log("folderId2" + folderId);
var roleId = $(obj).data('role-id');
dd.biz.contact.complexPicker({
title: "添加人员", //标题
@ -528,7 +628,7 @@
permissionType: "GLOBAL", //可添加权限校验选人权限目前只有GLOBAL这个参数
responseUserOnly: false, //返回人,或者返回人和部门
startWithDepartmentId: 0, //仅支持0和-1
onSuccess: function(result) {
onSuccess: function (result) {
/**
{
selectedCount:1, //选择人数
@ -537,7 +637,7 @@
}
*/
var arr = []
result.users.forEach(function(item) {
result.users.forEach(function (item) {
arr.push(item.emplId)
})
var ajaxdata = {
@ -547,7 +647,7 @@
"userIds": arr
}
var url = host + '/ding/dept/addUser';
dxtcRequest('post', url, JSON.stringify(ajaxdata), function(data) {
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
if (data.code == 200) {
getDeptUsers(type, folderId, roleId);
} else {
@ -555,7 +655,7 @@
}
}, 'application/json');
},
onFail: function(err) {
onFail: function (err) {
}
});
@ -575,7 +675,7 @@
"userIds": arr
}
var url = host + '/ding/dept/delUser';
dxtcRequest('post', url, JSON.stringify(ajaxdata), function(data) {
dxtcRequest('post', url, JSON.stringify(ajaxdata), function (data) {
if (data.code == 200) {
getDeptUsers(type, folderId, roleId, roleName);
} else {
@ -584,7 +684,7 @@
}, 'application/json');
}
//修改组织名称
$('body').on('click', '#saveFolder', function() {
$('body').on('click', '#saveFolder', function () {
var that = $('#folder-name');
var id = $('.org-menu-list li a.active').data('id');
var name = that.val();
@ -593,7 +693,7 @@
"name": name
}
var url = host + '/ding/dept/updName';
dxtcRequest('post', url, JSON.stringify(ajaxdata), function(data) {
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);
@ -603,10 +703,70 @@
}
}, 'application/json');
})
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" onclick="openFolder(this)" ondblclick="openFolder(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.files.length > 0) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list upload_selection" onclick="choiceFolder(this)" data-id="' +
item.id + '" data-name="' + item.name + '">' +
'<div class="img"><img src="image/icon-file/icon_' + item.type +
'.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);
}
});
}
</script>
<script>
layui.use(['element', 'form', 'laydate', 'layer'], function() {
layui.use(['element', 'form', 'laydate', 'layer'], function () {
var element = layui.element;
var form = layui.form;
var laydate = layui.laydate;
@ -628,4 +788,5 @@
});
</script>
</body>
</html>
</html>

View File

@ -33,6 +33,8 @@
<option value="1">文件上传</option>
<option value="2">文件下载</option>
<option value="3">文件更新</option>
<option value="4">文件隐藏</option>
<option value="5">文件显示</option>
</select>
</div>
</div>
@ -53,12 +55,12 @@
<div class="list-content">
<table class="table">
<thead>
<tr>
<th>账号</th>
<th>操作类型</th>
<th>文件名称</th>
<th>操作时间</th>
</tr>
<tr>
<th>账号</th>
<th>操作类型</th>
<th>文件名称</th>
<th>操作时间</th>
</tr>
</thead>
<tbody>
</tbody>
@ -149,6 +151,7 @@
logsData.scope = data.field.fileType
logsData.startTime = data.field.times.split(' - ')[0] || ''
logsData.endTime = data.field.times.split(' - ')[1] || ''
console.log(logsData);
getLogs()
return false;
});
@ -171,7 +174,7 @@
title: '操作记录',
body: $('.con-search'),
success: function ($el, idx) {
$el.find('.layui-form').css({padding: '20px'})
$el.find('.layui-form').css({ padding: '20px' })
$el.find('.font-18').hide()
$el.find('button[lay-submit]').on('click', function () {
layer.close(idx)
@ -207,13 +210,19 @@
case '3':
item.type = '文件更新';
break;
case '4':
item.type = '文件隐藏';
break;
case '5':
item.type = '文件显示';
break;
default:
item.type = '未知类型';
break;
}
return item
})
$items.html(layui.laytpl(itemTpl).render({items: items}))
$items.html(layui.laytpl(itemTpl).render({ items: items }))
return
}
@ -221,6 +230,7 @@
if (data.data.records.length > 0) {
var html = '';
data.data.records.forEach(function (item, i) {
html += '<tr>';
html += '<td><div class="list-img"><img src="image/img_01.png"><span>' + item.username + '</span></div></td>';
html += '<td>';
@ -230,6 +240,10 @@
html += '文件下载';
} else if (item.type == 3) {
html += '文件更新';
} else if (item.type == 4) {
html += '文件隐藏';
} else if (item.type == 5) {
html += '文件显示';
}
html += '</td>';
html += '<td>' + item.fileName + '</td>';
@ -292,4 +306,4 @@
});
</script>
<include src="./footer.html"></include>
<include src="./footer.html"></include>

View File

@ -43,29 +43,31 @@
<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" class="layui-input">
<input type="text" name="name" lay-verify="required" lay-reqtext="请填写文件名称" placeholder="请填写文件名称" autocomplete="off" 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" class="layui-input">
<input type="text" name="number" lay-verify="required" lay-reqtext="请填写文件号" placeholder="请填写文件号" autocomplete="off" 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" class="layui-input">
<input type="text" name="createUser" lay-verify="required" lay-reqtext="请填写拟稿人" placeholder="请填写拟稿人" autocomplete="off" 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="datetime" placeholder="请选择时间"
autocomplete="off" class="layui-input layui-time">
<input type="text" name="createTime" lay-verify="datetime" placeholder="请选择时间" autocomplete="off" class="layui-input layui-time">
</div>
</div>
<div class="layui-form-item list">
<label class="layui-form-label">文件备注:</label>
<div class="layui-input-block">
<textarea name="note" maxlength="200" placeholder="请输入内容" class="layui-textarea"></textarea>
</div>
</div>
</div>
@ -91,6 +93,7 @@
<div class="upload-form">
<button class="flie-btn" lay-submit lay-filter="formDemo">保存</button>
<button type="reset" class="flie-btn flie-btn-primary">重置</button>
<button type="button" onclick="ddFile()">重置</button>
</div>
</form>
</div>
@ -125,8 +128,7 @@
<!--文件夹-->
<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>
<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">
@ -164,9 +166,9 @@
var folderIds = []
var filesIds = []
$(function() {
$(function () {
$(".click-history").click(function() {
$(".click-history").click(function () {
$('.upload').show()
getFileList(fileAjaxData)
});
@ -177,22 +179,22 @@
function getDingCode() {
dd.runtime.permission.requestAuthCode({
corpId: corpId,
onSuccess: function(result) {
onSuccess: function (result) {
this_code = result.code;
},
onFail: function(err) {
onFail: function (err) {
console.log(err)
}
});
}
layui.use(['form', 'formSelects', 'upload', 'element', 'layer'], function() {
layui.use(['form', 'formSelects', 'upload', 'element', 'layer'], function () {
var form = layui.form;
var formSelects = layui.formSelects;
var upload = layui.upload;
var element = layui.element;
var layer = layui.layer;
var renewaddIntervalScript = setInterval(function() {
var renewaddIntervalScript = setInterval(function () {
var tmpHaveLogin = localStorage['haveLogin'] || false;
if (tmpHaveLogin) {
clearInterval(renewaddIntervalScript);
@ -200,7 +202,7 @@
}
}, 500);
form.on('radio(isPublic)', function(data) {
form.on('radio(isPublic)', function (data) {
fileAjaxData.isPublic = data.value
getMainDeptList(fileAjaxData.isPublic)
});
@ -218,16 +220,18 @@
},
field: 'file',
accept: 'file'
// ,acceptMime: '.docx,.doc,.xlsx,.xls,.pdf,.ppt,pptx,.png,.jpg,.jpeg,.gif,.csv'
,
// ,acceptMime: '.docx,.doc,.xlsx,.xls,.pdf,.ppt,pptx,.png,.jpg,.jpeg,.gif,.csv'
,
acceptMime: '*',
multiple: false //多文件
,
,
number: 1,
before: function(obj) {
before: function (obj) {
this.data.code = this_code;
console.log(this.data.code);
getDingCode();
obj.preview(function(index, file, result) {
obj.preview(function (index, file, result) {
uploadNum++
pressw = ''
// console.log('清空当前进度1' + pressw);
@ -242,18 +246,18 @@
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);
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) {
done: function (res, index, upload) {
if (res.code == 200) {
pressw = ''
// console.log('清空当前进度2' + pressw);
@ -262,7 +266,7 @@
uploadNum + '" data-id="' + res.data.id + '" data-filename="' +
res.data.name + '" data-filesize="' + res.data.size +
'" data-spaceid="' + res.data.spaceId + '" value="' + res.data
.url + '" />';
.url + '" />';
clearInterval(uploadTime);
$('.progress' + uploadNum).css('width', '100%');
@ -278,16 +282,16 @@
});
}
},
allDone: function(obj) {
allDone: function (obj) {
clearInterval(uploadTime);
$('.layui-upload-list .list i').css('width', '100%')
}
});
//选择文件夹
form.on('submit(formFile)', function(data) {
form.on('submit(formFile)', function (data) {
var navName = ''
$('#folder-navigation a').each(function() {
$('#folder-navigation a').each(function () {
if ($(this).attr('data-id') == $('#navigation').val()) {
navName = $(this).attr('data-name')
folderIds.push({
@ -296,7 +300,7 @@
})
}
})
$('.list-content#Chart ul li').each(function() {
$('.list-content#Chart ul li').each(function () {
if ($(this).attr('class') ==
'list upload_selection upload_list_acive') {
filesIds.push({
@ -314,7 +318,8 @@
})
//监听提交
form.on('submit(formDemo)', function(data) {
form.on('submit(formDemo)', function (data) {
console.log(data);
// console.log('提交时当前进度:' + pressw);
if (pressw != '100%') {
// console.log('不等于:' + pressw);
@ -328,23 +333,25 @@
var dingFileName = that.data('filename');
var dingFileSize = that.data('filesize');
var dingSpaceId = that.data('spaceid');
filesIds.forEach(function(item) {
filesIds.forEach(function (item) {
arr2.push(item.id)
})
if (folderIds.length == 0) {
layer.msg("请选择需要更新的文件", {
icon: 5,
shift: 6
}, function() {
}, function () {
$(".click-history").click();
});
return false;
}
var ajaxData = {
createTime: data.field.createTime + " 00:00:00",
createUser: '',
deptId: data.field.deptId,
drafter: data.field.createUser,
note: data.field.note,
//folderIds: folderIds.map(function(item){ return item.id }),
// groupId: "",
// id: '',
@ -376,7 +383,7 @@
type: "post",
contentType: "application/json",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
window.location = 'renew.html';
//window.location.reload()
@ -384,7 +391,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
layer.msg(data.responseJSON.msg)
}
@ -408,11 +415,11 @@
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
$('.renew-list select').empty()
if (data.data.length > 0) {
data.data.forEach(function(item) {
data.data.forEach(function (item) {
$('.renew-list select').append(
'<option value="' + item.id + '">' +
item.name + '</option>')
@ -423,7 +430,7 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
@ -434,7 +441,7 @@
//删除文件路径
function folderDel(obj) {
folderIds.forEach(function(item, i) {
folderIds.forEach(function (item, i) {
if (item.id == $(obj).attr('data-id')) {
folderIds.splice(i, 1)
}
@ -453,7 +460,7 @@
function init() {
//返回事件
$('.con-list .name span .icon-back').off("click").click(function() {
$('.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')
@ -463,10 +470,10 @@
}
});
//路由事件
$('#folder-navigation a').off("click").click(function() {
$('#folder-navigation a').off("click").click(function () {
var that = $(this)
fileAjaxData.parentFolderId = that.attr('data-id')
$('.con-list .name span a').each(function() {
$('.con-list .name span a').each(function () {
if ($(this).index() >= that.index()) {
$('.con-list .name span a').eq($(this).index()).remove()
}
@ -504,11 +511,11 @@
type: "get",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
success: function(data) {
success: function (data) {
if (data.code == 200) {
init()
if (data.data.folders.length > 0) {
data.data.folders.forEach(function(item) {
data.data.folders.forEach(function (item) {
var html1 =
'<li class="list" onclick="openFolder(this)" ondblclick="openFolder(this)" data-id="' +
item.id + '" data-name="' + item.name + '">' +
@ -520,7 +527,7 @@
})
}
if (data.data.files.length > 0) {
data.data.files.forEach(function(item) {
data.data.files.forEach(function (item) {
var html1 =
'<li class="list upload_selection" onclick="choiceFolder(this)" data-id="' +
item.id + '" data-name="' + item.name + '">' +
@ -542,11 +549,39 @@
layer.msg(data.msg)
}
},
error: function(data) {
error: function (data) {
console.log(data);
}
});
}
function ddFile(params) {
dd.biz.util.uploadAttachment({
types: ["photo"],
image: { "multiple": true, "compress": false, "max": 9, "spaceId": "12345" },
compress: true,
multiple: false,
max: 9,
isCopy: 0,
spaceId: "123",
space: { "corpId": "xxx3020", "spaceId": "12345", "isCopy": 1, "max": 9 },
file: { "spaceId": "12345", "max": 1 },
onSuccess: function (res) {
// 调用成功时回调
console.log(res)
},
onFail: function (err) {
// 调用失败时回调
console.log(err)
}
});
}
</script>
<include src="./footer.html"></include>
<include src="./footer.html"></include>