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

82 lines
2.5 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 v-if="!mobile" #extra>
<BaseButton type="primary" size="small" class="flex shrink-0 md:hidden" @click="emits('add')">
<div>ارسال پیامک</div>
<BaseIcon icon="vuesax-linear:sms" Size="16px" />
</BaseButton>
</template>
<div class="flex h-full min-h-0 flex-col">
<BaseTable v-if="!isMobileScreen" 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>
<BaseButton v-if="!mobile" type="primary" size="small" class="flex" @click="emits('add')">
<div>ارسال پیامک</div>
2026-05-31 11:51:52 +03:30
<BaseIcon icon="vuesax-linear:sms" Size="16px" />
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>
</div>-->
</template>
</BaseTable>
2026-05-31 11:51:52 +03:30
<SmsMobileCardList v-else ref="mobileListRef" class="min-h-0 flex-1" :mobile="mobile" />
</div>
2026-01-24 17:45:54 +03:30
</BasicShowContext>
</div>
</template>
<script lang="tsx" setup>
2026-05-31 11:51:52 +03:30
import type { TableInput } from '@core/type/baseTable'
2026-01-24 17:45:54 +03:30
import useBaseTable from '@core/components/BaseTableOld/hooks/useBaseTable'
2026-05-31 11:51:52 +03:30
import { cols } from '../hooks/smsColumns'
import { getSMSTable } from '@/api/sms'
import SmsMobileCardList from './SmsMobileCardList.vue'
import { isMobile as isMobileScreen } from '@core/utils/is'
2026-01-24 17:45:54 +03:30
interface Prop {
2026-05-31 11:51:52 +03:30
mobile?: number | string
2026-01-24 17:45:54 +03:30
}
const props = defineProps<Prop>()
const emits = defineEmits(['delete', 'edit', 'add', 'info'])
2026-05-31 11:51:52 +03:30
const [submit, reload] = useBaseTable()
const mobileListRef = ref<null | { fetch: () => Promise<void> }>(null)
2026-01-24 17:45:54 +03:30
const tblProps = ref<any>({
columns: cols,
api: (params: TableInput) => {
if (props.mobile) {
params.filters = []
params.filters?.push({
2026-05-31 11:51:52 +03:30
field: 'receiver',
type: 'text',
2026-01-24 17:45:54 +03:30
value: props.mobile,
2026-05-31 11:51:52 +03:30
cr: 'and',
op: 'eq',
2026-01-24 17:45:54 +03:30
hidden: false
})
}
return getSMSTable(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>