diff --git a/public/优势媒体报价导入模板.xlsx b/public/优势媒体报价导入模板.xlsx new file mode 100644 index 0000000..7ff1a2f Binary files /dev/null and b/public/优势媒体报价导入模板.xlsx differ diff --git a/src/api/mediaLibrary.js b/src/api/mediaLibrary.js index 7595fd3..2d2c4f5 100644 --- a/src/api/mediaLibrary.js +++ b/src/api/mediaLibrary.js @@ -23,7 +23,7 @@ export function updateMedia(query) { method: 'post', data: query }) -} +} // 查看单条媒体信息 export function mediaDetail(query) { return request({ @@ -143,4 +143,16 @@ export function outMediaPageList(query) { method: 'get', params: query }) +} + +// 导入媒体报价 +export function importPriceByExcel(query) { + return request({ + url: '/media/import/price/Excel', + method: 'post', + data: query, + headers: { + 'Content-Type': 'multipart/form-data' + } + }) } \ No newline at end of file diff --git a/src/components/FileUpload/PdfPreview.vue b/src/components/FileUpload/PdfPreview.vue index 3d19083..8e2002c 100644 --- a/src/components/FileUpload/PdfPreview.vue +++ b/src/components/FileUpload/PdfPreview.vue @@ -1,7 +1,7 @@ @@ -318,6 +294,7 @@ import viewFileDialog from '@/components/ViewFile/index.vue' import exportDialog from './exportDialog.vue'; import abolishDialog from './abolishDialog.vue'; import exportPPTDialog from './exportPPTDialog.vue'; +import importPrice from './importPrice.vue'; import { useBackgroundStore } from '@/store/modules/background' @@ -385,11 +362,10 @@ const mediaLogsRef = ref(null) // ppt模板数据 const templateList = ref([]) // 媒体多选数据 -const multipleChoseArr = ref([]) - - -const uploadOpen = ref(false) -const docUploadList = ref([]) +const multipleChoseArr = ref([]) +const unfoldFlag = ref(false) + +const importPriceRef = ref(null) const abolishRef = ref(null) const historyDataRef = ref(null) const downFileRef = ref(null) @@ -397,8 +373,6 @@ const viewFileRef = ref(null) const exportDialogRef = ref(null) const exportPPTDialogRef = ref(null) - - // 获取PPT模板 const getpptTemplatePageList = () => { pptTemplatePage(queryParams.value).then(res => { @@ -495,11 +469,9 @@ const getbusinessAreaList = (val) => { }) } // 折叠展开 -const unfoldFlag = ref(false) const handleFlod = () => { unfoldFlag.value = !unfoldFlag.value -} - +} /** 查询媒体信息列表 */ const getMediaPageList = () => { loading.value = true @@ -520,8 +492,7 @@ const getMediaPageList = () => { const handleQuery = () => { queryParams.value.pageNum = 1 getMediaPageList() -} - +} /** 重置按钮操作 */ const resetQuery = () => { queryParams.value = { @@ -541,8 +512,7 @@ const resetQuery = () => { businessDistrictId: undefined } handleQuery() -} - +} // 选择媒体事件 const handleSelectionChange = (selection) => { multipleChoseArr.value = selection @@ -608,13 +578,11 @@ const handleHistoryChart = (row) => { // 打开文件下载 const handleDownFiles = (row) => { downFileRef.value.initFileList(true, row.id) -} - +} // 查看文件 const handleViewPhoto = (_fileType, row) => { viewFileRef.value.initFileList(_fileType, row.id) -} - +} /** 导出Excel按钮操作 */ const handleExportExcel = () => { if (multipleChoseArr.value.length == 0) { @@ -632,64 +600,11 @@ const handleExportPPT = (tempId) => { } const mediaIds = multipleChoseArr.value.map(item => item.id); exportPPTDialogRef.value.initExportPPT(tempId, mediaIds, multipleChoseArr.value) -} - +} /** 导入按钮操作 */ const handleImport = (val) => { - uploadOpen.value = true -} - -// 自定义上传文件资料 -const requestDocUpload = (options) => { - proxy.$modal.loading('正在上传文件,请耐心等待...') - const { file } = options - var formData = new FormData(); - formData.append('file', file); - importSupplier(formData).then(res => { - if (res.code == 200) { - proxy.$modal.msgSuccess("导入成功") - proxy.$modal.closeLoading() - uploadOpen.value = false - getSupplierPageList() - } else { - proxy.$modal.closeLoading() - proxy.$modal.msgError(res.msg); - } - }) -} -//自定义上传文件资料校验 -const beforeDocUpload = (file) => { - const type = [ - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'application/vnd.ms-excel' - ]; - const isXlsx = type.includes(file.type); - // 检验文件格式 - if (!isXlsx) { - proxy.$modal.msgError("文件格式错误,请上传.xls;.xlsx后缀的文件。"); - return false; - } -} -// 移除已上传文件列表 -const removeDocUpload = (file, fileList) => { - docUploadList.value = docUploadList.value.filter( - item => item.name != file.name - ); -} -// 下载导入模板操作 -const importTemplate = () => { - // exportTemplate().then(res => { - // // 通过a标签打开新页面下载文件 - // const a = document.createElement('a') - // a.href = URL.createObjectURL(res) - // // a标签里有download属性可以自定义文件名 - // const downLoadName = '供应商导入模板_' + Date.now() + '.xlsx' - // a.setAttribute('download', downLoadName) - // document.body.appendChild(a) - // a.click() - // document.body.removeChild(a) - // }) -} + importPriceRef.value.initImportPriceExcel(val) +} // 打开媒体地图 const handleGoMediaMap = () => { router.push('/mediaMap') diff --git a/src/views/mediaLibrary/mediaForm.vue b/src/views/mediaLibrary/mediaForm.vue index 62af316..7a28e2c 100644 --- a/src/views/mediaLibrary/mediaForm.vue +++ b/src/views/mediaLibrary/mediaForm.vue @@ -629,7 +629,7 @@ const data = reactive({ mediaSize: [{ required: true, message: "媒体尺寸不能为空", trigger: "blur" }], mediaOrientation: [{ required: true, message: "媒体朝向不能为空", trigger: "blur" }], mediaCity: [{ required: true, message: "城市不能为空", trigger: "change" }], - businessDistrictId: [{ required: true, message: "商圈不能为空", trigger: "change" }], + // businessDistrictId: [{ required: true, message: "商圈不能为空", trigger: "change" }], firstInstallFee: [{ required: true, message: "首次制作安装费不能为空", trigger: "blur" }], changeInstallFee: [{ required: true, message: "换刊制作安装费不能为空", trigger: "blur" }], },