Skip to content

Commit

Permalink
refactor(logManage): 优化日志管理批量删除时,弹出提示框确认是否删除 (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo authored Nov 26, 2024
1 parent b323488 commit 8c8d35d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions web/src/modules/base/views/log/userLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ import type { Ref } from 'vue'
import getColumns from './userLoginLogData/UserLoginLogColumn.tsx'
import getSearchItems from './userLoginLogData/UserLoginLogSearch.tsx'
import { ResultCode } from '@/utils/ResultCode.ts'
import { useMessage } from '@/hooks/useMessage.ts'

defineOptions({ name: 'log:userLogin' })

const t = useTrans().globalTrans
const proTableRef = ref<MaProTableExpose>() as Ref<MaProTableExpose>
const selections: Ref<UserLoginVo[]> = ref([])
const msg = useMessage()

async function clickDelete() {
const ids = selections.value.map((value: UserLoginVo) => {
return value.id
const ids = selections.value.map((value: UserLoginVo) => value.id)
msg.confirm(t('crud.delMessage')).then(async () => {
const res = await UserLoginLog.delete(ids)
if (res.code === ResultCode.SUCCESS) {
proTableRef.value.refresh()
}
})
const res = await UserLoginLog.delete(ids)
if (res.code === ResultCode.SUCCESS) {
proTableRef.value.refresh()
}
}

const options = ref<MaProTableOptions>({
Expand Down
14 changes: 8 additions & 6 deletions web/src/modules/base/views/log/userOperation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ import getColumns from './userOperationLogData/UserOperationLogColumn.tsx'
import type { RequestLogInfoVo } from '~/base/api/log.ts'
import { UserOperatorLog } from '~/base/api/log.ts'
import { ResultCode } from '@/utils/ResultCode.ts'
import { useMessage } from '@/hooks/useMessage.ts'

defineOptions({ name: 'log:userOperation' })

const t = useTrans().globalTrans
const proTableRef = ref<MaProTableExpose>() as Ref<MaProTableExpose>
const selections: Ref<RequestLogInfoVo[]> = ref([])
const msg = useMessage()

async function clickDelete() {
const ids = selections.value.map((value: RequestLogInfoVo) => {
return value.id
const ids = selections.value.map((value: RequestLogInfoVo) => value.id)
msg.confirm(t('crud.delMessage')).then(async () => {
const res = await UserOperatorLog.delete(ids)
if (res.code === ResultCode.SUCCESS) {
proTableRef.value.refresh()
}
})
const res = await UserOperatorLog.delete(ids)
if (res.code === ResultCode.SUCCESS) {
proTableRef.value.refresh()
}
}

const options = ref<MaProTableOptions>({
Expand Down

0 comments on commit 8c8d35d

Please sign in to comment.