safesite/safesite/templates/safecert.html

123 lines
4.9 KiB
HTML

<table id="aqzstable" style="width:auto;height:100%;"></table>
<a id="downa" href="" target="_blank" style="display:none"></a>
<div id="aqzstablebar">
<div style="width: 400px;">
<label>快捷查询</label>
<select id='kjcxaqzs' style='width:150px'>
<option value="">请选择</option>
<option value="listself">我的证书</option>
<option value="listall">全部证书</option>
</select>
</div>
<div style="padding: 5px;">
{% load myfilter %}
{% if request|has_permission:'b_safecert_add' %}
<a id="addaqzs" class="easyui-linkbutton" onclick="addaqzs()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
{% endif %}
{% if request|has_permission:'b_safecert_add' %}
<a id="editaqzs" class="easyui-linkbutton" onclick="editaqzs()" data-options="iconCls: 'fa-pencil',plain:true">编辑</a>
{% endif %}
{% if request|has_permission:'b_safecert_del' %}
<a id="delaqzs" class="easyui-linkbutton" onclick="delaqzs()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
{% if request|has_permission:'b_safecert_exportexl' %}
<a id="exportaqzsexcel" onclick="javascript:$('#aqzstable').datagrid('toExcel','证书.xls')" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
{% endif %}
</div>
</div>
<script>
$(function(){
var searchStr = sessionStorage.getItem("safecert");
var queryParams = {'a':'listall'}
if(searchStr){
var lls = JSON.parse(searchStr)
queryParams = Object.assign(queryParams, lls)
}
$('#aqzstable').datagrid({url:'api/safecert',queryParams:queryParams});
})
$('#kjcxaqzs').combobox({
editable:false,
onSelect: function (node) {
if(node.value != 0){
$('#aqzstable').datagrid({url:'api/safecert',queryParams:{a:node.value}});
}
}
});
$('#aqzstable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#aqzstablebar',
border:false,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'user__userprofile__realname', title: '姓名', width: 80 },
{ field: 'user__userprofile__gender', title: '性别', width: 40 },
{ field: 'user__userprofile__cardnum', title: '身份证号', width: 100 },
{ field: 'zglx', title: '资格类型', width: 100 },
{ field: 'fzjg', title: '发证机关', width: 100 },
{ field: 'dwlx', title: '单位类型', width: 100 ,sortable:true},
{ field: 'yfsrq', title: '应复审日期', width: 80 ,sortable:true,styler: function (value, row, index) {
switch (row.zszt) {
case 1: return 'background-color:green;'; break;
case 2: return 'background-color:yellow;'; break;
case 3: return 'background-color:red;'; break;
}
}},
{ field: 'yxqkssj', title: '有效期开始时间', width: 80 },
{ field: 'yxqjssj', title: '有效期结束时间', width: 80 },
]]
});
function addaqzs(){
opendg('新增证书','html/safecert/add')
}
function delaqzs(){
var row = $('#aqzstable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'api/safecert?a=del',
data: { 'id': row.id },
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#aqzstable").datagrid('reload');
}
else {
$.messager.alert('提示', '你无权删除该证书!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
});
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
function editaqzs(){
var row = $('#aqzstable').datagrid('getSelected');
if (row) {
opendg('编辑','html/safecert/edit/' + row.id)
}
else {
$.messager.alert('提示', '请先选择一条记录!');
}
}
</script>