解决媒体库bug

This commit is contained in:
wangchengming 2025-09-26 22:22:21 +08:00
parent 6265706565
commit 3da79a6056
10 changed files with 271 additions and 52 deletions

View File

@ -89,6 +89,48 @@ export const constantRoutes = [
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: '/supplier/detailPage',
component: Layout,
hidden: true,
permissions: ['supplier:detail'],
children: [
{
path: ':supplierId(\\d+)',
component: () => import('@/views/supplier/linkSupplerDetail'),
name: 'linkSupplerDetail',
meta: { title: '供应商详情', activeMenu: '/supplier' }
}
]
},
{
path: '/supplier/formPage',
component: Layout,
hidden: true,
permissions: ['supplier:update'],
children: [
{
path: ':supplierId(\\d+)',
component: () => import('@/views/supplier/linkSupplierForm'),
name: 'linkSupplierForm',
meta: { title: '供应商表单', activeMenu: '/supplier' }
}
]
},
{
path: '/mediaLibrary/formPage',
component: Layout,
hidden: true,
permissions: ['mediaLibrary:update'],
children: [
{
path: ':mediaId(\\d+)',
component: () => import('@/views/mediaLibrary/linkMediaForm'),
name: 'linkMediaForm',
meta: { title: '媒体表单', activeMenu: '/mediaLibrary' }
}
]
},
// {
// path: '/supplierForm',
// component: Layout,

View File

