소스 검색

重置密码

1
mo 2 년 전
부모
커밋
cf416a8f93

+ 10 - 0
src/api/systemManage.js

@@ -410,3 +410,13 @@ export const simpleUpdate = data => request2({
   method: 'post',
   data
 })
+
+// 重置密码
+export const resetPassword = data => {
+  return request2({
+    url: '/api-web/employee/resetPassword',
+    method: 'post',
+    data,
+    requestType:'form'
+  })
+}

+ 11 - 0
src/views/categroyManager/insideSetting/api.js

@@ -35,3 +35,14 @@ export const userRole = data => {
     params: data
   })
 }
+
+
+// 重置密码
+export const resetPassword = data => {
+  return request2({
+    url: '/api-web/employee/resetPassword',
+    method: 'post',
+    data,
+    responseType:'form'
+  })
+}

+ 21 - 12
src/views/categroyManager/insideSetting/staffManager.vue

@@ -626,8 +626,7 @@ import {
   updateEducationTeacherId,
   queryEmployeeOrganByUser,
   getPosition,
-  getDepts,
-  getPosts,
+  resetPassword
 } from "@/api/systemManage";
 import { userRole } from "./api";
 import deepClone from "@/helpers/deep-clone";
@@ -1166,18 +1165,28 @@ export default {
               return;
             }
           }
-          employeeOperate({
-            employeeId: data.id,
-            operate: type,
-          }).then((res) => {
-            if (res.code == 200) {
-              this.$message.success(tempStatus ? "重置密码成功" : "更改成功");
-              this.roleStatus = false;
+          if (type == "RESET_PASSWORD") {
+            try {
+              const res = await resetPassword({ userId: data.id });
+              this.$message.success("重置密码成功");
               this.getList();
-            } else {
-              this.$message.error(res.msg);
+            } catch (e) {
+              console.log(e);
             }
-          });
+          } else {
+            employeeOperate({
+              employeeId: data.id,
+              operate: type,
+            }).then((res) => {
+              if (res.code == 200) {
+                this.$message.success(tempStatus ? "重置密码成功" : "更改成功");
+                this.roleStatus = false;
+                this.getList();
+              } else {
+                this.$message.error(res.msg);
+              }
+            });
+          }
         })
         .catch((err) => {});
     },

+ 41 - 19
src/views/categroyManager/insideSetting/staffPlatManager.vue

@@ -18,7 +18,7 @@
             type="text"
             clearable
             v-model.trim="searchForm.search"
-                   @keyup.enter.native="
+            @keyup.enter.native="
               (e) => {
                 e.target.blur();
                 $refs.searchForm.save();
@@ -148,9 +148,7 @@
             label="操作"
           >
             <template slot-scope="scope">
-              <el-button
-                @click="onJoinQrCode(scope.row)"
-                type="text"
+              <el-button @click="onJoinQrCode(scope.row)" type="text"
                 >入驻二维码</el-button
               >
               <el-button
@@ -161,7 +159,7 @@
               >
               <el-button
                 @click="onStaffOperation('RESET_PASSWORD', scope.row)"
-                v-if="permission('employee/employeeOperate/RESET_PASSWORD')"
+                v-if="permission('employee/resetPassword/RESET_PASSWORD')"
                 type="text"
                 >重置密码</el-button
               >
@@ -576,7 +574,12 @@
       </span>
     </el-dialog>
 
-    <qr-code v-model="codeStatus" :isDown="true" title="入驻二维码" :codeUrl="qrCodeUrl" />
+    <qr-code
+      v-model="codeStatus"
+      :isDown="true"
+      title="入驻二维码"
+      :codeUrl="qrCodeUrl"
+    />
   </div>
 </template>
 <script>
@@ -594,6 +597,7 @@ import {
   queryEmployeeOrganByUser,
   getDepts,
   getPosts,
+  resetPassword,
 } from "@/api/systemManage";
 // import { userRole } from "./api";
 import deepClone from "@/helpers/deep-clone";
@@ -727,8 +731,11 @@ export default {
   },
   methods: {
     onJoinQrCode(row) {
-      console.log(row)
-      this.qrCodeUrl = vaildStudentUrl() + "/project/questionAsk/index.html?recommender=" + row.id;
+      console.log(row);
+      this.qrCodeUrl =
+        vaildStudentUrl() +
+        "/project/questionAsk/index.html?recommender=" +
+        row.id;
       this.codeStatus = true;
     },
     permission,
@@ -1024,7 +1031,12 @@ export default {
           postalCode: data.postalCode,
           postDeptIds: postDeptArr,
           deptIds: tempDeptIds,
-          tenantIds: data.userTenantList&&data.userTenantList.length>0?data.userTenantList.map(item=>{return item.tenantId}) : [],
+          tenantIds:
+            data.userTenantList && data.userTenantList.length > 0
+              ? data.userTenantList.map((item) => {
+                  return item.tenantId;
+                })
+              : [],
         };
       } else {
         this.roleResetList = [...this.roleBaseList];
@@ -1125,18 +1137,28 @@ export default {
               return;
             }
           }
-          employeeOperate({
-            employeeId: data.id,
-            operate: type,
-          }).then((res) => {
-            if (res.code == 200) {
-              this.$message.success(tempStatus ? "重置密码成功" : "更改成功");
-              this.roleStatus = false;
+          if (type == "RESET_PASSWORD") {
+            try {
+              const res = await resetPassword({ userId: data.id });
+              this.$message.success("重置密码成功");
               this.getList();
-            } else {
-              this.$message.error(res.msg);
+            } catch (e) {
+              console.log(e)
             }
-          });
+          } else {
+            employeeOperate({
+              employeeId: data.id,
+              operate: type,
+            }).then((res) => {
+              if (res.code == 200) {
+                this.$message.success(tempStatus ? "重置密码成功" : "更改成功");
+                this.roleStatus = false;
+                this.getList();
+              } else {
+                this.$message.error(res.msg);
+              }
+            });
+          }
         })
         .catch((err) => {});
     },