16c3a03727ffa3bc3e3be10119170add964e4359.svn-base 1.3 KB

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