#I7V6NV 新增项目文档可以添加附件

This commit is contained in:
HDM58\hdm58 2023-10-31 15:08:53 +08:00
parent c645fd3268
commit 004549c295
7 changed files with 68 additions and 11 deletions

View File

@ -1757,6 +1757,7 @@ CREATE TABLE `oa_project_document` (
`project_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联项目id',
`admin_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题',
`file_ids` varchar(500) NOT NULL DEFAULT '' COMMENT '附件ids',
`content` text NULL COMMENT '文档内容',
`md_content` text NULL COMMENT 'markdown文档内容',
`create_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间',

View File

@ -36,6 +36,9 @@ class Document extends BaseController
{
$param = get_params();
if (request()->isPost()) {
if (isset($param['file'])) {
unset($param['file']);
}
if (isset($param['end_time'])) {
$param['end_time'] = strtotime(urldecode($param['end_time']));
}if (isset($param['flow_status'])) {
@ -89,7 +92,12 @@ class Document extends BaseController
$id = isset($param['id']) ? $param['id'] : 0;
$project_id = isset($param['project_id']) ? $param['project_id'] : 0;
if($id>0){
View::assign('detail', (new DocumentList())->detail($param['id']));
$detail = (new DocumentList())->detail($param['id']);
if($detail['file_ids'] !=''){
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
$detail['fileArray'] = $fileArray;
}
View::assign('detail', $detail);
}
View::assign('project_id', $project_id);
View::assign('id', $id);
@ -104,10 +112,12 @@ class Document extends BaseController
$id = isset($param['id']) ? $param['id'] : 0;
$detail = (new DocumentList())->detail($id);
if (empty($detail)) {
if (empty($detail)) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该文档不存在</div>';exit;
}
echo '<div style="text-align:center;color:red;margin-top:20%;">该文档不存在</div>';exit;
} else {
if($detail['file_ids'] !=''){
$fileArray = Db::name('File')->where('id','in',$detail['file_ids'])->select();
$detail['fileArray'] = $fileArray;
}
$project_ids = Db::name('ProjectUser')->where(['uid' => $this->uid, 'delete_time' => 0])->column('project_id');
if (in_array($detail['project_id'], $project_ids) || ($this->uid = $detail['admin_id'])) {
View::assign('detail', $detail);

View File

@ -19,6 +19,19 @@
</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" style="line-height:inherit">
<div class="layui-row" id="fileBox">
<input type="hidden" data-type="file" name="file_ids" value="">
</div>
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">文档内容<font>*</font></td>
<td colspan="5">
@ -47,6 +60,24 @@
</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" style="line-height:inherit">
<div class="layui-row" id="fileBox">
<input type="hidden" data-type="file" name="file_ids" value="{$detail.file_ids}">
{notempty name="$detail.file_ids"}
{volist name="$detail.fileArray" id="vo"}
<div class="layui-col-md4" id="uploadImg{$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">
@ -67,10 +98,11 @@
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','tinymce'];
const moduleInit = ['tool','oaTool','tinymce'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
var form = layui.form,tool=layui.tool,oaTool=layui.oaTool;
//相关附件上传
oaTool.addFile();
//编辑器初始化
var editor = layui.tinymce;
var edit = editor.render({

View File

@ -33,10 +33,24 @@
<div class="text-detial-content">
{$detail.content|raw}
</div>
{notempty name="$detail.file_ids"}
<h3 class="py-3">相关附件</h3>
<div class="layui-row" id="fileBox">
{volist name="$detail.fileArray" id="vo"}
<div class="layui-col-md4" id="uploadImg{$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','oaTool'];
function gouguInit() {
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -15,10 +15,10 @@ if (empty(file_exists(__DIR__ . '/../vendor/autoload.php'))) {
require __DIR__ . '/../vendor/autoload.php';
// 定义当前版本号
define('CMS_VERSION','4.92.10');
define('CMS_VERSION','4.93.11');
// 定义Layui版本号
define('LAYUI_VERSION','2.8.17');
define('LAYUI_VERSION','2.8.18-rc.3');
// 定义项目目录
define('CMS_ROOT', __DIR__ . '/../');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long