define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], function ($, undefined, Backend, Table, Form, Selectpage) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'statistics/remote/index' + location.search, } }); var table = $("#table"); var common_filter = {}; var common_op = {}; // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'a.createdAt', showToggle: false, showColumns: false, pageList: [10, 15, 25, 50], exportOptions: { ignoreColumn: [] }, queryParams: function (params) { //这里可以追加搜索条件 let filter = JSON.parse(params.filter); let op = JSON.parse(params.op); if(filter.local_institution_id){ filter['a.local_institution_id'] = filter.local_institution_id; op['a.local_institution_id'] = op.local_institution_id; delete filter.local_institution_id; delete op.local_institution_id; } if(filter.exam_class){ filter['a.exam_class'] = filter.exam_class; op['a.exam_class'] = op.exam_class; delete filter.exam_class; delete op.exam_class; } if(filter.req_date_time){ var start_time = filter.req_date_time.split(',')[0] + ' 00:00:00' var end_time = filter.req_date_time.split(',')[1] + ' 23:59:59' filter['req_date_time'] = start_time + ',' + end_time } params.filter = JSON.stringify(filter); params.op = JSON.stringify(op); common_filter = params.filter; common_op = params.op; return params; }, columns: [ [ {field: 'name', title: __('Name'), formatter: Table.api.formatter.bold, searchable: false}, {field: 'local_institution_id', title: __('Local_institution_id'), visible: false}, {field: 'local_institution_name', title: __('Local_institution_name'), searchable: false}, {field: 'a.remote_institution_id', title: __('Remote_institution_name'), visible: false}, {field: 'remote_institution_name', title: __('Remote_institution_name'), searchable: false}, {field: 'exam_class', title: __('Exam_class'), searchable: true}, {field: 'exam_project', title: __('检查方法'), searchable: true,operate: 'LIKE %...%',}, {field: 'id', title: __('ID'), searchable: false}, {field: 'req_doctor_name', title: __('Req_doctor_name'), searchable: false}, {field: 'req_date_time', title: __('Req_date_time'), searchable: true, operate: 'BETWEEN', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD" autocomplete="off"',}, {field: 'report_doctor_name', title: __('Report_doctor_name'), searchable: false}, {field: 'review_doctor_name', title: __('Review_doctor_name'), searchable: false}, {field: 'review_datetime', title: __('Review_datetime'), searchable: false}, {field: 'order_money', title: __('Order_money'), searchable: false, formatter: Table.api.formatter.italic}, { field: 'pay_way', title: __('Pay_way'), searchable: false, formatter: Table.api.formatter.normal, custom: {1: 'primary', 11: 'primary', 12: 'primary', 13: 'primary'}, searchList: { 1 : '医院付款', 11 : '微信', 12 : '支付宝', 13 : '银联', } }, { field: 'order_status', title: __('Order_status'), searchable: false, formatter: Table.api.formatter.label, custom: {1:'default',2:'success',3:'info',4:'warning',5:'danger', }, searchList: { 1 : '创建', 2 : '支付完成', 3 : '订单完成', 4 : '取消', 5 : '退款', } }, { field: 'is_urgent', title: __('Is_urgent'), searchable: false, formatter: Table.api.formatter.label, searchList: {0: '正常', 1: '急诊'}, custom: {0: 'primary', 1: 'danger'} }, { field: 'report_status', title: __('Report_status'), align: 'left', formatter: Table.api.formatter.normal, custom: {2:'info',3:'info',4:'info',5:'danger',6:'info',7:'info',8:'info',9:'info',10:'info',11:'danger', }, searchList: { 2 : '获取完善病例资料', 3 : '完善病例资料保存继续', 4 : '选择医院发起申请', 5 : '驳回申请', 6 : '接收申请', 7 : '书写报告', 8 : '审核报告', 9 : '最终完成报告', 10 : '确认报告', 11 : '撤回报告', 12 : '撤回', }, }, ] ] }); // 为表格绑定事件 Table.api.bindevent(table); $.ajax({ url: 'institution/institution/institutionSelectList', type: 'post', dataType: 'json', success: function success(res) { let data = res.rows; $('#local_institution_id').selectPage({ data : data, orderBy: 'index' }); $('input[name="a.remote_institution_id"]').selectPage({ data : data, orderBy: 'index' }); } }); $('.btn-remote-film').click(function () { Fast.api.ajax({ type: 'GET', url: 'statistics/remote/getPositive', data: { filter : common_filter, op : common_op }, loading:true }, function (data) { layer.alert('阳性总数:' + data.positive + ';阳性率:' + data.centage + '%'); return false; }, function (){ Toastr.warning('获取阳性率失败'); }); }); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });