form.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
  2. var Controller = {
  3. index : function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend : {
  7. index_url : 'qingdong/general/form/index',
  8. table : 'field'
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url : $.fn.bootstrapTable.defaults.extend.index_url,
  15. sortName : 'id',
  16. pageSize:1000,
  17. columns : [
  18. [
  19. {field : 'name', title : __('模块'), width : 200},
  20. {field : 'updatetime', title : '更新时间'},
  21. {
  22. field : 'operate',
  23. title : __('Operate'),
  24. table : table,
  25. events : Table.api.events.operate,
  26. formatter : Table.api.formatter.operate,
  27. buttons: [
  28. {
  29. text : "设计表单",
  30. title : __('设计表单'),
  31. extend:'data-area=\'["100%","100%"]\'',
  32. classname: 'records btn-dialog',
  33. url: 'qingdong/general/form/edit/#/?id={ids}'
  34. }
  35. ],
  36. }
  37. ]
  38. ],
  39. pageList:['ALL'],
  40. //启用普通表单搜索
  41. commonSearch : false,
  42. searchFormVisible : false,
  43. });
  44. // 为表格绑定事件
  45. Table.api.bindevent(table);
  46. $('.search').hide();
  47. $('.btn-import').hide();
  48. },
  49. edit : function () {
  50. Controller.api.bindevent();
  51. },
  52. api : {
  53. bindevent : function () {
  54. Form.api.bindevent($("form[role=form]"));
  55. },
  56. formatter : {
  57. thumb : function (value, row, index) {
  58. var style = row.storage == 'upyun' ? '!/fwfh/120x90' : '';
  59. return '<img src="' + row.image + '" data-tips-image alt="" title="封面图" style="max-height:90px;max-width:120px">';
  60. },
  61. }
  62. }
  63. };
  64. return Controller;
  65. });