ManageUser.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="main_right_height">
  3. <TopDes :flag="false" topDesFont="用户管理"></TopDes>
  4. <div class="mainTable-top-two">
  5. <div class="xl_input">
  6. <el-input
  7. placeholder="请输入搜索内容"
  8. v-model="nameSearch"
  9. prefix-icon="el-icon-search"
  10. @input="searchUser"
  11. >
  12. <!-- <el-button
  13. slot="append"
  14. @click="searchUser"
  15. icon="el-icon-search"
  16. ></el-button> -->
  17. </el-input>
  18. </div>
  19. </div>
  20. <div class="table_c">
  21. <el-table
  22. :data="tableData"
  23. :header-cell-style="{
  24. background: '#66B497',
  25. color: '#FFFFFF',
  26. 'letter-spacing': '4px',
  27. }"
  28. :row-class-name="tableRowClassName"
  29. style="width: 100%"
  30. >
  31. <el-table-column prop="userName" align="center" label="姓名"> </el-table-column>
  32. <el-table-column prop="identifier" align="center" label="编号"> </el-table-column>
  33. <el-table-column label="操作" align="center">
  34. <template slot-scope="scope">
  35. <el-button
  36. class="xl_d_button"
  37. size="mini"
  38. @click="handleEdit(scope.$index, scope.row)"
  39. >重置密码</el-button
  40. >
  41. </template>
  42. </el-table-column>
  43. </el-table>
  44. </div>
  45. <p align="center" style="margin-bottom: 40px">
  46. <el-pagination
  47. @size-change="handleSizeChange"
  48. @current-change="handleCurrentChange"
  49. :current-page="pageNum"
  50. :page-sizes="[10, , 50, 100, 200, 300, 400]"
  51. :page-size="pageSize"
  52. layout="total,sizes, prev, pager, next, jumper"
  53. :total="totolSize"
  54. >
  55. </el-pagination>
  56. </p>
  57. </div>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. head_style: "#f5f7fa",
  64. pageNum: 1,
  65. pageSize: 10,
  66. totolSize: 10,
  67. nameSearch: "",
  68. tableData: [],
  69. };
  70. },
  71. mounted() {
  72. this.queryUser();
  73. },
  74. methods: {
  75. searchUser() {
  76. this.pageNum = 1;
  77. this.queryUser();
  78. },
  79. queryUser() {
  80. let that = this;
  81. that.$http.post(
  82. `v1/user/find`,
  83. {
  84. pageNum: that.pageNum,
  85. pageSize: that.pageSize,
  86. startDate: "",
  87. endDate: "",
  88. userName: that.nameSearch,
  89. role: 0,
  90. },
  91. (res) => {
  92. if (res.data.code == 200) {
  93. that.tableData = res.data.data.content;
  94. that.totolSize = res.data.data.totalElements;
  95. // this.$message.success("保存成功");
  96. } else {
  97. this.$message.error("访问服务器失败!");
  98. }
  99. }
  100. );
  101. },
  102. handleSizeChange(val) {
  103. this.pageSize = val;
  104. this.queryUser();
  105. },
  106. handleCurrentChange(val) {
  107. this.pageNum = val;
  108. this.queryUser();
  109. // this.pageNum = val;
  110. // this.queryList();
  111. },
  112. handleEdit(index, row) {
  113. this.resetPassword(row);
  114. },
  115. handleDelete(index, row) {},
  116. tableRowClassName({ rowIndex }) {
  117. if (rowIndex % 2 === 0) {
  118. return "warning-row";
  119. } else if (rowIndex % 2 === 1) {
  120. return "success-row";
  121. }
  122. return "success-row";
  123. },
  124. resetPassword(row) {
  125. let that = this;
  126. that.$http.post(
  127. `/v1/user/reset`,
  128. {
  129. identifier: sessionStorage.getItem("num"),
  130. identifierInit: row.identifier,
  131. },
  132. (res) => {
  133. if (res.data.code == 200) {
  134. this.$message.success("账号重置成功");
  135. // this.$message.success("保存成功");
  136. } else {
  137. this.$message.error("访问服务器失败!");
  138. }
  139. }
  140. );
  141. },
  142. },
  143. };
  144. </script>
  145. <style scoped>
  146. .el-divider--horizontal {
  147. margin: 0;
  148. margin-top: 10px;
  149. margin-bottom: 10px;
  150. }
  151. .main_right_height {
  152. display: flex;
  153. flex-direction: column;
  154. height: 100vh;
  155. background: #ffffff;
  156. }
  157. .userManageClass {
  158. color: #0f0f0f;
  159. }
  160. /* .xl_input >>> .el-input__inner {
  161. width: 35.4vw;
  162. line-height: 64px;
  163. background: #eaeaea;
  164. border-radius: 30px 30px 30px 30px;
  165. opacity: 1;
  166. box-sizing: border-box;
  167. font-weight: 400;
  168. color: #929292;
  169. } */
  170. .mainTable-top-two {
  171. display: flex;
  172. flex-direction: row;
  173. margin-bottom: 20px;
  174. width: 92%;
  175. margin-left: 4%;
  176. }
  177. .table_c {
  178. flex: 1;
  179. overflow: auto;
  180. width: 92%;
  181. margin-left: 4%;
  182. }
  183. </style>