ソースを参照

机构,平台用户重置密码

guhongwei 3 年 前
コミット
44245e0154

+ 10 - 2
src/views/account/mechanism/index.vue

@@ -2,7 +2,7 @@
   <div id="index">
   <div id="index">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @add="toAdd" @back="back" :useNav="false">
     <admin-frame @search="search" :limit="limit" :total="total" topType="2" @add="toAdd" @back="back" :useNav="false">
       <template v-slot:info>
       <template v-slot:info>
-        <list-1 :list="list" @toEdit="toEdit" @toDel="toDel"></list-1>
+        <list-1 :list="list" @toEdit="toEdit" @toDel="toDel" @toPsd="toPsd"></list-1>
       </template>
       </template>
     </admin-frame>
     </admin-frame>
   </div>
   </div>
@@ -30,7 +30,7 @@ export default {
     await this.search();
     await this.search();
   },
   },
   methods: {
   methods: {
-    ...adminLogin(['query', 'delete']),
+    ...adminLogin(['query', 'delete', 'updatePwd']),
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
       if (searchName) info.name = this.searchName;
       if (searchName) info.name = this.searchName;
       let res = await this.query({ skip, limit, pid: this.user.id, role: '2', ...info });
       let res = await this.query({ skip, limit, pid: this.user.id, role: '2', ...info });
@@ -55,6 +55,14 @@ export default {
         this.search();
         this.search();
       }
       }
     },
     },
+    // 重置密码
+    async toPsd(data) {
+      let res = await this.updatePwd({ id: data.id, passwd: '123456' });
+      if (this.$checkRes(res)) {
+        this.$toast({ type: `success`, message: `重置密码完成` });
+        this.search();
+      }
+    },
     back() {
     back() {
       this.$router.push({ path: `/account/index` });
       this.$router.push({ path: `/account/index` });
     },
     },

+ 5 - 0
src/views/account/mechanism/parts/list_1.vue

@@ -19,6 +19,7 @@
         <van-col span="24" class="btn">
         <van-col span="24" class="btn">
           <van-button type="info" size="small" @click="toEdit(item)">修改信息</van-button>
           <van-button type="info" size="small" @click="toEdit(item)">修改信息</van-button>
           <van-button type="danger" size="small" @click="toDel(item)">删除信息</van-button>
           <van-button type="danger" size="small" @click="toDel(item)">删除信息</van-button>
+          <van-button type="info" size="small" @click="toPsd(item)">重置密码</van-button>
         </van-col>
         </van-col>
       </van-col>
       </van-col>
     </van-col>
     </van-col>
@@ -46,6 +47,10 @@ export default {
     toDel(data) {
     toDel(data) {
       this.$emit('toDel', data);
       this.$emit('toDel', data);
     },
     },
+    // 重置密码
+    toPsd(data) {
+      this.$emit('toPsd', data);
+    },
   },
   },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),

+ 10 - 2
src/views/account/users/index.vue

@@ -7,7 +7,7 @@
           <van-button type="info" size="small" @click="toImport()">批量注册用户</van-button>
           <van-button type="info" size="small" @click="toImport()">批量注册用户</van-button>
           <van-button type="info" size="small" @click="tpExport()">批量导出用户</van-button>
           <van-button type="info" size="small" @click="tpExport()">批量导出用户</van-button>
         </van-col>
         </van-col>
-        <van-col span="24" class="two"> <list-1 :list="list" @toEdit="toEdit" @toDel="toDel" @toPatent="toPatent"></list-1> </van-col>
+        <van-col span="24" class="two"> <list-1 :list="list" @toEdit="toEdit" @toDel="toDel" @toPatent="toPatent" @toPsd="toPsd"></list-1> </van-col>
       </template>
       </template>
     </admin-frame>
     </admin-frame>
   </div>
   </div>
@@ -33,7 +33,7 @@ export default {
     this.search();
     this.search();
   },
   },
   methods: {
   methods: {
-    ...personal(['query', 'delete', 'export']),
+    ...personal(['query', 'delete', 'export', 'updatePassword']),
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
       if (searchName) info.phone = searchName;
       if (searchName) info.phone = searchName;
       if (this.user.role != '1') info.code = this.user.code;
       if (this.user.role != '1') info.code = this.user.code;
@@ -74,6 +74,14 @@ export default {
     toPatent(data) {
     toPatent(data) {
       this.$router.push({ path: `/account/patent/index`, query: { id: data._id } });
       this.$router.push({ path: `/account/patent/index`, query: { id: data._id } });
     },
     },
+    // 重置密码
+    async toPsd(data) {
+      let res = await this.updatePassword({ id: data.id, password: '123456' });
+      if (this.$checkRes(res)) {
+        this.$toast({ type: `success`, message: `重置密码完成` });
+        this.search();
+      }
+    },
     // 返回
     // 返回
     back() {
     back() {
       this.$router.push({ path: `/account/index` });
       this.$router.push({ path: `/account/index` });

+ 5 - 0
src/views/account/users/parts/list-1.vue

@@ -19,6 +19,7 @@
         <van-col span="24" class="btn">
         <van-col span="24" class="btn">
           <van-button type="info" size="small" @click="toEdit(item)">修改/审核</van-button>
           <van-button type="info" size="small" @click="toEdit(item)">修改/审核</van-button>
           <van-button type="danger" size="small" @click="toDel(item)" v-if="user.role == '1'">删除信息</van-button>
           <van-button type="danger" size="small" @click="toDel(item)" v-if="user.role == '1'">删除信息</van-button>
+          <van-button type="info" size="small" @click="toPsd(item)">重置密码</van-button>
           <!-- <van-button type="info" size="small" @click="toPatent(item)">查看专利</van-button> -->
           <!-- <van-button type="info" size="small" @click="toPatent(item)">查看专利</van-button> -->
         </van-col>
         </van-col>
       </van-col>
       </van-col>
@@ -48,6 +49,10 @@ export default {
     toPatent(data) {
     toPatent(data) {
       this.$emit('toPatent', data);
       this.$emit('toPatent', data);
     },
     },
+    // 重置密码
+    toPsd(data) {
+      this.$emit('toPsd', data);
+    },
   },
   },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),