Files
boursecu_admin/src/pages/menuPages/users/components/table.vue
T

89 lines
2.9 KiB
Vue
Raw Normal View History

2026-01-24 17:45:54 +03:30
<template>
2026-05-31 11:51:52 +03:30
<div class="h-full min-h-0 min-w-0 max-w-full overflow-hidden">
2026-01-24 17:45:54 +03:30
<BasicShowContext title="لیست مدیران">
2026-05-31 11:51:52 +03:30
<template #extra>
2026-06-14 21:04:26 +03:30
<BaseButton
v-if="isMobile"
type="primary"
size="small"
icon="vuesax-linear:user-add"
@click="emits('add')"
>
افزودن مدیر
2026-05-31 11:51:52 +03:30
</BaseButton>
</template>
<div class="flex h-full min-h-0 flex-col">
<BaseTable v-if="!isMobile" class="h-full min-h-0 min-w-0" v-bind="tblProps" @register="submit" ref="tbl">
2026-01-24 17:45:54 +03:30
<template #extraHeader>
2026-06-14 21:04:26 +03:30
<BaseButton type="primary" size="small" icon="vuesax-linear:user-add" @click="emits('add')">
افزودن مدیر
2026-01-24 17:45:54 +03:30
</BaseButton>
</template>
<template #action="{ column, record }">
<div class="gap-2 flex justify-center">
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('info', record)">
<template #title>
<span>مشخصات</span>
</template>
<Icon icon="vuesax-linear:stickynote" color="#10913A" />
</a-tooltip>
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('edit', record)">
<template #title>
<span>ویرایش</span>
</template>
<Icon icon="vuesax-linear:edit" color="#4572E9" />
</a-tooltip>
2026-05-13 13:31:18 +03:30
<a-tooltip placement="bottom" class="cursor-pointer" @click="emits('delete', record.id)">
2026-01-24 17:45:54 +03:30
<template #title>
2026-05-13 13:31:18 +03:30
<span>حذف مدیر</span>
2026-01-24 17:45:54 +03:30
</template>
2026-05-13 13:31:18 +03:30
<Icon icon="vuesax-linear:user-remove" color="#EB3535" />
</a-tooltip>
2026-01-24 17:45:54 +03:30
</div>
</template>
</BaseTable>
2026-05-31 11:51:52 +03:30
<ManagerMobileCardList
v-else
ref="mobileListRef"
class="min-h-0 flex-1"
@info="(row) => emits('info', row)"
@edit="(row) => emits('edit', row)"
@delete="(id) => emits('delete', id)"
/>
</div>
2026-01-24 17:45:54 +03:30
</BasicShowContext>
</div>
</template>
<script lang="tsx" setup>
import type { TableInput } from '@core/type/baseTable'
import useBaseTable from '@core/components/BaseTableOld/hooks/useBaseTable'
import Icon from '@core/components/BaseIcon/src/Icon.vue'
2026-05-31 11:51:52 +03:30
import { getUserTable } from '@/api/user'
2026-01-24 17:45:54 +03:30
import { cols } from '../hooks/usersColumns'
2026-05-31 11:51:52 +03:30
import ManagerMobileCardList from './ManagerMobileCardList.vue'
import { isMobile } from '@core/utils/is'
2026-01-24 17:45:54 +03:30
const [submit, reload] = useBaseTable()
2026-05-31 11:51:52 +03:30
const mobileListRef = ref<null | { fetch: () => Promise<void> }>(null)
2026-01-24 17:45:54 +03:30
const emits = defineEmits(['delete', 'edit', 'add', 'info'])
const tblProps = ref<any>({
columns: cols,
api: (params: TableInput) => {
return getUserTable(params)
}
})
2026-05-31 11:51:52 +03:30
async function fetch() {
await Promise.allSettled([reload(), mobileListRef.value?.fetch?.() as Promise<void>])
2026-01-24 17:45:54 +03:30
}
2026-05-31 11:51:52 +03:30
2026-01-24 17:45:54 +03:30
defineExpose({
fetch
})
</script>