185 lines
7.1 KiB
HTML
185 lines
7.1 KiB
HTML
<table id="sjtable" style="width:auto;height:100%;"></table>
|
|
<div id="sjtablebar" style="padding:6px;height:auto">
|
|
<div style="margin-bottom:2px;margin-top:2px">
|
|
|
|
|
|
{% load myfilter %}
|
|
{% if request|has_permission:'b_exampaper_zujuan' %}
|
|
<a id="addsj" class="easyui-linkbutton" onclick="addsj()" data-options="iconCls: 'fa-plus',plain:true">手动组卷</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_exampaper_upd' %}
|
|
<a id="editsj" class="easyui-linkbutton" onclick="editsj()" data-options="iconCls: 'fa-pencil',plain:true">编辑试卷</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_exampaper_stop' %}
|
|
<a id="stopsj" class="easyui-linkbutton" onclick="stopsj()" data-options="iconCls: 'fa-stop',plain:true">停用</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_exampaper_del' %}
|
|
<a id="delsj" class="easyui-linkbutton" onclick="delsj()" data-options="iconCls: 'fa-trash',plain:true">删除</a>
|
|
{% endif %}
|
|
{% if request|has_permission:'b_exampaper_daochu' %}
|
|
<a id="exportsjword" onclick="exportsjword()" class="easyui-linkbutton" data-options="iconCls: 'fa-download',plain:true">导出Word</a>
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(function(){
|
|
var option = $('#main').attr('value')
|
|
$('#sjtable').datagrid({url:'api/exampaper',queryParams:{a:option}});
|
|
//$("#searchsjff").form('clear');
|
|
})
|
|
$('#sjtable').datagrid({
|
|
url: '',
|
|
rownumbers: true,
|
|
singleSelect: true,
|
|
striped: true,
|
|
fitColumns: true,
|
|
method: 'get',
|
|
pagination: 'true',
|
|
pageSize: 20,
|
|
toolbar: '#sjtablebar',
|
|
border:false,
|
|
columns: [[
|
|
{ field: 'id', title: 'ID', hidden: true },
|
|
{ field: 'num', title: '编号', width: 80 },
|
|
{ field: 'name', title: '试卷名', width: 200 },
|
|
{ field: 'state', title: '状态', width: 80,styler: function (value, row, index) {
|
|
switch (value) {
|
|
case 0: return 'background-color:red;'; break;
|
|
case 1: return 'background-color:green;'; break;
|
|
}
|
|
},formatter: function (value, row, index) {
|
|
switch (value) {
|
|
case 0: return '已禁用'; break;
|
|
case 1: return '使用中'; break;
|
|
}
|
|
} },
|
|
{ field: 'total', title: '题量', width: 400 ,formatter: function (value, row, index) {
|
|
return '总题数:'+ value.total.num + ';总分:'+value.total.score + ';单选题数:'+value.dx.num + ';多选题数:'+value.duox.num + ';判断题数:'+value.pd.num;
|
|
}},
|
|
]]
|
|
});
|
|
function addsj(){
|
|
var myw = screen.availWidth * 0.7;
|
|
opendg('组卷','html/exampaper/add',myw)
|
|
}
|
|
function delsj(){
|
|
var row = $('#sjtable').datagrid('getSelected');
|
|
if (row) {
|
|
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
|
if (r) {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: 'api/exampaper?a=del',
|
|
data: { 'id': row.id },
|
|
datatype: "json",
|
|
beforeSend: function () { },
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#sjtable").datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '你无权删除该条记录!');
|
|
}
|
|
},
|
|
complete: function (XMLHttpRequest, textStatus) {
|
|
},
|
|
error: function () {
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请选择一行数据!');
|
|
}
|
|
}
|
|
function stopsj(){
|
|
var row = $('#sjtable').datagrid('getSelected');
|
|
if (row) {
|
|
$.messager.confirm('提示', '确定停用吗?', function (r) {
|
|
if (r) {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: 'api/exampaper?a=stop',
|
|
data: { 'id': row.id },
|
|
datatype: "json",
|
|
beforeSend: function () { },
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#sjtable").datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请用管理员账号操作!');
|
|
}
|
|
},
|
|
complete: function (XMLHttpRequest, textStatus) {
|
|
},
|
|
error: function () {
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请选择一行数据!');
|
|
}
|
|
}
|
|
function delsj(){
|
|
var row = $('#sjtable').datagrid('getSelected');
|
|
if (row) {
|
|
$.messager.confirm('提示', '确定删除吗?', function (r) {
|
|
if (r) {
|
|
$.ajax({
|
|
type: "GET",
|
|
url: 'api/exampaper?a=del',
|
|
data: { 'id': row.id },
|
|
datatype: "json",
|
|
beforeSend: function () { },
|
|
success: function (data) {
|
|
if (data.code == 1) {
|
|
$("#sjtable").datagrid('reload');
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请用管理员账号操作!');
|
|
}
|
|
},
|
|
complete: function (XMLHttpRequest, textStatus) {
|
|
},
|
|
error: function () {
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
else {
|
|
$.messager.alert('提示', '请选择一行数据!');
|
|
}
|
|
}
|
|
function editsj(){
|
|
var row = $('#sjtable').datagrid('getSelected');
|
|
if (row) {
|
|
var url = 'html/exampaper/edit/' + row.id
|
|
var myw = screen.availWidth * 0.7;
|
|
opendg('编辑试卷',url,myw)
|
|
}
|
|
else { $.messager.alert('提示', '请选择一行数据!'); }
|
|
}
|
|
function exportsjword() {
|
|
var row = $('#sjtable').datagrid('getSelected');
|
|
if (row) {
|
|
var url = 'api/exampaper?a=exportword&id=' + row.id
|
|
$('<form method="post" action="' + url + '"></form>').appendTo('body').submit().remove();
|
|
}
|
|
else { $.messager.alert('提示', '请选择一张考卷!'); }
|
|
|
|
}
|
|
</script> |