|
@@ -1,9 +1,10 @@
|
|
|
<script setup>
|
|
|
import {ref,nextTick, reactive} from 'vue'
|
|
|
-import {apiChartInfoByCode} from '@/api/chart'
|
|
|
+import {apiChartInfoByCode,apiChartInfoById,apiEDBInfo} from '@/api/chart'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
import {chartRender} from '@/hooks/chart/render'
|
|
|
import {yearSelectOpt,sameOptionType} from '@/hooks/chart/config'
|
|
|
+import EDBInfo from './components/EDBInfo.vue'
|
|
|
|
|
|
const route=useRoute()
|
|
|
const chartCode=route.query.code
|
|
@@ -20,6 +21,10 @@ async function getChartInfo(){
|
|
|
}else{
|
|
|
edbList.value=res.Data.EdbInfoList
|
|
|
}
|
|
|
+
|
|
|
+ chartState.yearVal=res.Data.ChartInfo.DateType
|
|
|
+
|
|
|
+
|
|
|
nextTick(()=>{
|
|
|
chartRender({
|
|
|
data:res.Data,
|
|
@@ -32,15 +37,48 @@ async function getChartInfo(){
|
|
|
}
|
|
|
getChartInfo()
|
|
|
|
|
|
+// 选择项发生变化时 非配置项 获取新的图表数据
|
|
|
+async function reloadChartInfo(){
|
|
|
+ const params=sameOptionType.includes(chartInfo.value.ChartType)?{
|
|
|
+ ChartInfoId: chartInfo.value.ChartInfoId,
|
|
|
+ DateType: chartState.yearVal,
|
|
|
+ StartDate:'' ,//[5, 6].includes(this.year_select)?this.select_date[0]: ''
|
|
|
+ EndDate: '',//this.year_select === 5 ? this.select_date[1] : ''
|
|
|
+ }:{
|
|
|
+ ChartInfoId: chartInfo.value.ChartInfoId,
|
|
|
+ Calendar: '',//this.calendar_type
|
|
|
+ SeasonStartDate: '',//this.season_year ? this.season_year[0] : ''
|
|
|
+ SeasonEndDate:'' ,//this.season_year ? this.season_year[1] : ''
|
|
|
+ }
|
|
|
+ const res=await apiChartInfoById(params)
|
|
|
+ if(res.Ret!==200) return
|
|
|
+}
|
|
|
|
|
|
-let timeState=reactive({
|
|
|
+const minDate=new Date(1970, 0, 1)
|
|
|
+const maxDate=new Date(2050, 11, 31)
|
|
|
+let chartState=reactive({
|
|
|
showTimePop:false,
|
|
|
startTime:['2022', '06', '01'],
|
|
|
endTime:['2023', '06', '01'],
|
|
|
- minDate: new Date(1970, 0, 1),
|
|
|
- maxDate: new Date(2050, 11, 31),
|
|
|
+ yearVal:''
|
|
|
})
|
|
|
|
|
|
+// 切换年份选项
|
|
|
+function handleYearChange(item){
|
|
|
+ chartState.yearVal=item.value
|
|
|
+ reloadChartInfo()
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 显示指标详情
|
|
|
+let showEDB=ref(false)
|
|
|
+let showEDBData=ref({})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+function handleUpdateRender(val){
|
|
|
+
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -50,7 +88,7 @@ let timeState=reactive({
|
|
|
<div
|
|
|
class="select-time-box"
|
|
|
v-if="sameOptionType.includes(chartInfo.ChartType)||chartInfo.ChartType===2"
|
|
|
- @click="timeState.showTimePop=true"
|
|
|
+ @click="chartState.showTimePop=true"
|
|
|
>
|
|
|
<span>开始日期</span>
|
|
|
<span>至</span>
|
|
@@ -62,9 +100,10 @@ let timeState=reactive({
|
|
|
<!-- 一般曲线图选择时间区间 -->
|
|
|
<div class="select-year-box" v-if="sameOptionType.includes(chartInfo.ChartType)">
|
|
|
<span
|
|
|
- :class="['item']"
|
|
|
+ :class="['item',chartState.yearVal==item.value?'active':'']"
|
|
|
v-for="item in yearSelectOpt"
|
|
|
:key="item.value"
|
|
|
+ @click="handleYearChange(item)"
|
|
|
>{{item.name}}</span>
|
|
|
<span class="item">全部</span>
|
|
|
</div>
|
|
@@ -77,51 +116,69 @@ let timeState=reactive({
|
|
|
<!-- 指标模块 -->
|
|
|
<div class="edb-list-box">
|
|
|
<div class="list-lable">指标信息</div>
|
|
|
- <van-cell :title="item.EdbName" is-link v-for="item in edbList" :key="item.EdbInfoId"/>
|
|
|
+ <van-cell :title="item.EdbName" is-link v-for="item in edbList" :key="item.EdbInfoId" @click="showEDB=true,showEDBData=item"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 选择日期弹窗 -->
|
|
|
<van-popup
|
|
|
- v-model:show="timeState.showTimePop"
|
|
|
+ v-model:show="chartState.showTimePop"
|
|
|
position="bottom"
|
|
|
>
|
|
|
<div class="time-picker-wrap">
|
|
|
<van-picker-group
|
|
|
title="选择起始时间"
|
|
|
:tabs="['开始时间', '结束时间']"
|
|
|
- @cancel="timeState.showTimePop=false"
|
|
|
+ @cancel="chartState.showTimePop=false"
|
|
|
>
|
|
|
<van-date-picker
|
|
|
- v-model="timeState.startTime"
|
|
|
- :min-date="timeState.minDate"
|
|
|
- :max-date="timeState.maxDate"
|
|
|
+ v-model="chartState.startTime"
|
|
|
+ :min-date="minDate"
|
|
|
+ :max-date="maxDate"
|
|
|
:columns-type="chartInfo.ChartType==2?['year']:['year','month']"
|
|
|
/>
|
|
|
<van-date-picker
|
|
|
- v-model="timeState.endTime"
|
|
|
- :min-date="timeState.minDate"
|
|
|
- :max-date="timeState.maxDate"
|
|
|
+ v-model="chartState.endTime"
|
|
|
+ :min-date="minDate"
|
|
|
+ :max-date="maxDate"
|
|
|
:columns-type="chartInfo.ChartType==2?['year']:['year','month']"
|
|
|
/>
|
|
|
</van-picker-group>
|
|
|
</div>
|
|
|
</van-popup>
|
|
|
|
|
|
- <!-- -->
|
|
|
+ <!-- 指标信息弹窗 -->
|
|
|
+ <van-popup
|
|
|
+ v-model:show="showEDB"
|
|
|
+ position="bottom"
|
|
|
+ round
|
|
|
+ >
|
|
|
+ <EDBInfo
|
|
|
+ :data="showEDBData"
|
|
|
+ @change="handleUpdateRender"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
</template>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.chart-detail-page{
|
|
|
padding: $page-padding;
|
|
|
+ .chart-title{
|
|
|
+ font-size: 36px;
|
|
|
+ margin-bottom: 56px;
|
|
|
+ }
|
|
|
.chart-box{
|
|
|
width: 100%;
|
|
|
height: 700px;
|
|
|
}
|
|
|
.select-year-box{
|
|
|
+ margin: 20px 0;
|
|
|
.item{
|
|
|
display: inline-block;
|
|
|
margin-right: 20px;
|
|
|
+ &.active{
|
|
|
+ color: $theme-color;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|