|
@@ -9,7 +9,7 @@ import {useRoute, useRouter,onBeforeRouteUpdate} from 'vue-router'
|
|
|
import moment from 'moment'
|
|
|
import _ from 'lodash';
|
|
|
import Highcharts from 'highcharts/highstock';
|
|
|
-import {apiChartInfo,apiChartList,apiChartSave,apiChartBeforeAndNext,apiChartRefresh,apiMyChartDetail,apiCommonChartDetail,apiCommonChartRefresh,apiCommonChartSave} from '@/api/hzyb/chart.js'
|
|
|
+import {apiChartInfo,apiChartList,apiChartSave,apiChartBeforeAndNext,apiChartRefresh,apiMyChartDetail,apiCommonChartDetail,apiCommonChartRefresh,apiCommonChartSave,apiRelevanceChartRefresh} from '@/api/hzyb/chart.js'
|
|
|
const router=useRouter()
|
|
|
const route=useRoute()
|
|
|
document.title='图表详情'
|
|
@@ -218,7 +218,7 @@ const getChartInfo=async (type)=>{
|
|
|
loading.value=true
|
|
|
|
|
|
//相关性图表
|
|
|
- if(chartSource===3) return getRelevanceDetail();
|
|
|
+ if([3,4].includes(chartSource)) return getRelevanceDetail();
|
|
|
//商品价格曲线调另外的接口
|
|
|
if(chartSource===2) return getCommordityDetail();
|
|
|
|
|
@@ -370,10 +370,10 @@ const relevanceChartData=ref(null)
|
|
|
const initRelevanceChart=(data)=>{
|
|
|
// 处理X轴
|
|
|
let xAxis={
|
|
|
- categories: data.XEdbIdValue,
|
|
|
+ categories: data.ChartInfo.Source===3 ? data.XEdbIdValue : data.DataResp.XDateTimeValue,
|
|
|
tickWidth: 1,
|
|
|
title: {
|
|
|
- text: `期数(${data.CorrelationChartInfo.LeadUnit})`,
|
|
|
+ text: data.ChartInfo.Source===3 ? `期数(${data.CorrelationChartInfo.LeadUnit})` : null,
|
|
|
align: 'high',
|
|
|
rotation: 0,
|
|
|
x: 0,
|
|
@@ -432,27 +432,22 @@ const initRelevanceChart=(data)=>{
|
|
|
seriesData.push(serie_item)
|
|
|
})
|
|
|
|
|
|
+ const { LeadValue,LeadUnit } = data.CorrelationChartInfo;
|
|
|
let tooltip = {
|
|
|
formatter: function() {
|
|
|
- let str = `<p>相关性系数:${this.y.toFixed(4)}</p><br><p>领先${this.x}期</p>`
|
|
|
- return str
|
|
|
- },
|
|
|
- formatterCh: function() {
|
|
|
- let str = `<p>相关性系数:${this.y.toFixed(4)}</p><br><p>领先${this.x}期</p>`
|
|
|
- return str
|
|
|
- },
|
|
|
- formatterEn: function() {
|
|
|
- let str = `<p>Correlation coefficient:${this.y.toFixed(4)}</p><br><p>lead${this.x}stage</p>`
|
|
|
+ let str = `<p>相关性系数:${this.y.toFixed(4)}</p><br><p>领先${ data.ChartInfo.Source===3 ?this.x+'期' : LeadValue+LeadUnit}</p>`
|
|
|
return str
|
|
|
}
|
|
|
}
|
|
|
|
|
|
nextTick(()=>{
|
|
|
- const hEl=document.getElementById('chart-box')
|
|
|
- console.log(hEl.offsetHeight);
|
|
|
- xAxis.offset=-(hEl.offsetHeight-74)/2
|
|
|
+ if(data.ChartInfo.Source===3) {
|
|
|
+ const hEl=document.getElementById('chart-box')
|
|
|
+ console.log(hEl.offsetHeight);
|
|
|
+ xAxis.offset=-(hEl.offsetHeight-74)/2
|
|
|
+ }
|
|
|
chartData.value = {
|
|
|
- isRelevanceChart:true,
|
|
|
+ isRelevanceChart:data.ChartInfo.Source===3,
|
|
|
title: {
|
|
|
text:''
|
|
|
},
|
|
@@ -1960,7 +1955,7 @@ const handleRefreshChart=async ()=>{
|
|
|
res=await apiChartRefresh({ChartInfoId:Number(ChartInfoId)})
|
|
|
}else if(resData.value.ChartInfo.Source === 2){
|
|
|
res=await apiCommonChartRefresh({ChartInfoId:Number(ChartInfoId)})
|
|
|
- }else if(resData.value.ChartInfo.Source === 3){
|
|
|
+ }else if([3,4].includes(resData.value.ChartInfo.Source)){
|
|
|
res=await apiRelevanceChartRefresh({ChartInfoId:Number(ChartInfoId)})
|
|
|
}
|
|
|
if(res.code===200){
|
|
@@ -2046,7 +2041,7 @@ const posterParams=computed(()=>{
|
|
|
>
|
|
|
<img class="icon" src="@/assets/hzyb/share-poster-chart-icon.png" alt="">
|
|
|
</share-poster>
|
|
|
- <img class="icon" src="../../../assets/hzyb/chart/save.png" alt="" @click="handleSaveChart" v-if="canSave&&$route.query.chartSource!=3">
|
|
|
+ <img class="icon" src="../../../assets/hzyb/chart/save.png" alt="" @click="handleSaveChart" v-if="canSave&&![3,4].includes(chartSource)">
|
|
|
<img class="icon" src="../../../assets/hzyb/chart/refresh.png" alt="" @click="handleRefreshChart">
|
|
|
</div>
|
|
|
|