safesite/safesite/templates/checkjob.html

140 lines
5.1 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>
</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 %}
</div>
</div>
<table id="jobtab" style="width:100%;height:100%;text-align: center;"></table>
<script>
$(function () {
})
$('#kjcxyh').combobox({
editable: false,
onSelect: function (node) {
if (node.value != '') {
$('#jobtab').datagrid({ url: 'api/checkproject', queryParams: { a: node.value } });
}
}
})
$('#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__username', 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;
}
}, styler: function (value, row, index) {
switch (value) {
case 1: return 'color:green;font-weight:bold'; break;
case 2: return 'color:red;font-weight:bold'; break;
case 3: return 'color:yellow;font-weight:bold'; break;
}}},
{
field: 'jobstate', title: '任务状态', width: 100, styler: function (value, row, index) {
if (value == 1) {
return 'background-color:yellow;';
}
else {
return 'background-color:green;';
}
}, formatter: function (value, row, index) {
if (value == 1) {
return '可执行';
}
else {
return '已过期'
}
}
},
{ field: 'createdate', title: '创建时间', width: 100 },
{ field: 'yanshou', title: '验收时间', width: 100 },
//
//{ field: 'zguser__name', title: '整改人', width: 100 },
//{ field: 'zgtime', title: '整改时间', width: 100 },
]]
});
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.jobstate == 2) {
$.messager.alert('提示', '该任务已过期不能执行!');
}
else if (data.taskstate ==3) {
$.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())
}
else {
$.messager.alert('提示', '请先选择一条数据!');
}
}
</script>