123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], function ($, undefined, Backend, Table, Form, SelectPage) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'bi/user/index' + location.search,
- add_url: 'bi/user/add',
- edit_url: 'bi/user/edit',
- del_url: 'bi/user/del',
- multi_url: 'bi/user/multi',
- table: 'bi_user',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'institution_name', title: __('Institution_name')},
- {field: 'username', title: __('Username')},
- {field: 'password', title: __('Password')},
- {field: 'createdAt', title: __('Createdat'), operate:'RANGE', addclass:'datetimerange'},
- {field: 'realname', title: __('Realname')},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- biInstitutionSearchList();
- Controller.api.bindevent();
- },
- edit: function () {
- biInstitutionSearchList();
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- // 选择机构下拉列表
- let biInstitutionSearchList = function (id) {
- $.ajax({
- url: 'bi/institution/institutionSelectList',
- type: 'post',
- dataType: 'json',
- success: function success(res) {
- let data = res.rows;
- $('#c-institution_id').selectPage({
- data : data,
- orderBy: 'id'
- });
- }
- });
- };
- return Controller;
- });
|