1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'workerfeedback/index' + location.search,
- add_url: 'workerfeedback/add',
- edit_url: 'workerfeedback/edit',
- del_url: 'workerfeedback/del',
- multi_url: 'workerfeedback/multi',
- import_url: 'workerfeedback/import',
- table: 'worker_feedback',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'company_id', title: __('Company_id')},
- {field: 'company.companyname', title: __('Company.companyname'), operate: 'LIKE'},
- {field: 'worker_id', title: __('Worker_id')},
- {field: 'worker.truename', title: __('Worker.truename'), operate: 'LIKE'},
- {field: 'worker.gonghao', title: __('Worker.gonghao'), operate: 'LIKE'},
- {field: 'worker.mobile', title: __('Worker.mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'images', title: __('Images'), operate: false,
- cellStyle: {css: {
- "white-space": "break-spaces",
- "max-width": "150px",
- "min-width": "150px",
- "word-break": "break-all",
- "text-overflow": "inherit",
- "overflow": "visible",
- }
- },
- events: Table.api.events.image, formatter: Table.api.formatter.images},
- {field: 'content', title: __('Content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {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;
- });
|