123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- let Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init();
- //绑定事件
- $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
- var panel = $($(this).attr("href"));
- if (panel.size() > 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");
- },
- table:{
- first:function () {
- let table1 = $("#table1");
- // 初始化表格
- table1.bootstrapTable({
- url: 'money/bill/index',
- pk: 'id',
- sortName: 'id',
- showToggle : false,
- toolbar : '#toolbar1',
- showExport : false,
- showColumns : false,
- columns: [
- [
- { field : 'order_num',
- title: __('Order_num'),
- operate: 'LIKE %...%',
- formatter: Table.api.formatter.bold,
- },
- { field : 'institution_id',
- title: __('Institution_id'),
- searchable: false
- },
- { field : 'institution_name',
- title: __('Institution_name'),
- operate: 'LIKE %...%'
- },
- { field : 'createdAt',
- title : __('Createdat'),
- operate : 'RANGE',
- addclass: 'datetimerange'
- },
- { field : 'create_user_name',
- title: __('Create_user_name')
- },
- { field : 'remark',
- title: __('Remark'),
- width:'100px'
- },
- {
- field : 'id',
- title: __('operate'),
- width: '120px',
- formatter: function (value) {
- return '<a onclick="orderDetail('+ value +')" class="btn btn-xs btn-danger" title="查看缴费单" style="margin-right: 5px" ><i class="fa fa-file-text-o"></i></a>' +'<a href="/admin/money/money/downOrder/id/'+ value +'" title="下载缴费单" class="btn btn-xs btn-danger" style="margin-right: 5px" ><i class="fa fa-download"></i></a>'+
- '<a href="/admin/money/bill/exportExam/id/'+ value +'" class=" btn btn-xs btn-primary " title="下载明细" ><i class="fa fa-download"></i></a>';
- },
- }
- ]
- ]
- });
- orderDetail = function(id) {
- let ids = Table.api.getrowbyid(table1,id).water_ids;
- Fast.api.ajax({
- url: 'money/money/makePaymentOrder/disable/1',
- data: {
- ids : ids,
- _method: 'GET'
- }
- }, function (data) {
- Layer.open({
- content: data,
- area : [
- $(window).width() > 800 ? '800px' : '95%',
- $(window).height() > 600 ? '600px' : '95%'
- ],
- title: '缴费单',
- btn: false
- });
- return false;
- }, function (data, ret) {
- Toastr.error(ret);
- });
- }
- // 为表格绑定事件
- Table.api.bindevent(table1);
- },
- second:function () {
- let table2 = $("#table2");
- // 初始化表格
- table2.bootstrapTable({
- url: 'money/bill/completedList',
- pk: 'id',
- sortName: 'id',
- showToggle : false,
- toolbar : '#toolbar2',
- showExport : false,
- showColumns : false,
- columns: [
- [
- { field : 'order_num',
- title: __('Order_num'),
- operate: 'LIKE %...%',
- formatter: Table.api.formatter.bold,
- },
- { field : 'institution_id',
- title: __('Institution_id'),
- searchable: false
- },
- { field : 'institution_name',
- title: __('Institution_name'),
- operate: 'LIKE %...%'
- },
- { field : 'createdAt',
- title : __('Createdat'),
- operate : 'RANGE',
- addclass: 'datetimerange'
- },
- { field : 'create_user_name',
- title: __('Create_user_name')
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table2);
- }
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|