DeviceBind.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <!DOCTYPE html>
  2. <html class="x-admin-sm">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="renderer" content="webkit">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
  8. <link rel="shortcut icon" href="https://osscold.baozhida.cn/favicon.ico">
  9. <link rel="bookmark" href="https://osscold.baozhida.cn/favicon.ico">
  10. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/font.css">
  11. <link rel="stylesheet" href="https://osscold.baozhida.cn/css/xadmin.css">
  12. <script src="https://osscold.baozhida.cn/lib/layui/layui.js" charset="utf-8"></script>
  13. <script type="text/javascript" src="https://osscold.baozhida.cn/js/xadmin.js"></script>
  14. </head>
  15. <body>
  16. <div class="x-nav">
  17. <span class="layui-breadcrumb">
  18. <a href="">首页</a>
  19. <a><cite>宝智达</cite></a>
  20. </span>
  21. <a class="layui-btn layui-btn-normal" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
  22. <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
  23. </a>
  24. </div>
  25. <div class="layui-fluid">
  26. <div class="layui-row layui-col-space15">
  27. <div class="layui-col-md12">
  28. <div class="layui-card">
  29. <div class="layui-card-body ">
  30. <form class="layui-form layui-col-space5">
  31. <div class="layui-input-inline layui-show-xs-block">
  32. <input value="{{.Name}}" type="text" name="Name" placeholder="请输入 名称" autocomplete="off" class="layui-input"></div>
  33. <div class="layui-input-inline layui-show-xs-block">
  34. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">
  35. <i class="layui-icon">&#xe615;</i></button>
  36. </div>
  37. </form>
  38. </div>
  39. <div class="layui-card-body ">
  40. <table class="layui-table layui-form">
  41. <thead>
  42. <tr>
  43. <th>编号</th>
  44. <th>名称</th>
  45. <th>账号</th>
  46. <th>权限</th>
  47. <th>电话</th>
  48. <th>邮箱</th>
  49. <th>性别</th>
  50. <th>备注</th>
  51. <th>创建时间</th>
  52. {{if eq 1 $.Admin_Power.Power_Device_Bind_e }}
  53. <th>操作</th>
  54. {{end}}
  55. </tr>
  56. </thead>
  57. <tbody>
  58. {{range $index, $elem := .List}}
  59. <tr>
  60. <td>{{$elem.Admin_uuid}}</td>
  61. <td>{{$elem.Admin_name}}</td>
  62. <td>{{$elem.Admin_user}}</td>
  63. <td>
  64. {{range $index, $elemx := $.Power_List}}
  65. {{if eq $elem.Admin_power $elemx.Id }}
  66. {{$elemx.Power_name}}
  67. {{end}}
  68. {{end}}
  69. </td>
  70. <td>{{$elem.Admin_telephone}}</td>
  71. <td>{{$elem.Admin_mail}}</td>
  72. <td>
  73. {{if eq $elem.Admin_gender 0 }}
  74. 未知
  75. {{end}}
  76. {{if eq $elem.Admin_gender 1 }}
  77. {{end}}
  78. {{if eq $elem.Admin_gender 2 }}
  79. {{end}}
  80. </td>
  81. <td>{{$elem.Admin_text}}</td>
  82. <td>{{$elem.CreateTime}}</td>
  83. {{if eq 1 $.Admin_Power.Power_Device_Bind_e }}
  84. <td class="td-manage">
  85. <button class="layui-btn layui-btn-radius" style="float: right;margin-top: 2px" onclick="get_Device_bind_list_paste('{{$elem.Admin_uuid}}');">
  86. 粘贴</button>
  87. <button class="layui-btn layui-btn-radius layui-btn-warm" style="float: right;margin-top: 2px" onclick="get_Device_bind_list_copy('{{$elem.Admin_uuid}}');">
  88. 复制</button>
  89. <button class="layui-btn layui-btn-normal" style="float: right;margin-top: 2px" onclick="xadmin.open('绑定设备 | 绑定用户:{{$elem.Admin_name}}','DeviceBind_html_?Admin_uuid={{$elem.Admin_uuid}}');">
  90. <i class="iconfont" style="margin-right: 4px">&#xe6f7;</i> 绑定设备</button>
  91. </td>
  92. {{end}}
  93. </tr>
  94. {{end}}
  95. </tbody>
  96. </table>
  97. </div>
  98. <div class="layui-card-body ">
  99. <div class="page">
  100. <div>
  101. {{range $index, $elem := .Pages}}
  102. {{if eq $elem.A 1}}
  103. <a class="prev" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">&lt;&lt;</a>
  104. {{end}}
  105. {{if eq $elem.A 2}}
  106. <a class="num" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">{{$elem.V}}</a>
  107. {{end}}
  108. {{if eq $elem.A 3}}
  109. <span class="current">{{$elem.V}}</span>
  110. {{end}}
  111. {{if eq $elem.A 4}}
  112. <a class="num" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">{{$elem.V}}</a>
  113. {{end}}
  114. {{if eq $elem.A 5}}
  115. <a class="next" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">&gt;&gt;</a>
  116. {{end}}
  117. {{end}}
  118. </div>
  119. Page:{{.Page}}-
  120. Page_size:{{.Page_size}}-
  121. cnt:{{.cnt}}
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </body>
  129. <script>
  130. layui.use(['laydate', 'form'],
  131. function() {
  132. var laydate = layui.laydate;
  133. //执行一个laydate实例
  134. laydate.render({
  135. elem: '#start' //指定元素
  136. });
  137. //执行一个laydate实例
  138. laydate.render({
  139. elem: '#end' //指定元素
  140. });
  141. });
  142. /*用户-删除*/
  143. function member_del(obj, Admin_uuid) {
  144. layer.confirm('确认要删除吗?',
  145. function(index) {
  146. //发异步删除数据
  147. $(obj).parents("tr").remove();
  148. $.ajax({
  149. type: 'POST',
  150. url: 'User_Del',//发送请求
  151. data: {Admin_uuid:Admin_uuid},
  152. success: function(result) {
  153. console.log(result)
  154. if (result.Code == 200 ){
  155. layer.msg('已删除!', {
  156. icon: 1,
  157. time: 2000
  158. });
  159. window.location.reload();
  160. }else {
  161. layer.msg('删除失败!', {
  162. time: 2000
  163. });
  164. }
  165. }
  166. });
  167. });
  168. }
  169. // 复制设备
  170. var DeviceBind_List_copy = []
  171. function get_Device_bind_list_copy(Admin_uuid) {
  172. $.ajax({
  173. type: 'POST',
  174. url: 'DeviceBind_List',//发送请求
  175. data: {
  176. Admin_uuid: Admin_uuid,
  177. page: 0,
  178. page_z: 99999,
  179. },
  180. success: function (result) {
  181. console.log(result)
  182. if (result.Code == 200) {
  183. DeviceBind_List_copy = result.Data.Device_lite
  184. if(DeviceBind_List_copy.length == 0){
  185. layer.msg('复制失败,里面没有绑定设备!', {
  186. time: 2000
  187. });
  188. }
  189. layer.msg('复制数量:'+DeviceBind_List_copy.length, {
  190. time: 2000
  191. });
  192. } else {
  193. layer.msg('复制失败!', {
  194. time: 2000
  195. });
  196. }
  197. }
  198. });
  199. }
  200. // 粘贴设备
  201. function get_Device_bind_list_paste(Admin_uuid) {
  202. var loading = layer.load(0, {
  203. shade: false,
  204. time: 99*1000
  205. });
  206. DeviceBind_List_copy_i = DeviceBind_List_copy.length
  207. DeviceBind_List_copy_ok = 0
  208. DeviceBind_List_copy_no = 0
  209. for(var i = 0;i<DeviceBind_List_copy.length;i++){
  210. $.ajax({
  211. type: 'POST',
  212. url: 'DeviceBind_Add',//发送请求
  213. data: {
  214. Admin_uuid: Admin_uuid,
  215. T_sn: DeviceBind_List_copy[i].T_sn,
  216. },
  217. success: function (result) {
  218. console.log(result)
  219. if(result.Code == 200){
  220. DeviceBind_List_copy_ok += 1
  221. }else {
  222. DeviceBind_List_copy_no += 1
  223. }
  224. DeviceBind_List_copy_i -= 1
  225. console.log(DeviceBind_List_copy_i)
  226. if(DeviceBind_List_copy_i == 0){
  227. layer.close(loading)
  228. layer.msg('成功:'+DeviceBind_List_copy_ok+' 失败:'+DeviceBind_List_copy_no, {
  229. time: 2000
  230. });
  231. }
  232. }
  233. });
  234. }
  235. }
  236. </script>
  237. </html>