goodManageEdit.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. $(function() {
  2. var $tabs = $("#tabs");
  3. $tabs.tabs('select', "基本信息");
  4. $.OwnGoodManageEdit = new $.AbstractEdit({ entity : "OwnGoodManage", formId : "ownGoodManageForm",
  5. operate : operate, id : "id" });
  6. // 扩展或重写方法
  7. $.fn.extend($.OwnGoodManageEdit, { doAfterSuccessSave : function(response) {
  8. $("#operate").val("edit");
  9. },
  10. doBeforeSave:function(){
  11. var list = this.changeList;
  12. if (-1 != $.inArray('customerRelationId',list))
  13. {
  14. this.changeList.push('customerRelationName');
  15. }
  16. }
  17. });
  18. $("#status").combobox({
  19. valueField : 'id',
  20. textField : 'dictionaryName',
  21. data : statusList
  22. });
  23. $("#customerId").combobox({
  24. valueField : 'customerId',
  25. textField : 'customerName',
  26. url : WEBROOT + "/loadData.action?entity=customer",
  27. mode : 'remote',
  28. async:false,
  29. onSelectAfter : function(record)
  30. {
  31. $("#customerName").val(record.customerName);
  32. },
  33. refreshTarget : function(record)
  34. {
  35. $("#customerName").val(record.customerName);
  36. }
  37. });
  38. $("#customerRelationId").combobox({
  39. valueField : 'relationedCustomerId',
  40. textField : 'relationedCustomerName',
  41. url : WEBROOT + "/loadData.action?entity=customerRelation",
  42. mode : 'remote',
  43. async:false,
  44. onSelectAfter : function(record)
  45. {
  46. $("#customerRelationName").val(record.relationedCustomerName);
  47. },
  48. refreshTarget : function(record)
  49. {
  50. $("#customerRelationName").val(record.relationedCustomerName);
  51. },
  52. onBeforeLoad : function(param) {
  53. param.customerId = $("#customerId").combobox('getValue');
  54. //此设置使控件不会自动加载数据
  55. if (!param.customerId) {
  56. return false;
  57. } else {
  58. return true;
  59. }
  60. }
  61. });
  62. $("#warehouseId").combobox(
  63. { valueField : 'warehouseId', textField : 'warehouseName', data : warehouseList,
  64. onSelectAfter : function(record) {
  65. $("#warehouseName").val(record.warehouseName);
  66. }, refreshTarget : function(record) {
  67. $("#warehouseName").val(record.warehouseName);
  68. } });
  69. $.OwnGoodManageEdit.init();
  70. if ("add" == operate) {
  71. $("#id").val(id2Add);
  72. } else {
  73. if (!$.isEmpty(ownGoodManageData)) {
  74. var entity = JSON.parse(ownGoodManageData);
  75. $.OwnGoodManageEdit.fillData(entity);
  76. }
  77. }
  78. $("#saveOwnGoodManageBtn").click($.proxy($.OwnGoodManageEdit.save, $.OwnGoodManageEdit));
  79. });