123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form','selectpage'], function ($, undefined, Backend, Table, Form,Selectpage) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'statistics/printsync/index' + location.search,
- add_url: '',
- edit_url: '',
- del_url: '',
- multi_url: '',
- table: 'print_sync',
- }
- });
- var table = $("#table");
- var common_filter = {};
- var common_op = {};
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- showToggle: false,
- showColumns: false,
- exportDataType: "all",
- pageList: [10, 15, 25, 50],
- queryParams: function (params) {
- let filter = JSON.parse(params.filter);
- if(filter.print_time)
- {
- let time1 = filter.print_time.split(',')[0] + ' ' + '00:00:00';
- let time2 = filter.print_time.split(',')[1] + ' ' + '23:59:59';
- filter.print_time = time1+','+time2;
- }
- params.filter = JSON.stringify(filter);
- common_filter = params.filter;
- common_op = params.op;
- return params;
- },
- columns: [
- [
- {checkbox: true},
- {field: 'name', title:'姓名'},
- {field: 'times', title:'胶片数量',searchable:false},
- {field: 'code', title: '同步号'},
- {field: 'print_time', title: '打印时间',
- operate: 'BETWEEN',
- addclass: 'datetimepicker',
- data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',
- visible: false
- },
- {field: 'c', title:'打印时间', searchable:false},
- {field: 'institution_id', title:'医院', visible: false},
- {
- field: 'ins_name', title: __('医院名称'),
- searchable: false,
- align: 'left',
- formatter: Table.api.formatter.bold
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- $.ajax({
- url: 'institution/institution/institutionSelectList',
- type: 'post',
- dataType: 'json',
- success: function success(res) {
- let data = res.rows;
- $('#institution_id').selectPage({
- data : data,
- orderBy: 'index'
- });
- }
- });
- $('.btn-times').click(function () {
- Fast.api.ajax({
- type: 'GET',
- url: 'statistics/printsync/getAllTimes',
- data: {
- filter : common_filter
- },
- loading:true
- }, function (data) {
- // $("#centage").text(data.centage)
- // $("#centage").data('total', data.positive);
- layer.alert('胶片数量:' + data);
- return false;
- });
- });
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|