123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init();
- //绑定事件
- $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
- var panel = $($(this).attr("href"));
- if (panel.length > 0) {
- Controller.table[panel.attr("id")].call(this);
- $(this).on('click', function (e) {
- $($(this).attr("href")).find(".btn-refresh").trigger("click");
- });
- }
- //移除绑定的事件
- $(this).unbind('shown.bs.tab');
- });
- //必须默认触发shown.bs.tab事件
- $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
- },
- tableinfo:{
- url : '',
- toolbar: '',
- pk : 'id',
- sortName : 'id',
- fixedColumns : true,
- fixedNumber : 2,
- fixedRightNumber : 1,
- columns: [
- [
- {field: 'state', checkbox: true},
- {field: 'month', title: '月份', operate: false},
- {field: 'staff', title: '姓名', operate: false},
- {field: 'normal', title: __('正常天数'), operate: false},
- {field: 'error', title: __('异常天数'), operate: false},
- {field: 'late', title:'迟到', operate: false},
- {field: 'leave', title: '早退', operate: false},
- {field: 'work', title: __('旷工'), operate: false},
- {field: 'card', title: __('缺卡'), operate: false},
- {field: 'other', title: __('外勤'), operate: false},
- {field: 'overtime', title: __('加班时长'), operate: false},
- ]
- ],
- pagination : true,
- search : false,
- commonSearch : true,
- searchFormVisible : true,
- searchFormTemplate: 'customformtpl',
- //显示导出按钮
- showExport: false,
- onLoadSuccess:function(){
- // 这里就是数据渲染结束后的回调函数
- $(".btn-add").data("area",["80%","80%"]);
- $(".btn-edit").data("area",["80%","80%"]);
- }
- },
- table: {
- first: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'qingdongams/attendance/statisc/index',
- table: 'statisc'
- }
- });
- var table = $("#table");
- Controller.tableinfo.url=location.href+'&type=0';
- Controller.tableinfo.toolbar='#toolbar';
- Controller.tableinfo.columns[0][Controller.tableinfo.columns[0].length-1].table=table;
- // 初始化表格
- table.bootstrapTable(Controller.tableinfo);
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- second: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'qingdongams/attendance/statisc/index',
- table: 'statisc'
- }
- });
- var table = $("#table1");
- Controller.tableinfo.url=location.href+'&type=1';
- Controller.tableinfo.toolbar='#toolbar1';
- Controller.tableinfo.columns[0][Controller.tableinfo.columns[0].length-1].table=table;
- // 初始化表格
- table.bootstrapTable(Controller.tableinfo);
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- third: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'qingdongams/attendance/statisc/index',
- table: 'statisc'
- }
- });
- var table = $("#table2");
- Controller.tableinfo.url=location.href+'&type=2';
- Controller.tableinfo.toolbar='#toolbar2 ';
- Controller.tableinfo.columns[0][Controller.tableinfo.columns[0].length-1].table=table;
- // 初始化表格
- table.bootstrapTable(Controller.tableinfo);
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- },
- add: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- }
- };
- return Controller;
- });
|