许成详 6 years ago
parent
commit
f4de19f81b
2 changed files with 35 additions and 5 deletions
  1. 31
    5
      src/pages/system/systemSet/userManager/index.vue
  2. 4
    0
      src/util/api.js

+ 31
- 5
src/pages/system/systemSet/userManager/index.vue View File

65
           label="创建时间"
65
           label="创建时间"
66
           width="200">
66
           width="200">
67
         </el-table-column>
67
         </el-table-column>
68
-        <el-table-column label="操作" fixed='right' width="300">
68
+        <el-table-column label="操作" fixed='right' width="350">
69
           <template slot-scope="scope">
69
           <template slot-scope="scope">
70
             <el-button
70
             <el-button
71
               size="mini"
71
               size="mini"
75
               size="mini"
75
               size="mini"
76
               type="danger"
76
               type="danger"
77
               @click="handleDelete(scope.$index, scope.row)">删除</el-button>
77
               @click="handleDelete(scope.$index, scope.row)">删除</el-button>
78
-              <el-button
79
-              size="mini"
80
-              type="success"
81
-              @click="handleBind(scope.$index, scope.row)">绑定角色</el-button>
78
+            <el-button
79
+            size="mini"
80
+            type="success"
81
+            @click="handleBind(scope.$index, scope.row)">绑定角色</el-button>
82
+            <el-button
83
+            size="mini"
84
+            type="primary"
85
+            @click="resetPasswd(scope.$index, scope.row)">重置密码</el-button>
82
           </template>
86
           </template>
83
         </el-table-column>
87
         </el-table-column>
84
       </el-table>
88
       </el-table>
185
     this.getList()
189
     this.getList()
186
   },
190
   },
187
   methods: {
191
   methods: {
192
+    resetPasswd (index, row) { // 重置密码
193
+      this.$confirm('确认重置此用户密码?', '提示', {
194
+        confirmButtonText: '确定',
195
+        cancelButtonText: '取消',
196
+        type: 'warning'
197
+      }).then(() => {
198
+        this.$ajax(this.$api.systemSet.resetPassword.url, {
199
+          method: this.$api.systemSet.resetPassword.method,
200
+          data: {userid: row.UserId}
201
+        }).then(res => {
202
+          this.$message({
203
+            type: 'success',
204
+            message: '操作成功'
205
+          })
206
+        })
207
+      }).catch(() => {
208
+        this.$message({
209
+          type: 'info',
210
+          message: '已取消重置'
211
+        })
212
+      })
213
+    },
188
     bindRoles () { // 绑定角色
214
     bindRoles () { // 绑定角色
189
       this.$ajax(this.$api.systemSet.bindRoles.url, {
215
       this.$ajax(this.$api.systemSet.bindRoles.url, {
190
         method: this.$api.systemSet.bindRoles.method,
216
         method: this.$api.systemSet.bindRoles.method,

+ 4
- 0
src/util/api.js View File

44
       method: 'delete',
44
       method: 'delete',
45
       url: `${baseUrl}/common/user/:id`
45
       url: `${baseUrl}/common/user/:id`
46
     },
46
     },
47
+    resetPassword: { // 重置用户密码
48
+      method: 'put',
49
+      url: `${baseUrl}/common/user/password/reset`
50
+    },
47
     bindRoles: { // 绑定角色
51
     bindRoles: { // 绑定角色
48
       method: 'put',
52
       method: 'put',
49
       url: `${baseUrl}/common/userrole`
53
       url: `${baseUrl}/common/userrole`