123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- let table1_extend = {
- index_url: 'institution/department/institutionIndex/' + location.search,
- table: 'templates',
- };
- let table2_extend = {
- index_url: 'quality/quality/doctorList/type/pic/' + location.search,
- table: 'templates',
- };
- let table3_extend = {
- index_url: 'quality/quality/doctorList/type/rep/' + location.search,
- table: 'templates',
- };
- let Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init();
- this.table.first();
- this.table.second();
- this.table.third();
- },
- table: {
- first: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: table1_extend
- });
- let table1 = $("#table1");
- // 初始化表格
- table1.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- pageSize: 10,
- toolbar: '#toolbar1',
- showToggle: false,
- showExport: false,
- showColumns: false,
- commonSearch: false,
- singleSelect: true, //是否启用单选
- clickToSelect: true,
- onCheck: function (rows) { // 选中事件
- // 刷新子级列表
- $('#selected_institution').data('id',rows.id);
- $('#toolbar2 .btn-refresh').trigger('click');
- $('#toolbar3 .btn-refresh').trigger('click');
- },
- columns: [
- [
- {checkbox: true,},
- {field: 'name', title: __('Institution'), formatter: Table.api.formatter.bold, align:'left'},
- ]
- ]
- });
- // 默认选中第一条
- table1.on('post-body.bs.table', function () {
- $('#table1 tr[data-index="0"] td input[data-index="0"]').trigger('click');
- });
-
- // 为表格绑定事件
- Table.api.bindevent(table1);
- },
- second: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: table2_extend
- });
- let table2 = $("#table2");
- // 初始化表格
- table2.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- toolbar: '#toolbar2',
- showToggle: false,
- showColumns: false,
- // showExport: false,
- commonSearch: false,
- queryParams: function queryParams(params) {
- params.ins_id = $('#selected_institution').data('id');
- return params;
- },
- exportOptions: {
- ignoreColumn: ['buttons']
- },
- columns: [
- [
- { field : 'realname',
- title: __('Realname')
- },
- { field : 'JPL',
- title : __('JPL'),
- formatter: Table.api.formatter.italic,
- },
- { field : 'excellent',
- title : __('Excellent'),
- formatter: Controller.api.formatter.num
- },
- { field : 'good',
- title : __('Good'),
- formatter: Controller.api.formatter.num
- },
- { field : 'qualified',
- title : __('Qualified'),
- formatter: Controller.api.formatter.num
- },
- { field : 'poor',
- title : __('Poor'),
- formatter: Controller.api.formatter.num
- },
- {
- field : 'buttons',
- width : "120px",
- title : __('operate'),
- table: table2,
- events: Table.api.events.operate,
- formatter: Table.api.formatter.operate,
- buttons: [
- {
- name : 'detail',
- text : __('detail'),
- title : __('detail'),
- classname: 'btn btn-xs btn-primary btn-dialog',
- icon : 'fa fa-list',
- url : 'quality/quality/detail',
- }
- ]
- }
- ],
- ],
- });
- // 为表格绑定事件
- Table.api.bindevent(table2);
- return table2;
- },
- third: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: table3_extend
- });
- let table3 = $("#table3");
- // 初始化表格
- table3.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'd.id',
- toolbar: '#toolbar3',
- showToggle: false,
- showColumns: false,
- showExport: false,
- commonSearch: false,
- queryParams: function queryParams(params) {
- params.ins_id = $('#selected_institution').data('id');
- return params;
- },
- columns: [
- [
- {field: 'realname', title: __('Realname')},
- {field: 'excellent', title: __('Excellent'), formatter: Table.api.formatter.TJNum},
- {field: 'good', title: __('Good'), formatter: Table.api.formatter.TJNum},
- {field: 'qualified', title: __('Qualified'), formatter: Table.api.formatter.TJNum},
- {field: 'poor', title: __('Poor'), formatter: Table.api.formatter.TJNum},
- ]
- ],
- });
- // 为表格绑定事件
- Table.api.bindevent(table3);
- return table3;
- },
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- is_report: function (value) {
- return value == '1' ? '是' : '否';
- },
- num: function (value) {
- if(value === 0){
- return value;
- }
- return '<strong style="font-style:italic; font-size: 15px; color: #408eba;">'+ value +'</strong>';
- }
- },
- },
- };
- return Controller;
- });
|