完成户外媒体对接

This commit is contained in:
wangchengming 2025-09-15 12:20:25 +08:00
parent 7f24e4bb91
commit 950068dd7e
4 changed files with 83 additions and 8 deletions

View File

@ -62,6 +62,8 @@ const checkedPPTFields = ref([])
const handleCloseTag = (tag) => {
const rowIndex = chosedMediaList.value.findIndex(item => item.id == tag.id)
chosedMediaList.value.splice(rowIndex, 1)
// id
exportForm.value.mediaIds = chosedMediaList.value.map(item => item.id);
}
// PPT

View File

@ -2,7 +2,8 @@
<!-- 导出对话框 -->
<el-dialog :title="title" v-model="open" width="688px" class="my_dialog" align-center :destroy-on-close="true"
:close-on-click-modal="false">
<el-form ref="detailFormRef" :model="detailForm" label-width="100px" class="mySmailDetailForm">
<el-form ref="detailFormRef" :model="detailForm" label-width="100px" class="mySmailDetailForm"
v-loading="loading">
<el-row :gutter="20" class="my_form_row">
<el-col :span="6" v-for="itemFile in fileList">
<img :src="baseUrl + itemFile.fileName" fit="fill"
@ -78,14 +79,17 @@ const title = ref('户外媒介数据详情')
const open = ref(false)
const detailForm = ref({})
const fileList = ref([])
const loading = ref(false)
const getMediaDetail = (_mediaId) => {
loading.value = true
mediaDetail({ mediaId: _mediaId }).then(res => {
detailForm.value = res.data
if (detailForm.value.mediaFile && detailForm.value.mediaFile.length > 0) {
fileList.value = detailForm.value.mediaFile.filter(item => item.fileType == 6)
console.log('图片', fileList.value)
}
loading.value = false
})
}

View File

@ -99,7 +99,7 @@
<el-col :span="16" style="text-align: right;">
<el-button type="primary" class="primaryBtn" @click="handleQuery">查询</el-button>
<el-button type="primary" class="primaryBtn" @click="resetQuery">重置</el-button>
<el-button type="primary" class="primaryBtn">PPT批量导出</el-button>
<el-button type="primary" class="primaryBtn" @click="handleExportMore">PPT批量导出</el-button>
<el-button type="primary" class="primaryBtn" @click="handleClearChoseMedia">清空所选媒体</el-button>
</el-col>
</el-row>
@ -125,7 +125,7 @@
<div class="popBtns" @click="handleViewMedia(scope.row.id)"
v-hasPermi="['problemFeedback:edit']">查看
</div>
<div class="popBtns" @click="handleDownFiles(scope.row)"
<div class="popBtns" @click="handleDownPPT(scope.row)"
v-hasPermi="['problemFeedback:edit']">下载PPT</div>
<template #reference>
<img style="cursor: pointer;" :src="scope.row.currentImageSrc"
@ -156,6 +156,8 @@ import { sysRegionListByPid } from "@/api/system/administrativeRegion"
import { sysMediaTypeListByPid } from "@/api/system/mediaType"
import { busTradingAreaPage } from "@/api/system/businessArea"
import { outMediaPageList } from "@/api/mediaLibrary"
import { pptTemplatePage } from "@/api/system/pptTemplate"
import { exportMediaPPT } from "@/api/mediaLibrary"
import AMapLoader from "@amap/amap-jsapi-loader"; //
import optionIcon from '@/assets/images/optionIcon.png'
import optionIconHover from '@/assets/images/optionIconHover.png'
@ -217,6 +219,71 @@ const isFullscreen = ref(false)
//
const points = ref([])
//
const exportForm = ref({
mediaIds: undefined,
templateId: undefined,
exportFields: [
'mediaName',
'address',
'mediaSize',
'mediaOrientation',
'businessDistrictName',
'dailyAvgVehicleFlow',
'advantages'
]
})
// PPTID
const getpptTemplatePageList = () => {
pptTemplatePage(queryParams.value).then(res => {
const pptTemplate = res.data.list.filter(item => item.type == 3)
if (pptTemplate.length == 1) exportForm.value.templateId = pptTemplate[0].id
})
}
// ppt
const handleDownPPT = (row) => {
exportForm.value.mediaIds = [row.id]
handleSubmitExportPPT()
}
// PPT
const handleExportMore = () => {
if (multipleChoseArr.value.length == 0) {
proxy.$modal.msgWarning("请选择要导出的媒体!!!")
return false
}
exportForm.value.mediaIds = multipleChoseArr.value.map(item => item.id);
handleSubmitExportPPT()
}
// ppt
const handleSubmitExportPPT = () => {
exportMediaPPT(exportForm.value).then(res => {
const downLoadName = '媒体信息_' + getCurrentTime() + '.pptx'
// a
const a = document.createElement('a')
a.href = URL.createObjectURL(res)
// adownload
a.setAttribute('download', downLoadName)
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
})
}
const getCurrentTime = () => {
//
var getTime = new Date().getTime(); //
var time = new Date(getTime); //
var year = time.getFullYear(); //
var month = (time.getMonth() + 1).toString().padStart(2, '0'); //
var date = time.getDate().toString().padStart(2, '0'); //
var hour = time.getHours().toString().padStart(2, '0'); //
var minute = time.getMinutes().toString().padStart(2, '0'); //
var second = time.getSeconds().toString().padStart(2, '0'); //
var gettime = year + month + date + hour + minute + second
return gettime
}
//
const getMediaTypeOne = () => {
sysMediaTypeListByPid({ parentId: 0 }).then(res => {
@ -607,6 +674,8 @@ onUnmounted(() => {
//
onMounted(() => {
bgStore.setBgImage(otherbg)
// id
getpptTemplatePageList()
getOutMediaPageList()
getMediaTypeOne()
getProvinceList()