diffFile.jsp 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  3. <%@ taglib uri="/WEB-INF/SpaceCore.tld" prefix="core"%>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <title>文件对比</title>
  8. <link rel="icon" type="image/png" sizes="16x16" href="/dev/images/icon.png">
  9. <link rel="stylesheet" type="text/css" href="/dev/plug-in/layui/css/layui.css" />
  10. <link rel="stylesheet" type="text/css" href="/dev/css/common.css" />
  11. <link rel="stylesheet" type="text/css" charset="UTF-8" href="/dev/plug-in/sui/css/sui.min.css" />
  12. <link rel="stylesheet" type="text/css" charset="UTF-8" href="/dev/plug-in/sui/css/sui-append.min.css" />
  13. <script src="/dev/js/jquery-3.0.0.min.js" type="text/javascript" charset="utf-8"></script>
  14. <script src="/dev/js/space.core.base.js" type="text/javascript" charset="utf-8"></script>
  15. <script src="/dev/plug-in/sui/js/sui.js" type="text/javascript" charset="utf-8"></script>
  16. <script src="/dev/plug-in/layui/layui.all.js" type="text/javascript" charset="utf-8"></script>
  17. <script src="/dev/plug-in/clipboard/dist/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  18. <script src="/dev/js/common.js" type="text/javascript" charset="utf-8"></script>
  19. <script src="/dev/plug-in/vue/vue.min.js"></script>
  20. <style>
  21. .layui-table td{
  22. word-break: break-all;
  23. }
  24. .layui-table thead tr{
  25. background-color: #f2f2f2;
  26. }
  27. .layui-table tbody td{
  28. font-size: 12px;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <div class="dev-content-div layui-anim layui-anim-fadein" id="space-content">
  34. <div class="layui-row">
  35. <div class="layui-col-md12">
  36. <div class="search_div sui-form form-horizontal">
  37. <div class="control-group">
  38. <label for="targetHost">
  39. <span style="color: red;">*</span>
  40. 目标主机地址:
  41. </label>
  42. <div class="controls">
  43. <input type="text" id="targetHost" name="targetHost" class="input-xfat" v-model="targetHost" placeholder="请输入目标主机地址">
  44. </div>
  45. </div>
  46. <div class="control-group">
  47. <label for="catalogs">
  48. <span style="color: red;">*</span>
  49. 目录:
  50. </label>
  51. <div class="controls">
  52. <input type="text" id="catalogs" name="catalogs" class="input-xfat" v-model="catalogs" placeholder="相对路径,多个目录使用英文逗号分隔" style="width: 520px;">
  53. </div>
  54. </div>
  55. <div class="control-group">
  56. <label for="catalogs">
  57. <span style="color: red;">*</span>
  58. 过滤的文件名:
  59. </label>
  60. <div class="controls">
  61. <input type="text" id="filterNames" name="filterNames" class="input-xfat" v-model="filterNames" placeholder="可使用*通配符,多个条件使用英文逗号分隔">
  62. </div>
  63. </div>
  64. <div class="control-group search_div_searchBtnDiv">
  65. <button id="submitBtn" type="button" class="sui-btn btn-xlarge btn-primary" @click="submitClick">确定</button>
  66. </div>
  67. </div>
  68. <div class="no-data" v-if="!isShow"></div>
  69. <div class="has-data" v-else="isShow">
  70. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  71. <ul class="layui-tab-title">
  72. <li class="layui-this">有差异的文件</li>
  73. </ul>
  74. <div class="layui-tab-content">
  75. <div class="layui-tab-item layui-show">
  76. <table class="layui-table">
  77. <colgroup>
  78. <col width="200">
  79. <col>
  80. <col>
  81. <col>
  82. </colgroup>
  83. <thead>
  84. <tr>
  85. <th>文件名</th>
  86. <th>相对路径</th>
  87. <th>绝对路径</th>
  88. <th>MD5</th>
  89. </tr>
  90. </thead>
  91. <tbody>
  92. <tr v-for="item in diffFileList">
  93. <td>
  94. <button type="button" class="bjwj sui-btn btn-small btn-link" title="点击即可复制" data-clipboard-demo data-clipboard-action="copy" :data-clipboard-text="item.fileName">
  95. {{item.fileName}}
  96. </button>
  97. </td>
  98. <td>/{{item.relativePath}}</td>
  99. <td>{{item.parentAbsolutePath}}</td>
  100. <td>{{item.md5}}</td>
  101. </tr>
  102. </tbody>
  103. </table>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  108. <ul class="layui-tab-title">
  109. <li class="layui-this">目标主机没有的文件</li>
  110. </ul>
  111. <div class="layui-tab-content">
  112. <div class="layui-tab-item layui-show">
  113. <table class="layui-table">
  114. <colgroup>
  115. <col width="200">
  116. <col>
  117. <col>
  118. <col>
  119. </colgroup>
  120. <thead>
  121. <tr>
  122. <th>文件名</th>
  123. <th>相对路径</th>
  124. <th>绝对路径</th>
  125. <th>MD5</th>
  126. </tr>
  127. </thead>
  128. <tbody>
  129. <tr v-for="item in noneFileList">
  130. <td>
  131. <button type="button" class="bjwj sui-btn btn-small btn-link" title="点击即可复制" data-clipboard-demo data-clipboard-action="copy" :data-clipboard-text="item.fileName">
  132. {{item.fileName}}
  133. </button>
  134. </td>
  135. <td>/{{item.relativePath}}</td>
  136. <td>{{item.parentAbsolutePath}}</td>
  137. <td>{{item.md5}}</td>
  138. </tr>
  139. </tbody>
  140. </table>
  141. </div>
  142. </div>
  143. </div>
  144. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  145. <ul class="layui-tab-title">
  146. <li class="layui-this">目标主机多出来的文件</li>
  147. </ul>
  148. <div class="layui-tab-content">
  149. <div class="layui-tab-item layui-show">
  150. <table class="layui-table">
  151. <colgroup>
  152. <col width="200">
  153. <col>
  154. <col>
  155. <col>
  156. </colgroup>
  157. <thead>
  158. <tr>
  159. <th>文件名</th>
  160. <th>相对路径</th>
  161. <th>绝对路径</th>
  162. <th>MD5</th>
  163. </tr>
  164. </thead>
  165. <tbody>
  166. <tr v-for="item in unnecessaryFileList">
  167. <td>
  168. <button type="button" class="bjwj sui-btn btn-small btn-link" title="点击即可复制" data-clipboard-demo data-clipboard-action="copy" :data-clipboard-text="item.fileName">
  169. {{item.fileName}}
  170. </button>
  171. </td>
  172. <td>/{{item.relativePath}}</td>
  173. <td>{{item.parentAbsolutePath}}</td>
  174. <td>{{item.md5}}</td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </body>
  186. <script>
  187. var app = new Vue({
  188. el: '#space-content',
  189. data: function(){
  190. return {
  191. targetHost: "",
  192. catalogs: "",
  193. filterNames: ".DS_Store,",
  194. diffFileList: [],
  195. noneFileList: [],
  196. unnecessaryFileList: [],
  197. isShow: false,
  198. }
  199. },
  200. methods: {
  201. submitClick: function() {
  202. if(!this.targetHost){
  203. tip.error("请输入目标主机地址");
  204. }else if(!this.targetHost.startsWith("http") || !this.targetHost.endsWith("/")){
  205. tip.error("请以 “http” 开头,“/” 结尾");
  206. }else if(!this.catalogs){
  207. tip.error("请输入目录");
  208. }else{
  209. var loadIndex = layer.load(2);
  210. var that = this;
  211. $.ajax({
  212. type: "POST",
  213. url: "/devService?action=devAppDiff_File_view&targetHost=" + this.targetHost + "&catalogs=" + this.catalogs + "&filterNames=" + this.filterNames,
  214. dataType: "json",
  215. success: function(msg){
  216. layer.close(loadIndex);
  217. if(msg.code != "success"){
  218. tip.error(msg.msg)
  219. return;
  220. }
  221. that.isShow = true;
  222. that.diffFileList = msg.diffFileList;
  223. that.noneFileList = msg.noneFileList;
  224. that.unnecessaryFileList = msg.unnecessaryFileList;
  225. }
  226. })
  227. }
  228. }
  229. }
  230. })
  231. $(document).ready(function() {
  232. var clipboard = new ClipboardJS(".bjwj");
  233. clipboard.on('success', function(e) {
  234. tip.success("内容已复制到剪切板", 3000)
  235. e.clearSelection();
  236. });
  237. clipboard.on('error', function(e) {
  238. tip.error("复制失败,浏览器不支持该操作", 3000)
  239. });
  240. })
  241. </script>
  242. </html>