airdrop.js 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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: 'user/airdrop/index' + location.search,
  8. add_url: 'user/airdrop/add',
  9. del_url: 'user/airdrop/del',
  10. multi_url: 'user/airdrop/multi',
  11. import_url: 'user/airdrop/import',
  12. table: 'user_airdrop',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. { field: 'type_id', title: __('投放类型'), searchList: { "0": __('指定账号'), "1": __('超过Rwa数用户'),"2": __('指定区域消费金')}, formatter: Table.api.formatter.label },
  26. {field: 'product.zh_name', title: __('Product_id'), operate: 'LIKE'},
  27. {field: 'num', title: __('Num'), operate: false},
  28. {field: 'address', title: __('Address'), operate: 'LIKE'},
  29. {field: 'rwa_num', title: __('Rwa_num'), operate: false},
  30. {field: 'rwa_product.zh_name', title: __('持有产品'), operate: 'LIKE'},
  31. {field: 'amount', title: __('指定区域消费金'), operate: false, formatter: function (value, row, index, field) {
  32. return (row.amount > 0)? row.area_txt+ "-"+ row.amount: "";
  33. }},
  34. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  35. { field: 'status', title: __('Status'), searchList: { "1": __('已发放'), "0": __('待发放') }, formatter: Table.api.formatter.status },
  36. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  37. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  39. ]
  40. ]
  41. });
  42. // 为表格绑定事件
  43. Table.api.bindevent(table);
  44. },
  45. add: function () {
  46. Controller.api.bindevent();
  47. },
  48. edit: function () {
  49. Controller.api.bindevent();
  50. },
  51. api: {
  52. bindevent: function () {
  53. Form.api.bindevent($("form[role=form]"));
  54. //地区选择
  55. $(document).on('change','.form-inline select',function(){
  56. let txt = $(this).find("option:selected").text();
  57. let obj = $(this).parents('.form-inline').find('input')
  58. if(txt != '请选择') obj.val(txt)
  59. });
  60. }
  61. }
  62. };
  63. return Controller;
  64. });