wework_index.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>店面列表</title>
  8. <link rel="stylesheet" href="__LAYUI__/layui/css/layui.css" media="all">
  9. <script src="__LAYUI__/layui/layui.js"></script>
  10. <style>
  11. .wfooter {
  12. position: fixed;
  13. bottom: 0px;
  14. left: 0px;
  15. z-index: 999;
  16. width: 100%;
  17. height: 50px;
  18. background-color: #fff;
  19. box-sizing: border-box;
  20. padding: 0px 20px;
  21. display: flex;
  22. justify-content: flex-end;
  23. align-items: center;
  24. }
  25. button {
  26. cursor: pointer;
  27. }
  28. #copySetting {
  29. margin-left: 20px;
  30. width: 64px;
  31. height: 28px;
  32. line-height: 28px;
  33. }
  34. #addSetting {
  35. width: 64px;
  36. height: 28px;
  37. line-height: 28px;
  38. }
  39. .copyBoxStyle {
  40. width: 100%;
  41. height: 100%;
  42. box-sizing: border-box;
  43. padding: 20px 20px 20px 0px;
  44. }
  45. .submitStyle {
  46. margin-top: 150px;
  47. }
  48. .layui-form-label {
  49. padding: 10px 5px;
  50. width: 85px;
  51. }
  52. .flex-btn {
  53. margin-left: 20px;
  54. display: flex;
  55. justify-content: center;
  56. }
  57. </style>
  58. </head>
  59. <body>
  60. <div id="shop-list">
  61. <table id="shop-list-table" class="layui-table" lay-filter="shop-list">
  62. <thead>
  63. <tr>
  64. <th lay-data="{field:'corp_id',width: '40%'}">企业微信ID</th>
  65. <th lay-data="{field:'agentid',width:'40%'}">应用ID</th>
  66. <th lay-data="{field:'op',width:'20%'}">操作</th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. {volist name="list" id="vo"}
  71. <tr>
  72. <td>
  73. {notempty name="$vo['corp_id']"}
  74. {$vo.corp_id}
  75. {else /}
  76. 暂未设置
  77. {/notempty}
  78. </td>
  79. <td>
  80. {notempty name="$vo['agentid']"}
  81. {$vo.agentid}
  82. {else /}
  83. 暂未设置
  84. {/notempty}
  85. </td>
  86. <td>
  87. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i
  88. class="layui-icon layui-icon-edit"></i>编辑</a>
  89. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i
  90. class="layui-icon layui-icon-delete"></i>删除</a>
  91. </td>
  92. </tr>
  93. {/volist}
  94. </tbody>
  95. </table>
  96. </div>
  97. <div class="wfooter">
  98. <button class="layui-btn layui-btn-normal layui-btn-xs" id="addSetting">添加设置</button>
  99. <button class="layui-btn layui-btn-normal layui-btn-xs" id="copySetting">复制设置</button>
  100. </div>
  101. </body>
  102. <script type="text/html">
  103. <div></div>
  104. </script>
  105. <script>
  106. var wlist = JSON.parse('{:$list}');
  107. var company_id = '{$company_id}';
  108. layui.use(['table', 'form'], function () {
  109. let table = layui.table;
  110. let form = layui.form;
  111. let $ = layui.$;
  112. table.init('shop-list', { limit: 10000 });
  113. table.on('tool(shop-list)', function (obj) {
  114. if (obj.event === "edit") {
  115. let index = obj.tr.index();
  116. let data = wlist[index];
  117. parent.wechatEditSetting({...data,company_id:company_id});
  118. } else {
  119. let index = obj.tr.index();
  120. let data = wlist[index];
  121. layer.confirm('确定删除此设置?', function(index) {
  122. $.ajax({
  123. type: 'post',
  124. url: "{:url('company/wework_delete')}",
  125. data: {
  126. id: data.id
  127. },
  128. success: function(res) {
  129. if(res.code == 0) {
  130. layer.msg(res.msg, {
  131. anim: 0
  132. },function(){
  133. //执行重载
  134. location.reload();
  135. layer.close(index);
  136. });
  137. } else {
  138. layer.msg(res.msg, {
  139. anim: 6
  140. });
  141. }
  142. }
  143. });
  144. });
  145. }
  146. });
  147. document.querySelector('#addSetting').onclick = function (e) {
  148. parent.wechatSetting({ id: company_id })
  149. }
  150. parent.reloadFunc = function () {
  151. location.reload();
  152. }
  153. document.querySelector('#copySetting').onclick = function (e) {
  154. layer.open({
  155. type: 2,
  156. title: '复制企微设置',
  157. content: "{:url('company/wework_copy')}?company_id=" + company_id, //这里content是一个DOM,注意:最好该元素要存放在body最外层,否则可能被其它的相对元素所影响
  158. area: ['500px', '350px'],
  159. end: function () {
  160. location.reload();
  161. }
  162. });
  163. }
  164. });
  165. </script>
  166. </html>