machineAttrHistoryList.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <% layout('/layouts/default.html', {title: '设备历史属性', libs: ['dataGrid','laydate']}){ %>
  2. <style>
  3. /* 仅本页查询区样式,不影响其他模块 */
  4. .mah-search {
  5. display: flex;
  6. flex-wrap: wrap;
  7. align-items: center;
  8. gap: 12px 20px;
  9. padding: 14px 16px;
  10. margin-bottom: 12px;
  11. background: #f7f9fc;
  12. border: 1px solid #e6ebf2;
  13. border-radius: 6px;
  14. }
  15. .mah-search .mah-item {
  16. display: flex;
  17. align-items: center;
  18. margin: 0;
  19. }
  20. .mah-search .mah-item > label {
  21. margin: 0 8px 0 0;
  22. white-space: nowrap;
  23. color: #556070;
  24. font-weight: 500;
  25. }
  26. .mah-search .form-control {
  27. height: 34px;
  28. border-radius: 4px;
  29. border-color: #d0d7e2;
  30. box-shadow: none;
  31. }
  32. .mah-search .form-control:focus {
  33. border-color: #5b9bd5;
  34. box-shadow: 0 0 0 2px rgba(91, 155, 213, 0.15);
  35. }
  36. .mah-search #eqpId {
  37. width: 140px;
  38. }
  39. .mah-search #beginTime {
  40. width: 178px;
  41. cursor: pointer;
  42. background: #fff;
  43. }
  44. .mah-search .mah-actions {
  45. display: flex;
  46. gap: 8px;
  47. margin-left: auto;
  48. }
  49. .mah-search .mah-actions .btn {
  50. min-width: 72px;
  51. height: 34px;
  52. padding: 0 14px;
  53. border-radius: 4px;
  54. }
  55. </style>
  56. <div class="main-content">
  57. <div class="box box-main">
  58. <div class="box-header">
  59. <div class="box-title">
  60. <i class="fa icon-notebook"></i> ${text('设备历史属性')}
  61. </div>
  62. <div class="box-tools pull-right">
  63. <a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
  64. <a href="#" class="btn btn-default" id="btnRefresh" title="${text('刷新')}"><i class="fa fa-refresh"></i> ${text('刷新')}</a>
  65. <a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
  66. </div>
  67. </div>
  68. <div class="box-body">
  69. <#form:form id="searchForm" model="${machineAttrHistory}" action="${ctx}/tianHong/machineAttrHistory/listData" method="post" class="form-inline hide"
  70. data-page-no="${parameter.pageNo}" data-page-size="20" data-order-by="${parameter.orderBy}">
  71. <div class="mah-search">
  72. <div class="mah-item">
  73. <label>${text('设备号')}</label>
  74. <#form:input path="eqpId" maxlength="40" class="form-control" required="true" placeholder="如 D001"/>
  75. </div>
  76. <div class="mah-item">
  77. <label>${text('上传时间')}</label>
  78. <input type="text" id="beginTime" name="beginTime" readonly="readonly"
  79. maxlength="19" class="form-control laydate required"
  80. data-type="datetime" data-format="yyyy-MM-dd HH:mm:ss"
  81. data-msg-required="请选择上传时间"
  82. placeholder="上传时间"
  83. value="${machineAttrHistory.beginTime!, 'yyyy-MM-dd HH:mm:ss'}"/>
  84. </div>
  85. <div class="mah-actions">
  86. <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> ${text('查询')}</button>
  87. <button type="reset" class="btn btn-default btn-sm"><i class="fa fa-undo"></i> ${text('重置')}</button>
  88. </div>
  89. </div>
  90. </#form:form>
  91. <table id="dataGrid"></table>
  92. <div id="dataGridPage"></div>
  93. </div>
  94. </div>
  95. </div>
  96. <% } %>
  97. <script>
  98. // 初始化DataGrid对象(须先填设备号;每页 20,时间正序由后端保证)
  99. $('#dataGrid').dataGrid({
  100. searchForm: $("#searchForm"),
  101. pageSize: 20,
  102. shrinkToFit: false,
  103. columnModel: [
  104. {header:'${text("设备号")}', name:'eqpId', index:'t.eqp_id', width:100, align:"center", frozen:true},
  105. {header:'${text("炉膛温度(℃)")}', name:'cruTemp', index:'c.Value', width:100, align:"center"},
  106. {header:'${text("铝水温度(℃)")}', name:'aluTemp', index:'a.Value', width:100, align:"center"},
  107. {header:'${text("模具温度(℃)")}', name:'mouldInfo', index:'mt.mould_info', width:160, align:"center"},
  108. {header:'${text("理论压力")}', name:'theoryPressure', index:'p.TheoryValue', width:90, align:"center"},
  109. {header:'${text("实际压力")}', name:'realPressure', index:'p.RealValue', width:90, align:"center"},
  110. {header:'${text("压力段位")}', name:'pressureLevel', index:'p.LevelID', width:80, align:"center"},
  111. {header:'${text("电量总计")}', name:'eleConsume', index:'e.Value', width:90, align:"center"},
  112. {header:'${text("剩余模次")}', name:'aluVal', width:80, align:"center"},
  113. {header:'${text("保压时间")}', name:'pressurizeTime', width:80, align:"center"},
  114. {header:'${text("冷却时间")}', name:'coolingTime', width:80, align:"center"},
  115. {header:'${text("预压压力设定")}', name:'prePres', width:100, align:"center"},
  116. {header:'${text("保压开始信号")}', name:'holdPressure', width:100, align:"center"},
  117. {header:'${text("充型压力")}', name:'moldFillingPre', width:90, align:"center"},
  118. {header:'${text("属性更新时间")}', name:'attrEventTime', width:170, align:"center",
  119. formatter: function(val){
  120. if (!val) return '';
  121. if (typeof val === 'string') {
  122. return val.length >= 19 ? val.substring(0, 19) : val;
  123. }
  124. return val;
  125. }},
  126. {header:'${text("操作")}', name:'actions', width:120, align:"center", formatter: function(val, obj, row, act){
  127. var actions = [];
  128. var eqpId = js.val(row,'eqpId');
  129. var rowId = js.val(row,'id') || '';
  130. var href = '${ctx}/tianHong/machineAttrHistory/form?id=' + encodeURIComponent(eqpId || '');
  131. if (rowId && /_\d{20}$/.test(rowId)) {
  132. href += '&eventTimeKey=' + encodeURIComponent(rowId.slice(-20));
  133. } else {
  134. var et = js.val(row,'attrEventTime');
  135. if (et) {
  136. href += '&eventTime=' + encodeURIComponent(et);
  137. }
  138. }
  139. actions.push('<a href="'+href+'" class="addTabPage" data-title="${text("设备属性明细")}"><i class="fa fa-list"></i> ${text("属性明细")}</a>&nbsp;');
  140. return actions.join('');
  141. }}
  142. ]
  143. });
  144. $('#btnRefresh').click(function(){
  145. $('#dataGrid').dataGrid('refresh');
  146. });
  147. function pad(n){ return n < 10 ? '0' + n : '' + n; }
  148. function formatDate(d) {
  149. return d.getFullYear() + '-' + pad(d.getMonth()+1) + '-' + pad(d.getDate())
  150. + ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds());
  151. }
  152. function formatNow() { return formatDate(new Date()); }
  153. (function ensureDateTime(){
  154. var re = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
  155. var $b = $('#beginTime');
  156. if (!$b.val() || !re.test($b.val())) {
  157. $b.val(formatNow());
  158. }
  159. })();
  160. $('#searchForm').on('reset', function(){
  161. setTimeout(function(){
  162. $('#beginTime').val(formatNow());
  163. }, 0);
  164. });
  165. </script>