瀏覽代碼

密码重置

guhongwei 5 年之前
父節點
當前提交
4a15f5e8e2
共有 2 個文件被更改,包括 18 次插入2 次删除
  1. 4 0
      src/layout/otheruser/otheruserList.vue
  2. 14 2
      src/views/otheruser/index.vue

+ 4 - 0
src/layout/otheruser/otheruserList.vue

@@ -13,6 +13,7 @@
           </el-table-column>
           <el-table-column fixed="right" label="操作" align="center">
             <template slot-scope="scope">
+              <el-button @click="clickRest(scope.row.id)" type="text"><i class="el-icon-refresh"></i></el-button>
               <el-button @click="$router.push({ path: '/otheruser/detail', query: { id: scope.row.id } })" type="text"><i class="el-icon-edit"></i></el-button>
               <el-button @click.prevent="deleteRow(scope.row.id)" type="text"><i class="el-icon-delete"></i></el-button>
             </template>
@@ -37,6 +38,9 @@ export default {
     deleteRow(id) {
       this.$emit('deleteRow', id);
     },
+    clickRest(id) {
+      this.$emit('clickRest', id);
+    },
   },
 };
 </script>

+ 14 - 2
src/views/otheruser/index.vue

@@ -8,7 +8,7 @@
         <searchInfo></searchInfo>
       </el-col>
       <el-col :span="24" class="main">
-        <otheruserList :debtTable="debtTable" @deleteRow="deleteRow"></otheruserList>
+        <otheruserList :debtTable="debtTable" @deleteRow="deleteRow" @clickRest="clickRest"></otheruserList>
       </el-col>
     </el-col>
   </div>
@@ -38,7 +38,7 @@ export default {
   },
   computed: {},
   methods: {
-    ...otheruser(['query', 'delete']),
+    ...otheruser(['query', 'delete', 'update']),
     async searchInfo({ skip = 0, limit = 10, ...info } = {}) {
       const res = await this.query({ skip, limit, ...info });
       this.$set(this, `debtTable`, res.data);
@@ -53,6 +53,18 @@ export default {
       this.$checkRes(res, '删除成功', '删除失败');
       this.searchInfo();
     },
+    async clickRest(id) {
+      let data = {};
+      data.id = id;
+      data.passwd = '123456';
+      const res = await this.update(data);
+      if (res.errcode === 0) {
+        this.$message({
+          message: '密码重置成功',
+          type: 'success',
+        });
+      }
+    },
   },
 };
 </script>