ManageUser.vue 4.6 KB

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