|
@@ -3,8 +3,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
var Controller = {
|
|
var Controller = {
|
|
|
|
|
|
index: function () {
|
|
index: function () {
|
|
- $('.btn-add').data('area',['85%','85%']);
|
|
|
|
- $('.btn-edit').data('area',['85%','85%']);
|
|
|
|
|
|
+ // $('.btn-add').data('area',['85%','85%']);
|
|
|
|
+ // $('.btn-edit').data('area',['85%','85%']);
|
|
// 初始化表格参数配置
|
|
// 初始化表格参数配置
|
|
Table.api.init({
|
|
Table.api.init({
|
|
extend: {
|
|
extend: {
|
|
@@ -34,8 +34,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
{checkbox: true},
|
|
{checkbox: true},
|
|
{field: 'exam_collection_id', title: __('编号'),operate: false},
|
|
{field: 'exam_collection_id', title: __('编号'),operate: false},
|
|
{field: 'exam_collection_name', title: __('Exam_collection_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'exam_collection_name', title: __('Exam_collection_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
- {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
|
|
|
|
- {field: 'question_setting_method', title: __('Question_setting_method'),searchList:{"1":"系统随机","2":"教师自选","3":"任务自选"},formatter: Table.api.formatter.simmethod},
|
|
|
|
|
|
+ // {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
|
|
|
|
+ // {field: 'question_setting_method', title: __('Question_setting_method'),searchList:{"1":"系统随机","2":"教师自选","3":"任务自选"},formatter: Table.api.formatter.simmethod},
|
|
// {field: 'exam_collection_type', title: __('Exam_collection_type'),operate: false,formatter: function (value, row, index) {
|
|
// {field: 'exam_collection_type', title: __('Exam_collection_type'),operate: false,formatter: function (value, row, index) {
|
|
// return '练习';
|
|
// return '练习';
|
|
// }
|
|
// }
|
|
@@ -50,17 +50,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
|
|
|
|
// {field: 'task_id', title: __('Task_id')},
|
|
// {field: 'task_id', title: __('Task_id')},
|
|
{field: 'limit_duration', title: __('Limit_duration')},
|
|
{field: 'limit_duration', title: __('Limit_duration')},
|
|
- // {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
|
|
- // {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
|
|
- // {field: 'create_user_id', title: __('Create_user_id')},
|
|
|
|
{field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
|
|
{field: 'create_by', title: __('Create_by'), operate: 'LIKE'},
|
|
- {field: 'qudui_count', title: __('区队数量'), operate: false},
|
|
|
|
|
|
+ // {field: 'qudui_count', title: __('区队数量'), operate: false},
|
|
{field: 'xueyuan_count', title: __('应考人数'), operate: false},
|
|
{field: 'xueyuan_count', title: __('应考人数'), operate: false},
|
|
{field: 'yikao_count', title: __('已考人数'), operate: false},
|
|
{field: 'yikao_count', title: __('已考人数'), operate: false},
|
|
{field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false,formatter: Table.api.formatter.datetime},
|
|
{field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false,formatter: Table.api.formatter.datetime},
|
|
- // {field: 'update_by', title: __('Update_by'), operate: 'LIKE'},
|
|
|
|
- // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
|
|
|
- // {field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
// formatter: Table.api.formatter.operate
|
|
// formatter: Table.api.formatter.operate
|
|
formatter: Table.api.formatter.buttons,
|
|
formatter: Table.api.formatter.buttons,
|
|
@@ -71,7 +65,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
icon: 'fa fa-pencil',
|
|
icon: 'fa fa-pencil',
|
|
title: '编辑',
|
|
title: '编辑',
|
|
classname: 'btn btn-success btn-xs btn-magic btn-dialog',
|
|
classname: 'btn btn-success btn-xs btn-magic btn-dialog',
|
|
- extend: 'data-area=\'["85%","85%"]\'',
|
|
|
|
|
|
+ // extend: 'data-area=\'["85%","85%"]\'',
|
|
url: 'teacher/practice/edit',
|
|
url: 'teacher/practice/edit',
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -90,6 +84,45 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: 'dispatch',
|
|
name: 'dispatch',
|
|
|
|
+ text: '查看学员',
|
|
|
|
+ icon: 'fa fa-eye',
|
|
|
|
+ title: '查看学员',
|
|
|
|
+ visible: function (rr) {
|
|
|
|
+ if(rr.user_count > 0){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ classname: 'btn btn-warning btn-xs btn-magic btn-dialog',
|
|
|
|
+ extend: 'data-area=\'["85%","85%"]\'',
|
|
|
|
+ url: 'teacher/collection/viewuser',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'dispatch',
|
|
|
|
+ text: '添加学员',
|
|
|
|
+ icon: 'fa fa-plus',
|
|
|
|
+ title: '添加学员',
|
|
|
|
+ classname: 'btn btn-success btn-xs btn-magic btn-dialog',
|
|
|
|
+ extend: 'data-area=\'["85%","85%"]\'',
|
|
|
|
+ url: 'teacher/practice/adduser',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'dispatch',
|
|
|
|
+ text: '删除学员',
|
|
|
|
+ icon: 'fa fa-pencil',
|
|
|
|
+ title: '删除学员',
|
|
|
|
+ visible: function (rr) {
|
|
|
|
+ if(rr.user_count > 0){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ classname: 'btn btn-info btn-xs btn-magic btn-dialog',
|
|
|
|
+ extend: 'data-area=\'["75%","75%"]\'',
|
|
|
|
+ url: 'teacher/practice/edituser',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: 'dispatch',
|
|
text: '删除',
|
|
text: '删除',
|
|
icon: 'fa fa-trash',
|
|
icon: 'fa fa-trash',
|
|
title: '删除',
|
|
title: '删除',
|
|
@@ -369,16 +402,68 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
table2.bootstrapTable('refresh');
|
|
table2.bootstrapTable('refresh');
|
|
}, 30000);
|
|
}, 30000);
|
|
|
|
|
|
-
|
|
|
|
},
|
|
},
|
|
add: function () {
|
|
add: function () {
|
|
- Controller.api.bindevent();
|
|
|
|
|
|
+ Controller.api.bindevent1();
|
|
},
|
|
},
|
|
edit: function () {
|
|
edit: function () {
|
|
- Controller.api.bindevent();
|
|
|
|
|
|
+ Controller.api.bindevent1();
|
|
|
|
+ },
|
|
|
|
+ adduser: function () {
|
|
|
|
+ Controller.api.bindevent2();
|
|
|
|
+ },
|
|
|
|
+ edituser: function () {
|
|
|
|
+ Controller.api.bindevent2();
|
|
},
|
|
},
|
|
api: {
|
|
api: {
|
|
- bindevent: function () {
|
|
|
|
|
|
+ bindevent1: function () {
|
|
|
|
+ Form.api.bindevent($("form[role=form]"));
|
|
|
|
+ },
|
|
|
|
+ initSubTable: function (index, row, $detail,parent_table) {
|
|
|
|
+ var admin_id = row.id;
|
|
|
|
+ var cur_table = $detail.html('<table id="sub_'+ admin_id +'" style="background-color:#d7d1d147"></table>').find('table');
|
|
|
|
+ var sub_table = $(cur_table);
|
|
|
|
+ sub_table.bootstrapTable({
|
|
|
|
+ // url: 'area/index',
|
|
|
|
+ toolbar: false,
|
|
|
|
+ showColumns: false,
|
|
|
|
+ showToggle: false,
|
|
|
|
+ showExport: false,
|
|
|
|
+ search: false,
|
|
|
|
+ pagination:false,
|
|
|
|
+ commonSearch: false,
|
|
|
|
+ sortOrder: 'ASC',
|
|
|
|
+ checkboxHeader: false,
|
|
|
|
+ columns: [
|
|
|
|
+ {checkbox: true,
|
|
|
|
+ formatter: function(value,rows,index){
|
|
|
|
+ console.log('Config.user_ids');
|
|
|
|
+ console.log(Config.user_ids);
|
|
|
|
+ if(Config.user_ids.length==0){
|
|
|
|
+ return false;
|
|
|
|
+ }else if(Config.user_ids.indexOf(rows.id)>-1){
|
|
|
|
+ return true;
|
|
|
|
+ }else{
|
|
|
|
+ return {disabled : true}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // {field: 'id', title: 'ID'},
|
|
|
|
+ {field: 'username', title: __('学号')},
|
|
|
|
+ {field: 'nickname', title: __('姓名')},
|
|
|
|
+ ],
|
|
|
|
+ data: row.alluser
|
|
|
|
+ });
|
|
|
|
+ Table.api.bindevent(sub_table);
|
|
|
|
+ sub_table.on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table post-body.bs.table", function (e) {
|
|
|
|
+ var selectedIds = Table.api.selectedids(sub_table);
|
|
|
|
+ console.log(selectedIds);
|
|
|
|
+ $(".xueyuan_input").val(selectedIds.length);
|
|
|
|
+ $(".xueyuan_total").html(selectedIds.length);
|
|
|
|
+ $(".depart_ids").val(selectedIds.join());
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ bindevent2: function () {
|
|
var rel_Ids = [];
|
|
var rel_Ids = [];
|
|
var qudui_total = 0;
|
|
var qudui_total = 0;
|
|
var xueyuan_total = 0;
|
|
var xueyuan_total = 0;
|
|
@@ -396,108 +481,34 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
fixedColumns: true,
|
|
fixedColumns: true,
|
|
fixedRightNumber: 1,
|
|
fixedRightNumber: 1,
|
|
searchFormVisible:false,
|
|
searchFormVisible:false,
|
|
- pagination:false,
|
|
|
|
|
|
+ // pagination:false,
|
|
|
|
+ detailView: true,//父子表
|
|
Search:false,
|
|
Search:false,
|
|
columns: [
|
|
columns: [
|
|
[
|
|
[
|
|
- {checkbox: true,
|
|
|
|
- formatter: function(value,row,index){
|
|
|
|
- // console.log(row.id+'####'+Config.row_info.depart_ids)
|
|
|
|
- if(Config.row_info != undefined && Config.row_info.depart_ids.indexOf(row.id)>-1){
|
|
|
|
- rel_Ids.push(row.id);
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ {checkbox: true,},
|
|
{field: 'department_name', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'department_name', title: __('区队名称'), operate: false,width: '400px', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
|
{field: 'department_admin_count', title: __('全部人员数量'),operate: false},
|
|
{field: 'department_admin_count', title: __('全部人员数量'),operate: false},
|
|
]
|
|
]
|
|
],
|
|
],
|
|
- onLoadSuccess: function(data) {
|
|
|
|
- $.each(data.rows, function(index, row) {
|
|
|
|
- if(Config.row_info != undefined && Config.row_info.depart_ids.indexOf(row.id)>-1){
|
|
|
|
- qudui_total = qudui_total+1;
|
|
|
|
- xueyuan_total = xueyuan_total+row.department_admin_count;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- $(".qudui_total").html(qudui_total);
|
|
|
|
- $(".xueyuan_total").html(xueyuan_total);
|
|
|
|
- $(".qudui_input").val(qudui_total);
|
|
|
|
- $(".xueyuan_input").val(xueyuan_total);
|
|
|
|
|
|
+ onExpandRow: function (index, row, $detail) {
|
|
|
|
+ Controller.api.initSubTable(index, row, $detail);
|
|
},
|
|
},
|
|
- // 点击每一个单选框时触发的操作
|
|
|
|
- onCheck:function(row){
|
|
|
|
- rel_Ids.push(row.id);
|
|
|
|
- qudui_total = qudui_total+1;
|
|
|
|
- xueyuan_total = xueyuan_total+row.department_admin_count;
|
|
|
|
|
|
+ onCheck: function (row, $element) {
|
|
|
|
+ $('.btn-disabled').addClass('disabled');
|
|
|
|
+ var id = row.id;
|
|
|
|
+ $("#sub_" + id).bootstrapTable("checkAll");
|
|
|
|
|
|
- $(".depart_ids").val(rel_Ids.join());
|
|
|
|
- $(".qudui_total").html(qudui_total);
|
|
|
|
- $(".xueyuan_total").html(xueyuan_total);
|
|
|
|
- $(".qudui_input").val(qudui_total);
|
|
|
|
- $(".xueyuan_input").val(xueyuan_total);
|
|
|
|
},
|
|
},
|
|
- // 取消每一个单选框时对应的操作;
|
|
|
|
- onUncheck:function(row){
|
|
|
|
- var index = rel_Ids.indexOf(row.id);
|
|
|
|
- if(index > -1) {
|
|
|
|
- rel_Ids.splice(index, 1);
|
|
|
|
- }
|
|
|
|
- qudui_total = qudui_total-1;
|
|
|
|
- xueyuan_total = xueyuan_total-row.department_admin_count;
|
|
|
|
-
|
|
|
|
- $(".depart_ids").val(rel_Ids.join());
|
|
|
|
- $(".qudui_total").html(qudui_total);
|
|
|
|
- $(".xueyuan_total").html(xueyuan_total);
|
|
|
|
- $(".qudui_input").val(qudui_total);
|
|
|
|
- $(".xueyuan_input").val(xueyuan_total);
|
|
|
|
- }
|
|
|
|
|
|
+ onUncheck: function (row) {
|
|
|
|
+ var id = row.id;
|
|
|
|
+ $("#sub_" + id).bootstrapTable("uncheckAll");
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
// 为表格绑定事件
|
|
// 为表格绑定事件
|
|
Table.api.bindevent(table);
|
|
Table.api.bindevent(table);
|
|
|
|
|
|
- // table.on('click-row.bs.table', function (e, row, element) {
|
|
|
|
- // console.log(rel_Ids)
|
|
|
|
- // // console.log('row')
|
|
|
|
- // if(!$.inArray(row.id,rel_Ids)){
|
|
|
|
- // if(Config.row_info.starttime>0){
|
|
|
|
- // Layer.alert('考试正在进行中,只可增加区队不可取消区队');
|
|
|
|
- // return false;
|
|
|
|
- // }
|
|
|
|
- // arr = $.grep(rel_Ids, function(value) {
|
|
|
|
- // return value != row["id"];
|
|
|
|
- // });
|
|
|
|
- // rel_Ids = arr;
|
|
|
|
- // qudui_total = qudui_total-1;
|
|
|
|
- // xueyuan_total = xueyuan_total-row.department_admin_count;
|
|
|
|
- // }else if(rel_Ids.indexOf(row.id)>-1){
|
|
|
|
- // if(Config.row_info.starttime>0){
|
|
|
|
- // Layer.alert('考试正在进行中,只可增加区队不可取消区队');
|
|
|
|
- // return false;
|
|
|
|
- // }
|
|
|
|
- // var index = rel_Ids.indexOf(row.id);
|
|
|
|
- // if(index > -1) {
|
|
|
|
- // rel_Ids.splice(index, 1);
|
|
|
|
- // }
|
|
|
|
- // qudui_total = qudui_total-1;
|
|
|
|
- // xueyuan_total = xueyuan_total-row.department_admin_count;
|
|
|
|
- // }else{
|
|
|
|
- // qudui_total = qudui_total+1;
|
|
|
|
- // xueyuan_total = xueyuan_total+row.department_admin_count;
|
|
|
|
- // rel_Ids.push(row.id);
|
|
|
|
- // }
|
|
|
|
- // console.log(qudui_total);
|
|
|
|
- // console.log(xueyuan_total);
|
|
|
|
- // $(".depart_ids").val(rel_Ids.join());
|
|
|
|
- // $(".qudui_total").html(qudui_total);
|
|
|
|
- // $(".xueyuan_total").html(xueyuan_total);
|
|
|
|
- // $(".qudui_input").val(qudui_total);
|
|
|
|
- // $(".xueyuan_input").val(xueyuan_total);
|
|
|
|
- // });
|
|
|
|
-
|
|
|
|
$(document).on('change', '#c-question_setting_method', function () {
|
|
$(document).on('change', '#c-question_setting_method', function () {
|
|
if($(this).val()==1){
|
|
if($(this).val()==1){
|
|
$(".btn-sm,.btn-task").css('display','none');
|
|
$(".btn-sm,.btn-task").css('display','none');
|
|
@@ -569,11 +580,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
- // $("input[name='btSelectAll']").click(function () {
|
|
|
|
- // var ids = Table.api.selectedids(table);
|
|
|
|
- // console.log(ids);
|
|
|
|
- // $(".depart_ids").val(ids);
|
|
|
|
- // });
|
|
|
|
$("button[name=commonSearch]").css('display','none');
|
|
$("button[name=commonSearch]").css('display','none');
|
|
$("input[name='btSelectAll']").css('display','none');
|
|
$("input[name='btSelectAll']").css('display','none');
|
|
Form.api.bindevent($("form[role=form]"));
|
|
Form.api.bindevent($("form[role=form]"));
|