新增个人中心文档管理「已删除文档」相关功能

This commit is contained in:
zmister 2022-04-14 15:11:28 +08:00
parent 0715beacda
commit a7ed1a670f
2 changed files with 12 additions and 5 deletions

View File

@ -1471,8 +1471,10 @@ def manage_doc(request):
published_doc_cnt = Doc.objects.filter(create_user=request.user, status=1).count()
# 草稿文档数量
draft_doc_cnt = Doc.objects.filter(create_user=request.user, status=0).count()
# 回收站文档数量
recycle_doc_cnt = Doc.objects.filter(create_user=request.user, status=3).count()
# 所有文档数量
all_cnt = published_doc_cnt + draft_doc_cnt
all_cnt = published_doc_cnt + draft_doc_cnt + recycle_doc_cnt
return render(request,'app_doc/manage/manage_doc.html',locals())
else:
kw = request.POST.get('kw', '')

View File

@ -50,6 +50,7 @@
<input type="radio" name="status" title="全部({{all_cnt}})" value="-1" lay-skin="primary" checked lay-filter="doc_status">
<input type="radio" name="status" title="草稿({{draft_doc_cnt}})" value="0" lay-skin="primary" lay-filter="doc_status">
<input type="radio" name="status" title="已发布({{published_doc_cnt}})" value="1" lay-skin="primary" lay-filter="doc_status">
<input type="radio" name="status" title="已删除({{recycle_doc_cnt}})" value="3" lay-skin="primary" lay-filter="doc_status">
</div>
</div>
</div>
@ -286,11 +287,15 @@
// 监听状态筛选
form.on('radio(doc_status)', function(data){
console.log(data.value); //被点击的radio的value值
table.reload('doc-table',{
if(data.value == '3'){
top.layui.tab.addTabOnlyByElem("content",{id:"doc_recycle",title:"文档回收站",url:"{% url 'doc_recycle' %}",close:"true"})
}else{
table.reload('doc-table',{
where:{
'type':1,'status':data.value,
},
})
'type':1,'status':data.value,
},
})
}
});
// 监听搜索按钮
$("#search").click(function(){