166 lines
6.7 KiB
HTML
166 lines
6.7 KiB
HTML
<table id="tztable" style="width:auto;height:100%;"></table>
|
|
<div id="tztablebar" style="padding: 4px">
|
|
|
|
<div >
|
|
<label>快捷查询</label>
|
|
<select id='kjcxtz' style='width:150px'>
|
|
<option value="">请选择</option>
|
|
<option value="listall">全部</option>
|
|
<option value="listself">我发布的</option>
|
|
<option value="listtodo">发给我的</option>
|
|
</select>
|
|
<a onclick="javascript:$('#sdg_tz').dialog('open')" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">详细筛选</a>
|
|
</div>
|
|
<div >
|
|
{% load myfilter %}
|
|
{% if request|has_permission:'b_notice_add' %}
|
|
<a id="addtz" class="easyui-linkbutton" onclick="addtz()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_notice_change' %}
|
|
<a id="edittz" class="easyui-linkbutton" onclick="edittz()" data-options="iconCls: 'fa-pencil',plain:true">编辑</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_notice_del' %}
|
|
<a id="deltz" class="easyui-linkbutton" onclick="deltz()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_notice_detail' %}
|
|
<a id="tzdetail" onclick="tzdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查阅</a>
|
|
{% endif %}
|
|
</div>
|
|
<div id="sdg_tz" class="easyui-dialog" title="筛选条件" style="width:400px;height:300px;"
|
|
data-options="iconCls:'fa-search',resizable:true,modal:true,closed:true,border:false">
|
|
<div class="easyui-layout" style="width:100%;height:100%;">
|
|
<div data-options="region:'center'" style="height:100%;text-align:center">
|
|
<form id='searchtzff'>
|
|
<div style="margin-top:6px"><label>起始时间</label><input name='qssj' style="width:300px"
|
|
class="easyui-datetimebox" editable=false></div>
|
|
<div style="margin-top:6px"><label>结束时间</label><input name='jssj' style="width:300px"
|
|
class="easyui-datetimebox" editable=false></div>
|
|
</form>
|
|
</div>
|
|
<div id='southdiv' data-options="region:'south'" style="height:46px;text-align:center;padding:6px">
|
|
<a id="tzsearch" onclick="tzsearch()" class="easyui-linkbutton" data-options="iconCls: 'fa-search'">查询</a>
|
|
<a id="searchreset" onclick="reset()" class="easyui-linkbutton">重置</a>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(function(){
|
|
$('#tztable').datagrid({url:'api/notice',queryParams:{a:'listall'}});
|
|
})
|
|
$('#kjcxtz').combobox({
|
|
editable:false,
|
|
onSelect: function (node) {
|
|
if(node.value != 0){
|
|
$('#tztable').datagrid({url:'api/notice',queryParams:{a:node.value}});
|
|
}
|
|
}
|
|
});
|
|
function tzsearch() {
|
|
var querydata = $('#searchtzff').serializeJSON();
|
|
querydata['a'] = 'listsearch'
|
|
$("#sdg_tz").dialog("close");
|
|
$('#tztable').datagrid('load',querydata);
|
|
}
|
|
function reset() {
|
|
$('#searchtzff').form('clear')
|
|
$('#tztable').datagrid('options').queryParams = {
|
|
a:'listall'
|
|
}
|
|
$('#tztable').datagrid('load');
|
|
|
|
}
|
|
$('#tztable').datagrid({
|
|
url: '',
|
|
rownumbers: true,
|
|
singleSelect: true,
|
|
striped: true,
|
|
fitColumns: true,
|
|
method: 'get',
|
|
pagination: 'true',
|
|
pageSize: 20,
|
|
toolbar: '#tztablebar',
|
|
border:false,
|
|
columns: [[
|
|
{ field: 'id', title: 'ID', hidden: true },
|
|
{ field: 'pubuser__userid', title: 'uID', hidden: true },
|
|
{ field: 'title', title: '主题', width: 200 },
|
|
{ field: 'pubpart__partname', title: '发布部门', width: 100 },
|
|
{ field: 'pubuser__name', title: '发布人', width: 80 },
|
|
{ field: 'submittime', title: '创建时间', width: 80 },
|
|
{ field: 'modifytime', title: '更新时间', width: 80 },
|
|
{ field: 'reads', title: '阅读量', width: 80 },
|
|
{ field: 'isgg', title: '类型', width: 80,formatter: function (value, row, index) {
|
|
switch (value) {
|
|
case 1: return '公告:只可统计阅读量'; break;
|
|
case 0: return '通知:可查看阅读状态'; break;
|
|
}
|
|
} },
|
|
]]
|
|
});
|
|
function addtz(){
|
|
opendg('新增通知','html/notice/add')
|
|
}
|
|
function deltz(){
|
|
var row = $('#tztable').datagrid('getSelected');
|
|
if (row) {
|
|
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
|
if (r) {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: 'api/notice?a=del',
|
|
data: { 'id': row.id },
|
|
datatype: "json",
|
|
beforeSend: function () { },
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#tztable").datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '你无权删除该条记录!');
|
|
}
|
|
},
|
|
complete: function (XMLHttpRequest, textStatus) {
|
|
},
|
|
error: function () {
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请选择一行数据!');
|
|
}
|
|
}
|
|
function tzdetail(){
|
|
var row = $('#tztable').datagrid('getSelected');
|
|
if (row) {
|
|
var url = 'html/notice/detail/' + row.id
|
|
opendg('查看详情',url)
|
|
}
|
|
else { $.messager.alert('提示', '请选择一行数据!'); }
|
|
}
|
|
function edittz(){
|
|
var row = $('#tztable').datagrid('getSelected');
|
|
if (row) {
|
|
if(row.isgg == 1){
|
|
if(row.pubuser__userid == $('#userindex').attr('userid')){
|
|
var url = 'html/notice/edit/' + row.id
|
|
opendg('编辑公告',url)
|
|
}else{
|
|
$.messager.alert('提示', '非发布人不可编辑!');
|
|
}
|
|
|
|
}
|
|
else{
|
|
$.messager.alert('提示', '通知已发出,不可编辑!');
|
|
}
|
|
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请选择一行数据!');
|
|
}
|
|
}
|
|
</script> |