146 lines
5.8 KiB
HTML
146 lines
5.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>
|
|
<!-- {% load myfilter %}
|
|
{% if request|has_permission:'b_examtest_add1' %} -->
|
|
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="addplan()">新建</a>
|
|
<a id="updateplan" onclick="updateplan()" class="easyui-linkbutton" data-options="iconCls: 'fa-pencil',plain:true">编辑</a>
|
|
<a id="delplan" class="easyui-linkbutton" onclick="delplan()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
|
<!-- {% endif %}
|
|
{% if request|has_permission:'b_examtest_add2' %}
|
|
<a class="easyui-linkbutton" data-options="iconCls: 'fa-plus',plain:true" onclick="addplan2()">自动抽题考试</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_examtest_close' %}
|
|
<a class="easyui-linkbutton" data-options="iconCls: 'fa-times',plain:true" onclick="closeks()">关闭考试</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_examtest_del' %}
|
|
<a id="delplan" class="easyui-linkbutton" onclick="delplan()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_examtest_detail' %}
|
|
<a id="ksdetail" onclick="ksdetail()" class="easyui-linkbutton" data-options="iconCls: 'fa-info-circle',plain:true">查看详情</a>
|
|
{% endif %} -->
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(function(){
|
|
var option = $('#main').attr('value')
|
|
$('#pxjhtable').datagrid({url:'api/trainplan/',queryParams:{a:'listall'}});
|
|
setYears();
|
|
$("#year").combobox()
|
|
})
|
|
function addplan(obj){
|
|
opendg('创建计划','html/trainplan/add')
|
|
}
|
|
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 },
|
|
{ field: 'completion', title: '完成度', width: 160,formatter: function (value, row, index) {
|
|
var htmlstr='<div class="easyui-progressbar progressbar easyui-fluid" style="width: 100%; height: 20px;">'
|
|
+'<div class="progressbar-text" style="width: 100% height: 20px; line-height: 20px;">'+ value + '%</div> '
|
|
+ '<div class="progressbar-value" style="width:'+value+'%; height: 20px; line-height: 20px;">'
|
|
+ '<div class="progressbar-text" style="width: 100%; height: 20px; line-height: 20px;">'+value+'%</div>'
|
|
+'</div>'
|
|
+'</div>';
|
|
return htmlstr;
|
|
} },
|
|
|
|
]]
|
|
});
|
|
function updateplan(){
|
|
var row = $('#pxjhtable').datagrid('getSelected');
|
|
if (row) {
|
|
opendg('编辑','html/trainplan/edit/' + row.id)
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '未选择数据!');
|
|
}
|
|
}
|
|
function delplan(){
|
|
var row = $('#pxjhtable').datagrid('getSelected');
|
|
if (row) {
|
|
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
|
if (r) {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: 'api/trainplan/?a=del',
|
|
data: { 'id': row.id },
|
|
datatype: "json",
|
|
beforeSend: function () { },
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#pxjhtable").datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '你无权删除该条记录!');
|
|
}
|
|
},
|
|
complete: function (XMLHttpRequest, textStatus) {
|
|
},
|
|
error: function () {
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请选择一行数据!');
|
|
}
|
|
}
|
|
|
|
</script> |