$(function() { var $tabs = $("#tabs"); $tabs.tabs('select', "基本信息"); $.OwnGoodManageEdit = new $.AbstractEdit({ entity : "OwnGoodManage", formId : "ownGoodManageForm", operate : operate, id : "id" }); // 扩展或重写方法 $.fn.extend($.OwnGoodManageEdit, { doAfterSuccessSave : function(response) { $("#operate").val("edit"); }, doBeforeSave:function(){ var list = this.changeList; if (-1 != $.inArray('customerRelationId',list)) { this.changeList.push('customerRelationName'); } } }); $("#status").combobox({ valueField : 'id', textField : 'dictionaryName', data : statusList }); $("#customerId").combobox({ valueField : 'customerId', textField : 'customerName', url : WEBROOT + "/loadData.action?entity=customer", mode : 'remote', async:false, onSelectAfter : function(record) { $("#customerName").val(record.customerName); }, refreshTarget : function(record) { $("#customerName").val(record.customerName); } }); $("#customerRelationId").combobox({ valueField : 'relationedCustomerId', textField : 'relationedCustomerName', url : WEBROOT + "/loadData.action?entity=customerRelation", mode : 'remote', async:false, onSelectAfter : function(record) { $("#customerRelationName").val(record.relationedCustomerName); }, refreshTarget : function(record) { $("#customerRelationName").val(record.relationedCustomerName); }, onBeforeLoad : function(param) { param.customerId = $("#customerId").combobox('getValue'); //此设置使控件不会自动加载数据 if (!param.customerId) { return false; } else { return true; } } }); $("#warehouseId").combobox( { valueField : 'warehouseId', textField : 'warehouseName', data : warehouseList, onSelectAfter : function(record) { $("#warehouseName").val(record.warehouseName); }, refreshTarget : function(record) { $("#warehouseName").val(record.warehouseName); } }); $.OwnGoodManageEdit.init(); if ("add" == operate) { $("#id").val(id2Add); } else { if (!$.isEmpty(ownGoodManageData)) { var entity = JSON.parse(ownGoodManageData); $.OwnGoodManageEdit.fillData(entity); } } $("#saveOwnGoodManageBtn").click($.proxy($.OwnGoodManageEdit.save, $.OwnGoodManageEdit)); });