refactor: 优化系统日志、在线用户、存储管理、部门管理相关代码

This commit is contained in:
2024-04-22 23:13:35 +08:00
parent 2ddd900121
commit 2987d3eb4d
12 changed files with 57 additions and 51 deletions

View File

@@ -84,10 +84,10 @@ import DeptAddModal from './DeptAddModal.vue'
import { Message } from '@arco-design/web-vue'
import type GiTable from '@/components/GiTable/index.vue'
import type { TableInstanceColumns } from '@/components/GiTable/type'
import { DisEnableStatusList } from '@/constant/common'
import { useDownload } from '@/hooks'
import { isMobile } from '@/utils'
import has from '@/utils/has'
import { DisEnableStatusList } from '@/constant/common'
defineOptions({ name: 'SystemDept' })

View File

@@ -4,7 +4,7 @@
:title="title"
:mask-closable="false"
:esc-to-close="false"
:width="width >= 580 ? 580 : '100%'"
:width="width >= 600 ? 600 : '100%'"
@before-ok="save"
@close="reset"
>

View File

@@ -1,5 +1,5 @@
<template>
<a-drawer v-model:visible="visible" title="角色详情" :width="width >= 580 ? 580 : '100%'" :footer="false">
<a-drawer v-model:visible="visible" title="角色详情" :width="width >= 600 ? 600 : '100%'" :footer="false">
<a-descriptions title="基础信息" :column="2" size="large" class="general-description">
<a-descriptions-item label="ID" :span="2">{{ dataDetail?.id }}</a-descriptions-item>
<a-descriptions-item label="名称">{{ dataDetail?.name }}</a-descriptions-item>

View File

@@ -4,7 +4,7 @@
:title="title"
:mask-closable="false"
:esc-to-close="false"
:width="width >= 580 ? 580 : '100%'"
:width="width >= 600 ? 600 : '100%'"
@before-ok="save"
@close="reset"
>

View File

@@ -51,7 +51,7 @@
<a-link
v-permission="['system:storage:delete']"
status="danger"
:title="record.isDefault ? '默认存储不能删除' : undefined"
:title="record.isDefault ? '默认存储不能删除' : undefined"
:disabled="record.disabled"
@click="onDelete(record)"
>
@@ -104,9 +104,9 @@ const columns: TableInstanceColumns[] = [
title: '操作',
slotName: 'action',
width: 130,
show: has.hasPermOr(['system:storage:update', 'system:storage:delete']),
align: 'center',
fixed: !isMobile() ? 'right' : undefined
fixed: !isMobile() ? 'right' : undefined,
show: has.hasPermOr(['system:storage:update', 'system:storage:delete'])
}
]

View File

@@ -4,7 +4,7 @@
:title="title"
:mask-closable="false"
:esc-to-close="false"
:width="width >= 580 ? 580 : '100%'"
:width="width >= 600 ? 600 : '100%'"
@before-ok="save"
@close="reset"
>
@@ -160,6 +160,7 @@ const onUpdate = async (id: string) => {
// 保存
const save = async () => {
const rawPassword = form.password
try {
const isInvalid = await formRef.value?.validate()
if (isInvalid) return false
@@ -167,19 +168,16 @@ const save = async () => {
await updateUser(form, dataId.value)
Message.success('修改成功')
} else {
const rawPassword = form.password
if (rawPassword) {
form.password = encryptByRsa(rawPassword) || ''
}
await addUser(form).catch(() => {
form.password = rawPassword
return false
})
await addUser(form)
Message.success('新增成功')
}
emit('save-success')
return true
} catch (error) {
form.password = rawPassword
return false
}
}

View File

@@ -1,5 +1,5 @@
<template>
<a-drawer v-model:visible="visible" title="用户详情" :width="width >= 580 ? 580 : '100%'" :footer="false">
<a-drawer v-model:visible="visible" title="用户详情" :width="width >= 600 ? 600 : '100%'" :footer="false">
<a-descriptions :column="2" size="large" class="general-description">
<a-descriptions-item label="ID" :span="2">{{ dataDetail?.id }}</a-descriptions-item>
<a-descriptions-item label="用户名">{{ dataDetail?.username }}</a-descriptions-item>