123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <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"
- :expand="true"
- :loading="tableObject.loading"
- :pagination="{
- total: tableObject.total
- }"
- @expand-change="expandChange"
- >
- <template #expand> 展示活动商品和商品相关属性活动配置</template>
- <template #configIds="{ row }">
- <el-tag v-for="(name, index) in convertSeckillConfigNames(row)" :key="index" class="mr-5px">
- {{ name }}
- </el-tag>
- </template>
- <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" setup>
- import { allSchemas } from './seckillActivity.data'
- import { getListAllSimple } from '@/api/mall/promotion/seckill/seckillConfig'
- import * as SeckillActivityApi from '@/api/mall/promotion/seckill/seckillActivity'
- import SeckillActivityForm from './SeckillActivityForm.vue'
- import { cloneDeep } from 'lodash-es'
- defineOptions({ name: 'PromotionSeckillActivity' })
- 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)
- }
- const configList = ref([])
- const convertSeckillConfigNames = computed(
- () => (row) =>
- configList.value
- ?.filter((item) => row.configIds.includes(item.id))
- ?.map((config) => config.name)
- )
- const expandChange = (row, expandedRows) => {
-
- console.log(row, expandedRows)
- }
- onMounted(async () => {
-
- const index = allSchemas.tableColumns.findIndex((item) => item.field === 'spuId')
- const column = cloneDeep(allSchemas.tableColumns[index])
- allSchemas.tableColumns.splice(index, 1)
-
- allSchemas.tableColumns.unshift(column)
- await getList()
- configList.value = await getListAllSimple()
- })
- </script>
|