1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'thought_file/index' + location.search,
- add_url: 'thought_file/add',
- edit_url: 'thought_file/edit',
- del_url: 'thought_file/del',
- multi_url: 'thought_file/multi',
- import_url: 'thought_file/import',
- table: 'thought_file',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'unit_id', title: __('Unit_id')},
- {field: 'people_id', title: __('People_id')},
- {field: 'file_name', title: __('File_name'), operate: 'LIKE'},
- {field: 'thought_id', title: __('Thought_id')},
- {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();
- $("#c-people_id").data("params", function (obj) {
- var unit_id = $('#J_unitselect').val();
- return {"custom[unit_id][0]":"in","custom[unit_id][1]":unit_id};
- });
- $("#faupload-file").data("upload-success", function(data, ret){
- //这里进行后续操作
- $('#c-file_name').val(data.name);
- });
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|