|
@@ -20,6 +20,7 @@ import {setClipboardData} from '@/hooks/common'
|
|
|
import SetChartEnName from '@/components/SetChartEnName.vue'
|
|
|
import {useCachedViewsStore} from '@/store/modules/cachedViews'
|
|
|
import AddChartToMyETA from '@/views/chartETA/components/AddChartToMyETA.vue'
|
|
|
+import { setExtremumDate } from '@/hooks/chart/commonFun.js'
|
|
|
|
|
|
const { width, height } = useWindowSize()
|
|
|
const cachedViewsStore=useCachedViewsStore()
|
|
@@ -86,6 +87,13 @@ async function getChartInfo(){
|
|
|
}else{
|
|
|
edbList.value=res.Data.EdbInfoList
|
|
|
}
|
|
|
+ // 设置 起始日期 和 最新日期
|
|
|
+ const extremumDate= setExtremumDate(edbList.value)
|
|
|
+
|
|
|
+ minDate = new Date(extremumDate.earliestDate)
|
|
|
+
|
|
|
+ earliestDate.value = extremumDate.earliestDate
|
|
|
+ latestDate.value = extremumDate.latestDate
|
|
|
|
|
|
chartState.yearVal=res.Data.ChartInfo.DateType
|
|
|
if(res.Data.ChartInfo.DateType===5){
|
|
@@ -99,6 +107,18 @@ async function getChartInfo(){
|
|
|
temStartTime.value=res.Data.ChartInfo.StartDate.split('-')
|
|
|
}
|
|
|
|
|
|
+ if(res.Data.ChartInfo.DateType===20){
|
|
|
+ // 最近几年
|
|
|
+ let latestYear = parseInt(latestDate.value.substring(0,4))
|
|
|
+ chartState.startTime = `${latestYear-chartState.startYear+1}-01-01`
|
|
|
+ chartState.endTime = `${latestYear}-12-31`
|
|
|
+
|
|
|
+ chartState.startTime=res.Data.ChartInfo.StartDate
|
|
|
+ chartState.endTime=res.Data.ChartInfo.EndDate
|
|
|
+ temStartTime.value=chartState.startTime.split('-')
|
|
|
+ temEndTime.value=chartState.endTime.split('-')
|
|
|
+ }
|
|
|
+
|
|
|
nextTick(()=>{
|
|
|
CHARTINS=chartRender({
|
|
|
data:res.Data,
|
|
@@ -109,6 +129,41 @@ async function getChartInfo(){
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+function openDateSelect(){
|
|
|
+ // 回显
|
|
|
+
|
|
|
+ switch (chartState.yearVal) {
|
|
|
+ case 3:
|
|
|
+ temStartTime.value = [2015,1,1]
|
|
|
+ temEndTime.value = latestDate.value.split('-')
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ temStartTime.value = [2020,1,1]
|
|
|
+ temEndTime.value = latestDate.value.split('-')
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ temStartTime.value = [2021,1,1]
|
|
|
+ temEndTime.value = latestDate.value.split('-')
|
|
|
+ break;
|
|
|
+ case 11:
|
|
|
+ temStartTime.value = [2022,1,1]
|
|
|
+ temEndTime.value = latestDate.value.split('-')
|
|
|
+ break;
|
|
|
+ case '':
|
|
|
+ temStartTime.value = earliestDate.value.split('-')
|
|
|
+ temEndTime.value = latestDate.value.split('-')
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ temStartTime.value = chartState.startTime.split('-')
|
|
|
+ temEndTime.value = chartState.endTime.split('-')
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ chartState.showTimePop=true
|
|
|
+}
|
|
|
+
|
|
|
getChartInfo()
|
|
|
|
|
|
// 选择项发生变化时 非配置项 获取新的图表数据
|
|
@@ -120,9 +175,10 @@ async function reloadChartInfo(){
|
|
|
EndDate: chartState.endTime,
|
|
|
}:{
|
|
|
ChartInfoId: chartInfo.value.ChartInfoId,
|
|
|
+ DateType: chartState.yearVal,
|
|
|
Calendar: chartState.calendarType,//this.calendar_type
|
|
|
- SeasonStartDate: chartState.startTime,
|
|
|
- SeasonEndDate:chartState.endTime ,
|
|
|
+ StartDate: chartState.startTime,
|
|
|
+ EndDate:chartState.endTime ,
|
|
|
}
|
|
|
const res=await apiETAChart.chartInfoById(params)
|
|
|
if(res.Ret!==200) return
|
|
@@ -143,18 +199,24 @@ async function reloadChartInfo(){
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-const minDate=new Date(1970, 0, 1)
|
|
|
+let minDate=new Date(1970, 0, 1)
|
|
|
const maxDate=new Date(2050, 11, 31)
|
|
|
const cYear=moment().format('YYYY')
|
|
|
const cMonth=moment().format('MM')
|
|
|
-let temStartTime=ref([cYear,cMonth])
|
|
|
-let temEndTime=ref([cYear,cMonth])
|
|
|
+const cDay=moment().format('dd')
|
|
|
+
|
|
|
+let temStartTime=ref([cYear,cMonth,cDay])
|
|
|
+let temEndTime=ref([cYear,cMonth,cDay])
|
|
|
+const earliestDate=ref('')
|
|
|
+const latestDate=ref('')
|
|
|
+
|
|
|
let chartState=reactive({
|
|
|
showTimePop:false,
|
|
|
startTime:'',
|
|
|
endTime:'',
|
|
|
yearVal:'',
|
|
|
- calendarType:'公历'
|
|
|
+ calendarType:'公历',
|
|
|
+ startYear:5
|
|
|
})
|
|
|
|
|
|
// 切换年份选项
|
|
@@ -169,7 +231,7 @@ function handleYearChange(item){
|
|
|
function handleTimeChange(){
|
|
|
chartState.startTime=temStartTime.value.join('-')
|
|
|
chartState.endTime=temEndTime.value.join('-')
|
|
|
- chartState.yearVal=6
|
|
|
+ chartState.yearVal=5
|
|
|
reloadChartInfo()
|
|
|
chartState.showTimePop=false
|
|
|
}
|
|
@@ -509,7 +571,7 @@ const isShowAddToMyETADialog=ref(false)
|
|
|
<div
|
|
|
class="select-time-box"
|
|
|
v-if="(sameOptionType.includes(chartInfo.ChartType)&& chartInfo.Source===1)||chartInfo.ChartType===2"
|
|
|
- @click="chartState.showTimePop=true"
|
|
|
+ @click="openDateSelect"
|
|
|
>
|
|
|
<img class="left-icon" src="@/assets/imgs/icon_calendar.png" alt="">
|
|
|
<span :class="['val-box',!chartState.startTime?'val-box_grey':'']">{{chartState.startTime||'开始日期'}} ~ {{chartState.startTime&&!chartState.endTime?'至今':chartState.endTime||'结束日期'}}</span>
|
|
@@ -531,7 +593,7 @@ const isShowAddToMyETADialog=ref(false)
|
|
|
<span
|
|
|
class="time-box"
|
|
|
v-if="(sameOptionType.includes(chartInfo.ChartType)&& chartInfo.Source===1)||chartInfo.ChartType===2"
|
|
|
- @click="chartState.showTimePop=true"
|
|
|
+ @click="openDateSelect"
|
|
|
>{{chartState.startTime?chartState.startTime+'~'+(chartState.endTime?chartState.endTime:'至今'):'请选择时间段'}}</span>
|
|
|
</div>
|
|
|
<div class="right-action-box">
|
|
@@ -625,13 +687,13 @@ const isShowAddToMyETADialog=ref(false)
|
|
|
v-model="temStartTime"
|
|
|
:min-date="minDate"
|
|
|
:max-date="maxDate"
|
|
|
- :columns-type="chartInfo.ChartType==2?['year']:['year','month']"
|
|
|
+ :columns-type="['year','month','day']"
|
|
|
/>
|
|
|
<van-date-picker
|
|
|
v-model="temEndTime"
|
|
|
:min-date="minDate"
|
|
|
:max-date="maxDate"
|
|
|
- :columns-type="chartInfo.ChartType==2?['year']:['year','month']"
|
|
|
+ :columns-type="['year','month','day']"
|
|
|
/>
|
|
|
</van-picker-group>
|
|
|
</div>
|