884a08e2c66eaafe59f90a12ceeca9e262b2ba7b.svn-base 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. (function() {
  2. BemsWebApplication.FmsMaterialWarehouseViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.BusinessFieldId = ko.observable();
  5. this.WarehouseId = ko.observable();
  6. this.Name = ko.observable();
  7. this.IsUse = ko.observable();
  8. if(data)
  9. this.fromJS(data);
  10. };
  11. $.extend(BemsWebApplication.FmsMaterialWarehouseViewModel.prototype, {
  12. toJS: function() {
  13. return {
  14. SiteId: this.SiteId(),
  15. BusinessFieldId: this.BusinessFieldId(),
  16. WarehouseId: this.WarehouseId(),
  17. Name: this.Name(),
  18. IsUse: this.IsUse(),
  19. };
  20. },
  21. fromJS: function(data) {
  22. if(data) {
  23. this.SiteId(data.SiteId);
  24. this.BusinessFieldId(data.BusinessFieldId);
  25. this.WarehouseId(data.WarehouseId);
  26. this.Name(data.Name);
  27. this.IsUse(data.IsUse);
  28. }
  29. }
  30. });
  31. })();