123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- 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.on('load-success.bs.table', function (e, data) {
- //这里可以获取从服务端获取的JSON数据
- //这里我们手动设置顶部的企业总数
- $(".pingfen_total").text(data.defen.pingfen);
- $(".max_total").text(data.defen.max);
- $(".min_total").text(data.defen.min);
- });
- // 初始化表格
- 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: 'user_username', title: __('学号')},
- {field: 'user_nickname', title: __('姓名')},
- // {field: 'exam_status', title: __('Exam_status'),searchList: {"0":"未登录","1":"已登录","2":"模拟器检查并下发故障中","3":"模拟器正常","4":"答题中","5":"已交卷","6":"计算成绩中","7":"获取到成绩报告","80":"教师标记缺考","81":"登录未开始答题","90":"模拟器异常结束"},formatter: Table.api.formatter.simexamstatus},
- {field: 'exam_collection_name', title: __('考试名称')},
- {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
- // {
- // 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: '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: false, 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 '<span class="text-warning">待处理</span>';
- }else if(value==2){
- return '<span class="text-success">已送</span>';
- }else if(value==3){
- return '<span class="text-danger">已驳回</span>';
- }
- }
- },
- {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 '<span class="text-success">就绪</span>';
- }
- },
- {field: 'user_username', title: __('学员学号')},
- {field: 'user_nickname', title: __('学员姓名')},
- {field: '', title: __('考试状态'),
- formatter: function(value, row,index) {
- return '<span class="text-success">已交卷</span>';
- }
- },
- {field: 'total_score', title: __('考试成绩')},
- {field: '', title: __('出题题目')},
- {field: '', 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;
- });
|