diff --git a/src/api/system/user.js b/src/api/system/user.js index a03375a..b2ed8c4 100644 --- a/src/api/system/user.js +++ b/src/api/system/user.js @@ -97,6 +97,7 @@ export function updateUserPwd(oldPassword, newPassword) { return request({ url: '/system/user/profile/updatePwd', method: 'put', + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, data: data }) } diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index 2913564..918751c 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -15,8 +15,8 @@ const useSettingsStore = defineStore( state: () => ({ title: '', theme: storageSetting.theme || '#409EFF', - sideTheme: storageSetting.sideTheme || sideTheme, - showSettings: showSettings, + sideTheme: 'theme-light', //storageSetting.sideTheme || sideTheme, + showSettings: false, //showSettings, topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView, tagsIcon: storageSetting.tagsIcon === undefined ? tagsIcon : storageSetting.tagsIcon, @@ -25,7 +25,7 @@ const useSettingsStore = defineStore( dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle, footerVisible: storageSetting.footerVisible === undefined ? footerVisible : storageSetting.footerVisible, footerContent: footerContent, - isDark: isDark.value + isDark: false, // isDark.value }), actions: { // 修改布局设置 @@ -42,8 +42,8 @@ const useSettingsStore = defineStore( }, // 切换暗黑模式 toggleTheme() { - this.isDark = !this.isDark - toggleDark() + // this.isDark = !this.isDark + // toggleDark() } } }) diff --git a/src/views/mediaLibrary/exportDialog.vue b/src/views/mediaLibrary/exportDialog.vue index f1751c0..3d142cd 100644 --- a/src/views/mediaLibrary/exportDialog.vue +++ b/src/views/mediaLibrary/exportDialog.vue @@ -34,7 +34,7 @@ - + {{ item }} @@ -81,6 +81,170 @@ const exportOpen = ref(false) const activeName = ref('first') const curDeptIds = ref(null) +// 优势基础字段 +const ysBaseFild = ref([ + { + displayName: "媒体名称", + propertyPath: "mediaName" + }, + { + displayName: "媒体类型", + propertyPath: "mediaTypeStr" + }, + { + displayName: "媒体大类", + propertyPath: "mediaCategoryStr" + }, + { + displayName: "展示形式", + propertyPath: "displayFormStr" + }, + { + displayName: "是否照明", + propertyPath: "hasLighting" + }, + { + displayName: "播放时间", + propertyPath: "playbackTime" + }, + { + displayName: "媒体尺寸", + propertyPath: "mediaSize" + }, + { + displayName: "MR", + propertyPath: "mr" + }, + { + displayName: "日均车流量", + propertyPath: "dailyAvgVehicleFlow" + }, + { + displayName: "媒体朝向", + propertyPath: "mediaOrientation" + }, + { + displayName: "省", + propertyPath: "provinceName" + }, + { + displayName: "市", + propertyPath: "cityName" + }, + { + displayName: "区", + propertyPath: "areaName" + }, + { + displayName: "镇", + propertyPath: "townName" + }, + { + displayName: "商圈", + propertyPath: "businessDistrictName" + }, + { + displayName: "地址", + propertyPath: "address" + }, + { + displayName: "纬度", + propertyPath: "mapY" + }, + { + displayName: "经度", + propertyPath: "mapX" + }, + { + displayName: "最小购买周期", + propertyPath: "minPurchaseCycle" + }, + { + displayName: "首次制作安装费", + propertyPath: "firstInstallFee" + }, + { + displayName: "换刊制作安装费", + propertyPath: "changeInstallFee" + }, + { + displayName: "状态", + propertyPath: "state" + }, + { + displayName: "作废原因", + propertyPath: "invalidReason" + }, + { + displayName: "业务部门", + propertyPath: "dataScopeDeptName" + } +]) + +// 网络基础字段 +const wlBaseFild = ref([ + { + displayName: "媒体名称", + propertyPath: "mediaName" + }, + { + displayName: "媒体类型", + propertyPath: "mediaTypeStr" + }, + { + displayName: "媒体大类", + propertyPath: "mediaCategoryStr" + }, + { + displayName: "展示形式", + propertyPath: "displayFormStr" + }, + { + displayName: "省", + propertyPath: "provinceName" + }, + { + displayName: "市", + propertyPath: "cityName" + }, + { + displayName: "区", + propertyPath: "areaName" + }, + { + displayName: "镇", + propertyPath: "townName" + }, + { + displayName: "商圈", + propertyPath: "businessDistrictName" + }, + { + displayName: "地址", + propertyPath: "address" + }, + { + displayName: "纬度", + propertyPath: "mapY" + }, + { + displayName: "经度", + propertyPath: "mapX" + }, + { + displayName: "状态", + propertyPath: "state" + }, + { + displayName: "作废原因", + propertyPath: "invalidReason" + }, + { + displayName: "业务部门", + propertyPath: "dataScopeDeptName" + } +]) + // 优势报价字段 const ysPriceFild = ref([ { @@ -1150,7 +1314,7 @@ const ckdxPriceFild = ref([ const exportForm = ref({ ids: undefined, exportBaseFields: undefined, - exportPriceFields: false, + mediaTypeExport: [], hasFiles: false }) @@ -1159,7 +1323,7 @@ const baseFieldCheckAll = ref(false) const baseFieldIsIndeterminate = ref(false) // 基础字段 const baseFields = ref([]) -const _baseFields = ref(null) +// const _baseFields = ref(null) // 已选择的基础字段 const checkedBaseFields = ref([]) @@ -1196,19 +1360,95 @@ const handleCheckedBaseFieldChange = (value) => { } // 报价字段全选操作 const handleCheckAllPriceFieldChange = (val) => { + console.log('全选报价字段', val) checkedPriceFields.value = [] if (val) { priceFields.value.forEach(element => { checkedPriceFields.value.push(element.propertyPath) }); + + if (ToolOptions.value.length == 8) { + console.log('待处理报价', exportForm.value.mediaTypeExport, activeIndex.value) + // 查找指定类型的报价字段 + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == activeIndex.value); + if (curPriceFields.length > 0) { + console.log('过滤后的数据', curPriceFields[0].exportPriceFields) + curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使用数组索引 + } + } + if (ToolOptions.value.length == 7) { + let jsType = activeIndex.value + 1 + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == jsType); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使用数组索引 + } + } + if (ToolOptions.value.length == 0) { + console.log('待处理报价', exportForm.value.mediaTypeExport, 0) + // 查找指定类型的报价字段 + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == 0); + if (curPriceFields.length > 0) { + console.log('过滤后的数据', curPriceFields[0].exportPriceFields) + curPriceFields[0].exportPriceFields = [...checkedPriceFields.value] // 使用数组索引 + } + } + console.log('处理后的报价字段', exportForm.value.mediaTypeExport) + } else { + if (ToolOptions.value.length == 8) { + // 查找指定类型的报价字段 + const curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == activeIndex.value); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [] + } + } + if (ToolOptions.value.length == 7) { + let jsType = activeIndex.value + 1 + const curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == jsType); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [] + } + } + if (ToolOptions.value.length == 0) { + const curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == 0); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [] + } + } + console.log('处理后的报价字段', exportForm.value.mediaTypeExport) } priceFieldIsIndeterminate.value = false + // 更新选择状态 + checkPriceFieldSelectStatus() } // 单个选择报价字段 const handleCheckedPriceFieldChange = (value) => { + console.log('单个选择报价字段', value) const checkedCount = value.length priceFieldCheckAll.value = checkedCount === priceFields.value.length priceFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < priceFields.value.length + + // 同步更新到 exportForm + if (ToolOptions.value.length == 8) { + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == activeIndex.value); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [...value] + } + } + if (ToolOptions.value.length == 7) { + let jsType = activeIndex.value + 1 + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == jsType); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [...value] + } + } + if (ToolOptions.value.length == 0) { + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == 0); + if (curPriceFields.length > 0) { + curPriceFields[0].exportPriceFields = [...value] + } + } + // 更新选择状态 + checkPriceFieldSelectStatus() } // 选择是否包含附件 @@ -1224,7 +1464,7 @@ const handleClick = (tab, event) => { // 执行导出 const handleSubmitExport = () => { exportForm.value.exportBaseFields = checkedBaseFields - exportForm.value.exportPriceFields = checkedPriceFields + exportForm.value.mediaTypeExport = exportForm.value.mediaTypeExport.filter(item => item.exportPriceFields.length > 0) exportMediaExcel(exportForm.value).then(res => { const downLoadName = '媒体信息_' + getCurrentTime() + '.xlsx' // 通过a标签打开新页面下载文件 @@ -1255,20 +1495,15 @@ const getCurrentTime = () => { // 获取基础信息字段 const getMediaExcelBaseField = () => { - mediaExcelBaseField().then(res => { - 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)) - )]; + if (curDeptIds.value && curDeptIds.value.length == 2) baseFields.value = ysBaseFild.value + else if (curDeptIds.value && curDeptIds.value.length == 1) { + if (curDeptIds.value[0] == '219') { + // 网络媒体 + baseFields.value = wlBaseFild.value + } else { + baseFields.value = ysBaseFild.value } - }) + } } // 获取报价信息字段 const getMediaExcelPriceField = () => { @@ -1276,93 +1511,153 @@ const getMediaExcelPriceField = () => { ToolOptions.value = ['优势报价', '门禁', '候车厅', '道闸', '地铁', '高铁', '写字楼', '车库灯箱'] activeIndex.value = 0 priceFields.value = ysPriceFild.value + handleCheckPriceField(0) } else if (curDeptIds.value && curDeptIds.value.length == 1) { if (curDeptIds.value[0] == '219') { ToolOptions.value = ['门禁', '候车厅', '道闸', '地铁', '高铁', '写字楼', '车库灯箱'] activeIndex.value = 0 priceFields.value = mjPriceFild.value + handleCheckPriceField(1) } else { ToolOptions.value = [] activeIndex.value = 0 priceFields.value = ysPriceFild.value + handleCheckPriceField(0) } - } + } +} +// 判断报价信息是否存在指定类型数据 +const handleCheckPriceField = (_mediaType) => { + // 获取当前的所有要导出的报价字段 + const currentMediaTypeExport = [...exportForm.value.mediaTypeExport]; // 创建副本以避免直接修改原数组 + console.log('要导出的报价字段', currentMediaTypeExport) + // 过滤掉指定类型的旧数据 + const filteredFields = currentMediaTypeExport.filter(item => item.type !== _mediaType); + console.log('要导出的报价旧数据', filteredFields) + // 判断是否有指定类型数据 + const _mediaTypeArr = currentMediaTypeExport.filter(item => item.type == _mediaType); + console.log('当前类型的报价数据', _mediaTypeArr) + // 如果数据不存在 + if (_mediaTypeArr.length == 0) { + filteredFields.push({ type: _mediaType, exportPriceFields: [] }); // 使用 push 追加新文件 + exportForm.value.mediaTypeExport = [...filteredFields]; // 更新 ref + console.log('更新后的数据', exportForm.value.mediaTypeExport) + } } // 类型切换 const handleChangeType = (_type) => { activeIndex.value = _type priceFieldCheckAll.value = false priceFieldIsIndeterminate.value = false + + // 先获取当前类型的已选字段 + let currentCheckedFields = [] + if (ToolOptions.value.length == 8) { + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == _type); + if (curPriceFields.length > 0) { + currentCheckedFields = [...curPriceFields[0].exportPriceFields] + } + } + if (ToolOptions.value.length == 7) { + let wlType = _type + 1 + let curPriceFields = exportForm.value.mediaTypeExport.filter(item => item.type == wlType); + if (curPriceFields.length > 0) { + currentCheckedFields = [...curPriceFields[0].exportPriceFields] + } + } + if (ToolOptions.value.length == 8) { switch (_type) { case 0: priceFields.value = ysPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 1: priceFields.value = mjPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 2: priceFields.value = hctPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 3: priceFields.value = dzPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 4: priceFields.value = dtPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 5: priceFields.value = gtPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 6: priceFields.value = xzlPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 7: priceFields.value = ckdxPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; } + handleCheckPriceField(_type) } if (ToolOptions.value.length == 7) { switch (_type) { case 0: priceFields.value = mjPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 1: priceFields.value = hctPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 2: priceFields.value = dzPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 3: priceFields.value = dtPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 4: priceFields.value = gtPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 5: priceFields.value = xzlPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; case 6: priceFields.value = ckdxPriceFild.value - checkedPriceFields.value = [] + checkedPriceFields.value = currentCheckedFields break; } + let wlType = _type + 1 + console.log('网络类型', wlType) + handleCheckPriceField(wlType) } + // 新增:检查当前类型是否全选 + checkPriceFieldSelectStatus() +} +// 新增方法:检查报价字段选择状态 +const checkPriceFieldSelectStatus = () => { + const checkedCount = checkedPriceFields.value.length + const totalCount = priceFields.value.length + + priceFieldCheckAll.value = checkedCount === totalCount + priceFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < totalCount +} +// 新增方法:检查基础字段选择状态 +const checkBaseFieldSelectStatus = () => { + const checkedCount = checkedBaseFields.value.length + const totalCount = baseFields.value.length + + baseFieldCheckAll.value = checkedCount === totalCount + baseFieldIsIndeterminate.value = checkedCount > 0 && checkedCount < totalCount } // 初始化 const initExportExcel = (_mediaIds, _curDeptIds) => { @@ -1372,6 +1667,10 @@ const initExportExcel = (_mediaIds, _curDeptIds) => { exportOpen.value = true getMediaExcelBaseField() getMediaExcelPriceField() + + // 初始化时检查选择状态 + checkBaseFieldSelectStatus() + checkPriceFieldSelectStatus() } // 暴露方法\属性给父组件 @@ -1381,24 +1680,24 @@ defineExpose({ \ No newline at end of file diff --git a/src/views/mediaLibrary/mediaDetail.vue b/src/views/mediaLibrary/mediaDetail.vue index ac26e33..6de5f0d 100644 --- a/src/views/mediaLibrary/mediaDetail.vue +++ b/src/views/mediaLibrary/mediaDetail.vue @@ -38,7 +38,7 @@ - + {{ detailForm.mediaName }} @@ -113,7 +113,7 @@
- + {{ detailForm.provinceName }} -{{ detailForm.cityName }} @@ -121,7 +121,7 @@ -{{ detailForm.townName }} - + {{ detailForm.businessDistrictName }} diff --git a/src/views/mediaLibrary/mediaForm.vue b/src/views/mediaLibrary/mediaForm.vue index b57d115..cfd6166 100644 --- a/src/views/mediaLibrary/mediaForm.vue +++ b/src/views/mediaLibrary/mediaForm.vue @@ -8,7 +8,7 @@
- + @@ -31,7 +31,7 @@ - + diff --git a/src/views/mediaTool/calibrationIndex.vue b/src/views/mediaTool/calibrationIndex.vue index ea57e8a..a091d38 100644 --- a/src/views/mediaTool/calibrationIndex.vue +++ b/src/views/mediaTool/calibrationIndex.vue @@ -197,7 +197,7 @@ - + diff --git a/src/views/system/user/profile/resetPwd.vue b/src/views/system/user/profile/resetPwd.vue index 801fc91..73c6b18 100644 --- a/src/views/system/user/profile/resetPwd.vue +++ b/src/views/system/user/profile/resetPwd.vue @@ -45,7 +45,7 @@ const rules = ref({ function submit() { proxy.$refs.pwdRef.validate(valid => { if (valid) { - updateUserPwd(user.oldPassword, user.newPassword, user.confirmPassword).then(response => { + updateUserPwd(user.oldPassword, user.newPassword).then(response => { proxy.$modal.msgSuccess("修改成功") }) }