cmpatroltype-view-model.js 889 B

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