mesDeviceList2.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <% layout('/layouts/default.html', {title: '设备管理', libs: ['dataGrid']}){ %>
  2. <div class="main-content">
  3. <div class="box box-main">
  4. <div class="box-header">
  5. <div class="box-title">
  6. <i class="fa icon-notebook"></i> ${text('设备信息管理')}
  7. </div>
  8. <div class="box-tools pull-right">
  9. <a href="javascript:;" class="btn btn-default" onclick="work()" title="${text('工作面板')}"><i class="fa fa-fw fa-refresh"></i>工作面板</a>
  10. <!-- <a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>-->
  11. <a href="#" class="btn btn-default" id="btnRefreshTree" title="${text('刷新')}"><i class="fa fa-refresh"></i> ${text('刷新')}</a>
  12. <!-- <a href="#" class="btn btn-default" id="btnExpandTreeNode" title="${text('展开一级')}"><i class="fa fa-angle-double-down"></i> ${text('展开')}</a>-->
  13. <!-- <a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> ${text('折叠')}</a>-->
  14. <!-- <a href="#" class="btn btn-default" id="btnExport"><i class="glyphicon glyphicon-export"></i> 导出</a>-->
  15. <% if(hasPermi('mes:mesDevice:edit')){ %>
  16. <!-- <a href="#" class="btn btn-default" id="btnImport"><i class="glyphicon glyphicon-import"></i> 导入</a>-->
  17. <a href="${ctx}/mes/mesDevice/form" class="btn btn-default btnTool" title="${text('新增设备')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
  18. <% } %>
  19. <a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
  20. </div>
  21. </div>
  22. <div class="box-body">
  23. <#form:form id="searchForm" model="${mesDevice}" action="${ctx}/mes/mesDevice/listData" method="post" class="form-inline hide"
  24. data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
  25. <#form:hidden path="treeCode"/>
  26. <#form:hidden path="gw"/>
  27. <#form:hidden path="lineSn"/>
  28. <!-- <div class="form-group">-->
  29. <!-- <label class="control-label">${text('状态')}:</label>-->
  30. <!-- <div class="control-inline width-120">-->
  31. <!-- <#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>-->
  32. <!-- </div>-->
  33. <!-- </div>-->
  34. <!-- <div class="form-group">-->
  35. <!-- <label class="control-label">${text('班次')}:</label>-->
  36. <!-- <div class="control-inline width-120">-->
  37. <!-- <#form:select path="bc" dictType="mes_device_bc" blankOption="true" class="form-control isQuick"/>-->
  38. <!-- </div>-->
  39. <!-- </div>-->
  40. <!-- <div class="form-group">-->
  41. <!-- <label class="control-label">${text('设备工作状态')}:</label>-->
  42. <!-- <div class="control-inline width-120">-->
  43. <!-- <#form:select path="workStatus" dictType="mes_device_work_status" blankOption="true" class="form-control isQuick"/>-->
  44. <!-- </div>-->
  45. <!-- </div>-->
  46. <!-- <div class="form-group">-->
  47. <!-- <label class="control-label">${text('设备类型')}:</label>-->
  48. <!-- <div class="control-inline width-120">-->
  49. <!-- <#form:select path="deviceType" dictType="mes_device_type" blankOption="true" class="form-control isQuick"/>-->
  50. <!-- </div>-->
  51. <!-- </div>-->
  52. <!-- <div class="form-group">-->
  53. <!-- <label class="control-label">${text('工作类型')}:</label>-->
  54. <!-- <div class="control-inline width-120">-->
  55. <!-- <#form:select path="workType" dictType="mes_device_work_type" blankOption="true" class="form-control isQuick"/>-->
  56. <!-- </div>-->
  57. <!-- </div>-->
  58. <!-- <div class="form-group">-->
  59. <!-- <label class="control-label">${text('设备名称')}:</label>-->
  60. <!-- <div class="control-inline">-->
  61. <!-- <#form:input path="treeName" maxlength="200" class="form-control width-120"/>-->
  62. <!-- </div>-->
  63. <!-- </div>-->
  64. <!-- <div class="form-group">-->
  65. <!-- <label class="control-label">${text('唯一编号')}:</label>-->
  66. <!-- <div class="control-inline">-->
  67. <!-- <#form:input path="sn" maxlength="255" class="form-control width-120"/>-->
  68. <!-- </div>-->
  69. <!-- </div>-->
  70. <!-- <div class="form-group">-->
  71. <!-- <button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>-->
  72. <!-- <button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>-->
  73. <!-- </div>-->
  74. </#form:form>
  75. <table id="dataGrid"></table>
  76. <div id="dataGridPage"></div>
  77. </div>
  78. </div>
  79. </div>
  80. <% } %>
  81. <script>
  82. // 初始化DataGrid对象
  83. $('#dataGrid').dataGrid({
  84. searchForm: $("#searchForm"),
  85. columnModel: [
  86. {header:'${text("设备名称")}', name:'treeName', index:'a.tree_name', width:250, align:"center"},
  87. {header:'${text("唯一编号")}', name:'sn', index:'a.sn', width:150, align:"center"},
  88. //{header:'${text("上一级编号")}', name:'parentSn', index:'a.parentSn', width:150, align:"left"},
  89. {header:'${text("分类")}', name:'cateName', index:'a.cate_name', width:150, align:"center"},
  90. {header:'${text("IP地址")}', name:'ip', index:'a.ip', width:150, align:"center"},
  91. {header:'${text("产线编号")}', name:'lineSn', index:'a.line_sn', width:150, align:"center"},
  92. {header:'${text("工位")}', name:'gw', index:'a.gw', width:150, align:"center"},
  93. {header:'${text("设备识别码")}', name:'deviceCode', index:'a.device_code', width:150, align:"center"},
  94. // {header:'${text("工位地图位置")}', name:'postion', index:'a.postion', width:150, align:"left"},
  95. // {header:'${text("班次")}', name:'bc', index:'a.bc', width:150, align:"center", formatter: function(val, obj, row, act){
  96. // return js.getDictLabel(${@DictUtils.getDictListJson('mes_device_bc')}, val, '${text("未知")}', true);
  97. // }},
  98. {header:'${text("设备工作状态")}', name:'workStatus', index:'a.work_status', width:150, align:"center", formatter: function(val, obj, row, act){
  99. return js.getDictLabel(${@DictUtils.getDictListJson('mes_device_work_status')}, val, '${text("未知")}', true);
  100. }},
  101. // {header:'${text("设备工作状态时间")}', name:'workTime', index:'a.work_time', width:150, align:"center"},
  102. // {header:'${text("设备类型")}', name:'deviceType', index:'a.device_type', width:150, align:"center", formatter: function(val, obj, row, act){
  103. // return js.getDictLabel(${@DictUtils.getDictListJson('mes_device_type')}, val, '${text("未知")}', true);
  104. // }},
  105. // {header:'${text("工作类型")}', name:'workType', index:'a.work_type', width:150, align:"center", formatter: function(val, obj, row, act){
  106. // return js.getDictLabel(${@DictUtils.getDictListJson('mes_device_work_type')}, val, '${text("未知")}', true);
  107. // }},
  108. // {header:'${text("排序号")}', name:'treeSort', index:'a.tree_sort', width:150, align:"center"},
  109. {header:'${text("状态")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
  110. return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
  111. }},
  112. {header:'${text("备注")}', name:'remark', index:'a.remark', width:150, align:"left"},
  113. //{header:'${text("创建时间")}', name:'createDate', index:'a.create_date', width:150, align:"center"},
  114. {header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
  115. {header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
  116. var actions = [];
  117. //<% if(hasPermi('mes:mesDevice:edit')){ %>
  118. actions.push('<a href="${ctx}/mes/mesDevice/form?treeCode='+row.treeCode+'" class="btnList" title="${text("编辑设备")}"><i class="fa fa-pencil"></i></a>&nbsp;');
  119. if (row.status == Global.STATUS_NORMAL){
  120. actions.push('<a href="${ctx}/mes/mesDevice/disable?treeCode='+row.treeCode+'" class="btnList" title="${text("停用设备")}" data-confirm="${text("确认要停用该设备吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
  121. } else if (row.status == Global.STATUS_DISABLE){
  122. actions.push('<a href="${ctx}/mes/mesDevice/enable?treeCode='+row.treeCode+'" class="btnList" title="${text("启用设备")}" data-confirm="${text("确认要启用该设备吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
  123. }
  124. actions.push('<a href="${ctx}/mes/mesDevice/delete?treeCode='+row.treeCode+'" class="btnList" title="${text("删除设备")}" data-confirm="${text("确认要删除该设备及所有子设备吗?")}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
  125. // actions.push('<a href="${ctx}/mes/mesDevice/form?parentCode='+row.id+'" class="btnList" title="${text("新增下级设备")}"><i class="fa fa-plus-square"></i></a>&nbsp;');
  126. // actions.push('<a href="${ctx}/mes/mesDevice/detail?treeCode='+row.treeCode+'" class="btnList" title="${text("详情")}"><i class="fa fa-eye"></i></a>&nbsp;');
  127. //<% } %>
  128. return actions.join('');
  129. }}
  130. ],
  131. frozenCols: true,
  132. // treeGrid: true, // 启用树结构表格
  133. // defaultExpandLevel: 0, // 默认展开的层次
  134. // expandNodeClearPostData: 'cateId,workStatus,deviceType,workType,remark,treeName,sn,ip,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据)
  135. // 加载成功后执行事件
  136. ajaxSuccess: function(data){
  137. }
  138. });
  139. </script><script>
  140. $('#btnExport').click(function(){
  141. js.ajaxSubmitForm($('#searchForm'), {
  142. url:'${ctx}/mes/mesDevice/exportData',
  143. downloadFile:true
  144. });
  145. });
  146. function work(){
  147. window.location.href = '${ctx}/mes/mesProductRecord/work?oprno=${mesDevice.gw}&lineSn=${mesDevice.lineSn}';
  148. }
  149. $('#btnImport').click(function(){
  150. js.layer.open({
  151. type: 1,
  152. area: ['400px'],
  153. title: '${text("导入设备")}',
  154. resize: false,
  155. scrollbar: true,
  156. content: js.template('importTpl'),
  157. btn: ['<i class="fa fa-check"></i> ${text("导入")}',
  158. '<i class="fa fa-remove"></i> ${text("关闭")}'],
  159. btn1: function(index, layero){
  160. var form = {
  161. inputForm: layero.find('#inputForm'),
  162. file: layero.find('#file').val()
  163. };
  164. if (form.file == '' || (!js.endWith(form.file, '.xls') && !js.endWith(form.file, '.xlsx'))){
  165. js.showMessage("${text('文件不正确,请选择后缀为“xls”或“xlsx”的文件。')}", null, 'warning');
  166. return false;
  167. }
  168. js.ajaxSubmitForm(form.inputForm, function(data){
  169. js.showMessage(data.message);
  170. if(data.result == Global.TRUE){
  171. js.layer.closeAll();
  172. }
  173. page();
  174. }, "json");
  175. return true;
  176. }
  177. });
  178. });
  179. </script>
  180. <script id="importTpl" type="text/template">//<!--
  181. <form id="inputForm" action="${ctx}/mes/mesDevice/importData" method="post" enctype="multipart/form-data"
  182. class="form-horizontal mt20 mb10" style="overflow:auto;max-height:200px;">
  183. <div class="row">
  184. <div class="col-xs-12 col-xs-offset-1">
  185. <input type="file" id="file" name="file" class="form-file"/>
  186. <div class="mt10 pt5" style="color:red">
  187. ${text('提示:仅允许导入“xls”或“xlsx”格式文件!')}
  188. </div>
  189. <div class="mt10 pt5">
  190. <a href="${ctx}/mes/mesDevice/importTemplate" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> ${text('下载模板')}</a>
  191. </div>
  192. </div>
  193. </div>
  194. </form>
  195. //--></script>