inventoryAge.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. $(function() {
  2. // 仓库
  3. $('#warehouseId').combogrid({
  4. url : WEBROOT + "/loadData.action?entity=warehouse",
  5. idField : 'warehouseId',
  6. textField : 'warehouseName',
  7. delay : 500,
  8. showHeader : false,
  9. mode : 'remote',
  10. columns : [ [ {
  11. field : 'warehouseName',
  12. title : '仓库名称',
  13. width : 150
  14. } ] ],
  15. onBeforeLoad : function(param) { // 此设置使控件不会自动加载数据 这里不能使用this
  16. if (!$('#warehouseId').combogrid('getText')) {
  17. return false;
  18. } else {
  19. return true;
  20. }
  21. },
  22. onShowPanel : function() { // 在第一次触发下拉框事件是加载数据
  23. if (!$(this).combogrid('getText')) {
  24. $(this).combogrid({
  25. onBeforeLoad : function(param) {
  26. return true;
  27. }
  28. });
  29. }
  30. }
  31. });
  32. // 货主
  33. $('#customerId').combogrid({
  34. url : WEBROOT + "/loadData.action?entity=customer",
  35. idField : 'customerId',
  36. textField : 'customerName',
  37. delay : 500,
  38. mode : 'remote',
  39. showHeader : false,
  40. striped : true,
  41. columns : [ [ {
  42. field : 'customerName',
  43. width : 147
  44. } ] ],
  45. onBeforeLoad : function(param) {
  46. // 此设置使控件不会自动加载数据 这里不能使用this
  47. if (!$("#customerId").combogrid('getText')) {
  48. return false;
  49. } else {
  50. return true;
  51. }
  52. },
  53. onShowPanel : function() {
  54. // 在第一次触发下拉框事件是加载数据
  55. if (!$(this).combogrid('getText')) {
  56. $(this).combogrid({
  57. onBeforeLoad : function(param) {
  58. return true;
  59. }
  60. });
  61. }
  62. }
  63. });
  64. // 实例化查询表单,当前页面只能实例化一次
  65. var searchForm = $("#searchForm").searchForm();
  66. var advSearchForm = $("#advSearchForm").searchForm();
  67. // 实例化实体List
  68. $.InventoryAgeList = new $.AbstractList({
  69. entity : "Inventory",
  70. searchForm : searchForm,
  71. advSearchForm : advSearchForm,
  72. searchUrl : "/Inventory/inventoryAge.action",
  73. functionId : functionId,
  74. showExportButton : true,
  75. autoLoad:false,
  76. dataExportUrl:"/Inventory/exportInventoryAgeData.action"
  77. });
  78. // 扩展或重写方法
  79. $.fn.extend($.InventoryAgeList, {
  80. });
  81. $("#btnSearch").bind("click", $.proxy($.InventoryAgeList.quickSearch, $.InventoryAgeList));
  82. $("#btnAdvSearch").bind("click", $.proxy($.InventoryAgeList.openAdvSearchWindow, $.InventoryAgeList));
  83. $("#btnQuery").bind("click", $.proxy($.InventoryAgeList.advSearch, $.InventoryAgeList));
  84. $("#btnReset").bind("click", $.proxy($.InventoryAgeList.reset, $.InventoryAgeList));
  85. });