981bf06702342b9e928f69b9ef6c0f819224f9c1.svn-base 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. (function() {
  2. BemsWebApplication.FmsWorkDailyRecordPreventionViewModel = function(data) {
  3. this.SiteId = ko.observable();
  4. this.WorkDate = ko.observable();
  5. this.TemplateId = ko.observable();
  6. this.DailyRecordId = ko.observable();
  7. this.BusinessFieldId = ko.observable();
  8. this.PreventionId = ko.observable();
  9. this.ShopNo = ko.observable();
  10. this.ShopName = ko.observable();
  11. this.WorkTime = ko.observable();
  12. this.PreventionContent = ko.observable();
  13. this.SignificantContent = ko.observable();
  14. if(data)
  15. this.fromJS(data);
  16. };
  17. $.extend(BemsWebApplication.FmsWorkDailyRecordPreventionViewModel.prototype, {
  18. toJS: function() {
  19. return {
  20. SiteId: this.SiteId(),
  21. WorkDate: this.WorkDate(),
  22. TemplateId: this.TemplateId(),
  23. DailyRecordId: this.DailyRecordId(),
  24. BusinessFieldId: this.BusinessFieldId(),
  25. PreventionId: this.PreventionId(),
  26. ShopNo: this.ShopNo(),
  27. ShopName: this.ShopName(),
  28. WorkTime: this.WorkTime(),
  29. PreventionContent: this.PreventionContent(),
  30. SignificantContent: this.SignificantContent(),
  31. };
  32. },
  33. fromJS: function(data) {
  34. if(data) {
  35. this.SiteId(data.SiteId);
  36. this.WorkDate(data.WorkDate);
  37. this.TemplateId(data.TemplateId);
  38. this.DailyRecordId(data.DailyRecordId);
  39. this.BusinessFieldId(data.BusinessFieldId);
  40. this.PreventionId(data.PreventionId);
  41. this.ShopNo(data.ShopNo);
  42. this.ShopName(data.ShopName);
  43. this.WorkTime(data.WorkTime);
  44. this.PreventionContent(data.PreventionContent);
  45. this.SignificantContent(data.SignificantContent);
  46. }
  47. }
  48. });
  49. })();