123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'student/exam/index' + location.search,
- 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,
- search:false,
- columns: [
- [
- {checkbox: true},
- // {field: 'exam_id', title: __('Exam_id')},
- {field: 'exam_collection_name', title: __('考试名称'),operate: 'like'},
- {field: 'sim_type', title: __('Sim_type'),searchList:{"0001":"FZD04B型侦毒器","0002":"FZB006型毒剂报警器","0003":"防化兵用毒剂报警器"},formatter: Table.api.formatter.simtype},
- {field: 'user_username', title: __('学员学号'),operate: false},
- {field: 'user_nickname', title: __('学员姓名'),operate: false},
- {
- 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: '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},
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $(document).on('click', '.btn-view', function () {
- var ids = Table.api.selectedids(table);
- var title = '成绩详情';
- Fast.api.open(Fast.api.fixurl("student/exam/view/ids/"+ids), title, { area: ["75%", "95%"] });
- });
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|