User.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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-header">
  40. <!-- <button class="layui-btn layui-btn-danger" onclick="delAll()">-->
  41. <!-- <i class="layui-icon"></i>批量删除</button>-->
  42. <button class="layui-btn layui-btn-normal" onclick="xadmin.open('添加','User_?id=0',500,600,false);">
  43. <i class="layui-icon"></i>添加</button></div>
  44. <div class="layui-card-body ">
  45. <table class="layui-table layui-form">
  46. <thead>
  47. <tr>
  48. <th>编号</th>
  49. <th>名称</th>
  50. <th>账号</th>
  51. <th>权限</th>
  52. <th>电话</th>
  53. <th>邮箱</th>
  54. <th>性别</th>
  55. <th>备注</th>
  56. <th>创建时间</th>
  57. <th width="75px">操作</th></tr>
  58. </thead>
  59. <tbody>
  60. {{range $index, $elem := .List}}
  61. <tr>
  62. <td>{{$elem.Admin_uuid}}</td>
  63. <td>{{$elem.Admin_name}}</td>
  64. <td>{{$elem.Admin_user}}</td>
  65. <td>
  66. {{range $index, $elemx := $.Power_List}}
  67. {{if eq $elem.Admin_power $elemx.Id }}
  68. {{$elemx.Power_name}}
  69. {{end}}
  70. {{end}}
  71. </td>
  72. <td>{{$elem.Admin_telephone}}</td>
  73. <td>{{$elem.Admin_mail}}</td>
  74. <td>
  75. {{if eq $elem.Admin_gender 0 }}
  76. 未知
  77. {{end}}
  78. {{if eq $elem.Admin_gender 1 }}
  79. {{end}}
  80. {{if eq $elem.Admin_gender 2 }}
  81. {{end}}
  82. </td>
  83. <td>{{$elem.Admin_text}}</td>
  84. <td>{{$elem.CreateTime}}</td>
  85. <td class="td-manage" >
  86. <div style="float: left">
  87. <a title="无钥匙登陆" style="color: #05a000" onclick="User_entry(this,'{{$elem.Admin_uuid}}');" href="javascript:;">
  88. <i class="layui-icon" style="margin-right: 4px">&#xe663;</i>无钥匙登陆</a>
  89. <a title="同步分类" style="color: #a03eff;" onclick="DeviceClass_Syn('{{$elem.Admin_uuid}}');" href="javascript:;">
  90. <i class="iconfont" style="margin-right: 4px">&#xe6b4;</i>同步分类</a>
  91. </div>
  92. <div style="float: left;margin-bottom: 8px">
  93. <a title="编辑" style="color: #008cff;" onclick="xadmin.open('编辑','User_?id={{$elem.Id}}&Admin_uuid={{$elem.Admin_uuid}}',500,600,false);" href="javascript:;">
  94. <i class="layui-icon" >&#xe63c;</i>编辑</a>
  95. <a title="删除" style="color: #ff3636" onclick="member_del(this,'{{$elem.Admin_uuid}}')" href="javascript:;">
  96. <i class="layui-icon">&#xe640;</i>删除</a>
  97. </div>
  98. </td>
  99. </tr>
  100. {{end}}
  101. </tbody>
  102. </table>
  103. </div>
  104. <div class="layui-card-body ">
  105. <div class="page">
  106. <div>
  107. {{range $index, $elem := .Pages}}
  108. {{if eq $elem.A 1}}
  109. <a class="prev" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">&lt;&lt;</a>
  110. {{end}}
  111. {{if eq $elem.A 2}}
  112. <a class="num" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">{{$elem.V}}</a>
  113. {{end}}
  114. {{if eq $elem.A 3}}
  115. <span class="current">{{$elem.V}}</span>
  116. {{end}}
  117. {{if eq $elem.A 4}}
  118. <a class="num" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">{{$elem.V}}</a>
  119. {{end}}
  120. {{if eq $elem.A 5}}
  121. <a class="next" href="?page={{$elem.V}}&Name={{$.Name}}&Class_1={{$.Class_1}}">&gt;&gt;</a>
  122. {{end}}
  123. {{end}}
  124. </div>
  125. Page:{{.Page}}-
  126. Page_size:{{.Page_size}}-
  127. cnt:{{.cnt}}
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. </body>
  135. <script>
  136. layui.use(['laydate', 'form'],
  137. function() {
  138. var laydate = layui.laydate;
  139. //执行一个laydate实例
  140. laydate.render({
  141. elem: '#start' //指定元素
  142. });
  143. //执行一个laydate实例
  144. laydate.render({
  145. elem: '#end' //指定元素
  146. });
  147. });
  148. /*用户-删除*/
  149. function member_del(obj, Admin_uuid) {
  150. layer.confirm('确认要删除吗?',
  151. function(index) {
  152. //发异步删除数据
  153. $(obj).parents("tr").remove();
  154. $.ajax({
  155. type: 'POST',
  156. url: 'User_Del',//发送请求
  157. data: {Admin_uuid:Admin_uuid},
  158. success: function(result) {
  159. console.log(result)
  160. if (result.Code == 200 ){
  161. layer.msg('已删除!', {
  162. icon: 1,
  163. time: 2000
  164. });
  165. window.location.reload();
  166. }else {
  167. layer.msg('删除失败!', {
  168. time: 2000
  169. });
  170. }
  171. }
  172. });
  173. });
  174. }
  175. /*用户-无钥匙进入*/
  176. function User_entry(obj, Admin_uuid) {
  177. layer.confirm('确认要 无钥匙进入 子账号吗?(确定后本账户将会退出登陆)',
  178. function(index) {
  179. $.ajax({
  180. type: 'POST',
  181. url: 'User_Entry',//发送请求
  182. data: {
  183. Admin_uuid:Admin_uuid
  184. },
  185. success: function(result) {
  186. console.log(result)
  187. if (result.Code == 200 ){
  188. window.parent.location.reload();
  189. }else {
  190. layer.msg('失败!', {
  191. time: 2000
  192. });
  193. }
  194. }
  195. });
  196. // window.open("/Index", "_blank");
  197. });
  198. }
  199. /*用户-无钥匙进入*/
  200. function DeviceClass_Syn(Admin_uuid) {
  201. layer.confirm('确认要 同步分类 子账号吗?',
  202. function(index) {
  203. var loading = layer.load(0, {
  204. shade: false,
  205. time: 99*1000
  206. });
  207. $.ajax({
  208. type: 'POST',
  209. url: '../Device/DeviceClass_Syn',//发送请求
  210. data: {
  211. Admin_uuid:Admin_uuid
  212. },
  213. success: function(result) {
  214. layer.close(loading)
  215. console.log(result)
  216. if (result.Code != 200) {
  217. layer.msg(result.Msg);
  218. return
  219. }
  220. layer.msg("成功同步传感器分类数量:"+result.Data);
  221. }
  222. });
  223. // window.open("/Index", "_blank");
  224. });
  225. }
  226. </script>
  227. </html>