diff --git a/src/views/mediaLibrary/historyData.vue b/src/views/mediaLibrary/historyData.vue index ee334eb..55e43b7 100644 --- a/src/views/mediaLibrary/historyData.vue +++ b/src/views/mediaLibrary/historyData.vue @@ -13,7 +13,8 @@ value-format="YYYY-MM-DD HH:mm:ss" type="date" placeholder="结束时间" @change="validateEndTime" /> - + @@ -216,7 +217,14 @@ const initHistoryCharLine = () => { _historyChar.value.setOption({ tooltip: { trigger: 'item', - formatter: "{b} : {c} 元/天" //鼠标放上去 展示内容 + // formatter: "{b} : {c} 元/天" //鼠标放上去 展示内容 + formatter: function (params) { + // 从原始数据中获取时间 + const originalData = historyList.value; // 你的原始数据 + const time = originalData[params.dataIndex].createTime; + + return `${params.name}: ${params.value} 元/天
时间: ${time}`; + } }, grid: { left: '3%', @@ -304,7 +312,14 @@ const initHistoryCharBar = () => { _historyChar.value.setOption({ tooltip: { trigger: 'item', - formatter: "{b} : {c} 元/天" //鼠标放上去 展示内容 + // formatter: "{b} : {c} 元/天" //鼠标放上去 展示内容 + formatter: function (params) { + // 从原始数据中获取时间 + const originalData = historyList.value; // 你的原始数据 + const time = originalData[params.dataIndex].createTime; + + return `${params.name}: ${params.value} 元/天
时间: ${time}`; + } }, grid: { left: '3%', @@ -388,7 +403,7 @@ const initHistoryCharBar = () => { // _historyChar.value.resize() // }) } -const handleChangeMediaType = (val) => { +const handleChangeMediaType = (val) => { getMediaPriceList() } const handleChangeType = (val) => { @@ -424,8 +439,6 @@ const getMediaPriceList = () => { itemYDate = (convertIntTotalRegularPrice / (item.buyCycle * 7)).toFixed(2) } else { const repliceValue = parseInt(item.buyCycle.replace('个月', '').replace('月', '')) - console.log('会输入月份的原始值', item.buyCycle) - console.log('替换会输入月份的结果', repliceValue) itemYDate = (convertIntTotalRegularPrice / (repliceValue * 31)).toFixed(2) } } @@ -463,7 +476,7 @@ const validateEndTime = (val) => { } }; // 对外暴漏方法 -const initHistoryData = (_mediaId, _readonly) => { +const initHistoryData = (_mediaId, _readonly) => { historyDataOpen.value = true readonly.value = _readonly nextTick(() => {