doctor.js 5.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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: 'doctor/index' + location.search,
  8. add_url: 'doctor/add',
  9. edit_url: 'doctor/edit',
  10. del_url: 'doctor/del',
  11. multi_url: 'doctor/multi',
  12. import_url: 'doctor/import',
  13. table: 'doctor',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'ruletype', title: __('Ruletype'), searchList: {"1":__('Ruletype 1'),"2":__('Ruletype 2')}, formatter: Table.api.formatter.normal},
  29. {field: 'nickname', title: __('Nickname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  30. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  31. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  32. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  33. {field: 'realname', title: __('Realname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. {field: 'idcard', title: __('Idcard'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  35. {field: 'idcard_z_image', title: __('Idcard_z_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  36. {field: 'idcard_f_image', title: __('Idcard_f_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  37. {field: 'idcard_status', title: __('Idcard_status'), searchList: {"-1":__('Idcard_status -1'),"0":__('Idcard_status 0'),"1":__('Idcard_status 1'),"2":__('Idcard_status 2'),"3":__('Idcard_status 3')}, formatter: Table.api.formatter.status},
  38. {field: 'doctor_image', title: __('Doctor_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  39. {field: 'doctor_status', title: __('Doctor_status'), searchList: {"-1":__('Doctor_status -1'),"0":__('Doctor_status 0'),"1":__('Doctor_status 1'),"2":__('Doctor_status 2'),"3":__('Doctor_status 3')}, formatter: Table.api.formatter.status},
  40. {field: 'english_status', title: __('English_status'), searchList: {"1":__('English_status 1'),"0":__('English_status 0')}, formatter: Table.api.formatter.status},
  41. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
  42. {field: 'keshi_id', title: __('Keshi_id')},
  43. {field: 'hospital', title: __('Hospital'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  44. {field: 'goodat', title: __('Goodat'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  45. {field: 'ordernum', title: __('Ordernum')},
  46. {field: 'level_id', title: __('Level_id')},
  47. // {field: 'wechat_openid', title: __('Wechat_openid'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  48. {field: 'keshi.name', title: __('Keshi.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  49. {field: 'level.name', title: __('Level.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  50. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  51. ]
  52. ]
  53. });
  54. // 为表格绑定事件
  55. Table.api.bindevent(table);
  56. },
  57. add: function () {
  58. Controller.api.bindevent();
  59. },
  60. edit: function () {
  61. Controller.api.bindevent();
  62. },
  63. api: {
  64. bindevent: function () {
  65. Form.api.bindevent($("form[role=form]"));
  66. }
  67. }
  68. };
  69. return Controller;
  70. });