@@ -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(
'
')
})
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 += '
' +
'' + item.name +
' | '
html += '';
@@ -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) => `
+ 文件${i + 1}
+
+ `).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 =
- '' +
- '' +
+ '' +
+ '' +
+ '' +
'' + item.name + ' ' +
''
$('.list-content#Chart ul').append(html1)
var html2 = ' |
' +
- '' + item.name +
+ '' + item.name +
' | ' +
' | ' +
' | ' +
@@ -848,30 +1060,28 @@
})
}
if (data.data.files.length > 0) {
- data.data.files.forEach(function(item) {
+ data.data.files.forEach(function (item) {
var html1 =
- ' '
-
-
- + ''
- + ' ...'
- + ' 显示 '
- + ' '+
-
-
- ''
+ + (item.isPublic == "0" ?
+ " 内" : "") +
+
+ ' ' +
+ ' ' +
' ' + item.name + ' ' +
''
$('.list-content#Chart ul').append(html1)
var html2 = ' ' +
+
''
-
+
+ ''
+ ' ...'
+ ' 显示 '
@@ -879,8 +1089,8 @@
+
' ' + item.name + ' | ' +
'' + item.number + ' | ' +
'' + 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','功能区')
})
-
+
\ No newline at end of file
diff --git a/dist/index.html b/dist/index.html
index 7948d9b..41ee1db 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -343,8 +343,30 @@
-
+
+
+
+
+
+
+
+
+ 修改文件夹名称
+
+
+
+
+
+
+
+
| |