许成详 6 yıl önce
ebeveyn
işleme
f4de19f81b

+ 31
- 5
src/pages/system/systemSet/userManager/index.vue Dosyayı Görüntüle

@@ -65,7 +65,7 @@
65 65
           label="创建时间"
66 66
           width="200">
67 67
         </el-table-column>
68
-        <el-table-column label="操作" fixed='right' width="300">
68
+        <el-table-column label="操作" fixed='right' width="350">
69 69
           <template slot-scope="scope">
70 70
             <el-button
71 71
               size="mini"
@@ -75,10 +75,14 @@
75 75
               size="mini"
76 76
               type="danger"
77 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 86
           </template>
83 87
         </el-table-column>
84 88
       </el-table>
@@ -185,6 +189,28 @@ export default {
185 189
     this.getList()
186 190
   },
187 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 214
     bindRoles () { // 绑定角色
189 215
       this.$ajax(this.$api.systemSet.bindRoles.url, {
190 216
         method: this.$api.systemSet.bindRoles.method,

+ 4
- 0
src/util/api.js Dosyayı Görüntüle

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