safesite/safesite/templates/lawsindex.html

243 lines
8.4 KiB
HTML

<div class="easyui-layout" style="width:100%;height:100%;">
<div data-options="region:'west',split:true,border:false" style="width:240px;height:100%;">
<div id="mrfl" height="40%" title="默认分类">
<ul id="mrfltree" data-options="animate:true,toolbar:'#mrflbar'"></ul>
</div>
<!-- <div id="gwfl" height="30%"></div> -->
<div id="zjfl" height="60%" title="自建分类">
<div id="zjflbar" style="padding:5px;height:auto">
{% load myfilter %}
{% if request|has_permission:'b_laws_user_add' %}
<a id="addtmfl2" onclick="javascript:opendg('新建分类','rlt/html/laws/add')" class="easyui-linkbutton" data-options="iconCls:'fa-plus',plain:true">新增</a>
{% endif %}
{% if request|has_permission:'b_laws_user_upd' %}
<a id="edittmfl2" onclick="edittmfl2()" class="easyui-linkbutton" data-options="iconCls:'fa-pencil',plain:true">编辑</a>
{% endif %}
{% if request|has_permission:'b_laws_user_del' %}
<a id="deltmfl2" onclick="deltmfl2()" class="easyui-linkbutton" data-options="iconCls:'fa-trash',plain:true">删除</a>
{% endif %}
</div>
<ul id="zjfltree" data-options="animate:true,toolbar:'#zjflbar'"></ul>
</div>
</div>
<div data-options="region:'center',title:'法律法规管理',split:true,border:false" style="height:100%;">
<div id="tmbar" style="padding:5px;height:auto">
{% if request|has_permission:'b_laws_add' %}
<a id="addtm" onclick="javascript:opendg('新增法律法规信息','rlt/html/laws/addlaws')" class="easyui-linkbutton" data-options="iconCls:'fa-plus',plain:true">新建</a>
{% endif %}
{% if request|has_permission:'b_laws_upd' %}
<a id="edittm" onclick="edittm()" class="easyui-linkbutton"
data-options="iconCls:'fa-pencil',plain:true">编辑</a>
{% endif %}
{% if request|has_permission:'b_laws_del' %}
<a id="deltm" onclick="deltm()" class="easyui-linkbutton"
data-options="iconCls:'fa-trash',plain:true">删除</a>
{% endif %}
<!--<a id="edittm" onclick="edittm()" class="easyui-linkbutton"
data-options="iconCls:'fa-pencil',plain:true">详情</a>-->
</div>
<table id="tmtable" style="height:100%;"></table>
</div>
</div>
<script>
$('#mrfl').panel()
$('#mrfltree').tree({
url: 'rlt/api/lawstype?a=tree1',
animate: true,
toolbar: '#mrflbar',
loadFilter: function (rows) {
return convert(rows);
},
formatter: function (node) {
var s = node.text;
if (node.children) {
s += '&nbsp;<span style=\'color:blue\'>(' + node.children.length + ')</span>';
}
return s;
},
onSelect: function (row) {
$("#tmtable").datagrid({
url: 'rlt/api/lawstype?a=listall&typeID=' + row.id,
});
}
});
$('#zjfl').panel()
$('#zjfltree').tree({
url: 'rlt/api/lawstype?a=tree2',
animate: true,
toolbar: '#zjflbar',
loadFilter: function (rows) {
return convert(rows);
},
formatter: function (node) {
var s = node.text;
if (node.children) {
s += '&nbsp;<span style=\'color:blue\'>(' + node.children.length + ')</span>';
}
return s;
},
onSelect: function (row) {
$("#tmtable").datagrid({
url: 'rlt/api/lawstype?a=listall&typeID=' + row.id,
});
}
});
$('#tmtable').datagrid({
url: 'rlt/api/lawstype?a=listall',
rownumbers: true,
singleSelect: true,
striped: true,
method: 'get',
toolbar: '#tmbar',
pagination: 'true',
pageSize: 20,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'versionnum', title: '版本号', width: '14%' },
{ field: 'maragename', title: '法律法规名称', width: '16%' },
{ field: 'maragetype__typename', title: '所属分类', width: '14%' },
{ field: 'publisdate', title: '发布日期', width: '14%' },
{
field: 'maragestate', title: '状态', width: '14%', formatter: function (value, row, index) {
if (value == 0) {
return '现行';
}
else if (value == 1) {
return '废止'
}
else if (value == 2) {
return '修改'
}
else if (value == 3) {
return '修订'
}
}
},
{ field: 'actualizedata', title: '实施日期', width: '14%' },
{
field: 'maragepath', title: '点击下载', width:'14%', formatter: function (value, row, index) {
return '<a style="color:blue" target="_blank" href="' + row.maragepath + '" id="one">点击下载</a>';
}
},
]],
});
//法律法规分类编辑
function edittmfl2() {
var row = $('#zjfltree').tree('getSelected');
if (row) {
opendg('编辑分类', 'rlt/html/lawstype/edit/' + row.id)
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
//删除法律法规某个分类
function deltmfl2() {
var row = $('#zjfltree').tree('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'rlt/api/lawstype?a=del&id=' + row.id,
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#zjfltree").tree('reload');
} else {
$.messager.alert('提示', '您无权删除!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
}
);
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
function edittm() {
var row = $('#tmtable').datagrid('getSelected');
if (row) {
$.get('rlt/api/lawstype?a=canedit&id=' + row.id, function (res) {
if (res.code == 1) {
opendg('编辑法律法规', 'rlt/html/laws/edit/' + row.id)
}
else {
$.messager.alert('提示', '此条不是自建数据,不可编辑!');
}
})
}
else {
$.messager.alert('提示', '请选择一条数据!');
}
}
//根据id删除法律法规数据
function deltm() {
var row = $('#tmtable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'rlt/api/lawstype?a=dellaws&id=' + row.id,
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#tmtable").datagrid('reload');
} else {
$.messager.alert('提示', '您无权删除!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
}
);
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
</script>