|
|
@ -15,7 +15,7 @@ |
|
|
|
* limitations under the License. |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
import { ref, watch, onBeforeMount } from 'vue' |
|
|
|
import { ref, watch, onBeforeMount, computed } from 'vue' |
|
|
|
import { NSpace, NTooltip, NButton, NIcon, NTag } from 'naive-ui' |
|
|
|
import { NSpace, NTooltip, NButton, NIcon, NTag } from 'naive-ui' |
|
|
|
import { EditOutlined, DeleteOutlined } from '@vicons/antd' |
|
|
|
import { EditOutlined, DeleteOutlined } from '@vicons/antd' |
|
|
|
import { queryUserList } from '@/service/modules/users' |
|
|
|
import { queryUserList } from '@/service/modules/users' |
|
|
@ -28,7 +28,8 @@ type UseTableProps = { |
|
|
|
|
|
|
|
|
|
|
|
function useColumns({ onEdit, onDelete }: UseTableProps) { |
|
|
|
function useColumns({ onEdit, onDelete }: UseTableProps) { |
|
|
|
const { t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
|
const columns: any[] = [ |
|
|
|
const columns = computed(() => |
|
|
|
|
|
|
|
[ |
|
|
|
{ |
|
|
|
{ |
|
|
|
title: t('security.user.index'), |
|
|
|
title: t('security.user.index'), |
|
|
|
key: 'index', |
|
|
|
key: 'index', |
|
|
@ -60,9 +61,9 @@ function useColumns({ onEdit, onDelete }: UseTableProps) { |
|
|
|
key: 'state', |
|
|
|
key: 'state', |
|
|
|
render: (rowData: any, rowIndex: number) => { |
|
|
|
render: (rowData: any, rowIndex: number) => { |
|
|
|
return rowData.state === 1 ? ( |
|
|
|
return rowData.state === 1 ? ( |
|
|
|
<NTag type='success'>启用</NTag> |
|
|
|
<NTag type='success'>{t('security.user.state_enabled')}</NTag> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<NTag type='error'>停用</NTag> |
|
|
|
<NTag type='error'>{t('security.user.state_disabled')}</NTag> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -135,8 +136,9 @@ function useColumns({ onEdit, onDelete }: UseTableProps) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
].map((d: any) => ({ ...d, width: d.width || 160 })) |
|
|
|
].map((d: any) => ({ ...d, width: d.width || 160 })) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const scrollX = columns.reduce((p, c) => p + c.width, 0) |
|
|
|
const scrollX = columns.value.reduce((p, c) => p + c.width, 0) |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
columns, |
|
|
|
columns, |
|
|
|