Commit 7d9480ac by qinjianhui

fix: 重置密码

parent 79a8c23d
...@@ -119,6 +119,14 @@ ...@@ -119,6 +119,14 @@
> >
<Edit /> <Edit />
</el-icon> </el-icon>
<el-icon
size="24"
title="重置密码"
color="#67C23A"
style="cursor: pointer; vertical-align: middle"
@click.stop="resetPwd(scope.row)"
><RefreshLeft
/></el-icon>
</template> </template>
</ElTableColumn> </ElTableColumn>
</ElTable> </ElTable>
...@@ -202,13 +210,14 @@ import { ...@@ -202,13 +210,14 @@ import {
deleteUserApi, deleteUserApi,
getDetailsByIdApi, getDetailsByIdApi,
changeUserStatusApi, changeUserStatusApi,
resetPasswordApi,
} from '@/api/auth' } from '@/api/auth'
import Icon from '@/components/Icon.vue' import Icon from '@/components/Icon.vue'
import { UserEditForm, userData, userSearchForm } from '@/types/api/user' import { UserEditForm, userData, userSearchForm } from '@/types/api/user'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { Edit } from '@element-plus/icons-vue' import { Edit, RefreshLeft } from '@element-plus/icons-vue'
import type { FormRules } from 'element-plus' import type { FormRules } from 'element-plus'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
const [searchForm, resetSearchForm] = useValue<userSearchForm>({}) const [searchForm, resetSearchForm] = useValue<userSearchForm>({})
...@@ -347,6 +356,27 @@ const onChangeStatus = async (value: number, item: userData) => { ...@@ -347,6 +356,27 @@ const onChangeStatus = async (value: number, item: userData) => {
//showError(e) //showError(e)
} }
} }
const resetPwd = async (row: userData) => {
try {
await showConfirm(`确认要重置用户${row.account}的密码?`, {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
try {
const res = await resetPasswordApi(row.id)
await ElMessageBox.alert('重置成功\n\r 新密码为:' + res.data.passWord, {
confirmButtonText: '确定',
type: 'warning',
})
search()
} catch (e) {
search()
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment