|
@@ -1,10 +1,10 @@
|
|
|
<script setup>
|
|
|
-import { ref, reactive } from 'vue'
|
|
|
+import { ref, reactive, onMounted } from 'vue'
|
|
|
import {useRoute, useRouter,onBeforeRouteUpdate} from 'vue-router'
|
|
|
import chartBox from '../chart/component/chartBox.vue'
|
|
|
import {
|
|
|
- apiMyChartDetail,
|
|
|
-} from '@/api/hzyb/chart.js'
|
|
|
+ apiGetbaseEdbInfo,apiGetpredictEdbInfo,apiGetCalendarEventList
|
|
|
+} from '@/api/hzyb/forexCalendar.js'
|
|
|
import {setSplineOpt} from '../hooks/chartBase'
|
|
|
/**
|
|
|
* 外汇日历详情
|
|
@@ -16,6 +16,9 @@ import {setSplineOpt} from '../hooks/chartBase'
|
|
|
切换上下张切换索引,当到达第一张/最后一张时,循环这个列表
|
|
|
*/
|
|
|
const route=useRoute()
|
|
|
+let EdbList = ref([])
|
|
|
+let currentEdbIndex=ref(0) //当前展示的指标索引
|
|
|
+let currentEdbId=ref('') //当前展示的指标id
|
|
|
let chartData=ref({
|
|
|
series:[],
|
|
|
xAxis:[],
|
|
@@ -30,7 +33,7 @@ let pageBoxPosition=reactive({
|
|
|
temLeft:0,
|
|
|
})
|
|
|
localStorage.setItem('hzyb-token',route.query.token)
|
|
|
-async function testChart(){
|
|
|
+/* async function testChart(){
|
|
|
const res=await apiMyChartDetail({
|
|
|
ChartInfoId:'178',
|
|
|
})
|
|
@@ -38,6 +41,7 @@ async function testChart(){
|
|
|
chartData.value = setSplineOpt(res.data.EdbInfoList,resData)
|
|
|
}
|
|
|
testChart()
|
|
|
+ */
|
|
|
function pageChange(){}
|
|
|
const pageTouchmove=(e)=>{
|
|
|
const touchObj=e.touches[0]
|
|
@@ -62,12 +66,70 @@ const pageTouchmove=(e)=>{
|
|
|
event.preventDefault();//阻止页面移动
|
|
|
}
|
|
|
|
|
|
+//获取当月指标列表
|
|
|
+async function getEdbList(){
|
|
|
+ const {startDate,endDate,edbInfoId,matterType,permissionId} = route.query
|
|
|
+ await apiGetCalendarEventList({
|
|
|
+ chart_permission_id:Number(permissionId),
|
|
|
+ start_date:startDate,
|
|
|
+ end_date:endDate
|
|
|
+ }).then(res=>{
|
|
|
+ if(res.code!==200) return
|
|
|
+ let events = (res.data?res.data:[]).map(dailyEvents=>{
|
|
|
+ return dailyEvents.matters
|
|
|
+ })
|
|
|
+ events = events.flat().filter(e=>e.matter_type!==1).map(e=>{
|
|
|
+ return {
|
|
|
+ edbInfoId:e.edb_info_id,
|
|
|
+ matterType:e.matter_type
|
|
|
+ }
|
|
|
+ })
|
|
|
+ EdbList.value = events
|
|
|
+ currentEdbId.value = Number(edbInfoId)
|
|
|
+ const eventIndex = events.findIndex(e=>e.edb_info_id===Number(edbInfoId))
|
|
|
+ currentEdbIndex.value = eventIndex>=0?eventIndex:0
|
|
|
+ getEdbDetail()
|
|
|
+ })
|
|
|
+}
|
|
|
+getEdbList()
|
|
|
+
|
|
|
+async function getEdbDetail(){
|
|
|
+ const res = EdbList.value[currentEdbIndex.value].matterType===2
|
|
|
+ ?await apiGetbaseEdbInfo({edb_info_id:currentEdbId.value})
|
|
|
+ :await apiGetpredictEdbInfo({edb_info_id:currentEdbId.value})
|
|
|
+ resData.value=res.data
|
|
|
+ const edbData = {
|
|
|
+ DataList:res.data.DataList||[],
|
|
|
+ EdbInfo:{
|
|
|
+ ...res.data.EdbInfo,
|
|
|
+ ChartColor:'',
|
|
|
+ ChartStyle:'',
|
|
|
+ ChartType:0,
|
|
|
+ ChartWidth:0,
|
|
|
+ MaxData:res.data.EdbInfo.maxValue,
|
|
|
+ MinData:res.data.EdbInfo.minValue,
|
|
|
+ EdbInfoCategoryType:1,
|
|
|
+ EdbInfoType:1,
|
|
|
+ EdbName:res.data.EdbInfo.edbName,
|
|
|
+ IsAxis:1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ chartData.value = setSplineOpt(
|
|
|
+ [
|
|
|
+ {
|
|
|
+ ...edbData.EdbInfo,
|
|
|
+ DataList:edbData.DataList
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ {value:{ChartInfo:{ChartType:1}}}
|
|
|
+ )
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="edb-detail-wrap">
|
|
|
- <div class="edb-title">{{resData.ChartInfo.ChartName}}</div>
|
|
|
- <chartBox :options='chartData' :chartInfo="{}" v-if="!loading"></chartBox>
|
|
|
+ <div class="edb-title">{{resData.EdbInfo.edbName}}</div>
|
|
|
+ <chartBox :options='chartData' :chartInfo="{ChartType:1}" v-if="!loading"></chartBox>
|
|
|
<!-- 上一张下一张图切换 -->
|
|
|
<div
|
|
|
class="change-page-wrap"
|