This commit is contained in:
shizhong 2023-06-13 14:14:42 +08:00
parent 4cd4327bc8
commit 61396246a5

View File

@ -51,11 +51,21 @@
<Icon class="mr-5px" icon="ep:refresh" /> <Icon class="mr-5px" icon="ep:refresh" />
重置 重置
</el-button> </el-button>
<el-button v-hasPermi="['product:brand:create']" plain type="primary" @click="openForm"> <el-button v-hasPermi="['product:spu:create']" plain type="primary" @click="openForm">
<Icon class="mr-5px" icon="ep:plus" /> <Icon class="mr-5px" icon="ep:plus" />
新增 新增
</el-button> </el-button>
<!-- TODO @puhui999增加一个导出操作 --> <!-- TODO @puhui999增加一个导出操作 -->
<el-button
v-hasPermi="['product:spu: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>
@ -195,15 +205,17 @@ import { createImageViewer } from '@/components/ImageViewer'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import { ProductSpuStatusEnum } from '@/utils/constants' import { ProductSpuStatusEnum } from '@/utils/constants'
import { formatToFraction } from '@/utils'
import download from '@/utils/download'
import * as ProductSpuApi from '@/api/mall/product/spu' import * as ProductSpuApi from '@/api/mall/product/spu'
import * as ProductCategoryApi from '@/api/mall/product/category' import * as ProductCategoryApi from '@/api/mall/product/category'
import { formatToFraction } from '@/utils'
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const { currentRoute, push } = useRouter() // const { currentRoute, push } = useRouter() //
const loading = ref(false) // const loading = ref(false) //
const exportLoading = ref(false) //
const total = ref(0) // const total = ref(0) //
const list = ref<any[]>([]) // const list = ref<any[]>([]) //
// tabs // tabs
@ -365,7 +377,22 @@ const openDetail = () => {
message.alert('查看详情未完善!!!') message.alert('查看详情未完善!!!')
} }
// /** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ProductSpuApi.exportSpu(queryParams)
download.excel(data, '商品spu.xls')
} catch {
} finally {
exportLoading.value = false
}
}
// TODO @puhui999fix:
watch( watch(
() => currentRoute.value, () => currentRoute.value,
() => { () => {