33fe9f7828fcf5061be6c1c75e97595b8e76c4b9.svn-base 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. (function() {
  2. BemsWebApplication.FmsMaterialCodeClassViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.MaterialClassId = ko.observable();
  5. this.ParentMaterialClassId = ko.observable();
  6. this.Depth = ko.observable();
  7. this.Name = ko.observable();
  8. this.Abbreviation = ko.observable();
  9. this.IsUse = ko.observable();
  10. if(data)
  11. this.fromJS(data);
  12. };
  13. $.extend(BemsWebApplication.FmsMaterialCodeClassViewModel.prototype, {
  14. toJS: function() {
  15. return {
  16. SiteId: this.SiteId(),
  17. MaterialClassId: this.MaterialClassId(),
  18. ParentMaterialClassId: this.ParentMaterialClassId(),
  19. Depth: this.Depth(),
  20. Name: this.Name(),
  21. Abbreviation: this.Abbreviation(),
  22. IsUse: this.IsUse(),
  23. };
  24. },
  25. fromJS: function(data) {
  26. if(data) {
  27. this.SiteId(data.SiteId);
  28. this.MaterialClassId(data.MaterialClassId);
  29. this.ParentMaterialClassId(data.ParentMaterialClassId);
  30. this.Depth(data.Depth);
  31. this.Name(data.Name);
  32. this.Abbreviation(data.Abbreviation);
  33. this.IsUse(data.IsUse);
  34. }
  35. }
  36. });
  37. })();