48a6eee5bb52109194cbc1a03a70689df35069c0.svn-base 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. (function() {
  2. BemsWebApplication.FmsFacilityOperationItemViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.FacilityCode = ko.observable();
  5. this.ItemId = ko.observable();
  6. this.Name = ko.observable();
  7. this.ResultUnit = ko.observable();
  8. this.PointId = ko.observable();
  9. this.SystemId = ko.observable();
  10. this.EnergyCode = ko.observable();
  11. this.IsUse = ko.observable();
  12. this.SortOrderNo = ko.observable();
  13. this.InsertedDate = ko.observable();
  14. this.InsertedUserId = ko.observable();
  15. this.UpdatedDate = ko.observable();
  16. this.UpdatedUserId = ko.observable();
  17. if(data)
  18. this.fromJS(data);
  19. };
  20. $.extend(BemsWebApplication.FmsFacilityOperationItemViewModel.prototype, {
  21. toJS: function() {
  22. return {
  23. SiteId: this.SiteId(),
  24. FacilityCode: this.FacilityCode(),
  25. ItemId: this.ItemId(),
  26. Name: this.Name(),
  27. ResultUnit: this.ResultUnit(),
  28. PointId: this.PointId(),
  29. SystemId: this.SystemId(),
  30. EnergyCode: this.EnergyCode(),
  31. IsUse: this.IsUse(),
  32. SortOrderNo: this.SortOrderNo(),
  33. InsertedDate: this.InsertedDate(),
  34. InsertedUserId: this.InsertedUserId(),
  35. UpdatedDate: this.UpdatedDate(),
  36. UpdatedUserId: this.UpdatedUserId(),
  37. };
  38. },
  39. fromJS: function(data) {
  40. if(data) {
  41. this.SiteId(data.SiteId);
  42. this.FacilityCode(data.FacilityCode);
  43. this.ItemId(data.ItemId);
  44. this.Name(data.Name);
  45. this.ResultUnit(data.ResultUnit);
  46. this.PointId(data.PointId);
  47. this.SystemId(data.SystemId);
  48. this.EnergyCode(data.EnergyCode);
  49. this.IsUse(data.IsUse);
  50. this.SortOrderNo(data.SortOrderNo);
  51. this.InsertedDate(data.InsertedDate);
  52. this.InsertedUserId(data.InsertedUserId);
  53. this.UpdatedDate(data.UpdatedDate);
  54. this.UpdatedUserId(data.UpdatedUserId);
  55. }
  56. }
  57. });
  58. })();