mini-user-list.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>管理员列表</title>
  5. <meta http-equiv="Content-Type" content="text/html; 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. <script src="../../static/kj/upload-util.js"></script>
  18. <style type="text/css">
  19. .el-radio {
  20. margin-right: 10px;
  21. }
  22. </style>
  23. </head>
  24. <body>
  25. <div class="vue-box" style="display: none;" :style="'display: block;'">
  26. <div class="c-panel">
  27. <!-- ------------- 检索参数 ------------- -->
  28. <h4 class="c-title">检索参数</h4>
  29. <el-form>
  30. <div class="c-item" v-if="sa.isAdmin()">
  31. <label class="c-label">备案组织:</label>
  32. <el-select v-model="p.deptId">
  33. <el-option label="请选择" v-for="(item,index) in deptList" :key="item.id" :label="item.name"
  34. :value="item.id"></el-option>
  35. </el-select>
  36. </div>
  37. <sa-item type="text" name="名称" v-model="p.name"></sa-item>
  38. <sa-item type="text" name="手机号" v-model="p.phone"></sa-item>
  39. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1;f5()">查询
  40. </el-button>
  41. <el-button type="info" icon="el-icon-refresh" @click="p.name='';p.phone='';f5()">重置</el-button>
  42. </el-form>
  43. <!-- ------------- 数据列表 ------------- -->
  44. <el-table class="data-table" ref="data-table" :data="dataList">
  45. <sa-td type="index" name="序号"></sa-td>
  46. <sa-td type="text" name="姓名" prop="name"></sa-td>
  47. <sa-td type="text" name="手机" prop="phone" min-width="120px">
  48. <template slot-scope="s">
  49. <span v-if="s.row.phone">{{s.row.phone}}</span>
  50. <span v-else>{{s.row.name}}</span>
  51. </template>
  52. </sa-td>
  53. <sa-td type="text" name="所属组织" prop="deptName" not='-'></sa-td>
  54. <sa-td type="text" name="审核单位" prop="departmentName" not='-' width="130"></sa-td>
  55. <sa-td type="datetime" name="创建日期" prop="createTime" width="150px"></sa-td>
  56. <sa-td type="datetime" name="最后登录" prop="lastLoginTime" width="150px" not='-'></sa-td>
  57. <el-table-column label="操作" fixed="right" width="200px">
  58. <template slot-scope="s">
  59. <el-dropdown trigger="click" style="font-size: 0.85em;" v-if="sa.isAuth('mini-user-edit')">
  60. <el-button type="primary" class="c-btn">
  61. 修改资料 <i class="el-icon-arrow-down el-icon--right"></i>
  62. </el-button>
  63. <el-dropdown-menu slot="dropdown" >
  64. <span @click="updateDept(s.row)">
  65. <el-dropdown-item>修改组织</el-dropdown-item>
  66. </span>
  67. <span @click="updatePassword(s.row)">
  68. <el-dropdown-item>改密码</el-dropdown-item>
  69. </span>
  70. </el-dropdown-menu>
  71. </el-dropdown>
  72. <span @click="del(s.row)">
  73. <el-button v-if="sa.isAuth('mini-user-del')" type="danger" class="c-btn"
  74. icon="el-icon-delete">删除</el-button>
  75. </span>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <!-- 分页 -->
  80. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()">
  81. </sa-item>
  82. </div>
  83. <el-dialog title="修改组织" :modal="false" :visible.sync="dept.visible" width="400px">
  84. <div class="c-item">
  85. <label class="c-label"><span style="color: red;">*</span>组织:</label>
  86. <el-select v-model="dept.deptId">
  87. <el-option label="请选择" v-for="(item,index) in deptList" :key="item.id" :label="item.name"
  88. :value="item.id"></el-option>
  89. </el-select>
  90. </div>
  91. <span slot="footer" class="dialog-footer">
  92. <el-button @click="dept.visible=false">取 消</el-button>
  93. <el-button type="primary" @click="sureFn">确 定</el-button>
  94. </span>
  95. </el-dialog>
  96. </div>
  97. <script>
  98. var app = new Vue({
  99. components: {
  100. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  101. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')
  102. },
  103. el: '.vue-box',
  104. data: {
  105. sa: sa, // 超级对象
  106. p: { // 查询参数
  107. id: '',
  108. name: '',
  109. pageNo: 1,
  110. pageSize: 10,
  111. },
  112. dept:{
  113. visible:false,
  114. deptId:''
  115. },
  116. deptList: [],
  117. modal: {
  118. visible: false,
  119. form: {
  120. id: '',
  121. departmentId: ''
  122. }
  123. },
  124. dataCount: 0,
  125. dataList: [], // 数据集合
  126. roleList: [], // 角色集合
  127. },
  128. methods: {
  129. updateDept(data) {
  130. Object.assign(this.dept, {
  131. visible: true,
  132. deptId:data.deptId,
  133. id:data.id
  134. })
  135. },
  136. sureFn() {
  137. let data = this.dept;
  138. let deptId = data.deptId;
  139. if (!deptId) {
  140. sa.error('请选择组织');
  141. return;
  142. }
  143. sa.ajax('/TbMiniUser/updateDept', data, function(res) {
  144. this.dept.visible = false;
  145. this.f5();
  146. }.bind(this));
  147. },
  148. getDeptList() {
  149. sa.ajax('/TbDept/getList', {
  150. pageNo: 1,
  151. pageSize: 100
  152. }, function(resp) {
  153. let list = resp.data;
  154. this.deptList = list;
  155. }.bind(this))
  156. },
  157. // 刷新
  158. f5: function(isPage) {
  159. sa.ajax('/TbMiniUser/getList', this.p, function(res) {
  160. this.dataList = res.data; // 数据
  161. this.dataCount = res.dataCount;
  162. sa.f5TableHeight(); // 刷新表格高度
  163. }.bind(this));
  164. },
  165. // 修改密码
  166. updatePassword: function(data) {
  167. layer.prompt({
  168. title: '修改密码'
  169. }, function(pass, index) {
  170. layer.close(index);
  171. if (pass.length < 4) {
  172. return layer.msg('新密码长度请不要低于4位');
  173. }
  174. sa.ajax('/TbMiniUser/updatePassword', {
  175. id: data.id,
  176. password: pass
  177. }, function(res) {
  178. layer.msg('修改成功');
  179. })
  180. });
  181. },
  182. // 删除
  183. del: function(data) {
  184. sa.confirm('是否删除,此操作不可撤销', function() {
  185. sa.ajax('/TbMiniUser/delete', {
  186. id: data.id
  187. }, function(res) {
  188. sa.arrayDelete(app.dataList, data);
  189. sa.ok('删除成功');
  190. sa.f5TableHeight(); // 刷新表格高度
  191. })
  192. });
  193. },
  194. },
  195. created: function() {
  196. this.f5();
  197. this.getDeptList();
  198. sa.onInputEnter(); // 监听回车执行查询
  199. }
  200. })
  201. </script>
  202. </body>
  203. </html>