123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'selectpage'], function ($, undefined, Backend, Table, Form, Selectpage) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'intention/index',
- add_url: 'intention/add',
- edit_url: 'intention/edit',
- del_url: 'intention/del',
- multi_url: 'intention/multi',
- table: 'intention',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- showToggle: false,
- showColumns: false,
- columns: [
- [
- {field: 'unit_name', title: __('Unit_name')},
- {field: 'contacts', title: __('Contacts')},
- {field: 'con_position', title: __('Con_position'), searchable: false},
- {field: 'unit_type', title: __('Unit_type'), searchable: false},
- {field: 'number', title: __('Number'), searchable: false},
- {field: 'price', title: '单价', formatter:function (value) {
- return '¥ ' + value;
- }},
- {field: 'usr_nickname', title: '操作人'},
- {field: 'depart_id', title: '操作人部门',searchList: $.getJSON('auth/group/departList'),formatter:function (value, row) {
- return row.usr_depart;
- }},
- {field: 'created_at', title: '创建时间', operate:'RANGE', addclass:'datetimerange', searchable: false},
- // {field: 'operate', title: __('Operate'),
- // table: table, events: Table.api.events.operate,
- // formatter: Table.api.formatter.operate,
- // }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- $.ajax({
- url: 'intention/unitTypeList',
- type: 'post',
- dataType: 'json',
- success: function success(res) {
- var data = res.rows;
- $('#c-unit_type').selectPage({
- data : data,
- });
- console.log(data);
- }
- });
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|