EntApplicationCenterList.html 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  7. <title>企业应用私有</title>
  8. <link rel="stylesheet" href="../../assets/libs/layui/css/layui.css"/>
  9. <link rel="stylesheet" href="../../assets/module/admin.css?v=312"/>
  10. <link rel="stylesheet" href="../../assets/module/formSelects/formSelects-v4.css"/>
  11. <style>
  12. .layui-card-body {
  13. padding: 0;
  14. }
  15. #datatable + .layui-table-view .layui-table-body tbody > tr > td {
  16. padding: 0;
  17. }
  18. #datatable + .layui-table-view .layui-table-body tbody > tr > td > .layui-table-cell {
  19. height: 60px;
  20. line-height: 60px;
  21. }
  22. .tdImg {
  23. width: 50px;
  24. height: 50px;
  25. max-width: none;
  26. cursor: zoom-in;
  27. }
  28. .split-item:last-child {
  29. padding: 15px;
  30. }
  31. .split-item .ztree {
  32. padding: 15px;
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <!-- 页面加载loading -->
  38. <div class="page-loading">
  39. <div class="ball-loader">
  40. <span></span><span></span><span></span><span></span>
  41. </div>
  42. </div>
  43. <!-- 正文开始 -->
  44. <div class="layui-fluid">
  45. <div class="layui-row">
  46. <div class="layui-card">
  47. <div class="layui-card-header">
  48. 企业应用私有
  49. </div>
  50. <div class="layui-card-body">
  51. <div class="split-group" id="split-group">
  52. <div class="split-item" id="split1" style="overflow: hidden;overflow-y: scroll;">
  53. <ul id="groupTree" class="ztree"></ul>
  54. </div>
  55. <div class="split-item" id="split2" style="overflow: hidden;overflow-y: scroll;">
  56. <input type="hidden" id="cId">
  57. <fieldset class="layui-elem-field layui-field-title" style="margin:0px">
  58. <legend id="name"></legend>
  59. </fieldset>
  60. <div class="pull-right" id="add">
  61. <button id="addApp" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-normal"><i
  62. class="layui-icon">&#xe654;</i>添加应用
  63. </button>
  64. </div>
  65. <!-- <table class="layui-table" id="datatable" lay-filter="datatable"></table>-->
  66. <table class="layui-table" lay-size="sm">
  67. <thead>
  68. <tr>
  69. <th>序号</th>
  70. <th>标题</th>
  71. <th>图标</th>
  72. <th>包名</th>
  73. <th>是否公开</th>
  74. <th>操作</th>
  75. </tr>
  76. </thead>
  77. <tbody id="tableC">
  78. </tbody>
  79. </table>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </body>
  87. <!-- js部分 -->
  88. <script type="text/javascript" src="../../assets/libs/layui/layui.js"></script>
  89. <script type="text/javascript" src="../../assets/js/common.js?v=312"></script>
  90. <script type="text/html" id="optionTpl">
  91. <div class="layui-btn-group">
  92. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
  93. </div>
  94. </script>
  95. <script type="text/html" id="applicationCenterTpl">
  96. <form id="modelUserForm" lay-filter="modelUserForm" class="layui-form model-form">
  97. <div class="layui-form-item">
  98. <label class="layui-form-label">私有应用:</label>
  99. <div class="layui-input-block">
  100. <select name="applicationCenter" lay-verType="tips" class="layui-input-block"
  101. xm-select="applicationCenter" xm-select-search>
  102. <option value="">直接搜索或者选择私有应用</option>
  103. </select>
  104. </div>
  105. </div>
  106. </form>
  107. </script>
  108. <script>
  109. layui.use(['layer', 'form', 'util', 'zTree', 'admin', 'uParas', 'table', 'Split', '_zTree', 'formSelects'], function () {
  110. var $ = layui.jquery;
  111. var layer = layui.layer;
  112. var form = layui.form;
  113. var admin = layui.admin;
  114. var uParas = layui.uParas;
  115. var table = layui.table;
  116. var _zTree = layui._zTree;
  117. var Split = layui.Split;
  118. var formSelects = layui.formSelects;
  119. var vue = layui.vue;
  120. // 水平分割
  121. Split(['#split1', '#split2'], {sizes: [15, 85], minSize: 200});
  122. var pageHeight = admin.getPageHeight();
  123. $("#split-group").css("height", pageHeight - 80);
  124. $("#add").hide();
  125. $(".layui-table").hide();
  126. function load(id) {
  127. var url = uParas.baseUrl + '/3rd/app/query?type=all&cId=' + id;
  128. $.get(url, function (res) {
  129. $("#tableC").html('');
  130. var html = ``;
  131. $.each(res.data, function (i, item) {
  132. html += `<tr> <td>${i + 1}</td>`;
  133. html += `<td>${item.applicationTitle}</td>`;
  134. html += `<td><img src="${item.applicationIcon}" class="tdImg" tb-img/></td>`;
  135. html += `<td>${item.applicationPackage}</td>`;
  136. html += `<td>${item.applicationPublic == 0 ? "公开" : "私有"}</td>`;
  137. if (item.applicationPublic != 0) {
  138. html += `<td><a class="layui-btn layui-btn-danger layui-btn-xs" onclick="delApp(${item.cId},${item.applicationId})" >删除</a></td></tr>`;
  139. } else {
  140. html += `<td>&nbsp;</tr>`;
  141. }
  142. });
  143. $("#tableC").append(html);
  144. });
  145. }
  146. $('#addApp').click(function () {
  147. var cId = $("#cId").val();
  148. admin.open({
  149. type: 1,
  150. title: '应用中心',
  151. area: ["600px", "300px"],
  152. content: $('#applicationCenterTpl').html(),
  153. btn: ['确定', '取消']
  154. , yes: function () {
  155. var appIds = formSelects.value('applicationCenter', 'valStr');
  156. admin.req(uParas.baseUrl + '/entApplicationCenter/save', {
  157. cId: cId,
  158. appIds: appIds
  159. }, function (res) {
  160. if (res.code == 1) {
  161. layer.msg(res.msg, {offset: ['50%'], time: 2000}, function () {
  162. layer.closeAll();
  163. load(cId);
  164. });
  165. } else {
  166. layer.msg(res.msg);
  167. }
  168. }, 'post');
  169. }, btn2: function () {
  170. layer.closeAll();
  171. },
  172. zIndex: layer.zIndex,
  173. success: function (layero, dIndex) {
  174. $.getJSON(uParas.baseUrl + '/entApplicationCenter/queryAppIds?cId=' + cId, {}, function (resp) {
  175. uParas.initFormSelects("applicationCenter", "/sysApplicationCenter/queryList", "applicationTitle", "applicationId", resp.data);
  176. });
  177. }
  178. });
  179. });
  180. $.extend(window, {
  181. delApp: function (cId, applicationId) {
  182. layer.confirm("确定要删除吗?", {
  183. skin: 'layui-layer-admin',
  184. shade: .1
  185. }
  186. , function (i) {
  187. layer.close(i);
  188. layer.load();
  189. var obj = {};
  190. var url = uParas.baseUrl + "/entApplicationCenter/delById?cId=" + cId + "&appId=" + applicationId;
  191. admin.req(url, obj, function (res) {
  192. layer.closeAll('loading');
  193. if (res.code == 1) {
  194. layer.msg(res.msg, {offset: ['50%'], time: 2000}, function () {
  195. load(cId);
  196. });
  197. } else {
  198. layer.msg(res.msg);
  199. }
  200. }, 'post');
  201. });
  202. }
  203. });
  204. function onClick(event, treeId, treeNode, clickFlag) {
  205. var obj = treeNode;
  206. var cId = obj.id;
  207. $("#name").html(obj.name);
  208. $("#cId").val(cId);
  209. $("#add").show();
  210. $(".layui-table").show();
  211. load(cId);
  212. }
  213. _zTree._initx('/sys/company/queryList', "groupTree", onClick);
  214. // 点击图片放大
  215. $(document).off('click.tbImg').on('click.tbImg', '[tb-img]', function () {
  216. layer.photos({photos: {data: [{src: $(this).attr('src')}]}, shade: .1, closeBtn: true});
  217. });
  218. });
  219. </script>
  220. </html>