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

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