seas.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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/customer/seas/index',
  8. detail_url : 'qingdong/customer/customer/detail',
  9. table : 'customer',
  10. }
  11. });
  12. var table = $("#table");
  13. // 初始化表格
  14. table.bootstrapTable({
  15. url : $.fn.bootstrapTable.defaults.extend.index_url,
  16. pk : 'id',
  17. sortName : 'id',
  18. fixedColumns : true,
  19. fixedNumber : 2,
  20. fixedRightNumber : 1,
  21. search:false,
  22. searchFormVisible:true,
  23. columns : [
  24. [
  25. {checkbox : true},
  26. {
  27. field : 'name', title : '客户名称', fixedColumns : true, formatter : function (value, row, index) {
  28. return "<a href='javascript:void(0);' data-id='" + row.id + "' class='show-detail'>" + value + "</a>";
  29. },operate:'like'
  30. },
  31. {field : 'subname', title : '助记名称',operate:'like'},
  32. {field : 'industry', title : '客户所属',operate:'like'},
  33. {field : 'source', title : '客户来源',operate:'like'},
  34. {field : 'next_time', title : '下次联系时间',operate:false},
  35. {field : 'last_time', title : '最后跟进时间',operate:false},
  36. {field : 'remarks', title : '备注信息',operate:false},
  37. {field : 'address', title : '省市区',operate:false},
  38. {field : 'address_detail', title : '详细地址',operate:false},
  39. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.buttons,
  40. // buttons: [
  41. // {
  42. // name: 'seas',
  43. // text: __('领取'),
  44. // title: __('领取'),
  45. // classname: 'records btn-ajax',
  46. // url: 'qingdong/customer/customer/receive',
  47. // confirm: '确定要领取当前客户吗?',
  48. // refresh:true,
  49. // error: function (data, ret) {
  50. // console.log(data, ret);
  51. // Layer.alert(ret.msg);
  52. // return false;
  53. // }
  54. // },
  55. // ]
  56. // }
  57. ]
  58. ]
  59. });
  60. $(document).on('click', '.show-detail', function (data) {
  61. var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];
  62. var options = {
  63. shadeClose : false,
  64. shade : [0.3, '#393D49'],
  65. area : area,
  66. callback : function (value) {
  67. //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果
  68. console.log(value);
  69. }
  70. };
  71. Fast.api.open($.fn.bootstrapTable.defaults.extend.detail_url + "?ids=" + $(this).data('id'), '客户详情', options);
  72. });
  73. $(document).on('click','.btn-transfer',function () {
  74. //在templateView的模式下不能调用table.bootstrapTable('getSelections')来获取选中的ID,只能通过下面的Table.api.selectedids来获取
  75. if(Table.api.selectedids(table).length == 0){
  76. layer.alert('请选择要筛选的客户!');
  77. return false;
  78. }
  79. var ids=JSON.stringify(Table.api.selectedids(table));
  80. Fast.api.open("qingdong/customer/customer/batch_change?ids="+ids, "批量转移客户",{
  81. shadeClose: false,
  82. shade: false,
  83. maxmin: false,
  84. moveOut: false,
  85. scrollbars:false,
  86. 'area':[
  87. $(window).width() > 800 ? '600px' : '400px',
  88. $(window).height() > 600 ? '500px' : '400px'
  89. ],
  90. callback:function(value){
  91. Form.events.plupload("#plupload-local");
  92. // 在这里可以接收弹出层中使用`Fast.api.close(data)`进行回传数据
  93. },
  94. });
  95. });
  96. $(document).on('click','.btn-imports',function () {
  97. Fast.api.open("qingdong/customer/customer/import", "公海导入",{
  98. shadeClose: false,
  99. shade: false,
  100. maxmin: false,
  101. moveOut: false,
  102. scrollbars:false,
  103. 'area':[
  104. $(window).width() > 800 ? '600px' : '400px',
  105. $(window).height() > 600 ? '500px' : '400px'
  106. ],
  107. callback:function(value){
  108. Form.events.plupload("#plupload-local");
  109. // 在这里可以接收弹出层中使用`Fast.api.close(data)`进行回传数据
  110. },
  111. });
  112. });
  113. // 为表格绑定事件
  114. Table.api.bindevent(table);
  115. },
  116. add : function () {
  117. Controller.api.bindevent();
  118. },
  119. api : {
  120. bindevent : function () {
  121. Form.api.bindevent($("form[role=form]"));
  122. }
  123. }
  124. };
  125. return Controller;
  126. });