导出添加等待效果

This commit is contained in:
wangchengming 2025-11-18 19:59:33 +08:00
parent fb98fffca3
commit 5a04faae5f
3 changed files with 25 additions and 15 deletions

View File

@ -74,6 +74,7 @@
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { mediaExcelBaseField, mediaExcelPriceField, exportMediaExcel } from "@/api/mediaLibrary" import { mediaExcelBaseField, mediaExcelPriceField, exportMediaExcel } from "@/api/mediaLibrary"
const { proxy } = getCurrentInstance()
const activeIndex = ref(0) const activeIndex = ref(0)
const ToolOptions = ref(['优势报价', '门禁', '候车厅', '道闸', '地铁', '高铁', '写字楼', '车库灯箱']) const ToolOptions = ref(['优势报价', '门禁', '候车厅', '道闸', '地铁', '高铁', '写字楼', '车库灯箱'])
const exportTitle = ref('导出') const exportTitle = ref('导出')
@ -1359,17 +1360,17 @@ const handleCheckedBaseFieldChange = (value) => {
baseFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < baseFields.value.length baseFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < baseFields.value.length
} }
// //
const handleCheckAllPriceFieldChange = (val) => { const handleCheckAllPriceFieldChange = (val) => {
checkedPriceFields.value = [] checkedPriceFields.value = []
if (val) { if (val) {
priceFields.value.forEach(element => { priceFields.value.forEach(element => {
checkedPriceFields.value.push(element.propertyPath) checkedPriceFields.value.push(element.propertyPath)
}); });
if (ToolOptions.value.length == 8) { if (ToolOptions.value.length == 8) {
// //
let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == activeIndex.value); let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == activeIndex.value);
if (curPriceFields.length > 0) { if (curPriceFields.length > 0) {
curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使 curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使
} }
} }
@ -1380,13 +1381,13 @@ const handleCheckAllPriceFieldChange = (val) => {
curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使 curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使
} }
} }
if (ToolOptions.value.length == 0) { if (ToolOptions.value.length == 0) {
// //
let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == 0); let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == 0);
if (curPriceFields.length > 0) { if (curPriceFields.length > 0) {
curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使 curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使
} }
} }
} else { } else {
if (ToolOptions.value.length == 8) { if (ToolOptions.value.length == 8) {
// //
@ -1407,14 +1408,14 @@ const handleCheckAllPriceFieldChange = (val) => {
if (curPriceFields.length > 0) { if (curPriceFields.length > 0) {
curPriceFields[0].exportPriceFields = [] curPriceFields[0].exportPriceFields = []
} }
} }
} }
priceFieldIsIndeterminate.value = false priceFieldIsIndeterminate.value = false
// //
checkPriceFieldSelectStatus() checkPriceFieldSelectStatus()
} }
// //
const handleCheckedPriceFieldChange = (value) => { const handleCheckedPriceFieldChange = (value) => {
const checkedCount = value.length const checkedCount = value.length
priceFieldCheckAll.value = checkedCount === priceFields.value.length priceFieldCheckAll.value = checkedCount === priceFields.value.length
priceFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < priceFields.value.length priceFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < priceFields.value.length
@ -1457,7 +1458,11 @@ const handleClick = (tab, event) => {
const handleSubmitExport = () => { const handleSubmitExport = () => {
exportForm.value.exportBaseFields = checkedBaseFields exportForm.value.exportBaseFields = checkedBaseFields
exportForm.value.mediaTypeExport = exportForm.value.mediaTypeExport.filter(item => item.exportPriceFields.length > 0) exportForm.value.mediaTypeExport = exportForm.value.mediaTypeExport.filter(item => item.exportPriceFields.length > 0)
exportMediaExcel(exportForm.value).then(res => {
proxy.$modal.loading(`正在执行导出,请耐心等待...`)
exportMediaExcel(exportForm.value).then(res => {
proxy.$modal.closeLoading()
const downLoadName = '媒体信息_' + getCurrentTime() + '.xlsx' const downLoadName = '媒体信息_' + getCurrentTime() + '.xlsx'
// a // a
const a = document.createElement('a') const a = document.createElement('a')
@ -1524,9 +1529,9 @@ const handleCheckPriceField = (_mediaType) => {
// //
const currentMediaTypeExport = [...exportForm.value.mediaTypeExport]; // const currentMediaTypeExport = [...exportForm.value.mediaTypeExport]; //
// //
const filteredFields = currentMediaTypeExport.filter(item => item.type !== _mediaType); const filteredFields = currentMediaTypeExport.filter(item => item.type !== _mediaType);
// //
const _mediaTypeArr = currentMediaTypeExport.filter(item => item.type == _mediaType); const _mediaTypeArr = currentMediaTypeExport.filter(item => item.type == _mediaType);
// //
if (_mediaTypeArr.length == 0) { if (_mediaTypeArr.length == 0) {
filteredFields.push({ type: _mediaType, exportPriceFields: [] }); // 使 push filteredFields.push({ type: _mediaType, exportPriceFields: [] }); // 使 push
@ -1553,7 +1558,7 @@ const handleChangeType = (_type) => {
if (curPriceFields.length > 0) { if (curPriceFields.length > 0) {
currentCheckedFields = [...curPriceFields[0].exportPriceFields] currentCheckedFields = [...curPriceFields[0].exportPriceFields]
} }
} }
if (ToolOptions.value.length == 8) { if (ToolOptions.value.length == 8) {
switch (_type) { switch (_type) {
@ -1623,7 +1628,7 @@ const handleChangeType = (_type) => {
checkedPriceFields.value = currentCheckedFields checkedPriceFields.value = currentCheckedFields
break; break;
} }
let wlType = _type + 1 let wlType = _type + 1
handleCheckPriceField(wlType) handleCheckPriceField(wlType)
} }

View File

@ -40,6 +40,7 @@
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { mediaPPTField, exportMediaPPT } from "@/api/mediaLibrary" import { mediaPPTField, exportMediaPPT } from "@/api/mediaLibrary"
const { proxy } = getCurrentInstance()
const exportTitle = ref('导出PPT') const exportTitle = ref('导出PPT')
const exportOpen = ref(false) const exportOpen = ref(false)
// //
@ -154,7 +155,7 @@ const pptFields = ref([
{ {
displayName: "作废原因", displayName: "作废原因",
propertyPath: "invalidReason" propertyPath: "invalidReason"
} }
]) ])
@ -190,7 +191,10 @@ const handleCheckedPPTFieldChange = (value) => {
// ppt // ppt
const handleSubmitExportPPT = () => { const handleSubmitExportPPT = () => {
exportForm.value.exportFields = checkedPPTFields exportForm.value.exportFields = checkedPPTFields
proxy.$modal.loading(`正在执行导出,请耐心等待...`)
exportMediaPPT(exportForm.value).then(res => { exportMediaPPT(exportForm.value).then(res => {
proxy.$modal.closeLoading()
const downLoadName = '媒体信息_' + getCurrentTime() + '.pptx' const downLoadName = '媒体信息_' + getCurrentTime() + '.pptx'
// a // a
const a = document.createElement('a') const a = document.createElement('a')

View File

@ -1032,7 +1032,8 @@ const getSupplierInfo = () => {
const getMediaInfo = () => { const getMediaInfo = () => {
mediaDetail({ mediaId: ruleForm.value.id }).then(res => { mediaDetail({ mediaId: ruleForm.value.id }).then(res => {
ruleForm.value = res.data ruleForm.value = res.data
mediaFile.value = ruleForm.value.mediaFile mediaFile.value = res.data.mediaFile
mediaPrice.value = res.data.mediaPrices
ruleForm.value.mediaCity = ruleForm.value.provinceName + '/' + ruleForm.value.cityName + '/' + ruleForm.value.areaName + '/' + ruleForm.value.townName ruleForm.value.mediaCity = ruleForm.value.provinceName + '/' + ruleForm.value.cityName + '/' + ruleForm.value.areaName + '/' + ruleForm.value.townName
if (ruleForm.value.mapY && ruleForm.value.mapX) latVal.value = ruleForm.value.mapY + ',' + ruleForm.value.mapX if (ruleForm.value.mapY && ruleForm.value.mapX) latVal.value = ruleForm.value.mapY + ',' + ruleForm.value.mapX
if (ruleForm.value.belongSupplierId) getSupplierInfo() if (ruleForm.value.belongSupplierId) getSupplierInfo()