caeaa34e518ee0f23368b94c881b89f1ab269416.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. $(function () {
  2. "use strict";
  3. BemsWebApplication.Factory.PointLocationMapping = {
  4. getDataSourceWithRelation: function(store, options) {
  5. return BWA.Factory.getBaseDataSourceWithRelation(
  6. store,
  7. options,
  8. this.getDataSourceOptions(),
  9. 'FmsFacilityScheduleCheckGroup');
  10. },
  11. getDataSourceOptions: function() {
  12. return {
  13. select: [
  14. 'SiteId', 'FacilityTypeId', 'FacilityCode', 'PropertyId',
  15. 'BuildingId', 'FloorId', 'ZoneId',
  16. 'ValueType',
  17. //'IsAccumulated',
  18. 'Name', 'Description',
  19. 'CmFacility/Name', 'BemsServiceType/Name', 'BemsFacilityType/Name', 'BemsFuelType/Name'
  20. ],
  21. expand: ['CmFacility', 'BemsServiceType', 'BemsFacilityType', 'BemsFuelType'],
  22. extendOptions: {
  23. forceOriginalField: true
  24. //alterNames: {
  25. // 'CmFacility/Name': 'FacilityName',
  26. //}
  27. },
  28. filter: [
  29. ['SiteId', '=', BWA.UserInfo.SiteId()],
  30. 'and',
  31. ['FacilityTypeId', '<', 100]
  32. ]
  33. };
  34. },
  35. getDataSource: function() {
  36. return BWA.DataUtil.createDataSource({
  37. dataSourceOptions: this.getDataSourceOptions()
  38. }, 'BemsMonitoringPoint')
  39. },
  40. getDataSourceWithLocation: function() {
  41. return BWA.DataUtil.createDataSource({
  42. dataSourceOptions: {
  43. select: [
  44. 'SiteId', 'FacilityTypeId', 'FacilityCode', 'PropertyId',
  45. 'BuildingId', 'FloorId', 'ZoneId',
  46. 'ValueType',
  47. //'IsAccumulated',
  48. 'Name', 'Description',
  49. 'CmFacility/Name', 'CmBuilding/Name', 'CmFloor/Name', 'CmZone/Name'
  50. ],
  51. expand: ['CmFacility', 'CmBuilding', 'CmFloor', 'CmZone'],
  52. extendOptions: {
  53. alterNames: {
  54. 'CmFacility/Name': 'FacilityName',
  55. 'CmBuilding/Name': 'BuildingName',
  56. 'CmFloor/Name': 'FloorName',
  57. 'CmZone/Name': 'ZoneName',
  58. }
  59. },
  60. filter: [
  61. ['SiteId', '=', BWA.UserInfo.SiteId()],
  62. 'and',
  63. ['FacilityTypeId', '<', 100]
  64. ]
  65. }
  66. }, 'BemsMonitoringPoint')
  67. },
  68. defaultColumns: [
  69. { dataField: 'CmFacility/Name', caption: $G('facilityName'), width: '25%', alignment: 'center' },
  70. { dataField: 'Name', caption: $G('pointName'), width: '30%', alignment: 'center' },
  71. {
  72. dataField: 'ValueType', caption: $G('valueType'), width: '10%', alignment: 'center', allowFilter: false,
  73. customizeText: function(cellInfo) {
  74. return $G.pointValueType(cellInfo.value);
  75. }
  76. },
  77. //{
  78. // dataField: 'IsAccumulated', caption: $G('accumulatedOrInstantaneous'), width: '15%', alignment: 'center', allowFilter: false,
  79. // customizeText: function(cellInfo) {
  80. // return cellInfo.value ? $G('accumulated') : $G('instantaneous');
  81. // }
  82. //},
  83. { dataField: 'Location', caption: $G('location'), width: '35%', alignment: 'center' },
  84. ],
  85. cellPreparedFunc: function(cellElement, cellInfo) {
  86. if (cellInfo.rowType == 'data') {
  87. var data = cellInfo.data;
  88. switch (cellInfo.column.dataField) {
  89. case 'Location':
  90. {
  91. $(cellElement).text($G.formatLocation(data.BuildingName(), data.FloorName(), data.ZoneName()));
  92. break;
  93. }
  94. }
  95. }
  96. },
  97. }
  98. $.extend(BWA.Factory.PointLocationMapping, BWA.DataUtil.pickFunctions(BWA.Factory));
  99. })