safesite/safesite/templates/trainplanchose.html

82 lines
2.8 KiB
HTML

<table id="pxjhtable" style="width:auto;height:100%;"></table>
<div id="pxjhtablebar" style="padding:4px;height:auto">
<div>
<form id='searchpxjhff'>
<label>年份</label>
<select id="year" name='year' style='width:150px' editable=false>
</select>
<a class="easyui-textbox" name="search" data-options="prompt:'培训目的/概述'"></a>
<a onclick="plansearch()" class="easyui-linkbutton">查询</a>
<a onclick="planresset()" class="easyui-linkbutton">重置</a>
</form>
</div>
</div>
<script>
$(function(){
var option = $('#main').attr('value')
$('#pxjhtable').datagrid({url:'api/trainplan',queryParams:{a:'listall'}});
setYears();
$("#year").combobox()
})
function plansearch() {
var querydata = $('#searchpxjhff').serializeJSON();
querydata['a'] = 'listall'
$('#pxjhtable').datagrid('load', querydata);
}
function planresset() {
$('#searchpxjhff').form('clear')
$('#pxjhtable').datagrid('options').queryParams = {
a:'listall'
}
$('#pxjhtable').datagrid('load');
}
function setYears(){
var anOption = document.createElement("option");
var years= new Date().getFullYear()
years = years + 1
for(var i=0;i<=3;i++){
var anOption = document.createElement("option");
anOption.text=years-i;
anOption.value=years-i;
if(i==1){
anOption.selected = true
}
document.getElementById("year").appendChild(anOption);
}
}
$('#pxjhtable').datagrid({
url: '',
rownumbers: true,
singleSelect: true,
striped: true,
fitColumns: true,
method: 'get',
pagination: 'true',
pageSize: 20,
toolbar: '#pxjhtablebar',
border:false,
columns: [[
{ field: 'id', title: 'ID', hidden: true },
{ field: 'year', title: '年份', width: 60 },
{ field: 'month', title: '月份', width: 60 },
{ field: 'purpose', title: '培训目的/内容概述', width: 160 },
{ field: 'period', title: '预计学时', width: 60 },
{ field: 'group__groupname', title: '培训对象', width: 100 },
{ field: 'manager__name', title: '负责人', width: 80 },
]],
onClickRow: function (index, item) {
var id = item.id;
var name = item.year + '年' + item.month + '月' + '-' + item.purpose.substring(0,16) + '...';
var a = GetQueryString2("a");
top.$('#in').attr('value', id);
top.$('#in').attr('show', name);
top.$('#in').attr('target', a);
aaa(a);
closeForm2()
},
});
</script>