99 lines
4.3 KiB
HTML
99 lines
4.3 KiB
HTML
<div class="layui-card">
|
|
<div class="layui-card-header">
|
|
<span>版本管理</span>
|
|
<a class="layui-btn layui-btn-sm" style="float:right;" href="/docs/backend/version/add?project_id={$projectId}">新增版本</a>
|
|
</div>
|
|
<div class="layui-card-body">
|
|
<form class="layui-form docs-scope-bar" method="get" action="/docs/backend/version">
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label" style="width:70px;">所属项目</label>
|
|
<div class="layui-input-inline">
|
|
<select name="project_id" lay-filter="projectPick">
|
|
{volist name="projects" id="p"}
|
|
<option value="{$p.id}" {if condition="$projectId eq $p.id"}selected{/if}>{$p.title}</option>
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<table class="layui-table">
|
|
<colgroup>
|
|
<col width="70"><col width="140"><col><col width="90"><col width="90"><col width="80"><col width="90"><col width="150">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th><th>版本标识</th><th>版本名称</th><th>默认</th>
|
|
<th>文档数</th><th>排序</th><th>状态</th><th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{volist name="list" id="item" empty="<tr><td colspan='8' class='docs-empty'>该项目暂无版本</td></tr>"}
|
|
<tr>
|
|
<td>{$item.id}</td>
|
|
<td><code>{$item.name}</code></td>
|
|
<td>
|
|
{$item.title}
|
|
{if condition="$item.intro neq ''"}<div class="docs-tip">{$item.intro}</div>{/if}
|
|
</td>
|
|
<td>
|
|
{if condition="$item.is_default eq 1"}
|
|
<span class="layui-badge layui-bg-orange">默认</span>
|
|
{else/}
|
|
<span class="docs-tip">-</span>
|
|
{/if}
|
|
</td>
|
|
<td>{$item.doc_count}</td>
|
|
<td>{$item.sort}</td>
|
|
<td>
|
|
{if condition="$item.status eq 1"}
|
|
<span class="layui-badge layui-bg-blue">启用</span>
|
|
{else/}
|
|
<span class="layui-badge layui-bg-gray">禁用</span>
|
|
{/if}
|
|
</td>
|
|
<td>
|
|
<a class="layui-btn layui-btn-xs" href="/docs/backend/version/edit/{$item.id}">编辑</a>
|
|
<a class="layui-btn layui-btn-xs layui-btn-normal" href="/docs/backend/doc?project_id={$projectId}&version_id={$item.id}">管理文档</a>
|
|
<a class="layui-btn layui-btn-xs layui-btn-danger docs-del" href="javascript:;" data-id="{$item.id}" data-title="{$item.title}">删除</a>
|
|
</td>
|
|
</tr>
|
|
{/volist}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
layui.use(['form', 'layer', 'jquery'], function () {
|
|
var form = layui.form;
|
|
var layer = layui.layer;
|
|
var $ = layui.$;
|
|
|
|
form.on('select(projectPick)', function (data) {
|
|
location.href = '/docs/backend/version?project_id=' + data.value;
|
|
});
|
|
|
|
$('.docs-del').on('click', function () {
|
|
var id = $(this).data('id');
|
|
var title = $(this).data('title');
|
|
layer.confirm('删除版本「' + title + '」将同时删除其下所有文档,确定继续?', {
|
|
icon: 3, title: '确认删除'
|
|
}, function (index) {
|
|
layer.close(index);
|
|
$.post('/docs/backend/version/delete/' + id, {}, function (res) {
|
|
if (res.code === 0) {
|
|
layer.msg(res.message, { icon: 1 }, function () { location.reload(); });
|
|
} else {
|
|
layer.msg(res.message || '删除失败', { icon: 2 });
|
|
}
|
|
}, 'json').fail(function () {
|
|
layer.msg('请求失败,请重试', { icon: 2 });
|
|
});
|
|
});
|
|
});
|
|
});
|
|
</script>
|