|
@@ -84,6 +84,50 @@
|
|
|
btn1: function(index) { top.layer.close(index); }
|
|
btn1: function(index) { top.layer.close(index); }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /** 查看详情(带阅读记录) */
|
|
|
|
|
+ function openDetailDialogWithRead(id) {
|
|
|
|
|
+ // 先记录阅读行为
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ type: 'POST',
|
|
|
|
|
+ url: '${ctx}/workKnowledgeBase/readLike/recordRead',
|
|
|
|
|
+ data: { fileId: id },
|
|
|
|
|
+ success: function(result) {
|
|
|
|
|
+ // 无论是否首次阅读,都打开详情弹窗
|
|
|
|
|
+ openDetailDialog(id);
|
|
|
|
|
+ // 刷新列表,更新阅读量
|
|
|
|
|
+ setTimeout(function() {
|
|
|
|
|
+ search();
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function() {
|
|
|
|
|
+ // 即使记录失败也打开详情
|
|
|
|
|
+ openDetailDialog(id);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 预览文件(带阅读记录) */
|
|
|
|
|
+ function openPreviewWithRead(url, type, fileId) {
|
|
|
|
|
+ // 先记录阅读行为
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ type: 'POST',
|
|
|
|
|
+ url: '${ctx}/workKnowledgeBase/readLike/recordRead',
|
|
|
|
|
+ data: { fileId: fileId },
|
|
|
|
|
+ success: function(result) {
|
|
|
|
|
+ // 调用原有的预览方法
|
|
|
|
|
+ openPreview(url, type);
|
|
|
|
|
+ // 刷新列表,更新阅读量
|
|
|
|
|
+ setTimeout(function() {
|
|
|
|
|
+ search();
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function() {
|
|
|
|
|
+ // 即使记录失败也打开预览
|
|
|
|
|
+ openPreview(url, type);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/** 审核详情弹窗(三按钮:通过/驳回/关闭) */
|
|
/** 审核详情弹窗(三按钮:通过/驳回/关闭) */
|
|
|
function openAuditDetailDialog(id) {
|
|
function openAuditDetailDialog(id) {
|
|
@@ -271,6 +315,72 @@
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 显示阅读详情弹窗 */
|
|
|
|
|
+ function showReadDetail(fileId) {
|
|
|
|
|
+ top.layer.open({
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ area: ['90%', '80%'],
|
|
|
|
|
+ title: '阅读详情',
|
|
|
|
|
+ maxmin: true,
|
|
|
|
|
+ content: '${ctx}/workKnowledgeBase/readLike/readDetailPage?fileId=' + fileId,
|
|
|
|
|
+ btn: ['关闭'],
|
|
|
|
|
+ btn1: function(index) { top.layer.close(index); }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 显示点赞详情弹窗 */
|
|
|
|
|
+ function showLikeDetail(fileId) {
|
|
|
|
|
+ top.layer.open({
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ area: ['80%', '80%'],
|
|
|
|
|
+ title: '点赞详情',
|
|
|
|
|
+ maxmin: true,
|
|
|
|
|
+ content: '${ctx}/workKnowledgeBase/readLike/likeDetailPage?fileId=' + fileId,
|
|
|
|
|
+ btn: ['关闭'],
|
|
|
|
|
+ btn1: function(index) { top.layer.close(index); }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 点赞操作 */
|
|
|
|
|
+ function likeFile(fileId) {
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ type: 'POST',
|
|
|
|
|
+ url: '${ctx}/workKnowledgeBase/readLike/like',
|
|
|
|
|
+ data: { fileId: fileId },
|
|
|
|
|
+ success: function(data) {
|
|
|
|
|
+ if (data.success) {
|
|
|
|
|
+ layer.msg('点赞成功', {icon: 1});
|
|
|
|
|
+ search(); // 刷新列表
|
|
|
|
|
+ } else {
|
|
|
|
|
+ layer.msg(data.message || '点赞失败', {icon: 2});
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function() {
|
|
|
|
|
+ layer.msg('请求失败,请重试', {icon: 2});
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /** 取消点赞操作 */
|
|
|
|
|
+ function cancelLikeFile(fileId) {
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ type: 'POST',
|
|
|
|
|
+ url: '${ctx}/workKnowledgeBase/readLike/cancelLike',
|
|
|
|
|
+ data: { fileId: fileId },
|
|
|
|
|
+ success: function(data) {
|
|
|
|
|
+ if (data.success) {
|
|
|
|
|
+ layer.msg('已取消点赞', {icon: 1});
|
|
|
|
|
+ search(); // 刷新列表
|
|
|
|
|
+ } else {
|
|
|
|
|
+ layer.msg(data.message || '取消点赞失败', {icon: 2});
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function() {
|
|
|
|
|
+ layer.msg('请求失败,请重试', {icon: 2});
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/** 查询 */
|
|
/** 查询 */
|
|
|
function search() {
|
|
function search() {
|
|
|
$('#searchForm').submit();
|
|
$('#searchForm').submit();
|
|
@@ -460,24 +570,24 @@
|
|
|
var cols = [
|
|
var cols = [
|
|
|
{field: 'index', align: 'center', width: 50, title: '序号'},
|
|
{field: 'index', align: 'center', width: 50, title: '序号'},
|
|
|
{field: 'name', align: 'center', title: '文件名称', minWidth: 200, templet: function(d) {
|
|
{field: 'name', align: 'center', title: '文件名称', minWidth: 200, templet: function(d) {
|
|
|
- return '<a href="javascript:void(0)" class="attention-info" onclick="openDetailDialog(\'' + d.id + '\')">' + (d.name || '') + '</a>';
|
|
|
|
|
|
|
+ return '<a href="javascript:void(0)" class="attention-info" onclick="openDetailDialogWithRead(\'' + d.id + '\')">' + (d.name || '') + '</a>';
|
|
|
}},
|
|
}},
|
|
|
{field: 'fileUrl', align: 'center', title: '文件地址', minWidth: 200, templet: function(d) {
|
|
{field: 'fileUrl', align: 'center', title: '文件地址', minWidth: 200, templet: function(d) {
|
|
|
if(2 == d.uploadMode){
|
|
if(2 == d.uploadMode){
|
|
|
if(d.fileName.toLowerCase().indexOf('jpg') != -1 || d.fileName.toLowerCase().indexOf('png') != -1 || d.fileName.toLowerCase().indexOf('gif') != -1 || d.fileName.toLowerCase().indexOf('bmp') != -1 || d.fileName.toLowerCase().indexOf('jpeg') != -1){
|
|
if(d.fileName.toLowerCase().indexOf('jpg') != -1 || d.fileName.toLowerCase().indexOf('png') != -1 || d.fileName.toLowerCase().indexOf('gif') != -1 || d.fileName.toLowerCase().indexOf('bmp') != -1 || d.fileName.toLowerCase().indexOf('jpeg') != -1){
|
|
|
return "<img src="+d.temporaryUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.temporaryUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
|
|
return "<img src="+d.temporaryUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.temporaryUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
|
|
|
}else if(d.fileName.toLowerCase().indexOf('pdf') != -1){
|
|
}else if(d.fileName.toLowerCase().indexOf('pdf') != -1){
|
|
|
- return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreview('" + d.temporaryUrl +"',1)\">" + d.fileName + "</a>";
|
|
|
|
|
|
|
+ return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreviewWithRead('" + d.temporaryUrl +"',1,'" + d.id + "')\">" + d.fileName + "</a>";
|
|
|
}else{
|
|
}else{
|
|
|
- return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreview('" + d.temporaryUrl +"',2)\">" + d.fileName + "</a>";
|
|
|
|
|
|
|
+ return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreviewWithRead('" + d.temporaryUrl +"',2,'" + d.id + "')\">" + d.fileName + "</a>";
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
if(d.fileName.toLowerCase().indexOf('jpg') != -1 || d.fileName.toLowerCase().indexOf('png') != -1 || d.fileName.toLowerCase().indexOf('gif') != -1 || d.fileName.toLowerCase().indexOf('bmp') != -1 || d.fileName.toLowerCase().indexOf('jpeg') != -1){
|
|
if(d.fileName.toLowerCase().indexOf('jpg') != -1 || d.fileName.toLowerCase().indexOf('png') != -1 || d.fileName.toLowerCase().indexOf('gif') != -1 || d.fileName.toLowerCase().indexOf('bmp') != -1 || d.fileName.toLowerCase().indexOf('jpeg') != -1){
|
|
|
return "<img src="+d.fileUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.fileUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
|
|
return "<img src="+d.fileUrl+" width='50' height='50' onclick=\"openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=" + d.fileUrl +"','90%','90%')\" alt='"+d.fileName+"'>";
|
|
|
}else if(d.fileName.toLowerCase().indexOf('pdf') != -1){
|
|
}else if(d.fileName.toLowerCase().indexOf('pdf') != -1){
|
|
|
- return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreview('" + d.fileUrl +"',1)\">" + d.fileName + "</a>";
|
|
|
|
|
|
|
+ return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreviewWithRead('" + d.fileUrl +"',1,'" + d.id + "')\">" + d.fileName + "</a>";
|
|
|
}else{
|
|
}else{
|
|
|
- return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreview('" + d.fileUrl +"',2)\">" + d.fileName + "</a>";
|
|
|
|
|
|
|
+ return "<a class=\"attention-info\" title=\"" + d.fileName + "\" href=\"javascript:void(0);\" onclick=\"openPreviewWithRead('" + d.fileUrl +"',2,'" + d.id + "')\">" + d.fileName + "</a>";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}},
|
|
}},
|
|
@@ -497,6 +607,12 @@
|
|
|
}},
|
|
}},
|
|
|
{field: 'createByName', align: 'center', title: '创建人', width: 100},
|
|
{field: 'createByName', align: 'center', title: '创建人', width: 100},
|
|
|
{field: 'createTime', align: 'center', title: '创建时间', width: 160},
|
|
{field: 'createTime', align: 'center', title: '创建时间', width: 160},
|
|
|
|
|
+ {field: 'readCount', align: 'center', title: '阅读量', width: 100, templet: function(d){
|
|
|
|
|
+ return '<a href="javascript:void(0)" onclick="showReadDetail(\'' + d.id + '\')" style="color:#1e9fff;cursor:pointer;">' + (d.readCount || 0) + '</a>';
|
|
|
|
|
+ }},
|
|
|
|
|
+ {field: 'likeCount', align: 'center', title: '点赞量', width: 100, templet: function(d){
|
|
|
|
|
+ return '<a href="javascript:void(0)" onclick="showLikeDetail(\'' + d.id + '\')" style="color:#ff5722;cursor:pointer;">' + (d.likeCount || 0) + '</a>';
|
|
|
|
|
+ }},
|
|
|
|
|
|
|
|
{align:'center', title: '状态', fixed: 'right', width:70,templet:function(d){
|
|
{align:'center', title: '状态', fixed: 'right', width:70,templet:function(d){
|
|
|
var st = getWorkKnowledgeAuditState(parseInt(d.auditStatus));
|
|
var st = getWorkKnowledgeAuditState(parseInt(d.auditStatus));
|
|
@@ -547,6 +663,15 @@
|
|
|
if (status === 1 || status === 2 || status === 4 || status === 5) {
|
|
if (status === 1 || status === 2 || status === 4 || status === 5) {
|
|
|
xml += '<a href="javascript:void(0)" onclick="viewAuditRecords(\'' + d.id + '\')" class="layui-btn layui-btn-xs"> 记录</a>';
|
|
xml += '<a href="javascript:void(0)" onclick="viewAuditRecords(\'' + d.id + '\')" class="layui-btn layui-btn-xs"> 记录</a>';
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 点赞/取消点赞按钮(仅审核通过的文件显示)
|
|
|
|
|
+ if (status === 5) {
|
|
|
|
|
+ if (d.liked) {
|
|
|
|
|
+ xml += '<a href="javascript:void(0)" onclick="cancelLikeFile(\'' + d.id + '\')" class="layui-btn layui-btn-xs layui-bg-orange"><i class="fa fa-heart"></i> 已赞</a>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ xml += '<a href="javascript:void(0)" onclick="likeFile(\'' + d.id + '\')" class="layui-btn layui-btn-xs layui-bg-red"><i class="fa fa-heart-o"></i> 点赞</a>';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
xml += '</div>';
|
|
xml += '</div>';
|
|
|
return xml;
|
|
return xml;
|
|
@@ -584,6 +709,9 @@
|
|
|
,"auditStatus": ${row.auditStatus != null ? row.auditStatus : 0}
|
|
,"auditStatus": ${row.auditStatus != null ? row.auditStatus : 0}
|
|
|
,"treeNodeId": "${row.treeNodeId}"
|
|
,"treeNodeId": "${row.treeNodeId}"
|
|
|
,"treeName": "<c:out value='${row.treeName}'/>"
|
|
,"treeName": "<c:out value='${row.treeName}'/>"
|
|
|
|
|
+ ,"readCount": ${row.readCount != null ? row.readCount : 0}
|
|
|
|
|
+ ,"likeCount": ${row.likeCount != null ? row.likeCount : 0}
|
|
|
|
|
+ ,"liked": ${row.liked == true ? 'true' : 'false'}
|
|
|
<c:forEach items="${dynamicFields}" var="field">
|
|
<c:forEach items="${dynamicFields}" var="field">
|
|
|
,"dynamic_${field.fieldKey}": "<c:out value='${row["dynamic_".concat(field.fieldKey)]}'/>"
|
|
,"dynamic_${field.fieldKey}": "<c:out value='${row["dynamic_".concat(field.fieldKey)]}'/>"
|
|
|
|
|
|