12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'comment'], function ($, undefined, Backend, Table, Form, Comment) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- var status = GetQueryString('status');
- Table.api.init({
- extend: {
- index_url: 'protector/index' + '/status/' + status,
- add_url: 'protector/add',
- edit_url: 'protector/edit',
- del_url: 'protector/del',
- multi_url: 'protector/multi',
- table: 'protector',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {field: 'unit_name', title: __('Unit_name')},
- {field: 'contacts', title: __('Contacts')},
- {field: 'con_position', title: __('Con_position')},
- {field: 'unit_type', title: __('Unit_type')},
- {field: 'number', title: __('Number')},
- {field: 'price', title: '单价', formatter:function (value) {
- return '¥' + value;
- }},
- {field: 'usr_nickname', title: '操作人'},
- {field: 'usr_depart', title: '操作人部门'},
- {field: 'pro_date', title: __('Pro_date'), operate:'RANGE', addclass:'datetimerange'},
- {field: 'ex_date', title: __('Ex_date'), operate:'RANGE', addclass:'datetimerange'},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|