增加文件编辑

This commit is contained in:
邹景立 2022-10-18 11:18:30 +08:00
parent 93ecdbf432
commit b6a0db5b74
3 changed files with 64 additions and 2 deletions

View File

@ -29,6 +29,17 @@ use think\admin\Storage;
*/
class File extends Controller
{
protected $types;
/**
* 控制器初始化
* @return void
*/
protected function initialize()
{
$this->types = Storage::types();
}
/**
* 系统文件管理
* @auth true
@ -39,7 +50,6 @@ class File extends Controller
*/
public function index()
{
$this->types = Storage::types();
SystemFile::mQuery()->layTable(function () {
$this->title = '系统文件管理';
$this->xexts = SystemFile::mk()->distinct()->column('xext');
@ -61,6 +71,16 @@ class File extends Controller
}
}
/**
* 编辑系统文件
* @auth true
* @return void
*/
public function edit()
{
SystemFile::mForm('form');
}
/**
* 删除系统文件
* @auth true

View File

@ -0,0 +1,39 @@
<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="RoleTable">
<div class="layui-card-body padding-left-40">
<label class="layui-form-item relative block">
<span class="help-label"><b>文件名称</b>Name</span>
<input maxlength="100" class="layui-input" name="name" value='{$vo.name|default=""}' required placeholder="请输入文件名称">
</label>
<label class="layui-form-item relative block">
<span class="help-label"><b>文件大小</b>Size</span>
<input maxlength="100" class="layui-input layui-bg-gray" value='{$vo.size|default=0|format_bytes}' readonly>
</label>
<label class="layui-form-item relative block">
<span class="help-label"><b>文件哈希</b>Hash</span>
<input maxlength="100" class="layui-input layui-bg-gray" value='{$vo.hash|default=""}' readonly>
</label>
<label class="layui-form-item relative block">
<span class="help-label"><b>文件链接</b>Link</span>
<input maxlength="100" class="layui-input layui-bg-gray" value='{$vo.xurl|default=""}' readonly>
</label>
<label class="layui-form-item relative block">
<span class="help-label"><b>存储方式</b>Type</span>
<input maxlength="100" class="layui-input layui-bg-gray" value='{$types[$vo.type]??""}' readonly>
</label>
</div>
<div class="hr-line-dashed"></div>
{notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
<div class="layui-form-item text-center">
<button class="layui-btn" type='submit'>保存数据</button>
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
</div>
</form>

View File

@ -48,13 +48,16 @@
},
{field: 'ctype', title: '存储方式', align: 'center', width: '10%'},
{field: 'create_at', title: '上传时间', align: 'center', width: '15%', sort: true},
{toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 90, fixed: 'right'}
{toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 140, fixed: 'right'}
]]
});
});
</script>
<script type="text/html" id="toolbar">
<!--{if auth("remove")}-->
<a class="layui-btn layui-btn-sm" data-modal="{:url('edit')}?id={{d.id}}" data-title="编辑文件信息"> </a>
<!--{/if}-->
<!--{if auth("remove")}-->
<a class="layui-btn layui-btn-sm layui-btn-danger" data-action="{:url('remove')}" data-value="id#{{d.id}}"> </a>
<!--{/if}-->