forked from mirror/MrDoc
124 lines
4.8 KiB
HTML
124 lines
4.8 KiB
HTML
{% extends 'app_doc/user/user_base.html' %}
|
|
{% load static %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "文档模板管理" %}{% endblock %}
|
|
{% block content %}
|
|
<div class="layui-card">
|
|
<div class="layui-card-body">
|
|
<div class="layui-card-header" style="margin-bottom: 10px;">
|
|
<div class="layui-row">
|
|
<span style="font-size:18px;">{% trans "文档模板管理" %}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="layui-row">
|
|
<form action="{% url 'manage_doctemp' %}" method="get">
|
|
<div class="layui-form-item">
|
|
<div class="layui-input-inline">
|
|
<input type="text" name="kw" id="kw" placeholder="输入文档模板内容" autocomplete="off" class="layui-input">
|
|
</div>
|
|
<button class="layui-btn layui-btn-normal layui-btn-sm" type="submit"><i class="layui-icon layui-icon-search"></i>{% trans "搜索" %}</button>
|
|
<a href="{% url 'create_doctemp' %}" target="_blank" class="layui-btn layui-btn-normal layui-btn-sm">
|
|
<i class="layui-icon layui-icon-addition"></i>{% trans "新建" %}</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="layui-row" >
|
|
<table class="layui-table" id="doctemp-list" lay-skin="nob" lay-even>
|
|
<colgroup>
|
|
<col width="200">
|
|
<col width="200">
|
|
<col>
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans "模板名称" %}</th>
|
|
<th>{% trans "创建时间" %}</th>
|
|
<th>{% trans "操作" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for temp in doctemps %}
|
|
<tr>
|
|
<td>{{ temp.name }}</td>
|
|
<td>{{ temp.create_time }}</td>
|
|
<td>
|
|
<a href="{% url 'modify_doctemp' doctemp_id=temp.id %}" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal">
|
|
<i class="layui-icon layui-icon-edit"></i>{% trans "修改" %}
|
|
</a>
|
|
<a href="javascript:void(0);" onclick="delTemp('{{temp.id}}');" class="layui-btn layui-btn-xs layui-btn-warm">
|
|
<i class="layui-icon layui-icon-delete"></i>{% trans "删除" %}
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- 分页 -->
|
|
<div class="layui-row">
|
|
<div class="layui-box layui-laypage layui-laypage-default">
|
|
<!-- 上一页 -->
|
|
{% if doctemps.has_previous %}
|
|
<a href="?page={{ doctemps.previous_page_number }}&kw={{doctemps.kw}}" class="layui-btn layui-btn-xs layui-btn-normal">{% trans "上一页" %}</a>
|
|
{% else %}
|
|
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-disabled">{% trans "上一页" %}</a>
|
|
{% endif %}
|
|
<!-- 当前页 -->
|
|
<span class="layui-laypage-curr">
|
|
<em class="layui-laypage-em"></em>
|
|
<em>{{ doctemps.number }}/{{ doctemps.paginator.num_pages }}</em>
|
|
</span>
|
|
<!-- 下一页 -->
|
|
{% if doctemps.has_next %}
|
|
<a href="?page={{ doctemps.next_page_number }}&kw={{doctemps.kw}}" class="layui-btn layui-btn-xs layui-btn-normal">{% trans "下一页" %}</a>
|
|
{% else %}
|
|
<a class="layui-btn layui-btn-xs layui-btn-disabled">{% trans "下一页" %}</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
{% block custom_script %}
|
|
<script>
|
|
layui.use(['table', 'form', 'jquery', 'layer'], function() {
|
|
let table = layui.table;
|
|
let form = layui.form;
|
|
let $ = layui.jquery;
|
|
let layer = layui.layer;
|
|
$.ajaxSetup({
|
|
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
|
});
|
|
delTemp = function(doctemp_id){
|
|
layer.open({
|
|
type:1,
|
|
title:'删除文档',
|
|
area:'300px;',
|
|
id:'delPro',//配置ID
|
|
content:'<div style="margin-left:10px;">警告:此操作将删除此文档模板!</div>',
|
|
btn:['确定','取消'], //添加按钮
|
|
btnAlign:'c', //按钮居中
|
|
yes:function (index,layero) {
|
|
layer.load(1);
|
|
data = {
|
|
'doctemp_id':doctemp_id,
|
|
}
|
|
$.post("{% url 'del_doctemp' %}",data,function(r){
|
|
layer.closeAll('loading');
|
|
if(r.status){
|
|
//修改成功
|
|
window.location.reload();
|
|
//layer.close(index)
|
|
}else{
|
|
//修改失败,提示
|
|
// console.log(r)
|
|
layer.msg(r.data)
|
|
}
|
|
})
|
|
},
|
|
});
|
|
}
|
|
})
|
|
</script>
|
|
{% endblock %} |