officeList.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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-grid"></i> ${text('机构管理')}
  7. </div>
  8. <div class="box-tools pull-right">
  9. <a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
  10. <a href="#" class="btn btn-default" id="btnRefreshTree" title="${text('刷新')}"><i class="fa fa-refresh"></i> ${text('刷新')}</a>
  11. <a href="#" class="btn btn-default" id="btnExpandTreeNode" title="${text('展开一级')}"><i class="fa fa-angle-double-down"></i> ${text('展开')}</a>
  12. <a href="#" class="btn btn-default" id="btnCollapseTreeNode" title="${text('折叠全部')}"><i class="fa fa-angle-double-up"></i> ${text('折叠')}</a>
  13. <a href="#" class="btn btn-default" id="btnExport"><i class="glyphicon glyphicon-export"></i> ${text('导出')}</a>
  14. <% if(hasPermi('sys:office:edit')){ %>
  15. <a href="#" class="btn btn-default" id="btnImport"><i class="glyphicon glyphicon-import"></i> ${text('导入')}</a>
  16. <a href="${ctx}/sys/office/form" class="btn btn-default btnTool" title="${text('新增机构')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
  17. <% } %>
  18. <a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
  19. </div>
  20. </div>
  21. <div class="box-body">
  22. <#form:form id="searchForm" model="${office}" action="${ctx}/sys/office/listData" method="post" class="form-inline hide"
  23. data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
  24. <#form:hidden name="ctrlPermi" value="${ctrlPermi}"/>
  25. <#form:hidden path="officeCode" class="isReset"/>
  26. <div class="form-group">
  27. <label class="control-label">${text('机构代码')}:</label>
  28. <div class="control-inline">
  29. <#form:input path="viewCode" maxlength="100" class="form-control width-90"/>
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="control-label">${text('机构名称')}:</label>
  34. <div class="control-inline">
  35. <#form:input path="officeName" maxlength="100" class="form-control width-90"/>
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="control-label">${text('机构全称')}:</label>
  40. <div class="control-inline">
  41. <#form:input path="fullName" maxlength="200" class="form-control width-90"/>
  42. </div>
  43. </div>
  44. <!--<div class="form-group">
  45. <label class="control-label">${text('机构类型')}:</label>
  46. <div class="control-inline width-90">
  47. <#form:select path="officeType" dictType="sys_office_type" blankOption="true" class="form-control"/>
  48. </div>
  49. </div>-->
  50. <div class="form-group">
  51. <label class="control-label">${text('状态')}:</label>
  52. <div class="control-inline width-60">
  53. <#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control isQuick"/>
  54. </div>
  55. </div>
  56. <div class="form-group">
  57. <button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
  58. <button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
  59. </div>
  60. </#form:form>
  61. <table id="dataGrid"></table>
  62. </div>
  63. </div>
  64. </div>
  65. <% } %>
  66. <script>
  67. // 初始化DataGrid对象
  68. $('#dataGrid').dataGrid({
  69. searchForm: $("#searchForm"),
  70. columnModel: [
  71. {header:'${text("机构名称")}', name:'officeName', index:'a.office_name', width:300, align:"left", frozen:true, formatter: function(val, obj, row, act){
  72. return '( '+row.viewCode+' ) '+'<a href="${ctx}/sys/office/form?officeCode='+row.officeCode+'" class="btnList" data-title="${text("编辑机构")}">'+(val||row.id)+'</a>';
  73. }},
  74. {header:'${text("机构全称")}', name:'fullName', index:'a.full_name', width:200, align:"left"},
  75. {header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
  76. {header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:100, align:"left"},
  77. {header:'${text("状态")}', name:'status', index:'a.status', width:80, align:"center", formatter: function(val, obj, row, act){
  78. return js.getDictLabel(${@DictUtils.getDictListJson('sys_status')}, val, '${text("未知")}', true);
  79. }},
  80. {header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
  81. var actions = [];
  82. //<% if(hasPermi('sys:office:edit')){ %>
  83. actions.push('<a href="${ctx}/sys/office/form?officeCode='+row.officeCode+'" class="btnList" title="${text("编辑机构")}"><i class="fa fa-pencil"></i></a>&nbsp;');
  84. if (row.status == Global.STATUS_NORMAL){
  85. actions.push('<a href="${ctx}/sys/office/disable?officeCode='+row.officeCode+'" class="btnList" title="${text("停用机构")}" data-confirm="${text("确认要停用该机构吗?")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
  86. } else if (row.status == Global.STATUS_DISABLE){
  87. actions.push('<a href="${ctx}/sys/office/enable?officeCode='+row.officeCode+'" class="btnList" title="${text("启用机构")}" data-confirm="${text("确认要启用该机构吗?")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
  88. }
  89. actions.push('<a href="${ctx}/sys/office/delete?officeCode='+row.officeCode+'" class="btnList" title="${text("删除机构")}" data-confirm="${text("确认要删除该机构及所有子机构吗?")}" data-deltreenode="'+row.id+'"><i class="fa fa-trash-o"></i></a>&nbsp;');
  90. actions.push('<a href="${ctx}/sys/office/form?parentCode='+row.id+'" class="btnList" title="${text("新增下级机构")}"><i class="fa fa-plus-square"></i></a>&nbsp;');
  91. //<% } %>
  92. return actions.join('');
  93. }}
  94. ],
  95. treeGrid: true, // 启用树结构表格
  96. defaultExpandLevel: 0, // 默认展开的层次
  97. expandNodeClearPostData: 'viewCode,officeName,fullName,', // 展开节点清理请求参数数据(一般设置查询条件的字段属性,否则在查询后,不能展开子节点数据) // 加载成功后执行事件
  98. ajaxSuccess: function(data){
  99. if ($('#officeCode').val() != ''){
  100. $('#officeCode').val('');
  101. $('#btnExpandTreeNode').click();
  102. }
  103. }
  104. });
  105. $('#btnExport').click(function(){
  106. js.ajaxSubmitForm($('#searchForm'), {
  107. url:'${ctx}/sys/office/exportData',
  108. downloadFile:true
  109. });
  110. });
  111. $('#btnImport').click(function(){
  112. js.layer.open({
  113. type: 1,
  114. area: ['400px'],
  115. title: '${text("导入机构数据")}',
  116. resize: false,
  117. scrollbar: true,
  118. content: js.template('importTpl'),
  119. success: function(layero, index){
  120. layero.find('input[type="checkbox"]').iCheck();
  121. },
  122. btn: ['<i class="fa fa-check"></i> ${text("导入")}',
  123. '<i class="fa fa-remove"></i> ${text("关闭")}'],
  124. btn1: function(index, layero){
  125. var form = {
  126. inputForm: layero.find('#inputForm'),
  127. file: layero.find('#file').val()
  128. };
  129. if (form.file == '' || (!js.endWith(form.file, '.xls') && !js.endWith(form.file, '.xlsx'))){
  130. js.showMessage("${text('文件不正确,请选择后缀为“xls”或“xlsx”的文件。')}", null, 'warning');
  131. return false;
  132. }
  133. js.ajaxSubmitForm(form.inputForm, function(data){
  134. js.showMessage(data.message);
  135. if(data.result == Global.TRUE){
  136. js.layer.closeAll();
  137. }
  138. page();
  139. }, "json");
  140. return true;
  141. }
  142. });
  143. });
  144. </script>
  145. <script id="importTpl" type="text/template">//<!--
  146. <form id="inputForm" action="${ctx}/sys/office/importData" method="post" enctype="multipart/form-data"
  147. class="form-horizontal mt20 mb10" style="overflow:auto;max-height:200px;">
  148. <div class="row">
  149. <div class="col-xs-12 col-xs-offset-1">
  150. <input type="file" id="file" name="file" class="form-file"/>
  151. <div class="mt10 pt5">
  152. <#form:checkbox name="updateSupport" label="${text('是否更新已经存在的机构数据')}" class="form-control"
  153. title="${text('如果机构编码已经存在,更新这条数据。')}"/> &nbsp;
  154. <a href="${ctx}/sys/office/importTemplate" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> ${text('下载模板')}</a>
  155. </div>
  156. <font color="red" class="pull-left mt10">
  157. ${text('提示:仅允许导入“xls”或“xlsx”格式文件!')}
  158. </font>
  159. </div>
  160. </div>
  161. </form>
  162. //--></script>