safesite/safesite/templates/checkjob.html

227 lines
8.9 KiB
HTML

<div id="taskbar" style="padding: 4px;">
<div>
<label>快捷查询</label>
<select id='kjcxyh' style='width:150px;'>
<option value="">请选择</option>
<option value="listself">我的任务</option>
<option value="listchuli">验收任务</option>
<option value="listallx">全部任务</option>
</select>
<a onclick="javascript:$('#sdg_job').dialog('open')" class="easyui-linkbutton" data-options="iconCls: 'fa-search',plain:true">详细筛选</a>
</div>
<div>
{% load myfilter %}
{% if request|has_permission:'b_checkjob_add' %}
<a id="addtask" class="easyui-linkbutton" onclick="addcheckrw()" data-options="iconCls: 'fa-plus',plain:true">执行任务</a>
{% endif %}
{% if request|has_permission:'b_checkjob_detail' %}
<a id="detailprg" class="easyui-linkbutton" onclick="detailtask()" data-options="iconCls: 'fa-info-circle',plain:true">验收详情</a>
{% endif %}
{% if request|has_permission:'b_checkjob_del' %}
<a id="deljob" class="easyui-linkbutton" onclick="deljob()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
{% endif %}
</div>
<div id="sdg_job" class="easyui-dialog" title="筛选条件" style="width:400px;height:420px;"
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:right;">
<form id='searchyhff' style="margin-right: 10px">
<div style="margin-top:4px"><label>起始时间:</label><input name='qssj' id='qssjyh' style="width:300px"></div>
<div style="margin-top:4px"><label>结束时间:</label><input name='jssj' id='jssjyh' style="width:300px"></div>
<div style="margin-top:4px"><label>检查表名:</label><input id="checktabtitle" name="checktabtitle" style="width:300px" /></div>
<div style="margin-top:4px"><label>任务名称:</label><input id="checktaskname" name="checktaskname" style="width:300px"/></div>
<div style="margin-top:4px"><label>检查人:</label><input name="checkername" style="width:300px" class="easyui-textbox"/></div>
</form>
</div>
<div id='southdiv' data-options="region:'south'" style="height:44px;text-align:center;padding:4px">
<a id="yhsearch" onclick="yhsearch()">查询</a>
<a id="searchreset" onclick="reset()" class="easyui-linkbutton">重置</a>
</div>
</div>
</div>
</div>
<table id="jobtab" style="width:100%;height:100%;text-align: center;"></table>
<script>
$(function () {
var option = $('#main').attr('value')
$("#searchyhff").form('clear');
})
$('#jobtab').datagrid({
url: 'api/checkproject?a=listall4',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
border: false,
toolbar:'#taskbar',
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'checktask__checktaskname', title: '任务名称', width: 100 },
{ field: 'checktask__checktype__checktitle', title: '检查表', width: 100 },
{ field: 'checkname__name', title: '检查人员', width: 100 },
//{ field: 'zguser__username', title: '整改人', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
{ field: 'starttime', title: '任务开始时间', width: 100 },
{ field: 'endtime', title: '任务结束时间', width: 100 },
{
field: 'taskstate', title: '工作状态', width: 100, formatter: function (value, row, index) {
switch (value) {
case 1: return '正在整改中'; break;
case 2: return '已整改完成'; break;
case 3: return '任务关闭'; break;
case 4: return '待执行'; break;
}
}, styler: function (value, row, index) {
switch (value) {
case 1: return 'color:red;font-weight:bold'; break;
case 2: return 'color:darkblue;font-weight:bold'; break;
case 3: return 'color:green;font-weight:bold'; break;
case 4: return 'color:orange;font-weight:bold'; break;
}}},
{ field: 'createdate', title: '创建时间', width: 100 },
{ field: 'yanshou', title: '验收时间', width: 100 },
//
//{ field: 'zguser__name', title: '整改人', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
]]
});
$('#kjcxyh').combobox({
editable: false,
onSelect: function (node) {
if (node.value != '') {
$('#jobtab').datagrid({ url: 'api/checkproject', queryParams: { a: node.value } });
}
}
})
$('#yhsearch').linkbutton({
iconCls: 'fa-search',
});
$("#qssjyh").datebox({
editable: false
});
$("#jssjyh").datebox({
editable: false
});
$("#checktabtitle").combobox({
url: 'api/checkproject?a=checktablist',
valueField: 'value',
textField: 'text',
editable: false,
});
$("#checktaskname").combobox({
url: 'api/checkproject?a=checktablist2',
valueField: 'value',
textField: 'text',
editable: false,
});
function yhsearch() {
var querydata = $('#searchyhff').serializeJSON();
querydata['a'] = 'listsearch'
$('#sdg_job').dialog('close')
$('#jobtab').datagrid('load', querydata);
}
function reset() {
$('#searchyhff').form('clear')
$('#jobtab').datagrid('options').queryParams = {
a:'listall'
}
$('#jobtab').datagrid('load');
}
function addcheckrw() {
var row = $('#jobtab').datagrid('getSelected');
if (row) {
$.get('api/checkproject?a=jobdetail&id=' + row.id, function (res) {
var data = res.data
console.log(data)
if (data.taskstate == 3) {
$.messager.alert('提示', '该任务已关闭不能执行!');
}
else if (data.taskstate ==2) {
$.messager.alert('提示', '该任务已执行完成!');
}
else
opendg('查看检查任务','html/addcheckjob/'+row.id.toString())
});
}
else {
$.messager.alert('提示', '请先选择一条数据!');
}
}
function detailtask() {
var row = $('#jobtab').datagrid('getSelected');
if (row) {
opendg('任务详情','html/detailjob/'+row.id.toString())
// $.get('api/checkproject?a=jobdetail&id=' + row.id, function (res) {
// var data = res.data
// opendg('任务详情','html/detailjob/'+row.id.toString())
// });
}
else {
$.messager.alert('提示', '请先选择一条数据!');
}
}
function deljob() {
var row = $('#jobtab').datagrid('getSelected');
if (row) {
$.messager.confirm('提示', '确定删除吗?', function (r) {
if (r) {
$.ajax({
type: "GET",
url: 'api/checkproject?a=deljob',
data: { 'id': row.id },
datatype: "json",
beforeSend: function () { },
success: function (data) {
if (data.code == 1) {
$("#jobtab").datagrid('reload');
}
else {
$.messager.alert('提示', '你无权删除该条任务信息!');
}
},
complete: function (XMLHttpRequest, textStatus) {
},
error: function () {
}
});
}
});
}
else {
$.messager.alert('提示', '请选择一行数据!');
}
}
</script>