@ -51,7 +51,8 @@
</div>
</div>
<ul class="resource-list" v-if="notices.length > 0">
<li v-for="(notice, index) in notices" :key="index" class="resource-link" @click="handleGoSupplierManage">
<li v-for="(notice, index) in notices" :key="index" class="resource-link"
@click="handleGoFormManage(notice.businessId, notice.businessType)">
{{ notice.noticeTitle }}
</li>
</ul>
@ -114,7 +115,11 @@ const handleGoMediaMap = () => {
const handleGoSupplierManage = () => {
router.push('/supplier')
}
//
const handleGoFormManage = (businessId, businessType) => {
if (businessType == 1) router.push('/supplier/formPage/' + businessId)
if (businessType == 2) router.push('/mediaLibrary/formPage/' + businessId)
}
//
const handleGoMediaLibary = () => {
router.push('/mediaLibrary')

View File

@ -72,6 +72,7 @@ import { mediaExcelBaseField, mediaExcelPriceField, exportMediaExcel } from "@/a
const exportTitle = ref('导出')
const exportOpen = ref(false)
const activeName = ref('first')
const curDeptIds = ref(null)
//
const exportForm = ref({
@ -86,6 +87,7 @@ const baseFieldCheckAll = ref(false)
const baseFieldIsIndeterminate = ref(true)
//
const baseFields = ref([])
const _baseFields = ref(null)
//
const checkedBaseFields = ref([])
@ -94,6 +96,7 @@ const priceFieldCheckAll = ref(false)
const priceFieldIsIndeterminate = ref(true)
//
const priceFields = ref([])
const _priceFields = ref(null)
//
const checkedPriceFields = ref([])
@ -181,18 +184,44 @@ const getCurrentTime = () => {
//
const getMediaExcelBaseField = () => {
mediaExcelBaseField().then(res => {
baseFields.value = res.data
if (curDeptIds.value && curDeptIds.value.length == 2) baseFields.value = res.data
else if (curDeptIds.value && curDeptIds.value.length == 1) {
if (curDeptIds.value[0] == '219') {
//
_baseFields.value = "媒体名称,媒体类型,媒体大类,展示形式,省,市,区,镇,商圈,地址,经度,纬度,状态,废除原因, 部门"
} else {
_baseFields.value = "媒体名称,媒体类型,媒体大类,展示形式,是否照明,播放时间,媒体尺寸,mr,日均车流量,媒体朝向,省,市,区,镇,商圈,地址,经度,纬度,最小购买周期,首次制作安装费,换刊制作安装费,状态,废除原因, 部门"
}
baseFields.value = [...new Set( //
res.data.filter(item => _baseFields.value.includes(item.displayName))
)];
}
})
}
//
const getMediaExcelPriceField = () => {
mediaExcelPriceField().then(res => {
priceFields.value = res.data
if (curDeptIds.value && curDeptIds.value.length == 2) priceFields.value = res.data
else if (curDeptIds.value && curDeptIds.value.length == 1) {
if (curDeptIds.value[0] == '219') {
//
_priceFields.value = "年份,媒体大类,实际购买频次,是否框内,制作成本,供应商,项目名称"
priceFields.value = [...new Set( //
res.data.filter(item => !_priceFields.value.includes(item.displayName))
)];
} else {
_priceFields.value = "年份,城市/市场,媒体大类,媒体名称,频次,刊例价,刊例价单位,实际购买频次,实际购买刊例价,购买周期,折扣,媒体总净价,总制作费,总净价,单日覆盖人流量,SOV,CPM,备注,是否框内,成本,制作成本,供应商,项目名称"
priceFields.value = [...new Set( //
res.data.filter(item => _priceFields.value.includes(item.displayName))
)];
}
}
})
}
//
const initExportExcel = (_mediaIds) => {
const initExportExcel = (_mediaIds, _curDeptIds) => {
exportForm.value.ids = _mediaIds
curDeptIds.value = _curDeptIds
exportOpen.value = true
getMediaExcelBaseField()
getMediaExcelPriceField()

View File

@ -606,7 +606,8 @@ const handleExportExcel = () => {
return false
}
const mediaIds = multipleChoseArr.value.map(item => item.id);
exportDialogRef.value.initExportExcel(mediaIds)
const uniqueDeptIds = [...new Set(multipleChoseArr.value.map(item => item.dataScopeDeptId))];
exportDialogRef.value.initExportExcel(mediaIds, uniqueDeptIds)
}
/** 导出PPT按钮操作 */
const handleExportPPT = (tempId) => {

View File

@ -0,0 +1,26 @@
<template>
<div class="app-container">
<media-form ref="mediaFormRef" />
</div>
</template>
<script setup name="Post">
import { onMounted, ref } from 'vue';
import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png'
import mediaForm from "./mediaForm.vue";
const bgStore = useBackgroundStore()
const route = useRoute()
const mediaFormRef = ref(null)
//
onMounted(() => {
bgStore.setBgImage(otherbg)
const _mediaId = route.params && route.params.mediaId
if (_mediaId) {
console.log('接收id', _mediaId)
mediaFormRef.value.initForm('编辑媒体信息', { id: _mediaId })
}
});
</script>

View File

@ -91,11 +91,22 @@
</el-row>
<div class="splineBar" v-if="detailForm.dataScopeDeptName == '优势媒体部'" />
<el-row :gutter="30" class="my_form_row" v-if="detailForm.dataScopeDeptName == '优势媒体部'">
<el-col :span="24">
<el-col :span="12">
<el-form-item label="媒体朝向" prop="business_department">
{{ detailForm.mediaOrientation }}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称">
<!-- <router-link :to="'/supplier/detailPage/' + detailForm.belongSupplierId" custom>
</router-link> -->
<span class="mediaNameLabel"
@click="handleOpenSupplierDetail(detailForm.belongSupplierId)">
{{ detailForm.belongSupplierName }}
</span>
</el-form-item>
</el-col>
</el-row>
<div class="splineBar" v-if="detailForm.dataScopeDeptName == '优势媒体部'" />
<el-row :gutter="30" class="my_form_row">
@ -182,7 +193,7 @@
<el-row :gutter="30" class="my_form_row">
<el-col :span="6">
<el-form-item label="媒体归属名称">
{{ detailForm.belongSupplierName }}
{{ detailForm.belongName }}
</el-form-item>
</el-col>
<el-col :span="6">
@ -459,10 +470,9 @@ import highSpeedRailway from './components/highSpeedRailway.vue'
import officeBuilding from './components/officeBuilding.vue'
import garageLightBox from './components/garageLightBox.vue'
import supplierDetailFile from '../../components/FileUpload/supplierDetailFile.vue';
import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png'
const bgStore = useBackgroundStore()
import { useRouter } from 'vue-router'
const router = useRouter()
const { proxy } = getCurrentInstance()
const emit = defineEmits(['handleShowList']);
//
@ -599,6 +609,10 @@ const getMediaInfo = () => {
})
}
//
const handleOpenSupplierDetail = (supplierId) => {
router.push('/supplier/detailPage/' + supplierId)
}
const initForm = (_ruleForm) => {
detailForm.value = _ruleForm
if (detailForm.value.id) getMediaInfo()

View File

@ -35,6 +35,36 @@
<el-input v-model="ruleForm.mediaName" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="6" v-if="ruleForm.id">
<el-form-item label="供应商名称">
<el-select class="filterSelect" v-model="ruleForm.belongSupplierId"
@change="handleChoseSupplier" filterable remote reserve-keyword
:remote-method="getSupplierList" :loading="selectLoading" placeholder="请输入"
remote-show-suffix clearable style="min-width: 70px;">
<el-option v-for="item in supplierList" :key="item.supplierId"
:label="item.supplierName" :value="item.supplierId" />
<template #footer>
<div class="select-footer">
<el-button v-if="!isAddSuppliering" @click="onAddSupplierOption"
type="primary" text
style="justify-content: flex-start; width: 100%; color: #1a75e6;">
添加供应商
</el-button>
<template v-else>
<el-input v-model="addSupplierName" class="option-input"
placeholder="请输入供应商名称" />
<div class="footer-buttons">
<el-button class="my-confirm-btn" type="primary"
@click="onSupplierConfirm">确认</el-button>
<el-button class="my-cancel-btn"
@click="clearSupplier">取消</el-button>
</div>
</template>
</div>
</template>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30" class="my_form_row">
<el-col :span="6">
@ -149,16 +179,6 @@
<el-option v-for="item in businessAreaList" :key="item.id" :label="item.name"
:value="item.id" />
<template #footer>
<!-- <el-button v-if="!isAdding" @click="onAddOption">
添加商圈
</el-button>
<template v-else>
<el-input v-model="optionName" class="option-input" placeholder="请输入商圈名称" />
<el-button class="my-confirm-btn" type="primary" @click="onConfirm">
确认
</el-button>
<el-button class="my-cancel-btn" @click="clear">取消</el-button>
</template> -->
<div class="select-footer">
<el-button v-if="!isAdding" @click="onAddOption" type="primary" text
style="justify-content: flex-start; width: 100%; color: #1a75e6;">
@ -261,13 +281,7 @@
<el-row :gutter="30" class="my_form_row">
<el-col :span="6">
<el-form-item label="媒体归属名称">
<el-select class="filterSelect" v-model="ruleForm.belongSupplierId"
@change="handleChoseSupplier" filterable remote reserve-keyword
:remote-method="getSupplierList" :loading="selectLoading" placeholder="请输入"
remote-show-suffix clearable style="min-width: 70px;">
<el-option v-for="item in supplierList" :key="item.supplierId"
:label="item.supplierName" :value="item.supplierId" />
</el-select>
<el-input v-model="ruleForm.belongName" placeholder="请输入" />
</el-form-item>
</el-col>
<el-col :span="6">
@ -547,7 +561,7 @@
<script setup>
import { onMounted, nextTick, defineEmits, ref } from 'vue'
import { Close, LocationInformation } from '@element-plus/icons-vue'
import { listBusSupplier, getBusSupplier } from "@/api/supplier"
import { addBusSupplier, listBusSupplier, getBusSupplier } from "@/api/supplier"
import { sysRegionListByPid } from "@/api/system/administrativeRegion"
import { sysMediaTypeListByPid } from "@/api/system/mediaType"
import { listDept } from "@/api/system/dept"
@ -625,6 +639,9 @@ const mRProductionRequirementsRef = ref(null)
//
const isAdding = ref(false)
const optionName = ref('')
//
const isAddSuppliering = ref(false)
const addSupplierName = ref('')
//
const mediaTypeOne = ref([])
@ -706,6 +723,19 @@ const handleChangeDept = (val) => {
if (ruleForm.value.dataScopeDeptName == '网络媒体部' && activePriceType.value == '高铁') highSpeedRailwayRef.value.getMediaPrice(ruleForm.value.id, true)
if (ruleForm.value.dataScopeDeptName == '网络媒体部' && activePriceType.value == '写字楼') officeBuildingRef.value.getMediaPrice(ruleForm.value.id, true)
if (ruleForm.value.dataScopeDeptName == '网络媒体部' && activePriceType.value == '车库灯箱') garageLightBoxRef.value.getMediaPrice(ruleForm.value.id, true)
// -1,-2,-3,-4,-5,-6,-7,-8, -9, -10, -11,MR-12
if (approvalDocumentRef.value) approvalDocumentRef.value._fileType = 1;
if (exclusiveLicenseFileRef.value) exclusiveLicenseFileRef.value._fileType = 2;
if (mediaLicenseFileRef.value) mediaLicenseFileRef.value._fileType = 3;
if (mediaOwnershipRef.value) mediaOwnershipRef.value._fileType = 4;
if (onceMediaPhotoRef.value) onceMediaPhotoRef.value._fileType = 5;
if (mediaPicRef.value) mediaPicRef.value._fileType = 6;
if (mediaVideoRef.value) mediaVideoRef.value._fileType = 7;
if (stampedPublicationRef.value) stampedPublicationRef.value._fileType = 8;
if (qualificationFileRef.value) qualificationFileRef.value._fileType = 9;
if (mediaChainRef.value) mediaChainRef.value._fileType = 10;
if (journalCataloguePhotoRef.value) journalCataloguePhotoRef.value._fileType = 11;
if (mRProductionRequirementsRef.value) mRProductionRequirementsRef.value._fileType = 12;
})
}
//
@ -738,6 +768,30 @@ const clear = () => {
optionName.value = ''
isAdding.value = false
}
//
const onAddSupplierOption = () => {
isAddSuppliering.value = true
}
//
const onSupplierConfirm = () => {
if (addSupplierName.value) {
const paramsForm = {
supplierName: addSupplierName.value
}
addBusSupplier(paramsForm).then(response => {
clearSupplier()
listBusSupplier({ keyword: addSupplierName.value }).then(res => {
supplierList.value = res.data
})
})
}
}
//
const clearSupplier = () => {
addSupplierName.value = ''
isAddSuppliering.value = false
}
//
const handleChoseSupplier = (val) => {
const choseSupplier = supplierList.value.filter(item => item.supplierId == val)[0]
@ -920,11 +974,18 @@ const getMediaTypeThree2 = (value) => {
//
const handleSetMediaFile = (_fileType, _files) => {
//
var cachFileList = mediaFile.value.filter(item => item.fileType !== _fileType);
//
if (_files.length > 0) mediaFile.value = cachFileList.concat(_files)
else mediaFile.value = cachFileList
//
const currentFiles = [...mediaFile.value]; //
//
const filteredFiles = currentFiles.filter(item => item.fileType !== _fileType);
//
if (_files.length > 0) {
filteredFiles.push(..._files); // 使 push
mediaFile.value = filteredFiles; // ref
} else {
// mediaFile.value
mediaFile.value = filteredFiles;
}
}
//
const handleSetCompetOfferMediaPrice = (mediaType, _priceList) => {
@ -1071,21 +1132,6 @@ const initForm = (_formTitle, _ruleForm) => {
getMediaTypeOne()
getProvinceList()
if (ruleForm.value.id) getMediaInfo()
nextTick(() => {
// -1,-2,-3,-4,-5,-6,-7,-8, -9, -10, -11,MR-12
if (approvalDocumentRef.value) approvalDocumentRef.value._fileType = 1;
if (exclusiveLicenseFileRef.value) exclusiveLicenseFileRef.value._fileType = 2;
if (mediaLicenseFileRef.value) mediaLicenseFileRef.value._fileType = 3;
if (mediaOwnershipRef.value) mediaOwnershipRef.value._fileType = 4;
if (onceMediaPhotoRef.value) onceMediaPhotoRef.value._fileType = 5;
if (mediaPicRef.value) mediaPicRef.value._fileType = 6;
if (mediaVideoRef.value) mediaVideoRef.value._fileType = 7;
if (stampedPublicationRef.value) stampedPublicationRef.value._fileType = 8;
if (qualificationFileRef.value) qualificationFileRef.value._fileType = 9;
if (mediaChainRef.value) mediaChainRef.value._fileType = 10;
if (journalCataloguePhotoRef.value) journalCataloguePhotoRef.value._fileType = 11;
if (mRProductionRequirementsRef.value) mRProductionRequirementsRef.value._fileType = 12;
});
}
// \
defineExpose({

View File

@ -10,8 +10,8 @@
<el-col :span="12">
<el-form :model="queryParams" ref="queryRef" :inline="true" class="searchInputForm">
<el-form-item label="">
<el-input v-model="queryParams.noticeTitle" placeholder="请输入供应商/媒体名称"
:prefix-icon="Search" style="width: 400px;" />
<el-input v-model="queryParams.noticeTitle" placeholder="请输入供应商/媒体名称" :prefix-icon="Search"
style="width: 400px;" />
</el-form-item>
</el-form>
</el-col>
@ -59,10 +59,12 @@
import { onMounted, ref } from 'vue';
import { Search } from '@element-plus/icons-vue'
import { noticeList, exportNotice } from "@/api/notice"
import { useRouter } from 'vue-router'
import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png'
const bgStore = useBackgroundStore()
const router = useRouter()
const { proxy } = getCurrentInstance()
//
@ -112,7 +114,8 @@ function resetQuery() {
/** 去处理 */
const handleUpdate = (row) => {
if (row.businessType == 1) router.push('/supplier/formPage/' + row.businessId)
if (row.businessType == 2) router.push('/mediaLibrary/formPage/' + row.businessId)
}
/** 导出按钮操作 */
const handleExport = () => {

View File

@ -0,0 +1,27 @@
<template>
<div class="app-container">
<supplier-detail ref="supplierDetailRef" />
</div>
</template>
<script setup name="Post">
import { onMounted, ref } from 'vue';
import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png'
import supplierDetail from "./supplierDetail.vue";
const bgStore = useBackgroundStore()
const route = useRoute()
const supplierDetailRef = ref(null)
//
onMounted(() => {
bgStore.setBgImage(otherbg)
const _supplierId = route.params && route.params.supplierId
if (_supplierId) {
console.log('接收id', _supplierId)
supplierDetailRef.value.getSupplierInfo(_supplierId)
}
});
</script>

View File

@ -0,0 +1,26 @@
<template>
<div class="app-container">
<supplier-form ref="supplierFormRef" />
</div>
</template>
<script setup name="Post">
import { onMounted, ref } from 'vue';
import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png'
import supplierForm from "./supplierForm.vue";
const bgStore = useBackgroundStore()
const route = useRoute()
const supplierFormRef = ref(null)
//
onMounted(() => {
bgStore.setBgImage(otherbg)
const _supplierId = route.params && route.params.supplierId
if (_supplierId) {
console.log('接收id', _supplierId)
supplierFormRef.value.initForm('编辑供应商', { supplierId: _supplierId })
}
});
</script>