js-index.txt 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <#if table#>
  2. import table from "@components/Table.js";
  3. <#endif#>
  4. export default{
  5. components:{
  6. <#if table#>
  7. 'YunTable':table
  8. <#endif#>
  9. },
  10. data:{
  11. <#if table#>
  12. extend:{
  13. index_url: '<#pack#>/index',
  14. <#if form#>
  15. add_url: '<#pack#>/add',
  16. edit_url: '<#pack#>/edit',
  17. <#endif#>
  18. <#if in_array('del',actions)#>
  19. del_url: '<#pack#>/del',
  20. <#endif#>
  21. multi_url: '<#pack#>/multi',
  22. <#if in_array('download',actions)#>
  23. download_url: '<#pack#>/download',
  24. <#endif#>
  25. <#if in_array('import',actions)#>
  26. import_url: '<#pack#>/import',
  27. <#endif#>
  28. <#if in_array('recyclebin',actions)#>
  29. recyclebin_url:'<#pack#>/recyclebin'
  30. <#endif#>
  31. },
  32. columns:[
  33. <#if reduced#>
  34. {checkbox: true},
  35. <#endif#>
  36. <#if !reduced#>
  37. {checkbox: true,selectable:function (row,index){
  38. //可以根据业务需求返回false让某些行不可选中
  39. return true;
  40. }},
  41. <#endif#>
  42. <#fields#>
  43. <#if isTree#>
  44. {treeExpand: true},
  45. <#endif#>
  46. {
  47. field: 'operate',
  48. title: __('操作'),
  49. width:130,
  50. action:{
  51. <#if in_array('edit',actions)#>
  52. <#if reduced#>
  53. edit:true,
  54. <#endif#>
  55. <#if !reduced#>
  56. edit:function(row){
  57. //可以根据业务需求返回false让按钮不显示
  58. return true
  59. },
  60. <#endif#>
  61. <#endif#>
  62. <#if in_array('del',actions)#>
  63. del:true,
  64. <#endif#>
  65. <#if sort#>
  66. sort:true,
  67. <#endif#>
  68. <#if expand#>
  69. expand:true,
  70. <#endif#>
  71. }
  72. }
  73. ]
  74. <#endif#>
  75. },
  76. <#if !reduced#>
  77. //页面加载完成时执行
  78. onLoad:function(query){
  79. console.log(query);
  80. },
  81. //页面初始显示或在框架内显示时执行
  82. onShow:function(){
  83. },
  84. //页面在框架内隐藏时执行
  85. onHide:function(){
  86. },
  87. //页面在框架内关闭时执行
  88. onUnload:function(){
  89. },
  90. <#endif#>
  91. methods: {
  92. <#if !reduced && table#>
  93. onTableRender:function(list){
  94. //表格渲染完成后执行
  95. /**
  96. * table常用方法
  97. * this.$refs.yuntable.reset();//重新渲染整个组件,当columns修改时,需要重新渲染表格才能生效,可以执行该方法。
  98. * this.$refs.yuntable.reload();//保持当前的page,重新获取数据
  99. * this.$refs.yuntable.submit();//返回第一页,重新获取数据
  100. * this.$refs.yuntable.expandAllTree();//树形表格展开所有节点
  101. * this.$refs.yuntable.expandTree(topid);//树形表格展开指定节点
  102. */
  103. }
  104. <#endif#>
  105. }
  106. }