Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangshenghang committed Jan 12, 2025
1 parent f07fe97 commit 6664aa9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions seatunnel-ui/src/views/user-manage/list/use-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@

import { reactive, ref, h } from 'vue'
import { useI18n } from 'vue-i18n'
import { NSpace, NButton } from 'naive-ui'
import { NSpace, NButton, NTooltip } from 'naive-ui'
import { userList, userDelete, userEnable, userDisable } from '@/service/user'
import { getTableColumn } from '@/common/table'
import type { ResponseTable } from '@/service/types'
import type { UserDetail } from '@/service/user/types'
import { useUserStore } from '@/store/user'

export function useTable() {
const { t } = useI18n()
const userStore = useUserStore()
const state = reactive({
columns: [],
tableData: [],
Expand Down Expand Up @@ -56,8 +58,11 @@ export function useTable() {
{
title: t('user_manage.operation'),
key: 'operation',
render: (row: UserDetail) =>
h(NSpace, null, {
render: (row: UserDetail) => {
const currentUser = userStore.getUserInfo as UserDetail
const isCurrentUser = Boolean(currentUser?.id && row?.id && currentUser.id === row.id)

return h(NSpace, null, {
default: () => [
h(
NButton,
Expand All @@ -76,11 +81,18 @@ export function useTable() {
),
h(
NButton,
{ text: true, onClick: () => handleDelete(row) },
{ default: () => t('user_manage.delete') }
{
text: true,
disabled: isCurrentUser,
onClick: () => handleDelete(row)
},
{
default: () => t('user_manage.delete')
}
)
]
})
}
}
]
}
Expand Down

0 comments on commit 6664aa9

Please sign in to comment.