safesite/safesite/templates/socert.html

155 lines
6.4 KiB
HTML

<table id="tzzstable" style="width:auto;height:100%;"></table>
<a id="downa" href="" target="_blank" style="display:none"></a>
<div id="tzzstablebar">
<div style="padding: 5px;">
<!-- <a id="tzzssearch" onclick="tzzssearch()" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">查询</a> -->
<!-- <a id="tzzsdetail" onclick="tzzsdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a> -->
<label>快捷查询</label>
<select id='kjcxtzzs' 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_socert_add' %}
<a id="addtzzs" class="easyui-linkbutton" onclick="addtzzs()" data-options="iconCls: 'fa-plus',plain:true">新增</a>
{% endif %}
{% if request|has_permission:'b_socert_add' %}
<a id="edittzzs" class="easyui-linkbutton" onclick="edittzzs()" data-options="iconCls: 'fa-pencil',plain:true">编辑</a>
{% endif %}
{% if request|has_permission:'b_socert_del' %}
<a id="deltzzs" class="easyui-linkbutton" onclick="deltzzs()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
{% if request|has_permission:'b_socert_exportexl' %}
<a id="exporttzzsexcel" onclick="javascript:$('#tzzstable').datagrid('toExcel','证书.xls')" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Excel</a>
{% endif %}
</div>
<!-- <form id='searchwsff'>
<div>
<div>
<label>发生部门</label><input id="sfsbm" name="fsbm" style="width:auto;" editable=false/>
<label>起始时间</label><input name='qssj' id='qssjgc' style="width:200px" class="easyui-datetimebox" editable=false>
<label>结束时间</label><input name='jssj' id='jssjgc' style="width:200px" class="easyui-datetimebox" editable=false>
</div>
</div>
</form> -->
</div>
<script>
$(function(){
var searchStr = sessionStorage.getItem("socert");
var queryParams = {'a':'listall'}
if(searchStr){
var lls = JSON.parse(searchStr)
queryParams = Object.assign(queryParams, lls)
sessionStorage.removeItem("socert")
}
$('#tzzstable').datagrid({url:'api/socert',queryParams:queryParams});
})
// $("#sfsbm").combotree({
// url: 'parthandle?a=tree',
// editable: false,
// 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;
// },
// });
$('#kjcxtzzs').combobox({
editable:false,
onSelect: function (node) {
if(node.value != 0){
$('#tzzstable').datagrid({url:'api/socert',queryParams:{a:node.value}});
}
}
});
// function wssearch() {
// var querydata = $('#searchwsff').serializeJSON();
// querydata['a'] = 'listsearch'
// $('#wstable').datagrid('load',querydata);
// }
$('#tzzstable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#tzzstablebar',
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: 'zylb', title: '作业类别', width: 100 },
{ field: 'fzjg', title: '发证机关', width: 100 },
{ field: 'czxm', title: '操作项目', width: 100 ,sortable:true},
{ field: 'ccfzrq', title: '初次发证日期', width: 80 },
{ field: 'yfsrq', title: '应复审日期', width: 80 ,sortable:true,styler: function (value, row, index) {
switch (row.zszt) {
case 1: return 'background-color:green;color:white'; break;
case 2: return 'background-color:yellow;'; break;
case 3: return 'background-color:red;color:white'; break;
}
}},
{ field: 'yxqkssj', title: '有效期开始时间', width: 80 },
{ field: 'yxqjssj', title: '有效期结束时间', width: 80 },
]]
});
function addtzzs(){
opendg('新增证书','socerthtml/add')
}
function deltzzs(){
var row = $('#tzzstable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'api/socert?a=del',
data: { 'id': row.id },
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#tzzstable").datagrid('reload');
}
else {
$.messager.alert('提示', '你无权删除该证书!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
});
}
else {
$.messager.alert('提示', '未选择数据!');
}
}
function edittzzs(){
var row = $('#tzzstable').datagrid('getSelected');
if (row) {
opendg('编辑','html/socert/edit/' + row.id)
}
else {
$.messager.alert('提示', '请先选择一条记录!');
}
}
</script>