app-user-list.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>移动端账号-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. </head>
  17. <body>
  18. <div class="vue-box" style="display: none;" :style="'display: block;'">
  19. <div class="c-panel">
  20. <!-- ------------- 检索参数 ------------- -->
  21. <div class="c-title">检索参数</div>
  22. <el-form ref="form" :model='p' @submit.native.prevent>
  23. <sa-item type="text" name="手机号码" v-model="p.phone" width="100px"></sa-item>
  24. <sa-item type="text" name="姓名" v-model="p.name"></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-button v-if="sa.isAuth('app-user-add')" size="mini" type="primary" @click="add()">新增</el-button>
  28. </el-form>
  29. <!-- ------------- 数据列表 ------------- -->
  30. <el-table class="data-table" ref="data-table" :data="dataList" >
  31. <sa-td type="index" name="序号"></sa-td>
  32. <sa-td name="手机号码" prop="phone" ></sa-td>
  33. <sa-td name="姓名" prop="name" width="100"></sa-td>
  34. <sa-td name="类型" prop="userType" type="enum" :jv="{1: '普通边民', 2: '边民组长', 3: '收购商', 4: '司机', 5: '外籍商户', 6: '合作社'}"></sa-td>
  35. <sa-td name="状态" prop="enable" width="90" align="center">
  36. <template slot-scope="scope">
  37. <el-tag type="primary" v-if="scope.row.status==1">启用</el-tag>
  38. <el-tag type="danger" v-if="scope.row.status==0">禁用</el-tag>
  39. </template>
  40. </sa-td>
  41. <sa-td name="是否认证" prop="enable" width="90" align="center">
  42. <template slot-scope="scope">
  43. <el-tag type="success" v-if="scope.row.auth==1">已认证</el-tag>
  44. <el-tag type="danger" v-if="scope.row.auth==0">未认证</el-tag>
  45. </template>
  46. </sa-td>
  47. <sa-td name="认证时间" prop="authTime" ></sa-td>
  48. <sa-td name="登录次数" prop="loginCount" width="90"></sa-td>
  49. <sa-td name="上次登录时间" prop="lastLoginTime" ></sa-td>
  50. <el-table-column label="操作" fixed="right" width="270px">
  51. <template slot-scope="s">
  52. <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  53. <el-button v-if="sa.isAuth('app-user-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  54. <el-button v-if="sa.isAuth('app-user-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="pass(s.row)">改密</el-button>
  55. <el-button v-if="sa.isAuth('app-user-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <!-- ------------- 分页 ------------- -->
  60. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  61. </div>
  62. </div>
  63. <script>
  64. var app = new Vue({
  65. components: {
  66. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  67. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  68. },
  69. el: '.vue-box',
  70. data: {
  71. p: { // 查询参数
  72. phone: '', // 手机号码
  73. name: '', // 姓名
  74. pageNo: 1, // 当前页
  75. pageSize: 10, // 页大小
  76. sortType: 0 // 排序方式
  77. },
  78. dataCount: 0,
  79. dataList: [], // 数据集合
  80. },
  81. methods: {
  82. // 刷新
  83. f5: function() {
  84. sa.ajax('/sp-admin/AppUser/getList', sa.removeNull(this.p), function(res) {
  85. this.dataList = res.data; // 数据
  86. this.dataCount = res.dataCount; // 数据总数
  87. sa.f5TableHeight(); // 刷新表格高度
  88. }.bind(this));
  89. },
  90. // 查看
  91. get: function(data) {
  92. sa.showIframe('数据详情', 'app-user-info.html?id=' + data.id, '1050px', '90%');
  93. },
  94. // 查看 - 根据选中的
  95. getBySelect: function(data) {
  96. var selection = this.$refs['data-table'].selection;
  97. if(selection.length == 0) {
  98. return sa.msg('请选择一条数据')
  99. }
  100. this.get(selection[0]);
  101. },
  102. // 修改
  103. update: function(data) {
  104. sa.showIframe('修改数据', 'app-user-add.html?id=' + data.id, '1000px', '90%');
  105. },
  106. // 改密
  107. pass: function(data) {
  108. sa.showIframe('修改密码', 'app-user-pass.html?id=' + data.id, '500px', '50%');
  109. },
  110. // 新增
  111. add: function(data) {
  112. sa.showIframe('新增数据', 'app-user-add.html?id=-1', '1000px', '90%');
  113. },
  114. // 删除
  115. del: function(data) {
  116. sa.confirm('是否删除,此操作不可撤销', function() {
  117. sa.ajax('/sp-admin/AppUser/delete?id=' + data.id, function(res) {
  118. sa.arrayDelete(this.dataList, data);
  119. sa.ok('删除成功');
  120. sa.f5TableHeight(); // 刷新表格高度
  121. }.bind(this))
  122. }.bind(this));
  123. },
  124. // 批量删除
  125. deleteByIds: function() {
  126. // 获取选中元素的id列表
  127. let selection = this.$refs['data-table'].selection;
  128. let ids = sa.getArrayField(selection, 'id');
  129. if(selection.length == 0) {
  130. return sa.msg('请至少选择一条数据')
  131. }
  132. // 提交删除
  133. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  134. sa.ajax('/sp-admin/AppUser/deleteByIds', {ids: ids.join(',')}, function(res) {
  135. sa.arrayDelete(this.dataList, selection);
  136. sa.ok('删除成功');
  137. sa.f5TableHeight(); // 刷新表格高度
  138. }.bind(this))
  139. }.bind(this));
  140. },
  141. },
  142. created: function() {
  143. this.f5();
  144. sa.onInputEnter();
  145. }
  146. })
  147. </script>
  148. </body>
  149. </html>