fmsdailycheckreport-view-model.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. 
  2. (function () {
  3. BemsWebApplication.FmsDailyCheckReportViewModel = function (data) {
  4. this.SiteId = ko.observable();
  5. this.DailyCheckReportId = ko.observable();
  6. this.Name = ko.observable();
  7. this.Contents = ko.observable();
  8. this.RegisterUserId = ko.observable();
  9. this.AddDate = ko.observable();
  10. if (data)
  11. this.fromJS(data);
  12. };
  13. $.extend(BemsWebApplication.FmsDailyCheckReportViewModel.prototype, {
  14. toJS: function () {
  15. return {
  16. SiteId: this.SiteId(),
  17. DailyCheckReportId: this.DailyCheckReportId(),
  18. Name: this.Name(),
  19. Contents: this.Contents(),
  20. RegisterUserId: this.RegisterUserId(),
  21. AddDate: this.AddDate(),
  22. };
  23. },
  24. fromJS: function (data) {
  25. if (data) {
  26. this.SiteId(data.SiteId);
  27. this.DailyCheckReportId(data.DailyCheckReportId);
  28. this.Name(data.Name);
  29. this.Contents(data.Contents);
  30. this.RegisterUserId(data.RegisterUserId);
  31. this.AddDate(data.AddDate);
  32. }
  33. }
  34. });
  35. })();