You've already forked think-plugs-notice
feat(notice): 通知公告功能增加附件上传和查看
- 在通知公告表单中添加附件上传功能 - 在通知公告列表中显示附件图标,点击可下载- 在通知公告查看页面展示附件列表,可点击下载 - 修改数据库,将 files 字段从 string 类型改为 text 类型
This commit is contained in:
@@ -35,6 +35,35 @@
|
||||
{ field: 'title', title: '标题', width: 200 },
|
||||
{ field: 'type', title: '类型', width: 120 },
|
||||
{ field: 'content', title: '内容' },
|
||||
{ field: 'files', title: '附件', width: 120, align: 'center', templet: function(d){
|
||||
if(d.files && d.files.trim()) {
|
||||
var files = d.files.split('|').filter(function(url) {
|
||||
return url.trim() !== '';
|
||||
});
|
||||
if(files.length > 0) {
|
||||
var html = '';
|
||||
files.forEach(function(url, index) {
|
||||
if(url.trim()) {
|
||||
var fileName = '附件' + (index + 1);
|
||||
try {
|
||||
var urlObj = new URL(url, window.location.origin);
|
||||
var attname = urlObj.searchParams.get('attname');
|
||||
if (attname) {
|
||||
fileName = decodeURIComponent(attname);
|
||||
} else {
|
||||
fileName = url.split('/').pop() || '附件' + (index + 1);
|
||||
}
|
||||
} catch (e) {
|
||||
fileName = url.split('/').pop() || '附件' + (index + 1);
|
||||
}
|
||||
html += '<i class="layui-icon layui-icon-file" style="color: #1E9FFF; cursor: pointer; margin-right: 5px;" title="' + fileName + '" onclick="window.open(\'' + url + '\', \'_blank\')"></i>';
|
||||
}
|
||||
});
|
||||
return html;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}},
|
||||
{ field: 'to', title: '通知用户' },
|
||||
{ field: 'create_at', title: '创建时间', width: 200, sort: true },
|
||||
{ fixed: "right", title: "操作", width: 200, align: "center", toolbar: "#ToolbarTpl"}
|
||||
|
||||
Reference in New Issue
Block a user