1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <!-- 搜索工作栏 -->
- <ContentWrap>
- <Search :schema="allSchemas.searchSchema" @reset="setSearchParams" @search="setSearchParams">
- <!-- 新增等操作按钮 -->
- <template #actionMore>
- <el-button
- v-hasPermi="['promotion:seckill-activity:create']"
- plain
- type="primary"
- @click="openForm('create')"
- >
- <Icon class="mr-5px" icon="ep:plus" />
- 新增
- </el-button>
- </template>
- </Search>
- </ContentWrap>
- <!-- 列表 -->
- <ContentWrap>
- <Table
- v-model:currentPage="tableObject.currentPage"
- v-model:pageSize="tableObject.pageSize"
- :columns="allSchemas.tableColumns"
- :data="tableObject.tableList"
- :loading="tableObject.loading"
- :pagination="{
- total: tableObject.total
- }"
- >
- <template #action="{ row }">
- <el-button
- v-hasPermi="['promotion:seckill-activity:update']"
- link
- type="primary"
- @click="openForm('update', row.id)"
- >
- 编辑
- </el-button>
- <el-button
- v-hasPermi="['promotion:seckill-activity:delete']"
- link
- type="danger"
- @click="handleDelete(row.id)"
- >
- 删除
- </el-button>
- </template>
- </Table>
- </ContentWrap>
- <!-- 表单弹窗:添加/修改 -->
- <SeckillActivityForm ref="formRef" @success="getList" />
- </template>
- <script lang="ts" name="PromotionSeckillActivity" setup>
- import { allSchemas } from './seckillActivity.data'
- import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
- import SeckillActivityForm from './SeckillActivityForm.vue'
- // tableObject:表格的属性对象,可获得分页大小、条数等属性
- // tableMethods:表格的操作对象,可进行获得分页、删除记录等操作
- // 详细可见:https://doc.iocoder.cn/vue3/crud-schema/
- const { tableObject, tableMethods } = useTable({
- getListApi: SeckillActivityApi.getSeckillActivityPage, // 分页接口
- delListApi: SeckillActivityApi.deleteSeckillActivity // 删除接口
- })
- // 获得表格的各种操作
- const { getList, setSearchParams } = tableMethods
- /** 添加/修改操作 */
- const formRef = ref()
- const openForm = (type: string, id?: number) => {
- formRef.value.open(type, id)
- }
- /** 删除按钮操作 */
- const handleDelete = (id: number) => {
- tableMethods.delList(id, false)
- }
- /** 初始化 **/
- onMounted(() => {
- getList()
- })
- </script>
|