Browse Source

重置密码

xiaochan 1 year ago
parent
commit
8ba356b5db

+ 9 - 0
src/api/settings/permission-settings.js

@@ -76,6 +76,7 @@ export function modifyEmployeeInfo(data) {
         data,
     })
 }
+
 export function saveEmployeeInfo(data) {
     return request({
         url: '/settings/saveEmployeeInfo',
@@ -84,4 +85,12 @@ export function saveEmployeeInfo(data) {
     })
 }
 
+export function resetPasswordByCode(code) {
+    return request({
+        url: '/settings/resetPasswordByCode',
+        method: 'post',
+        data: {code},
+    })
+}
+
 

+ 1 - 3
src/components/cy/message-box/src/cy-message-box.ts

@@ -110,9 +110,7 @@ function MessageBox(options: MessageBoxType) {
         }
 
         Object.assign(data, options, {...icon});
-        const vNode = createVNode(MessageBoxConstructor,
-            data,
-            null);
+        const vNode = createVNode(MessageBoxConstructor, data, null);
         render(vNode, div);
     });
 }

+ 4 - 3
src/components/cy/message-box/src/message-box.type.ts

@@ -21,13 +21,14 @@ export interface MessageBoxType {
     beforeClose?: (inputValue: string) => boolean,
 }
 
+declare type  CyMessageClose = { action: 'cancel' | 'confirm' | 'close', value: string }
+
 export type CyMessageBoxShortcutMethod = ((
     options: MessageBoxType
-) => Promise<{ action: 'cancel' | 'confirm' | 'close', value: string }>
-    )
+) => Promise<CyMessageClose>)
 
 export interface IElMessageBox {
-    (options: MessageBoxType): Promise<{ action: 'cancel' | 'confirm' | 'close', value: string }>
+    (options: MessageBoxType): Promise<CyMessageClose>
 
     /** Show an alert message box */
     alert: CyMessageBoxShortcutMethod

+ 19 - 5
src/views/settings/permissions/UserRoleSettings.vue

@@ -69,11 +69,13 @@
         <el-table-column prop="socialNo" label="身份证"></el-table-column>
         <el-table-column prop="phoneNo" label="手机号码"></el-table-column>
         <el-table-column prop="ybCode" label="医保编码"></el-table-column>
-        <el-table-column label="操作" fixed="right">
+        <el-table-column label="操作" fixed="right" width="180">
           <template v-slot="scope">
-            <el-button type="primary" text @click="clickToEdit(scope.$index, scope.row)">编辑</el-button>
-            <br/>
-            <el-button text size="small" v-if="competence" @click="viewUserRoles(scope.row)">角色</el-button>
+            <el-button-group>
+              <el-button type="primary" text @click="clickToEdit(scope.$index, scope.row)">编辑</el-button>
+              <el-button text size="small" v-if="competence" @click="viewUserRoles(scope.row)">角色</el-button>
+              <el-button text size="small" v-if="competence" @click="resetPasswordClick(scope.row)">重置密码</el-button>
+            </el-button-group>
           </template>
         </el-table-column>
       </el-table>
@@ -117,7 +119,7 @@
   </page-layer>
 </template>
 
-<script setup name="UserRoleSettings">
+<script setup>
 import store from '@/store'
 import {
   addNewRole,
@@ -125,12 +127,14 @@ import {
   getAllUsers,
   getDeptTree,
   getUserRoles,
+  resetPasswordByCode,
   saveUserRoles
 } from '@/api/settings/permission-settings'
 import {ElMessage, ElMessageBox} from 'element-plus'
 import PersonnelInformationEditing from '@/components/settings/permissions/PersonnelInformationEditing.vue'
 import {needRule} from '@/utils/public'
 import PageLayer from "@/layout/PageLayer";
+import {CyMessageBox} from "@/components/cy/message-box";
 
 const windowSize = store.state.app.windowSize
 const tableHeight = windowSize.h - 10
@@ -287,6 +291,16 @@ const addEmployees = () => {
   userInfo.value = {}
 }
 
+function resetPasswordClick(row) {
+  CyMessageBox.confirm({
+    type: 'info',
+    message: `是否要重置:【${row.name}】密码`,
+  }).then(() => {
+    resetPasswordByCode(row.code)
+  })
+
+}
+
 onMounted(() => {
   clickToQuery()
   getAllRoles().then((res) => {