| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'task/index' + location.search,
- add_url: 'task/add',
- edit_url: 'task/edit',
- del_url: 'task/del',
- multi_url: 'task/multi',
- import_url: 'task/import',
- table: 'task',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'name', title: __('Name'), operate: 'LIKE'},
- {field: 'bach', title: __('Bach'), operate: 'LIKE'},
- {field: 'drawer_name', title: __('Drawer_name'), operate: 'LIKE'},
- {field: 'examine_name', title: __('Examine_name'), operate: 'LIKE'},
- {field: 'machine', title: __('Machine'), operate: 'LIKE'},
- {field: 'number', title: __('Number'), operate: 'LIKE'},
- {field: 'remark', title: __('Remark'), operate: 'LIKE'},
- {field: 'fid', title: __('Fid')},
- {field: 'create', title: __('Create'), operate: 'LIKE'},
- // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- {field: 'operate', title: '操作', buttons:[{
- name:'task',
- text:'查看',
- title:'查看',
- icon:'fa fa-add',
- extend: 'data-area=["100%","100%"]',
- classname:'btn btn-xs btn-info btn-fields btn-dialog task',
- url:'task/show',
- }],
- table: table,
- events: Table.api.events.operate, formatter: Table.api.formatter.operate
- },
- ]
- ]
- });
- $("#button").on("click",function(){
- var temp=table.bootstrapTable('getSelections');//获取复选框id中信息
- var ids = '';
- for (i=0;i<temp.length;i++){
- ids += temp[i].id+',';
- }
- if (ids == ''){return false;}
- Fast.config.openArea = ['100%','100%'];
- Fast.api.open("task/taskadd?ids="+ids, "生成领料单", {//将id传控制器
- });
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- taskadd: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|