Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
owen 2023-10-16 13:01:02 +08:00
commit 8dec8edc6a
5 changed files with 10 additions and 117 deletions

View File

@ -40,8 +40,3 @@ export const updateArticle = async (data: ArticleVO) => {
export const deleteArticle = async (id: number) => { export const deleteArticle = async (id: number) => {
return await request.delete({ url: `/promotion/article/delete?id=` + id }) return await request.delete({ url: `/promotion/article/delete?id=` + id })
} }
// 导出文章管理 Excel
export const exportArticle = async (params) => {
return await request.download({ url: `/promotion/article/export-excel`, params })
}

View File

@ -37,8 +37,3 @@ export const updateArticleCategory = async (data: ArticleCategoryVO) => {
export const deleteArticleCategory = async (id: number) => { export const deleteArticleCategory = async (id: number) => {
return await request.delete({ url: `/promotion/article-category/delete?id=` + id }) return await request.delete({ url: `/promotion/article-category/delete?id=` + id })
} }
// 导出文章分类 Excel
export const exportArticleCategory = async (params) => {
return await request.download({ url: `/promotion/article-category/export-excel`, params })
}

View File

@ -37,6 +37,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import * as ArticleCategoryApi from '@/api/mall/promotion/articleCategory' import * as ArticleCategoryApi from '@/api/mall/promotion/articleCategory'
import { CommonStatusEnum } from '@/utils/constants'
defineOptions({ name: 'PromotionArticleCategoryForm' }) defineOptions({ name: 'PromotionArticleCategoryForm' })
@ -111,8 +112,8 @@ const resetForm = () => {
id: undefined, id: undefined,
name: undefined, name: undefined,
picUrl: undefined, picUrl: undefined,
status: undefined, status: CommonStatusEnum.ENABLE,
sort: undefined sort: 0
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

@ -56,16 +56,6 @@
<Icon class="mr-5px" icon="ep:plus" /> <Icon class="mr-5px" icon="ep:plus" />
新增 新增
</el-button> </el-button>
<el-button
v-hasPermi="['promotion:article-category:export']"
:loading="exportLoading"
plain
type="success"
@click="handleExport"
>
<Icon class="mr-5px" icon="ep:download" />
导出
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -73,19 +63,19 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true"> <el-table v-loading="loading" :data="list" :show-overflow-tooltip="true" :stripe="true">
<el-table-column align="center" label="编号" prop="id" /> <el-table-column align="center" label="编号" prop="id" min-width="100" />
<el-table-column align="center" label="分类名称" prop="name" /> <el-table-column align="center" label="分类名称" prop="name" min-width="240" />
<el-table-column label="分类图图" min-width="80"> <el-table-column label="分类图图" min-width="80">
<template #default="{ row }"> <template #default="{ row }">
<el-image :src="row.picUrl" class="h-30px w-30px" @click="imagePreview(row.picUrl)" /> <el-image :src="row.picUrl" class="h-30px w-30px" @click="imagePreview(row.picUrl)" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" prop="status"> <el-table-column align="center" label="状态" prop="status" min-width="150">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="排序" prop="sort" /> <el-table-column align="center" label="排序" prop="sort" min-width="150" />
<el-table-column <el-table-column
:formatter="dateFormatter" :formatter="dateFormatter"
align="center" align="center"
@ -130,7 +120,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ArticleCategoryApi from '@/api/mall/promotion/articleCategory' import * as ArticleCategoryApi from '@/api/mall/promotion/articleCategory'
import ArticleCategoryForm from './ArticleCategoryForm.vue' import ArticleCategoryForm from './ArticleCategoryForm.vue'
import { createImageViewer } from '@/components/ImageViewer' import { createImageViewer } from '@/components/ImageViewer'
@ -203,21 +192,6 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ArticleCategoryApi.exportArticleCategory(queryParams)
download.excel(data, '分类.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()

View File

@ -32,15 +32,6 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="文章作者" prop="author">
<el-input
v-model="queryParams.author"
class="!w-240px"
clearable
placeholder="请输入文章作者"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" class="!w-240px" clearable placeholder="请选择状态"> <el-select v-model="queryParams.status" class="!w-240px" clearable placeholder="请选择状态">
<el-option <el-option
@ -51,41 +42,6 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关联商品" prop="spuId">
<el-select
v-model="queryParams.spuId"
class="!w-240px"
placeholder="全部"
@keyup.enter="handleQuery"
>
<el-option v-for="item in spuList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="热门" prop="recommendHot">
<el-select v-model="queryParams.recommendHot" class="!w-240px" clearable placeholder="全部">
<el-option
v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="轮播图" prop="recommendBanner">
<el-select
v-model="queryParams.recommendBanner"
class="!w-240px"
clearable
placeholder="全部"
>
<el-option
v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="创建时间" prop="createTime">
<el-date-picker <el-date-picker
v-model="queryParams.createTime" v-model="queryParams.createTime"
@ -115,16 +71,6 @@
<Icon class="mr-5px" icon="ep:plus" /> <Icon class="mr-5px" icon="ep:plus" />
新增 新增
</el-button> </el-button>
<el-button
v-hasPermi="['promotion:article:export']"
:loading="exportLoading"
plain
type="success"
@click="handleExport"
>
<Icon class="mr-5px" icon="ep:download" />
导出
</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -215,9 +161,8 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { DICT_TYPE, getBoolDictOptions, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import * as ArticleApi from '@/api/mall/promotion/article' import * as ArticleApi from '@/api/mall/promotion/article'
import ArticleForm from './ArticleForm.vue' import ArticleForm from './ArticleForm.vue'
import * as ArticleCategoryApi from '@/api/mall/promotion/articleCategory' import * as ArticleCategoryApi from '@/api/mall/promotion/articleCategory'
@ -236,12 +181,9 @@ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
categoryId: undefined, categoryId: undefined,
spuId: undefined,
title: null, title: null,
author: null,
status: undefined, status: undefined,
recommendHot: undefined, spuId: undefined,
recommendBanner: undefined,
createTime: [] createTime: []
}) })
const queryFormRef = ref() // const queryFormRef = ref() //
@ -295,25 +237,11 @@ const handleDelete = async (id: number) => {
} catch {} } catch {}
} }
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ArticleApi.exportArticle(queryParams)
download.excel(data, '文章管理.xls')
} catch {
} finally {
exportLoading.value = false
}
}
const categoryList = ref<ArticleCategoryApi.ArticleCategoryVO[]>([]) const categoryList = ref<ArticleCategoryApi.ArticleCategoryVO[]>([])
const spuList = ref<ProductSpuApi.Spu[]>([]) const spuList = ref<ProductSpuApi.Spu[]>([])
onMounted(async () => { onMounted(async () => {
await getList() await getList()
//
categoryList.value = categoryList.value =
(await ArticleCategoryApi.getSimpleArticleCategoryList()) as ArticleCategoryApi.ArticleCategoryVO[] (await ArticleCategoryApi.getSimpleArticleCategoryList()) as ArticleCategoryApi.ArticleCategoryVO[]
spuList.value = (await ProductSpuApi.getSpuSimpleList()) as ProductSpuApi.Spu[] spuList.value = (await ProductSpuApi.getSpuSimpleList()) as ProductSpuApi.Spu[]