business.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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: 'qingdong/general/business/index',
  8. edit_url: 'qingdong/general/business/edit',
  9. }
  10. });
  11. var table = $("#table");
  12. //在表格内容渲染完成后回调的事件
  13. table.on('post-body.bs.table', function (e, json) {
  14. $("tbody tr[data-index]", this).each(function () {
  15. if (parseInt($("td:eq(1)", this).text()) == Config.admin.id) {
  16. $("input[type=checkbox]", this).prop("disabled", true);
  17. }
  18. });
  19. });
  20. // 初始化表格
  21. table.bootstrapTable({
  22. url: $.fn.bootstrapTable.defaults.extend.index_url,
  23. columns: [
  24. [
  25. {field: 'state', checkbox: true, },
  26. {field: 'admininfo.username', title: __('Username'), operate:false},
  27. {field: 'sign_no', title:'商户标识'},
  28. {field: 'name', title:'公司名称'},
  29. {field: 'subname', title:'公司简称'},
  30. {field: 'mobile', title: '联系电话'},
  31. {field: 'company_type', title: '企业类型'},
  32. {field: 'industry', title: '所属行业'},
  33. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
  34. $(table).data("operate-del",null);
  35. return Table.api.formatter.operate.call(this, value, row, index);
  36. }}
  37. ]
  38. ],
  39. search: false,
  40. //启用普通表单搜索
  41. commonSearch: true,
  42. //显示导出按钮
  43. showExport: false,
  44. searchFormVisible: true
  45. });
  46. // 为表格绑定事件
  47. Table.api.bindevent(table);
  48. },
  49. add: function () {
  50. Form.api.bindevent($("form[role=form]"));
  51. },
  52. edit: function () {
  53. Form.api.bindevent($("form[role=form]"));
  54. }
  55. };
  56. return Controller;
  57. });