durg_putouts.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: 'durg_putout/index' + location.search,
  8. table: 'durg_putout',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. columns: [
  18. [
  19. {checkbox: true},
  20. {field: 'order_number', title: __('序号')},
  21. {field: 'number', title: __('领用编号')},
  22. {field: 'durg_archives_id_text', title: __('药品名称')},
  23. {field: 'durg_brand', title: __('品牌')},
  24. {field: 'specifications', title: __('规格'), operate: 'LIKE'},
  25. {field: 'manufacturer', title: __('厂家'), operate: 'LIKE'},
  26. {field: 'unit_id_text', title: __('发放单位')},
  27. {field: 'unit_id1_text', title: __('领用单位')},
  28. {field: 'receive_id_text', title: __('使用人')},
  29. {field: 'put_out', title: __('领用数量'), operate: 'LIKE'},
  30. {field: 'put_time', title: __('使用时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  31. ]
  32. ]
  33. });
  34. // 为表格绑定事件
  35. Table.api.bindevent(table);
  36. },
  37. add: function () {
  38. Controller.api.bindevent();
  39. },
  40. edit: function () {
  41. Controller.api.bindevent();
  42. },
  43. api: {
  44. bindevent: function () {
  45. Form.api.bindevent($("form[role=form]"));
  46. },
  47. events: {
  48. getAmount:function(){
  49. $.get('durg_putout/getAmount',{durg_id:$("#c-durg_archives_id").val()},function(res){
  50. if($('#c-put_out').val() > res.data)$('#c-put_out').val(res.data);
  51. $('#c-put_out').data('max',res.data);
  52. });
  53. }
  54. }
  55. }
  56. };
  57. return Controller;
  58. });