Skip to content

Commit

Permalink
修改登录默认帐号;拖拽改变尺寸指令增加处理器;增加在线管理员;修复所有列表页误操作权限显示操作列的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gmingchen committed Jun 13, 2023
1 parent 4f41947 commit 221772a
Show file tree
Hide file tree
Showing 25 changed files with 282 additions and 9 deletions.
27 changes: 27 additions & 0 deletions src/api/online/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import service from '@/utils/request'

/**
* 分页
* @param {*} params
* @returns
*/
export function pageApi(params) {
return service({
url: '/admin/online/page',
method: 'get',
params
})
}

/**
* 强制退出
* @param {*} data
* @returns
*/
export function logoutApi(data) {
return service({
url: '/admin/online/logout',
method: 'post',
data
})
}
16 changes: 15 additions & 1 deletion src/directive/drag-resize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ const defaultOptions = {
// Element的最小宽度/高度
min: 200,
// Element的最大宽度/高度
max: 460
max: 460,
// 处理器
downHandler: null,
moveHandler: null,
upHandler: null
}

const weakMap = new WeakMap()
Expand Down Expand Up @@ -68,6 +72,10 @@ const createElement = (options) => {

const mouseListener = (el, div, options) => {
div.addEventListener('mousedown', (downEvent) => {
const { downHandler, moveHandler, upHandler } = options
if (typeof downHandler === 'function') {
downHandler(downEvent)
}
const moveController = new AbortController()
const upController = new AbortController()

Expand All @@ -80,6 +88,9 @@ const mouseListener = (el, div, options) => {
weakMap.set(el, { div, moveController, upController })

document.addEventListener('mousemove', (moveEvent) => {
if (typeof moveHandler === 'function') {
moveHandler(moveHandler)
}
document.documentElement.style.cursor = div.style.cursor
if (horizontal.includes(options.position)) {
const value = moveEvent.pageX - downPageX
Expand All @@ -106,6 +117,9 @@ const mouseListener = (el, div, options) => {
}, { signal: moveController.signal })

document.addEventListener('mouseup', () => {
if (typeof upHandler === 'function') {
upHandler(moveHandler)
}
moveController.abort()
upController.abort()
document.documentElement.style.cursor = ''
Expand Down
2 changes: 1 addition & 1 deletion src/stores/modules/adminer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const useAdminerStore = defineStore('adminer', {
if (r) {
this.$state = r.data
}
return r.data
return r ? r.data : null
},
/**
* 退出当前账户
Expand Down
2 changes: 1 addition & 1 deletion src/views/constant/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const loading = ref(false)
const captcha = ref('')
const form = reactive({
account: 'demo1',
account: 'admin1',
password: 'superadmin',
uuid: '',
code: ''
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/develop/dict/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ const changeHandle = (row) => {
prop="updatedAt"
width="160" />
<el-table-column
v-permission="'dictSub:update|dictSub:delete'"
align="center"
label="操作"
width="110"
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/develop/generator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ onBeforeMount(() => {
prop="updatedAt"
width="160" />
<el-table-column
v-permission="'generator:generate'"
align="center"
label="操作"
width="80"
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/develop/job/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ onBeforeMount(() => {
prop="updatedAt"
width="160" />
<el-table-column
v-permission="'job:update|job:run|job:resume|job:paush|job:delete'"
align="center"
label="操作"
width="110"
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/infrastructure/backup/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ onBeforeMount(() => {
width="160"
show-overflow-tooltip />
<el-table-column
v-permission="'backup:info|backup:recovery|backup:delete'"
align="center"
label="操作"
width="160"
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/infrastructure/file/config/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ onBeforeMount(() => {
prop="updatedAt"
width="160" />
<el-table-column
v-permission="'fileConfig:update|fileConfig:delete'"
align="center"
label="操作"
width="110"
Expand Down
2 changes: 1 addition & 1 deletion src/views/modules/infrastructure/ip/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ onBeforeMount(() => {
@change="getList" />
</template>
</Container>
</template>
</template>
1 change: 1 addition & 0 deletions src/views/modules/infrastructure/mail/account/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ onBeforeMount(() => {
width="160"
show-overflow-tooltip />
<el-table-column
v-permission="'mailAccount:update|mailAccount:delete'"
align="center"
label="操作"
width="110"
Expand Down
2 changes: 1 addition & 1 deletion src/views/modules/infrastructure/mail/list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ onBeforeMount(() => {
label="操作"
width="110"
fixed="right"
v-permission="'mail:delete'">
v-permission="'mail:info|mail:delete'">
<template v-slot="{ row }">
<el-button
v-permission="'mail:info'"
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/infrastructure/mail/template/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ onBeforeMount(() => {
width="160"
show-overflow-tooltip />
<el-table-column
v-permission="'mailTemplate:update|mailTemplate:delete'"
align="center"
label="操作"
width="110"
Expand Down
1 change: 1 addition & 0 deletions src/views/modules/infrastructure/notice/template/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ onBeforeMount(() => {
prop="updatedAt"
width="160" />
<el-table-column
v-permission="'noticeTemplate:update|noticeTemplate:delete'"
align="center"
label="操作"
width="110"
Expand Down
214 changes: 214 additions & 0 deletions src/views/modules/infrastructure/online/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
<script setup>
import { ElMessage, ElMessageBox } from 'element-plus'
import TenantSidebar from '@/components/tenant-sidebar/index.vue'
import { Status } from '@/utils/enum'
import { pageApi, logoutApi } from '@/api/online'
const refContainerSidebar = ref()
const refTable = ref()
const loading = ref(false)
const visible = ref(false)
const form = reactive({
tenantId: ''
})
const page = reactive({
current: 1,
size: 10,
total: 0
})
const list = ref([])
/**
* @description: 获取分页列表
* @param {*}
* @return {*}
*/
const getList = () => {
const { current, size } = page
const params = {
...form,
current,
size
}
loading.value = true
pageApi(params).then(r => {
if (r) {
list.value = r.data.list
page.total = r.data.total
}
nextTick(() => {
loading.value = false
})
})
}
/**
* @description: 强制退出
* @param {number} id
* @return {*}
*/
const logoutHandle = id => {
ElMessageBox.confirm(`确定对[id=${ id }]进行[强制退出]操作?`, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
logoutApi({ adminerId: id }).then(r => {
if (r) {
ElMessage({
message: '操作成功!',
type: 'success'
})
getList()
}
})
}).catch(() => {
// to do something on canceled
})
}
const changeHandle = _val => {
refContainerSidebar.value.setScrollTop()
getList()
}
onBeforeMount(() => {
getList()
})
</script>

<template>
<ContainerSidebar ref="refContainerSidebar" :scroll="false">
<template #sidebar>
<TenantSidebar v-model="form.tenantId" @change="changeHandle" />
</template>
<template #default>
<el-table
ref="refTable"
v-loading="loading"
:data="list"
border>
<el-table-column
align="center"
label="ID"
prop="id"
width="80"
show-overflow-tooltip /><el-table-column
align="center"
label="头像"
prop="avatar"
width="80">
<template v-slot="{row}">
<el-image
v-if="row.avatar"
class="height-50 width-50"
fit="cover"
:src="row.avatar"
preview-teleported
:preview-src-list="[row.avatar]" />
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column
align="center"
label="用户名"
prop="username"
show-overflow-tooltip />
<el-table-column
align="center"
label="昵称"
prop="nickname"
show-overflow-tooltip>
<template v-slot="{row}">
{{ row.nickname || '-' }}
</template>
</el-table-column>
<el-table-column
align="center"
label="性别"
prop="sex"
width="80">
<template v-slot="{ row }">
<el-tag :type="row.sex_type">{{ row.sex_dict }}</el-tag>
</template>
</el-table-column>
<el-table-column
align="center"
label="手机号"
prop="mobile"
width="120">
<template v-slot="{row}">
{{ row.mobile || '-' }}
</template>
</el-table-column>
<el-table-column
align="center"
label="邮箱"
prop="email"
show-overflow-tooltip>
<template v-slot="{row}">
{{ row.email || '-' }}
</template>
</el-table-column>
<el-table-column
align="center"
label="部门"
prop="deptName"
show-overflow-tooltip>
<template v-slot="{row}">
{{ row.deptName || '-' }}
</template>
</el-table-column>
<el-table-column
align="center"
label="是否是租户"
prop="isTenant"
width="100">
<template v-slot="{row}">
<el-tag type="success" v-if="row.isTenant">是</el-tag>
<el-tag v-else>否</el-tag>
</template>
</el-table-column>
<el-table-column
align="center"
label="所属租户"
prop="tenant"
show-overflow-tooltip>
<template v-slot="{row}">
{{ row.tenant ? row.tenant.name || '-' : '-' }}
</template>
</el-table-column>
<el-table-column
align="center"
label="登录时间"
prop="loginAt"
width="160" />
<el-table-column
align="center"
label="操作"
width="80"
fixed="right"
v-permission="'online:logout'">
<template v-slot="{ row }">
<el-button
v-permission="'online:logout'"
type="danger"
link
@click="logoutHandle(row.id)">强制退出</el-button>
</template>
</el-table-column>
</el-table>
</template>
<template #footer>
<Page
v-model:current="page.current"
v-model:size="page.size"
:total="page.total"
@change="getList" />
</template>
</ContainerSidebar>
</template>
1 change: 1 addition & 0 deletions src/views/modules/infrastructure/region/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ onBeforeMount(() => {
prop="updatedAt"
width="160" />
<el-table-column
v-permission="'region:update|region:delete'"
align="center"
label="操作"
width="110"
Expand Down
Loading

0 comments on commit 221772a

Please sign in to comment.