task.js 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'task/index' + location.search,
  8. add_url: 'task/add',
  9. edit_url: 'task/edit',
  10. del_url: 'task/del',
  11. multi_url: 'task/multi',
  12. import_url: 'task/import',
  13. table: 'task',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. {field: 'name', title: __('Name'), operate: 'LIKE'},
  27. {field: 'bach', title: __('Bach'), operate: 'LIKE'},
  28. {field: 'drawer_name', title: __('Drawer_name'), operate: 'LIKE'},
  29. {field: 'examine_name', title: __('Examine_name'), operate: 'LIKE'},
  30. {field: 'machine', title: __('Machine'), operate: 'LIKE'},
  31. {field: 'number', title: __('Number'), operate: 'LIKE'},
  32. {field: 'kuodan', title: __('Kuodan'), operate: 'LIKE'},
  33. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  34. {field: 'fid', title: __('Fid')},
  35. {field: 'create', title: __('Create'), operate: 'LIKE'},
  36. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate},
  37. {field: 'operate', title: '操作', buttons:[{
  38. name:'task',
  39. text:'查看',
  40. title:'查看',
  41. icon:'fa fa-add',
  42. extend: 'data-area=["100%","100%"]',
  43. classname:'btn btn-xs btn-info btn-fields btn-dialog task',
  44. url:'task/show',
  45. }],
  46. table: table,
  47. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  48. },
  49. ]
  50. ]
  51. });
  52. table.on('post-body.bs.table',function(){
  53. $(".btn-editone").data("area",["100%","100%"]);
  54. });
  55. $("#button").on("click",function(){
  56. var temp=table.bootstrapTable('getSelections');//获取复选框id中信息
  57. var ids = '';
  58. for (i=0;i<temp.length;i++){
  59. ids += temp[i].id+',';
  60. }
  61. if (ids == ''){return false;}
  62. Fast.config.openArea = ['100%','100%'];
  63. Fast.api.open("task/taskadd?ids="+ids, "生成领料单", {//将id传控制器
  64. });
  65. });
  66. // 为表格绑定事件
  67. Table.api.bindevent(table);
  68. },
  69. add: function () {
  70. Controller.api.bindevent();
  71. },
  72. edit: function () {
  73. Controller.api.bindevent();
  74. },
  75. taskadd: function () {
  76. Controller.api.bindevent();
  77. },
  78. api: {
  79. bindevent: function () {
  80. Form.api.bindevent($("form[role=form]"));
  81. }
  82. }
  83. };
  84. return Controller;
  85. });