safesite/safesite/templates/drill.html

284 lines
11 KiB
HTML

<table id="yltable" style="width:100%;height:100%;"></table>
<div id="yltablebar" style="padding: 4px;">
<div>
<label>快捷查询</label>
<select id='kjcxyl' style='width:150px'>
<option value="">请选择</option>
<option value="listtodo">我的待评估演练</option>
<option value="listall">全部演练</option>
</select>
<a onclick="javascript:$('#sdg_yl').dialog('open')" class="easyui-linkbutton"
data-options="iconCls: 'fa-search',plain:true">详细筛选</a>
</div>
<div>
{% load myfilter %}
{% if request|has_permission:'b_drill_add' %}
<a id="adddrill" onclick="javascript:opendg('新建演练','abdrill?a=adddrill')">新增</a>
{% endif %}
<a id="accessdrill" onclick="accessdrill()">评估</a>
<!-- <a href="#" class="easyui-linkbutton" iconCls="icon-edit" onclick="edittrain()" plain="true">编辑</a> -->
{% if request|has_permission:'b_drill_del' %}
<a id="deldrill" onclick="deldrill()">删除</a>
{% endif %}
{% if request|has_permission:'b_drill_detail' %}
<a id="yldetail" onclick="yldetail()">查看详情</a>
{% endif %}
{% if request|has_permission:'b_drill_exportdoc' %}
<a id="exportylword" onclick="exportylword()">导出Word</a>
{% endif %}
{% if request|has_permission:'b_drill_exportxls' %}
<a id="exportylexcel" onclick="exportylexcel()">导出Excel</a>
{% endif %}
</div>
<div id="sdg_yl" 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='searchylff'>
<div style="margin-top:6px"><label>起始时间</label><input name='qssj' id='qssjyl' style="width:300px">
</div>
<div style="margin-top:6px"><label>结束时间</label><input name='jssj' id='jssjyl' style="width:300px">
</div>
<div style="margin-top:6px"><label>演练部门</label><input name='drillpart' id="sdrillpart"
style="width:300px;" /></div>
<div style="margin-top:6px"><label>演练级别</label><input name='drilllevel' id="sdrilllevel"
style="width:300px;" /></div>
<div style="margin-top:6px"><label>演练内容</label><input name='drillcontent' id="sdrillcontent"
style="width:300px;" class='easyui-combobox' editable=false /></div>
</form>
</div>
<div id='southdiv' data-options="region:'south'" style="height:46px;text-align:center;padding:6px">
<a id="ylsearch" onclick="ylsearch()">查询</a>
<a id="searchreset" onclick="reset()" class="easyui-linkbutton">重置</a>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
var searchStr = sessionStorage.getItem("drill");
var queryParams = {'a':'listall'}
if(searchStr){
var lls = JSON.parse(searchStr)
queryParams = Object.assign(queryParams, lls)
sessionStorage.removeItem("drill")
}
$('#yltable').datagrid({ url: 'ylhandle', queryParams: queryParams });
$("#searchylff").form('clear');
})
$('#yltable').datagrid({
rownumbers: true,
singleSelect: true,
striped: true,
url: '',
method: 'get',
fitColumns: true,
pagination: 'true',
pageSize: 20,
toolbar: '#yltablebar',
border: false,
columns: [[
{ field: 'drillid', hidden: true },
{ field: 'drillnum', title: '编号', width: 150 },
{
field: 'state', title: '状态', width: 80, styler: function (value, row, index) {
if (value == 0) {
return 'background-color:yellow;';
}
else {
return 'background-color:green;';
}
}, formatter: function (value, row, index) {
if (value == 0) {
return '待评估';
}
else {
return '已评估'
}
}
},
{ field: 'drillplace', title: '演练地点', width: 80 },
{ field: 'drillname', title: '演练名称', width: 200 },
{ field: 'starttime', title: '开始时间', width: 200 },
{ field: 'drilltype__dickeyname', title: '演练类型', width: 200 },
{ field: 'chief__name', title: '总指挥', width: 200 },
{ field: 'submituser__name', title: '填报人', width: 80 },
{ field: 'submituser__userid', title: '填报人ID', hidden: true },
]]
});
$('#kjcxyl').combobox({
editable: false,
onSelect: function (node) {
if (node.value == 0) { }
else { $('#yltable').datagrid({ url: 'ylhandle', queryParams: { a: node.value } }); }
}
});
$('#adddrill').linkbutton({ iconCls: 'fa-plus', plain: true });
$('#accessdrill').linkbutton({ iconCls: 'fa-flash', plain: true });
$('#deldrill').linkbutton({ iconCls: 'fa-trash', plain: true });
$('#ylsearch').linkbutton({ iconCls: 'fa-search' });
$('#yldetail').linkbutton({ iconCls: 'fa-info-circle', plain: true });
$('#exportylword').linkbutton({ iconCls: 'fa-download', plain: true });
$('#exportylexcel').linkbutton({ iconCls: 'fa-download', plain: true });
$("#sdrilllevel").combobox({
url: 'getdicclass?dicid=11&a=combobox',
method: 'get',
valueField: 'value',
textField: 'text',
groupField: 'group',
editable: false,
});
$("#sdrillcontent").combobox({ url: 'getdickey?dicclass=13&a=combobox', });
$("#sdrillpart").combotree({
url: 'parthandle?a=tree',
method: 'get',
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;
},
editable: false,
});
$("#qssjyl").datebox({ editable: false });
$("#jssjyl").datebox({ editable: false });
function deldrill() {
var row = $('#yltable').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'ylhandle?a=del',
data: { 'drillid': row.drillid },
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#yltable").datagrid('reload');
}
else {
$.messager.alert('提示', '你无权删除该条演练!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
});
}
else {
$.messager.alert('提示', '请选择一行数据!');
}
}
function accessdrill() {
var row = $('#yltable').datagrid('getSelected');
var url = 'abdrill?drillid=' + row.drillid + '&a=accessdrill';
if (row) {
if (row.state == 0) {
if ($("#userindex").attr('userid') == row.submituser__userid) {
opendg('评估演练', url)
} else { $.messager.alert('提示', '非填报人不能评估!'); }
}
else { $.messager.alert('提示', '该演练已经评估!'); }
}
else {
$.messager.alert('提示', '请选择一行数据!');
}
}
function yldetail() {
var row = $('#yltable').datagrid('getSelected');
if (row) {
var url = 'ylhandle?a=detailhtml&drillid=' + row.drillid
opendg('查看详情', url)
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function exportylword() {
var row = $('#yltable').datagrid('getSelected');
if (row) {
$.ajax({
type: "GET",
url: 'ylhandle?a=exportword&drillid=' + row.drillid,
datatype: "json",
async: false,
beforeSend: function () { loading() },
success: function (data) {
removeLoading();
if (data.code == 1) {
window.open(data.downloadurl);
}
else {
$.messager.alert('提示', '导出Word失败!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
else { $.messager.alert('提示', '请选择一行数据!'); }
}
function exportylexcel() {
var querydata = $('#searchylff').serializeJSON();
querydata['a'] = 'exportexcel'
$.ajax({
type: "GET",
url: 'ylhandle',
data: querydata,
datatype: "json",
async: false,
beforeSend: function () { loading(); },
success: function (data) {
removeLoading();
if (data.code == 1) {
window.open(data.downloadurl);
}
else {
$.messager.alert('提示', '导出Excel失败!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
function ylsearch() {
var querydata = $('#searchylff').serializeJSON();
querydata['a'] = 'listsearch'
$('#sdg_yl').dialog('close')
$('#yltable').datagrid('load', querydata);
}
function reset() {
$('#searchylff').form('clear')
$('#yltable').datagrid('options').queryParams = {
a:'listall'
}
$('#yltable').datagrid('load');
}
</script>
</body>
</html>