first commit
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
{extend name="../../base/view/common/base" /}
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
{eq name="id" value ="0"}
|
||||
<h3 class="pb-3">新建文档</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">文档名称<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" lay-reqText="请输入文档名称" placeholder="请输入文档名称" class="layui-input" value="">
|
||||
</td>
|
||||
<td class="layui-td-gray">关联项目<font>*</font></td>
|
||||
<td>
|
||||
<input type="text" name="project_name" placeholder="所属项目" value="{$project_name|default=''}" readonly class="layui-input picker-oa" data-types="project" autocomplete="off" />
|
||||
<input type="hidden" name="project_id" value="{$project_id}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">
|
||||
<div class="layui-input-inline">相关附件</div>
|
||||
<div class="layui-input-inline">
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="uploadBtn"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="5">
|
||||
<div class="layui-row" id="uploadBox">
|
||||
<input type="hidden" data-type="file" name="file_ids" value="{$detail.file_ids|default=''}">
|
||||
{notempty name="$detail.file_ids"}
|
||||
{volist name="$detail.file_array" id="vo"}
|
||||
<div class="layui-col-md4" id="uploadFile{$vo.id}">{:file_card($vo)}</div>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="vertical-align:top;">文档内容<font>*</font></td>
|
||||
<td colspan="5">
|
||||
<textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container" style="border:0;padding:0"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{else/}
|
||||
<h3 class="pb-3">编辑文档</h3>
|
||||
<table class="layui-table layui-table-form">
|
||||
<tr>
|
||||
<td class="layui-td-gray">文档名称<font>*</font>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="title" lay-verify="required" lay-reqText="请输入文档名称" placeholder="请输入文档名称"
|
||||
class="layui-input" value="{$detail.title}">
|
||||
</td>
|
||||
<td class="layui-td-gray">关联项目<font>*</font></td>
|
||||
<td>
|
||||
<select id="projectId" name="project_id" lay-filter="project_id">
|
||||
<option value="">请选择关联项目</option>
|
||||
{volist name=":get_project()" id="v"}
|
||||
<option value="{$v.id}" {eq name = "$v.id" value="$detail.project_id"} selected{/eq}>{$v.name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray-2">
|
||||
<div class="layui-input-inline">相关附件</div>
|
||||
<div class="layui-input-inline">
|
||||
<button type="button" class="layui-btn layui-btn-xs" id="uploadBtn"><i class="layui-icon"></i></button>
|
||||
</div>
|
||||
</td>
|
||||
<td colspan="5">
|
||||
<div class="layui-row" id="uploadBox">
|
||||
<input type="hidden" data-type="file" name="file_ids" value="{$detail.file_ids|default=''}">
|
||||
{notempty name="$detail.file_ids"}
|
||||
{volist name="$detail.file_array" id="vo"}
|
||||
<div class="layui-col-md4" id="uploadFile{$vo.id}">{:file_card($vo)}</div>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="layui-td-gray" style="vertical-align:top;">文档内容<font>*</font></td>
|
||||
<td colspan="5">
|
||||
<textarea name="content" placeholder="请输入内容" class="layui-textarea" id="container" style="border:0;padding:0">{$detail.content}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/eq}
|
||||
<div class="pt-4">
|
||||
<input type="hidden" name="id" value="{$id}" />
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool','uploadPlus','tinymce','oaPicker'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool,uploadPlus = layui.uploadPlus;
|
||||
//相关附件上传
|
||||
var attachment = new uploadPlus();
|
||||
|
||||
//编辑器初始化
|
||||
var editor = layui.tinymce;
|
||||
var edit = editor.render({
|
||||
selector: "#container",
|
||||
images_upload_url: '/api/index/upload/sourse/tinymce',//图片上传接口
|
||||
height:600
|
||||
});
|
||||
|
||||
//监听提交
|
||||
form.on('submit(webform)', function (data) {
|
||||
data.field.content = tinyMCE.editors['container'].getContent();
|
||||
if (data.field.content == '') {
|
||||
layer.msg('请先完善文档内容');
|
||||
return false;
|
||||
}
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
tool.sideClose(1000,'documentTable');
|
||||
}
|
||||
}
|
||||
let clickbtn = $(this);
|
||||
tool.post("/project/document/add", data.field, callback,clickbtn);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
{/block}
|
||||
@@ -0,0 +1,116 @@
|
||||
{extend name="../../base/view/common/base" /}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<div class="p-page">
|
||||
<div class="gg-form-bar border-t border-x">
|
||||
<form class="layui-form" lay-filter="barsearchform">
|
||||
<div class="layui-input-inline" style="width:240px;">
|
||||
<input type="text" name="project_name" placeholder="所属项目" readonly class="layui-input picker-oa" data-types="project" autocomplete="off" />
|
||||
<input name="project_id" style="display: none;" value="" />
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width:300px;">
|
||||
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off" />
|
||||
</div>
|
||||
<div class="layui-input-inline" style="width:150px;">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
|
||||
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<table class="layui-hide" id="document" lay-filter="document"></table>
|
||||
</div>
|
||||
<script type="text/html" id="toolbarDemo">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="add">+ 新建文档</button>
|
||||
</div>
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /主体 -->
|
||||
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script>
|
||||
const moduleInit = ['tool','tablePlus','oaPicker'];
|
||||
function gouguInit() {
|
||||
var table = layui.tablePlus, form = layui.form, tool = layui.tool;
|
||||
|
||||
layui.documentTable = table.render({
|
||||
elem: '#document',
|
||||
title: '文档列表',
|
||||
toolbar: '#toolbarDemo',
|
||||
is_excel: true,
|
||||
cellMinWidth: 80,
|
||||
height: 'full-114',
|
||||
url: "/project/document/datalist",
|
||||
cols: [[
|
||||
{
|
||||
field: 'id', title: '文档编号', width: 90, align: 'center', templet: function (d) {
|
||||
return 'D' + d.id;
|
||||
}
|
||||
}
|
||||
, {
|
||||
field: 'title', title: '文档主题',minWidth:240, templet: function (d) {
|
||||
var html = '<a class="side-a" data-href="/project/document/view/id/' + d.id + '">' + d.title + '</a>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
, { field: 'project', title: '关联项目', width: 240,}
|
||||
, { field: 'admin_name', title: '创建人', align: 'center', width: 80 }
|
||||
, { field: 'create_time', title: '创建时间', align: 'center', width: 150 }
|
||||
,{
|
||||
field: 'right',
|
||||
fixed:'right',
|
||||
title: '操作',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
templet: function (d) {
|
||||
var html = '<div class="layui-btn-group">';
|
||||
var btn1='<span class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</span>';
|
||||
var btn2='<span class="layui-btn layui-btn-xs" lay-event="edit">编辑</span>';
|
||||
var btn3='<span class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</span>';
|
||||
return html+btn1+btn2+btn3+'</div>';
|
||||
}
|
||||
}
|
||||
]]
|
||||
});
|
||||
|
||||
|
||||
//触发事件
|
||||
table.on('toolbar(document)', function(obj){
|
||||
if (obj.event === 'add') {
|
||||
tool.side("/project/document/add");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
//监听行工具事件
|
||||
table.on('tool(document)', function(obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'view') {
|
||||
tool.side("/project/document/view?id="+data.id);
|
||||
return;
|
||||
}
|
||||
if(obj.event === 'edit'){
|
||||
tool.side('/project/document/add?id='+data.id);
|
||||
return;
|
||||
}
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确定要删除吗?', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
let callback = function (e) {
|
||||
layer.msg(e.msg);
|
||||
if (e.code == 0) {
|
||||
obj.del();
|
||||
}
|
||||
}
|
||||
tool.delete("/project/document/delete", {id: data.id}, callback);
|
||||
layer.close(index);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
||||
@@ -0,0 +1,58 @@
|
||||
{extend name="../../base/view/common/base" /}
|
||||
{block name="style"}
|
||||
<link rel="stylesheet" href="{__GOUGU__}/third_party/prism/prism.css"/>
|
||||
<style>
|
||||
.text-detial-ops{line-height: 30px; color:#999; font-size: 12px; padding: 12px 0;}
|
||||
.text-detial-ops span{margin-right: 20px;}
|
||||
.text-detial-ops a{margin-right:10px;}
|
||||
.text-detial-content{padding: 8px 0; color:#333; word-break: break-all; border-top:1px solid #e8e8e8;font-size: 16px!important; line-height: 1.72!important;}
|
||||
.text-detial-content p{padding: 8px 0;}
|
||||
.text-detial-content img{max-width:98%!important; margin:0 auto; display:block; border: 1px solid #e6e6e6; -webkit-box-shadow: 0 2px 6px rgba(26,26,26,.08); box-shadow: 0 2px 6px rgba(26,26,26,.08); border-radius: 4px;}
|
||||
.text-detial-content h1,.text-detial-content h2,.text-detial-content h3,.text-detial-content h4,.text-detial-content h5{margin-top:10px;}
|
||||
.text-detial-content a{color:#186AF2; font-style:italic;}
|
||||
.text-detial-content a:hover{text-decoration:underline;}
|
||||
|
||||
.text-detial-content p code,.blog-detial-content pre{margin:0 3px;font-size: 14px; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; background: #f6f6f6; padding: 10px; border-radius: 2px;}
|
||||
.text-detial-content p code{border: 1px solid #eee;padding: 2px 4px;}
|
||||
.text-detial-content table {border-collapse: collapse; border-spacing: 0; display: block; width: 100%; overflow: auto; word-break: normal;word-break: keep-all; margin-top: 0;margin-bottom: 16px;}
|
||||
.text-detial-content table tr {background-color: #fff;border-top: 1px solid #ccc;}
|
||||
.text-detial-content table tr:nth-child(2n) {background-color: #f8f8f8;}
|
||||
.text-detial-content table td, .blog-detial-content table th { padding: 6px 12px;border: 1px solid #ddd; font-size:14px; }
|
||||
.text-detial-content table th {font-weight: 800;}
|
||||
.text-detial-content li {list-style: initial;margin-left: 20px;}
|
||||
:not(pre)>code[class*=language-], pre[class*=language-]{background:#fff!important;border:1px solid #e8e8e8!important; border-radius:3px;}
|
||||
.upload-file{padding:12px; background-color:#fff; border:1px solid #eee; margin-bottom:12px;}
|
||||
.upload-file h3{margin-bottom:12px;}
|
||||
</style>
|
||||
{/block}
|
||||
<!-- 主体 -->
|
||||
{block name="body"}
|
||||
<form class="layui-form p-4">
|
||||
<h1>{$detail.title}</h1>
|
||||
<div class="text-detial-ops">
|
||||
<span>{$detail.admin_name}发表于:{$detail.create_time}</span><span>关联项目:{$detail.project_name}</span>
|
||||
</div>
|
||||
<div class="text-detial-content">
|
||||
{$detail.content|raw}
|
||||
</div>
|
||||
{notempty name="$detail.file_ids"}
|
||||
<div class="upload-file layui-row">
|
||||
<h3>相关附件</h3>
|
||||
{volist name="$detail.file_array" id="vo"}
|
||||
<div class="layui-col-md4" id="uploadFile{$vo.id}">{:file_card($vo,'view')}</div>
|
||||
{/volist}
|
||||
</div>
|
||||
{/notempty}
|
||||
</div>
|
||||
{/block}
|
||||
<!-- 脚本 -->
|
||||
{block name="script"}
|
||||
<script src="{__GOUGU__}/third_party/prism/prism.js"></script>
|
||||
<script>
|
||||
const moduleInit = ['tool'];
|
||||
function gouguInit() {
|
||||
var form = layui.form,tool=layui.tool;
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
<!-- /脚本 -->
|
||||
Reference in New Issue
Block a user