agent.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. $('#c-platform_id').change(function(){
  3. var thisval = $(this).val();
  4. if(thisval){
  5. thisval = 'p'+thisval;
  6. $('.'+thisval)[0].checked=true;
  7. $('.platform').removeAttr("disabled");
  8. $('.'+thisval).attr("disabled",true);
  9. }else{
  10. //清空所有平台的readonly属性
  11. $('.platform').removeAttr("disabled");
  12. }
  13. });
  14. $('#c-pay_method').change(function(){
  15. var sval = $(this).val();
  16. if (sval<3){ //银行卡
  17. $('.c-card_bank').show();
  18. $('.c-card_holder').html('* 收款人:');
  19. $('.c-card_num').html('* 收款账号:');
  20. }else if(sval==3){ //微信
  21. $('.c-card_bank').hide();
  22. $('.c-card_holder').html('* 姓名:');
  23. $('.c-card_num').html('* 微信账号:');
  24. $('#c-card_bank').val('');
  25. }else if(sval==4){ //支付宝
  26. $('.c-card_bank').hide();
  27. $('.c-card_holder').html('* 姓名:');
  28. $('.c-card_num').html('* 支付宝账号:');
  29. $('#c-card_bank').val('');
  30. }
  31. });
  32. //book_but
  33. $(document).on('click','.book_but',function () {
  34. Fast.api.open($(this).attr('href'), '代理商数据', {});
  35. return false;
  36. });
  37. $(document).on('click','.btn-re',function () {
  38. var uid = $(this).data('uid');
  39. layer.confirm("请确认你要进行重置服务号,重置后将会导致、数据清空、老用户无法访问、等等一系列你无法想象的超级严重的问题", { title: "重置服务号确认" }, function (index) {
  40. layer.close(index);
  41. $.post('/admin/auth/agent/re?admin_id='+uid,{},function(data){
  42. console.log(data);
  43. if(data.code != 0){
  44. Toastr.success(data.msg);
  45. setTimeout(function() {
  46. window.location.reload();
  47. },2000);
  48. }else{
  49. Toastr.error(data.msg);
  50. }
  51. })
  52. });
  53. });
  54. $(document).on('click','.btn-sync',function () {
  55. var uid = $(this).data('uid');
  56. layer.confirm("请确认你要进行微信用户同步确认", { title: "微信用户同步确认" }, function (index) {
  57. layer.close(index);
  58. $.post('/admin/auth/agent/sync?admin_id='+uid,{},function(data){
  59. if(data.code != 0){
  60. Toastr.success(data.msg);
  61. setTimeout(function() {
  62. window.location.reload();
  63. },2000);
  64. }else{
  65. Toastr.error(data.msg);
  66. }
  67. })
  68. });
  69. });
  70. if(Config.ids>0){
  71. var Controller = {
  72. index: function () {
  73. // 初始化表格参数配置
  74. Table.api.init({
  75. extend: {
  76. index_url: 'auth/agent/index?ids='+Config.ids,
  77. add_url: '',
  78. edit_url: '',
  79. del_url: '',
  80. multi_url: '',
  81. },
  82. });
  83. var table = $("#table");
  84. // 初始化表格
  85. table.bootstrapTable({
  86. url: $.fn.bootstrapTable.defaults.extend.index_url,
  87. searchFormVisible:true,
  88. columns: [
  89. [
  90. {field: 'id', title: 'ID', operate: false},
  91. {field: 'username', title: __('账号'), operate: false},
  92. {field: 'nickname', title: __('昵称'), operate: false},
  93. {field: 'admin_extend.benefit', title: __('佣金比例'), operate: false},
  94. {field: 'admin_extend.create_by', title: __('开户人'), operate: false},
  95. {field: 'today_recharge_money', title: __('今日充值'), operate: false},
  96. {field: 'yesterday_recharge_money', title: __('昨日充值'), operate: false},
  97. {field: 'recharge_money', title: __('总充值金额(不含当日)'), operate: false},
  98. {field: 'benefit_money', title: __('结算单总额(包含当日)'), operate: false},
  99. {field: 'no_cash_money', title: __('未提现总额(包含当日)'), operate: false},
  100. {
  101. field: 'admin_extend.createtime',
  102. title: __('注册时间'),
  103. formatter: Table.api.formatter.datetime,
  104. operate: false
  105. },
  106. {field: 'admin_extend.distribute', title: __('配号状态'),formatter:function(value, row, index){
  107. if(value==0){
  108. return '<span style="color:red">关闭</span>';
  109. }else{
  110. return '<span style="color:green">已开启</span>';
  111. }
  112. }, operate: false},
  113. {
  114. field: 'tongji', visible:(Config.group>=2), title: __("统计"), operate: false, formatter: function (value, row, index) {
  115. return '<a style="float:left;margin-left: 10%" href="/admin/collect/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">数据统计</a>'+
  116. '<a style="float:left;margin-left: 10%" href="/admin/orders/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单明细</a>';
  117. }
  118. },
  119. {field: 'status', title: __("Status"), formatter: Table.api.formatter.status,searchList: {'normal': __('Normal'), 'hidden': __('Hidden')}, style: 'min-width:100px;'},
  120. ]
  121. ]
  122. });
  123. // 为表格绑定事件
  124. Table.api.bindevent(table);
  125. },
  126. add: function () {
  127. Form.api.bindevent($("form[role=form]"));
  128. $('.checkbox_plat input').change(function(){
  129. var $this = $(this);
  130. var txt = $this.attr('textinfo');
  131. var id = $this.attr('value');
  132. if($this.is(":checked")){
  133. $('#c-platform_id').append($('<option class="rem_'+ id +'" value='+ id +'>'+txt+'</option>'));
  134. }else{
  135. $('.rem_' + id).remove();
  136. }
  137. $("#c-platform_id" ).selectpicker('refresh');
  138. // alert(txt + '=====' +id + '=====' +$this.is(":checked"));
  139. });
  140. },
  141. edit: function () {
  142. Form.api.bindevent($("form[role=form]"));
  143. },
  144. select: function() {
  145. // 初始化表格参数配置
  146. Table.api.init({
  147. extend: {
  148. index_url: 'auth/agent/select',
  149. },
  150. showColumns:false,
  151. showToggle:false,
  152. showExport:false,
  153. searchFormVisible: true,
  154. search:false,
  155. });
  156. var table = $("#table");
  157. // 初始化表格
  158. table.bootstrapTable({
  159. url: $.fn.bootstrapTable.defaults.extend.index_url,
  160. pk: 'id',
  161. sortName: 'id',
  162. columns: [
  163. [
  164. {checkbox: true},
  165. {field: 'id', title: '代理ID', visible:false,operate:false},
  166. {field: 'nickname', title: '代理名称',operate: 'LIKE %...%'},
  167. {field: 'operate', title: __('Operate'), events: {
  168. 'click .btn-chooseone': function (e, value, row, index) {
  169. Fast.api.close([row]);
  170. },
  171. }, formatter: function () {
  172. return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
  173. }}
  174. ]
  175. ]
  176. });
  177. // 为表格绑定事件
  178. Table.api.bindevent(table);
  179. //获取选中数据
  180. $(document).on('click', "#btn-chooseone", function () {
  181. Fast.api.close(table.bootstrapTable('getSelections'));
  182. });
  183. }
  184. };
  185. }else{
  186. if(Config.group>2){
  187. var Controller = {
  188. index: function () {
  189. // 初始化表格参数配置
  190. Table.api.init({
  191. extend: {
  192. index_url: 'auth/agent/index',
  193. add_url: 'auth/agent/add',
  194. edit_url: 'auth/agent/edit',
  195. del_url: 'auth/agent/del',
  196. multi_url: 'auth/agent/multi',
  197. },
  198. });
  199. var table = $("#table");
  200. // 初始化表格
  201. table.bootstrapTable({
  202. url: $.fn.bootstrapTable.defaults.extend.index_url,
  203. search: false,
  204. searchFormVisible:true,
  205. columns: [
  206. [
  207. {field: 'admin.id', title: 'ID', operate:'=',visible:false},
  208. {field: 'id', title: 'ID', operate:false},
  209. {field: 'username', title: '账号', operate: 'LIKE %...%'},
  210. {field: 'nickname', title: '昵称', operate: 'LIKE %...%'},
  211. {field: 'admin_extend.benefit', title: __('佣金比例'), operate: false},
  212. {field: 'admin_extend.create_by', title: __('开户人'), operate: false},
  213. {field: 'today_recharge_money', title: __('今日充值'), operate: false},
  214. {field: 'yesterday_recharge_money', title: __('昨日充值'), operate: false},
  215. {field: 'recharge_money', title: __('总充值金额(不含当日)'), operate: false},
  216. {field: 'benefit_money', title: __('结算单总额(包含当日)'), operate: false},
  217. {field: 'no_cash_money', title: __('未提现总额(包含当日)'), operate: false},
  218. {field: 'admin_extend.distribute', title: __('配号状态'),formatter:function(value, row, index){
  219. if(value==0){
  220. return '<span style="color:red">关闭</span>';
  221. }else{
  222. return '<span style="color:green">已开启</span>';
  223. }
  224. }, operate: false},
  225. {
  226. field: 'tongji',visible:(Config.group>=2), title: __("统计"), operate: false, formatter: function (value, row, index) {
  227. return '<a style="float:left;margin-left: 10%" href="/admin/collect/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">数据统计</a>'+
  228. '<a style="float:left;margin-left: 10%" href="/admin/orders/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单明细</a>';
  229. }
  230. },
  231. {field: 'operate', title: __('Operate'), table: table, buttons: [], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
  232. //{field: 'id', title: __('统计'), table: table, buttons: [
  233. // {name: 'collect', text: '数据统计', title: '数据统计', icon: 'fa fa-list', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/collect', callback:function(data){}},
  234. // {name: 'more', text: '更多', title: '更多', icon: 'fa fa-flash', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/more'}
  235. //], operate:false, formatter: Table.api.formatter.buttons},
  236. ]
  237. ]
  238. });
  239. // 为表格绑定事件
  240. Table.api.bindevent(table);
  241. },
  242. add: function () {
  243. Form.api.bindevent($("form[role=form]"));
  244. },
  245. edit: function () {
  246. $("#c-platform_id").change(function(){
  247. var id = $(this).val();
  248. var url = "auth/channel/ajaxgetlistbyplatformid?platform_id=" + id;
  249. $.get(url,function(data){
  250. if(data.code == 0){
  251. // var oplist = "";
  252. // var wxlist = "";
  253. $("#c-ophost_id").html("<option value='0' >请选择</option>");
  254. // if(data.data.ophostList){
  255. for(var key1 in data.data.ophostList){
  256. $("#c-ophost_id").append("<option value='"+ key1 +"' >"+data.data.ophostList[key1]+"</option><br>");
  257. // oplist += "<option value='"+ key1 +"' >"+data.data.ophostList[key1]+"</option><br>";
  258. }
  259. // }
  260. // $("#c-ophost_id").html(oplist);
  261. // if(data.data.wxpayList){
  262. $("#c-wxpay_id").html("<option value='0' >请选择</option>");
  263. for(var key2 in data.data.wxpayList){
  264. $("#c-wxpay_id").append("<option value='"+ key2 +"' >"+data.data.wxpayList[key2]+"</option><br>");
  265. // wxlist += "<option value='"+ key2 +"' >"+data.data.wxpayList[key2]+"</option><br>";
  266. }
  267. // }
  268. // $("#c-wxpay_id").html(wxlist);
  269. }
  270. });
  271. })
  272. Form.api.bindevent($("form[role=form]"));
  273. },
  274. select: function() {
  275. // 初始化表格参数配置
  276. Table.api.init({
  277. extend: {
  278. index_url: 'auth/agent/select',
  279. },
  280. showColumns:false,
  281. showToggle:false,
  282. showExport:false,
  283. searchFormVisible: true,
  284. search:false,
  285. });
  286. var table = $("#table");
  287. // 初始化表格
  288. table.bootstrapTable({
  289. url: $.fn.bootstrapTable.defaults.extend.index_url,
  290. pk: 'id',
  291. sortName: 'id',
  292. columns: [
  293. [
  294. {checkbox: true},
  295. {field: 'id', title: '代理ID', visible:false,operate:false},
  296. {field: 'nickname', title: '代理名称',operate: 'LIKE %...%'},
  297. {field: 'operate', title: __('Operate'), events: {
  298. 'click .btn-chooseone': function (e, value, row, index) {
  299. Fast.api.close([row]);
  300. },
  301. }, formatter: function () {
  302. return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
  303. }}
  304. ]
  305. ]
  306. });
  307. // 为表格绑定事件
  308. Table.api.bindevent(table);
  309. //获取选中数据
  310. $(document).on('click', "#btn-chooseone", function () {
  311. Fast.api.close(table.bootstrapTable('getSelections'));
  312. });
  313. }
  314. };
  315. }else{
  316. var Controller = {
  317. index: function () {
  318. // 初始化表格参数配置
  319. Table.api.init({
  320. extend: {
  321. index_url: 'auth/agent/index',
  322. add_url: 'auth/agent/add',
  323. edit_url: 'auth/agent/edit',
  324. del_url: 'auth/agent/del',
  325. multi_url: 'auth/agent/multi',
  326. },
  327. });
  328. var table = $("#table");
  329. // 初始化表格
  330. table.bootstrapTable({
  331. url: $.fn.bootstrapTable.defaults.extend.index_url,
  332. search: false,
  333. searchFormVisible:true,
  334. columns: [
  335. [
  336. {field: 'admin.id', title: 'ID', operate:'=',visible:false},
  337. {field: 'id', title: 'ID', operate:false},
  338. {field: 'username', title: '账号', operate: 'LIKE %...%'},
  339. {field: 'nickname', title: '昵称', operate: 'LIKE %...%'},
  340. {field: 'ac.appid', title: __('Appid'),visible:false,operate: 'LIKE %...%'},
  341. {field: 'appid', title: __('Appid'),operate:false},
  342. {field: 'admin_extend.benefit', title: __('佣金比例'), operate: false},
  343. {field: 'admin_extend.create_by', title: __('开户人'), operate: false},
  344. {field: 'status', title: __("Status"), formatter: Table.api.formatter.status,searchList: {'normal': '正常', 'hidden':'隐藏'}},
  345. {field: 'today_recharge_money', title: __('今日充值'), operate: false},
  346. {field: 'yesterday_recharge_money', title: __('昨日充值'), operate: false},
  347. {field: 'recharge_money', title: __('总充值金额(不含当日)'), operate: false},
  348. {field: 'benefit_money', title: __('结算单总额(包含当日)'), operate: false},
  349. {field: 'no_cash_money', title: __('未提现总额(包含当日)'), operate: false},
  350. {field: 'is_fouce', title: __("是否强制授权"), operate: false,formatter: function(value,row,index){return value==1?"强制":"不强制";}},
  351. {field: 'ac.platform_id', title: __("默认平台"), visible:false, searchList:function(){
  352. var list = {};
  353. for(var val in Config.platforms){
  354. list[Config.platforms[val].id] = Config.platforms[val].name;
  355. }
  356. return list;
  357. }()},
  358. {field: 'platforms', title: __("域名系统"), operate: false,formatter: function(value,row,index){return $('<div/>').html(value).text();}},
  359. {field: 'ophost', title: __("业务域名(主)"), operate: 'LIKE %...%'},
  360. {field: 'wxpay', title: __("支付服务号(主)"), operate: false},
  361. {field: 'menuophost', title: __("业务域名(菜单)"), operate: 'LIKE %...%'},
  362. {field: 'menuwxpay_host', title: __("支付服务号(菜单)"), operate: false},
  363. {field: 'entryhost', title: __("入口域名"), operate: false},
  364. {field: 'admin_extend.distribute', title: __('配号状态'),formatter:function(value, row, index){
  365. if(value==0){
  366. return '<span style="color:red">关闭</span>';
  367. }else{
  368. return '<span style="color:green">已开启</span>';
  369. }
  370. }, searchList: {'0': '关闭', '1':'开启'}},
  371. {field: 'admin_extend.reward_state', title: __('赏金开关'),formatter:function(value,row,index){return value==1?"已开启":"未开启";}, searchList: {'0': '未开启', '1':'已开启'}},
  372. // {
  373. // field: 'tongji',visible:(Config.group>=2), title: __("统计"), operate: false, formatter: function (value, row, index) {
  374. // return '<a style="float:left;margin-left: 10%" href="/admin/collect/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">数据统计</a>'+
  375. // '<a style="float:left;margin-left: 10%" href="/admin/orders/index?channel_id=' + row.id + '" class="btn btn-xs btn-success btn-editone book_but">订单明细</a>';
  376. // }
  377. // },
  378. {
  379. field: 'tongji', visible:(Config.group>=2), title: __("统计"), operate: false, formatter: function (value, row, index) {
  380. return '<a style="display:inline-block; margin:4px 5px;vertical-align: middle;" href="/admin/collect/index?channel_id=' + row.id + '" class="book_but"><button type="button" class="btn dropdown-toggle" style="background-color:#ddd;">订单统计</button></a>' +
  381. '<div class="dropdown" style="display:inline-block; margin:4px 5px;vertical-align: middle;"> <button type="button" style="background-color:#ddd;" class="btn dropdown-toggle" id="dropdownMenu1"data-toggle="dropdown">更多' +
  382. '<span class="caret"></span>' +
  383. '</button>' +
  384. '<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1" style="min-width: 5px;">' +
  385. '<li role="presentation">' +
  386. '<a role="menuitem" tabindex="-1" href="/admin/user/collect/index?ids=' + row.id + '" class="book_but">用户统计</a>' +
  387. '</li>' +
  388. '<li role="presentation">' +
  389. '<a role="menuitem" tabindex="-1" href="/admin/orders/index?channel_id=' + row.id + '" class="book_but">订单明细</a>' +
  390. '</li>' +
  391. '<li role="presentation">' +
  392. '<a role="menuitem" tabindex="-1" href="/admin/referral/referral/index?ids=' + row.id + '" class="book_but">推广链接</a>' +
  393. '</li>' +
  394. '</ul>' +
  395. '</div>';
  396. }
  397. },
  398. {field: 'operate', title: __('Operate'), table: table, buttons: [], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
  399. //{field: 'id', title: __('统计'), table: table, buttons: [
  400. // {name: 'collect', text: '数据统计', title: '数据统计', icon: 'fa fa-list', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/collect', callback:function(data){}},
  401. // {name: 'more', text: '更多', title: '更多', icon: 'fa fa-flash', classname: 'btn btn-xs btn-primary btn-dialog', url: '/admin/auth/agent/more'}
  402. //], operate:false, formatter: Table.api.formatter.buttons},
  403. ]
  404. ]
  405. });
  406. // 为表格绑定事件
  407. Table.api.bindevent(table);
  408. },
  409. add: function () {
  410. Form.api.bindevent($("form[role=form]"));
  411. },
  412. edit: function () {
  413. $('.checkbox_plat input').change(function(){
  414. var $this = $(this);
  415. var id = $this.attr('value');
  416. var url = "auth/agent/checkplatformauth?platform_id=" + id +'&channel_id='+Config.rowid;
  417. // var wxopurl = "auth/channel/ajaxgetlistbyplatformid?platform_id=" + id ;
  418. var txt = $this.attr('textinfo');
  419. if($this.is(":checked")){
  420. // $.get(wxopurl,function(data){
  421. // if(data.code == 0){
  422. // for(var key1 in data.data.ophostList){
  423. // $("#c-menuophost_id").append($('<option class="rem_'+ id +'" value='+ key1 +'>'+data.data.ophostList[key1]+'</option>'));
  424. // }
  425. // for(var key2 in data.data.wxpayList){
  426. // $("#c-menuwxpay_id").append($('<option class="rem_'+ id +'" value='+ key2 +'>'+data.data.ophostList[key1]+'</option>'));
  427. // }
  428. // }
  429. // });
  430. if(Config.is_exists_auth){
  431. $.get(url,function(data){
  432. if(data.code){
  433. $('#c-platform_id').append($('<option class="rem_'+ id +'" value='+ id +'>'+txt+'</option>'));
  434. }
  435. });
  436. }else{
  437. $('#c-platform_id').append($('<option class="rem_'+ id +'" value='+ id +'>'+txt+'</option>'));
  438. }
  439. }else{
  440. $('.rem_' + id).remove();
  441. }
  442. // $("#c-platform_id" ).selectpicker('refresh');
  443. })
  444. $("#c-platform_id").change(function(){
  445. var id = $(this).val();
  446. var url = "auth/channel/ajaxgetlistbyplatformid?platform_id=" + id;
  447. $.get(url,function(data){
  448. if(data.code == 0){
  449. // var oplist = "";
  450. // var wxlist = "";
  451. $("#c-ophost_id").html("<option value='0' >请选择</option>");
  452. // if(data.data.ophostList){
  453. for(var key1 in data.data.ophostList){
  454. $("#c-ophost_id").append("<option value='"+ key1 +"' >"+data.data.ophostList[key1]+"</option><br>");
  455. // oplist += "<option value='"+ key1 +"' >"+data.data.ophostList[key1]+"</option><br>";
  456. }
  457. $("#c-menuophost_id").html("<option value='0' >请选择</option>");
  458. for(var key1 in data.data.ophostList) {
  459. $("#c-menuophost_id").append("<option value='" + key1 + "' >" + data.data.ophostList[key1] + "</option><br>");
  460. }
  461. // }
  462. // $("#c-ophost_id").html(oplist);
  463. // if(data.data.wxpayList){
  464. $("#c-wxpay_id").html("<option value='0' >请选择</option>");
  465. for(var key2 in data.data.wxpayList){
  466. $("#c-wxpay_id").append("<option value='"+ key2 +"' >"+data.data.wxpayList[key2]+"</option><br>");
  467. // wxlist += "<option value='"+ key2 +"' >"+data.data.wxpayList[key2]+"</option><br>";
  468. }
  469. $("#c-menuwxpay_id").html("<option value='0' >请选择</option>");
  470. for(var key2 in data.data.wxpayList) {
  471. $("#c-menuwxpay_id").append("<option value='" + key2 + "' >" + data.data.wxpayList[key2] + "</option><br>");
  472. }
  473. // }
  474. // $("#c-wxpay_id").html(wxlist);
  475. }
  476. });
  477. })
  478. Form.api.bindevent($("form[role=form]"));
  479. },
  480. select: function() {
  481. // 初始化表格参数配置
  482. Table.api.init({
  483. extend: {
  484. index_url: 'auth/agent/select',
  485. },
  486. showColumns:false,
  487. showToggle:false,
  488. showExport:false,
  489. searchFormVisible: true,
  490. search:false,
  491. });
  492. var table = $("#table");
  493. // 初始化表格
  494. table.bootstrapTable({
  495. url: $.fn.bootstrapTable.defaults.extend.index_url,
  496. pk: 'id',
  497. sortName: 'id',
  498. columns: [
  499. [
  500. {checkbox: true},
  501. {field: 'id', title: '代理ID', visible:false,operate:false},
  502. {field: 'nickname', title: '代理名称',operate: 'LIKE %...%'},
  503. {field: 'operate', title: __('Operate'), events: {
  504. 'click .btn-chooseone': function (e, value, row, index) {
  505. Fast.api.close([row]);
  506. },
  507. }, formatter: function () {
  508. return '<a href="javascript:;" class="btn btn-danger btn-chooseone btn-xs"><i class="fa fa-check"></i> ' + __('Choose') + '</a>';
  509. }}
  510. ]
  511. ]
  512. });
  513. // 为表格绑定事件
  514. Table.api.bindevent(table);
  515. //获取选中数据
  516. $(document).on('click', "#btn-chooseone", function () {
  517. Fast.api.close(table.bootstrapTable('getSelections'));
  518. });
  519. }
  520. };
  521. }
  522. }
  523. return Controller;
  524. });