✨ 新增管理员代登录功能
This commit is contained in:
@@ -59,6 +59,9 @@
|
||||
<el-tooltip content="分配角色" placement="top" v-if="row.userId !== 1">
|
||||
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(row)" v-hasPermi="['system:user:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="以此用户身份进入" placement="top" v-if="String(userStore.id) === '1' && String(row.userId) !== '1' && row.status === '0'">
|
||||
<el-button link type="primary" icon="User" @click="handleImpersonate(row)" v-hasPermi="['system:user:impersonate']"></el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</basic-table>
|
||||
</div>
|
||||
@@ -163,10 +166,13 @@ import TreePanel from "@/components/TreePanel"
|
||||
import ExcelImportDialog from "@/components/ExcelImportDialog"
|
||||
import UserViewDrawer from "./view"
|
||||
import { usePasswordRule } from "@/utils/passwordRule"
|
||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect, syncUsersFromOracle } from "@/api/system/user"
|
||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect, syncUsersFromOracle, startImpersonation } from "@/api/system/user"
|
||||
import { setImpersonationToken } from '@/utils/auth'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { nextTick } from "vue"
|
||||
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const { proxy } = getCurrentInstance()
|
||||
const { pwdValidator, pwdPromptValidator } = usePasswordRule()
|
||||
const { sys_normal_disable, sys_user_sex } = useDict("sys_normal_disable", "sys_user_sex")
|
||||
@@ -203,7 +209,7 @@ const columns = [
|
||||
{ label: "手机号码", prop: "phonenumber", width: 120 },
|
||||
{ label: "状态", prop: "status" },
|
||||
{ label: "创建时间", prop: "createTime", width: 160, parseTime: true },
|
||||
{ label: "操作", prop: "action", width: 150, showInToolbar: false }
|
||||
{ label: "操作", prop: "action", width: 180, showInToolbar: false }
|
||||
]
|
||||
|
||||
// 查询函数
|
||||
@@ -323,6 +329,17 @@ function handleAuthRole(row) {
|
||||
router.push("/system/user-auth/role/" + userId)
|
||||
}
|
||||
|
||||
async function handleImpersonate(row) {
|
||||
try {
|
||||
await proxy.$modal.confirm(`将以「${row.nickName}(${row.userName})」的权限进入系统,期间的操作会记录实际管理员。是否继续?`)
|
||||
const res = await startImpersonation(row.userId)
|
||||
setImpersonationToken(res.token)
|
||||
location.replace('/index')
|
||||
} catch (error) {
|
||||
// 确认取消或请求错误由公共组件处理。
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置密码按钮操作 */
|
||||
function handleResetPwd(row) {
|
||||
proxy.$prompt(`请输入「${row.userName}」的新密码`, "重置密码", {
|
||||
|
||||
Reference in New Issue
Block a user