userdecoratelianmeng.js 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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: 'userdecoratelianmeng/index' + location.search,
  8. add_url: 'userdecoratelianmeng/add',
  9. // edit_url: 'userdecoratelianmeng/edit',
  10. // del_url: 'userdecoratelianmeng/del',
  11. multi_url: 'userdecoratelianmeng/multi',
  12. import_url: 'userdecoratelianmeng/import',
  13. table: 'user_decorate_lianmeng',
  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: 'user_id', title: __('User_id')},
  27. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  28. // {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  29. // {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  30. {field: 'decorate_id', title: __('Decorate_id')},
  31. {field: 'decoratelianmeng.name', title: __('Decoratelianmeng.name'), operate: 'LIKE'},
  32. {field: 'decoratelianmeng.type', title: __('Decoratelianmeng.type'),searchList: {"1":__('Decoratelianmeng.type 1'),"2":__('Decoratelianmeng.type 2'),"3":__('Decoratelianmeng.type 3'),"4":__('Decoratelianmeng.type 4')}, formatter: Table.api.formatter.normal},
  33. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  35. {field: 'is_using', sortable:true, title: __('Is_using'), searchList: {"1":__('Is_using 1'),"0":__('Is_using 0')}, formatter: Table.api.formatter.normal},
  36. {field: 'plat_name', title: __('Plat_name'), operate: 'LIKE'},
  37. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  38. {field: 'audittime', title: __('Audittime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
  40. {field: 'operate', title: __('Operate'), table: table,
  41. buttons:[
  42. {
  43. name:'audit',
  44. text:'核销',
  45. title:'核销',
  46. icon:'fa fa-exclamation-circle',
  47. classname:'btn btn-xs btn-info btn-dialog',
  48. url:'userdecoratelianmeng/audit/id/{ids}?dialog=1',
  49. target:'_self',
  50. hidden:function(row){
  51. return row.status==0 && row.is_using == 1 ? false : true;
  52. }
  53. }
  54. ],
  55. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  56. ]
  57. ]
  58. });
  59. // 为表格绑定事件
  60. Table.api.bindevent(table);
  61. },
  62. add: function () {
  63. Controller.api.bindevent();
  64. },
  65. edit: function () {
  66. Controller.api.bindevent();
  67. },
  68. audit: function () {
  69. Controller.api.bindevent();
  70. },
  71. api: {
  72. bindevent: function () {
  73. Form.api.bindevent($("form[role=form]"));
  74. }
  75. }
  76. };
  77. return Controller;
  78. });