app-user-login-log-list.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>移动端用户登录日志-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css & js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. </head>
  18. <body>
  19. <div class="vue-box" style="display: none;" :style="'display: block;'">
  20. <div class="c-panel">
  21. <!-- ------------- 检索参数 ------------- -->
  22. <div class="c-title">检索参数</div>
  23. <el-form ref="form" :model='p' @submit.native.prevent>
  24. <sa-item type="text" name="登录账户" v-model="p.userName" width="100px"></sa-item>
  25. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  26. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  27. </el-form>
  28. <!-- ------------- 数据列表 ------------- -->
  29. <el-table class="data-table" ref="data-table" :data="dataList">
  30. <sa-td type="selection"></sa-td>
  31. <!-- <sa-td name="主键" prop="id" type="num"></sa-td> -->
  32. <sa-td name="登录账户" prop="userName"></sa-td>
  33. <sa-td name="登录IP" prop="loginIp"></sa-td>
  34. <sa-td name="登录设备" prop="deviceMode"></sa-td>
  35. <sa-td name="app版本号" prop="appVersion"></sa-td>
  36. <sa-td name="登录状态" prop="status">
  37. <template slot-scope="scope">
  38. <el-tag type="success" v-if="scope.row.status==3">登录成功</el-tag>
  39. <el-tag type="danger" v-if="scope.row.status==0">账户不存在</el-tag>
  40. <el-tag type="danger" v-if="scope.row.status==1">密码错误</el-tag>
  41. <el-tag type="danger" v-if="scope.row.status==2">该账户已停用</el-tag>
  42. </template>
  43. </sa-td>
  44. <sa-td name="登录时间" prop="createTime"></sa-td>
  45. <el-table-column label="操作" fixed="right" width="240px">
  46. <template slot-scope="s">
  47. <el-button v-if="sa.isAuth('app-user-login-log-del')" class="c-btn" type="danger"
  48. icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <!-- ------------- 分页 ------------- -->
  53. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount"
  54. @change="f5()"></sa-item>
  55. </div>
  56. </div>
  57. <script>
  58. var app = new Vue({
  59. components: {
  60. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  61. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  62. },
  63. el: '.vue-box',
  64. data: {
  65. p: { // 查询参数
  66. id: '', // 主键
  67. loginTime: '', // 登录时间
  68. deviceMode: '', // 登录设备
  69. appVersion: '', // app版本号
  70. pageNo: 1, // 当前页
  71. pageSize: 10, // 页大小
  72. sortType: 0 // 排序方式
  73. },
  74. dataCount: 0,
  75. dataList: [], // 数据集合
  76. },
  77. methods: {
  78. // 刷新
  79. f5: function() {
  80. sa.ajax('/sp-admin/AppUserLoginLog/getList', sa.removeNull(this.p), function(res) {
  81. this.dataList = res.data; // 数据
  82. this.dataCount = res.dataCount; // 数据总数
  83. sa.f5TableHeight(); // 刷新表格高度
  84. }.bind(this));
  85. },
  86. // 查看
  87. get: function(data) {
  88. sa.showIframe('数据详情', 'app-user-login-log-info.html?id=' + data.id, '1050px', '90%');
  89. },
  90. // 查看 - 根据选中的
  91. getBySelect: function(data) {
  92. var selection = this.$refs['data-table'].selection;
  93. if (selection.length == 0) {
  94. return sa.msg('请选择一条数据')
  95. }
  96. this.get(selection[0]);
  97. },
  98. // 删除
  99. del: function(data) {
  100. sa.confirm('是否删除,此操作不可撤销', function() {
  101. sa.ajax('/sp-admin/AppUserLoginLog/delete?id=' + data.id, function(res) {
  102. sa.arrayDelete(this.dataList, data);
  103. sa.ok('删除成功');
  104. sa.f5TableHeight(); // 刷新表格高度
  105. }.bind(this))
  106. }.bind(this));
  107. },
  108. // 批量删除
  109. deleteByIds: function() {
  110. // 获取选中元素的id列表
  111. let selection = this.$refs['data-table'].selection;
  112. let ids = sa.getArrayField(selection, 'id');
  113. if (selection.length == 0) {
  114. return sa.msg('请至少选择一条数据')
  115. }
  116. // 提交删除
  117. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  118. sa.ajax('/sp-admin/AppUserLoginLog/deleteByIds', {
  119. ids: ids.join(',')
  120. }, function(res) {
  121. sa.arrayDelete(this.dataList, selection);
  122. sa.ok('删除成功');
  123. sa.f5TableHeight(); // 刷新表格高度
  124. }.bind(this))
  125. }.bind(this));
  126. },
  127. },
  128. created: function() {
  129. this.f5();
  130. sa.onInputEnter();
  131. }
  132. })
  133. </script>
  134. </body>
  135. </html>