define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function ($, undefined, Backend, Table, Form,editable) { var Controller = { index: function () { $('.btn-edit').data('area',['55%','95%']); // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'teacher/exams/index' + location.search, add_url: 'teacher/exams/add', edit_url: 'teacher/exams/edit', del_url: 'teacher/exams/del', multi_url: 'teacher/exams/multi', import_url: 'teacher/exams/import', table: 'teacher_exams', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'exam_id', sortName: 'exam_id', fixedColumns: true, fixedRightNumber: 1, searchFormVisible:true, singleSelect : true, // columns: [ [ {checkbox: true}, {field: 'exam_id', title: __('Exam_id')}, {field: 'exam_collection_name', title: __('考试名称')}, {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype}, {field: 'user_username', title: __('学员学号')}, {field: 'user_nickname', title: __('学员姓名')}, { field: 'user_depart_id', title: __('Department'), visible: false, addclass: 'selectpage', extend: 'data-source="department/index/index" data-field="name"', operate: Config.groupIds !=8 ? 'in':false, formatter: Table.api.formatter.search }, // { // field: 'dadmin', // title: __('Department'), // formatter: function (value, row, index) { // if (value.length == 0) // return '-' ; // var department=""; // $.each(value,function(i,v){ //arrTmp数组数据 // if (v.department){ // department+=department?','+v.department.name:v.department.name; // } // }); // return Table.api.formatter.flag.call(this, department, row, index); // }, operate:false // }, // {field: 'exam_collection_id', title: __('Exam_collection_id')}, // {field: 'user_id', title: __('User_id')}, // {field: 'seat_id', title: __('Seat_id')}, // {field: 'sim_id', title: __('Sim_id')}, {field: 'exam_status', title: __('Exam_status'),searchList: {"0":"未登录","1":"已登录","2":"模拟器检查并下发故障中","3":"模拟器正常","4":"答题中","5":"已交卷","6":"计算成绩中","7":"获取到成绩报告","80":"教师标记缺考","81":"登录未开始答题","90":"模拟器异常结束"},formatter: Table.api.formatter.simexamstatus}, {field: 'total_score', title: __('Total_score')}, // {field: 'deduction_total_score', title: __('Deduction_total_score')}, {field: 'starttime', title: __('Start_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, {field: 'endtime', title: __('End_time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true}, // {field: 'login_time', title: __('Login_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, // {field: 'logout_time', title: __('Logout_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, // {field: 'create_by', title: __('Create_by'), operate: 'LIKE'}, // {field: 'createtime', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, // {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, // formatter: Table.api.formatter.operate formatter: Table.api.formatter.buttons, buttons: [ { name: 'dispatch', text: '', icon: 'fa fa-pencil', title: '编辑', classname: 'btn btn-success btn-xs btn-magic btn-dialog', extend: 'data-area=\'["55%","95%"]\'', url: 'teacher/exams/edit', } ], } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); $(document).on('click', '.btn-view', function () { var ids = Table.api.selectedids(table); var title = '成绩详情'; Fast.api.open(Fast.api.fixurl("teacher/exams/view/ids/"+ids), title, { area: ["60%", "95%"] }); }); }, persent: function () { Table.api.init({ extend: { index_url: 'teacher/exams/persent' + location.search, edit_url: 'teacher/exams/editscore', indexed_url: 'teacher/exams/examing' + location.search, score_url: 'teacher/exams/score' + location.search, table: 'teacher_exams', } }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'rel_id', sortName: 'rel_id', toolbar: '#toolbar', fixedColumns: true, fixedRightNumber: 1, searchFormVisible:false, showExport:false, search:false, columns: [ [ // {checkbox: true}, {field: 'fault_name', title: __('更换件')}, {field: 'create_by', title: __('学员姓名')}, {field: 'request_status', title: __('状态'), formatter: function(value, row,index) { if(value==1){ return '待处理'; }else if(value==2){ return '已送'; }else if(value==3){ return '已驳回'; } } }, {field: 'createtime', title: __('申请时间'), formatter: Table.api.formatter.datetime, operate: false, addclass: 'datetimerange', sortable: true}, {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, // formatter: Table.api.formatter.operate formatter: Table.api.formatter.buttons, buttons: [ { name: 'dispatch', text: '', icon: 'fa fa-check', title: '已送', classname: 'btn btn-success btn-xs btn-magic btn-ajax', url: 'teacher/exams/handle/type/1', visible: function (rr) { if(rr.request_status == 1 || rr.request_status == 0){ return true; } return false; }, success: function (data, ret) { table.bootstrapTable("refresh"); }, },{ name: 'dispatch', text: '', icon: 'fa fa-reply-all', title: '驳回', classname: 'btn btn-danger btn-xs btn-magic btn-ajax', url: 'teacher/exams/handle/type/2', visible: function (rr) { if(rr.request_status == 1 || rr.request_status == 0){ return true; } return false; }, success: function (data, ret) { table.bootstrapTable("refresh"); }, } ], } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); var table1 = $("#table1"); // 初始化表格 table1.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.indexed_url, pk: 'exam_id', sortName: 'exam_id', toolbar: '#toolbar1', fixedColumns: true, fixedRightNumber: 1, searchFormVisible:false, showExport:false, search:false, columns: [ [ // {checkbox: true}, {field: 'seat_id', title: __('座号')}, {field: '', title: __('模拟器状态'), formatter: function(value, row,index) { return '就绪'; } }, {field: 'user_username', title: __('学员学号')}, {field: 'user_nickname', title: __('学员姓名')}, {field: '', title: __('考试状态'), formatter: function(value, row,index) { return '已交卷'; } }, {field: 'total_score', title: __('考试成绩')}, // {field: '', title: __('故障现象')}, // {field: '', title: __('故障部位')}, // {field: '', title: __('排除方法')}, // {field: 'operate', title: __('Operate'), table: table1, // events: Table.api.events.operate, // // formatter: Table.api.formatter.operate // formatter: Table.api.formatter.buttons, // buttons: [ // // { // // name: 'dispatch', // // text: '', // // icon: 'fa fa-pencil', // // title: '编辑', // // classname: 'btn btn-success btn-xs btn-magic btn-dialog', // // extend: 'data-area=\'["55%","95%"]\'', // // url: 'teacher/exams/edit', // // } // ], // } ] ] }); // 为表格绑定事件 Table.api.bindevent(table1); var table2 = $("#table2"); // 初始化表格 table2.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.score_url, pk: 'exam_id', sortName: 'exam_id', toolbar: '#toolbar2', fixedColumns: true, pageSize: 10, pagination:false, fixedLeftNumber: 4, searchFormVisible:false, showExport:false, search:false, columns: [ [ // {checkbox: true}, {field: 'seat_id', title: __('座号')}, {field: 'user_username', title: __('学员学号')}, {field: 'user_nickname', title: __('学员姓名')}, {field: 'total', title: __('考试成绩')}, {field: 'fault_one_score', title: __('故障一扣分'),editable:true}, {field: 'fault_two_score', title: __('故障二扣分'),editable:true}, {field: 'fault_three_score', title: __('故障三扣分'),editable:true}, {field: 'xianxian_score', title: __('故障现象扣分'),editable:true}, {field: 'yuanyin_socre', title: __('可能原因扣分'),editable:true}, {field: 'buwei_score', title: __('故障部位扣分'),editable:true}, {field: 'fangfa_score', title: __('排除方法扣分'),editable:true}, {field: 'jielun_score', title: __('修复结论扣分'),editable:true}, {field: 'overtime_score', title: __('按每扣分'),editable:true}, ] ] }); // 为表格绑定事件 Table.api.bindevent(table2); $("button[name=commonSearch]").css('display','none'); }, add: function () { Controller.api.bindevent(); }, edit: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });