doctor.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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: 'nickname', title: __('Nickname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  29. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  30. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  31. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  32. {field: 'realname', title: __('Realname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  33. {field: 'idcard', title: __('Idcard'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  34. {field: 'idcard_z_image', title: __('Idcard_z_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  35. {field: 'idcard_f_image', title: __('Idcard_f_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  36. {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},
  37. {field: 'doctor_image', title: __('Doctor_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
  38. {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},
  39. {field: 'english_status', title: __('English_status'), searchList: {"1":__('English_status 1'),"0":__('English_status 0')}, formatter: Table.api.formatter.status},
  40. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
  41. {field: 'keshi_id', title: __('Keshi_id')},
  42. {field: 'hospital', title: __('Hospital'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  43. {field: 'goodat', title: __('Goodat'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  44. {field: 'ordernum', title: __('Ordernum')},
  45. {field: 'level_id', title: __('Level_id')},
  46. {field: 'keshi.name', title: __('Keshi.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  47. {field: 'level.name', title: __('Level.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  48. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  49. ]
  50. ]
  51. });
  52. // 为表格绑定事件
  53. Table.api.bindevent(table);
  54. },
  55. add: function () {
  56. Controller.api.bindevent();
  57. },
  58. edit: function () {
  59. Controller.api.bindevent();
  60. },
  61. api: {
  62. bindevent: function () {
  63. Form.api.bindevent($("form[role=form]"));
  64. }
  65. }
  66. };
  67. return Controller;
  68. });