fmsmaterialcodetype-view-model.js 1.0 KB

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