safesite/safesite/templates/task.html

102 lines
4.7 KiB
HTML

<div class="easyui-layout" style="width:100%;height:100%;">
<div id="riskactbar" style="padding:5px;height:auto">
<a onclick="taskplan()" class="easyui-linkbutton" data-options="iconCls:'fa-tasks',plain:true">按岗位批量制定排查任务</a>
</div>
<table id="taskplantable" style="height:100%;"></table>
</div>
<div id="taskdg" class="easyui-dialog" title="排查任务" style="width:400px;height:200px;text-align: center"
data-options="iconCls:'fa-tasks',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">
<div style="margin-top:6px">
<select id="tasktype" class="easyui-combobox" name="tasktype" style="width:90%;" data-options="label:'排查频次'"
required=true editable=false>
<option value="3">每周一次</option>
<option value="2">每天一次(24h)</option>
<option value="1">每班一次(8h)</option>
</select>
</div>
<div style="margin-top:6px">
<input id="firsttime" editable="false" name="firsttime" class="easyui-datetimebox" style="width:90%;"
data-options="label:'初次执行时间',currentText:'今天',closeText:'关闭',showSeconds:false" />
</div>
</div>
<div id='southdiv' data-options="region:'south'" style="height:46px;text-align:center;padding:6px">
<a id="taskconfirm" onclick="taskplanconfirm()" class="easyui-linkbutton" data-options="iconCls: 'fa-save'">确定</a>
</div>
</div>
</div>
<script>
$('#firsttime').datebox().datebox('calendar').calendar({
validator : function(date){
var now = new Date();
var d1 = new Date(now.getFullYear(),now.getMonth(),now.getDate());
return d1 <= date;
}
});
$('#taskplantable').datagrid({
url: 'api/riskact?a=listalltask',
rownumbers: true,
fitColumns: true,
striped: true,
method: 'get',
toolbar: '#riskactbar',
pagination: 'true',
pageSize: 20,
columns: [[
{ field: 'ck', checkbox: true },
{ field: 'tasktype', title: '排查频次', width: 100, formatter: function (value, row, index) {
switch (value) {
case 0: return '未制定'; break;
case 1: return '每班一次(8h)'; break;
case 2: return '每天一次(24h)'; 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:green;font-weight:bold'; break;
case 3: return 'color:green;font-weight:bold'; break;
case 4: return 'color:green;font-weight:bold'; break;
}}},
{ field: 'tasktime', title: '最近任务时间', width: 80 },
{ field: 'group__groupname', title: '所属岗位', width: 100 },
{ field: 'name', title: '风险点名称', width: 80 },
{ field: 'area__name', title: '区域', width: 100 },
{ field: 'type__dickeyname', title: '风险点类型', width: 100 },
// { field: 'num', title: '风险数量', width: 100 },
]],
})
function taskplanconfirm(){
$('#taskconfirm').linkbutton('disable');
var nodes = $('#taskplantable').datagrid('getChecked');
var tasktype = $('#tasktype').combobox('getValue')
var firsttime = $('#firsttime').datetimebox('getValue')
//var url = 'api/risktask?a=updates';
var url = 'api/riskact?a=updatetask'
$.post(url,{'tasktype':tasktype,'riskacts':JSON.stringify(nodes),'firsttime':firsttime},function(res){
if(res.code==1){
$('#taskconfirm').linkbutton('enable');
$('#taskdg').dialog('close').window('center');
$("#taskplantable").datagrid('reload');
}
})
}
function taskplan(){
var nodes = $('#taskplantable').datagrid('getChecked');
console.log(nodes)
if(nodes.length==0){
$.messager.alert('提示', '请先选择岗位风险,可多选!');
}else{
$('#taskconfirm').linkbutton('enable');
$('#tasktype').combobox('setValue',1)
$('#taskdg').dialog('open').window('center');
}
}
</script>