Browse Source

切换上一张下一张

jwyu 2 years ago
parent
commit
f9ee570fe7

+ 9 - 1
src/api/chart.js

@@ -218,6 +218,14 @@ export default{
      */
     chartRefresh(params){
         return get('/datamanage/chart_info/refresh',params)
+    },
+    /**
+     * 图切换上一张下一张
+     * @param KeyWord
+     * @param ChartClassifyId
+     * @param IsShowMe
+     */
+    chartLocate(params){
+        return get('/my_chart/chart/locate',params)
     }
-
 } 

+ 39 - 9
src/views/chartETA/ChartDetail.vue

@@ -21,6 +21,12 @@ const cachedViewsStore=useCachedViewsStore()
 const route=useRoute()
 const router=useRouter()
 
+let routeQueryData=reactive({
+    chartType:route.query.chartType,
+    id:route.query.id,
+    chartClassifyId:route.query.chartClassifyId,
+})
+
 //获取图详情
 let chartInfoData=null
 let chartInfo=ref(null)
@@ -28,13 +34,13 @@ let chartInfo=ref(null)
 let highChart = ref(null)
 let edbList=ref([])//指标数据
 async function getChartDetail(e){
-    const params=sameOptionType.includes(Number(route.query.chartType))?{
-        ChartInfoId:Number(route.query.id),
+    const params=sameOptionType.includes(Number(routeQueryData.chartType))?{
+        ChartInfoId:Number(routeQueryData.id),
         DateType: chartState.yearVal,
         StartDate: chartState.startTime,
         EndDate: chartState.endTime,
     }:{
-        ChartInfoId:Number(route.query.id),
+        ChartInfoId:Number(routeQueryData.id),
         Calendar: chartState.calendarType,//this.calendar_type
         SeasonStartDate: chartState.startTime,
         SeasonEndDate:chartState.endTime ,
@@ -404,8 +410,8 @@ function deleteChart(){
         showCancelButton:true
     }).then(() => {
         apiChart.deleteClassify({
-            ChartClassifyId:Number(route.query.chartClassifyId),
-            ChartInfoId:Number(route.query.id),
+            ChartClassifyId:Number(routeQueryData.chartClassifyId),
+            ChartInfoId:Number(routeQueryData.id),
         }).then(res=>{
             if(res.Ret===200){
                 cachedViewsStore.removeCaches('ChartETAList')
@@ -421,9 +427,33 @@ function deleteChart(){
     })
 }
 
+//获取图排序列表数据
+const chartSortListData=ref([])
+async function getChartSortList(){
+    const res=await apiChart.chartLocate({
+        KeyWord:route.query.keyword||'',
+        ChartClassifyId:Number(route.query.chartClassifyId),
+        IsShowMe:route.query.IsShowMe=='true'?true:false
+    })
+    if(res.Ret===200){
+        chartSortListData.value=res.Data||[]
+    }
+}
+getChartSortList()
+
 // 切换图
-function handleSwitchChart(type){
-    
+async function handleSwitchChart(type){
+    const index=chartSortListData.value.findIndex((item)=>item.ChartInfoId==routeQueryData.id)
+    let item=null
+    if(type==='prev'){
+        item=index===0?chartSortListData.value[chartSortListData.value.length-1]:chartSortListData.value[index-1]
+    }else{
+        item=index===chartSortListData.value.length-1?chartSortListData.value[0]:chartSortListData.value[index+1]
+    }
+    routeQueryData.id=item.ChartInfoId
+    routeQueryData.chartType=item.ChartType
+    routeQueryData.chartClassifyId=item.ChartClassifyId
+    getChartDetail('init')
 }
 
 
@@ -511,11 +541,11 @@ function handleSwitchChart(type){
         </div>
         <!-- 底部悬浮操作模块 -->
         <div class="fix-bot-action-box">
-            <div class="item" @click="handleSwitchChart('prev')">
+            <div class="item" @click="handleSwitchChart('prev')" v-if="chartSortListData.length>0">
                 <img class="icon" src="@/assets/imgs/icon_arrow.png" alt="">
                 <div>上一张</div>
             </div>
-            <div class="item" @click="handleSwitchChart('next')">
+            <div class="item" @click="handleSwitchChart('next')" v-if="chartSortListData.length>0">
                 <img class="icon" style="transform: rotate(180deg);" src="@/assets/imgs/icon_arrow.png" alt="">
                 <div>下一张</div>
             </div>

+ 2 - 1
src/views/chartETA/List.vue

@@ -29,7 +29,8 @@ const goChartDetail = (item)=>{
         query:{
             id:item.ChartInfoId,
             chartType:item.ChartType,
-            chartClassifyId:listState.cid
+            chartClassifyId:listState.cid,
+            IsShowMe:listState.IsShowMe
         }
     })
 }

+ 2 - 1
src/views/chartETA/Search.vue

@@ -58,7 +58,8 @@ function goDetail(item){
         query:{
             id:item.ChartInfoId,
             chartType:item.ChartType,
-            chartClassifyId:0
+            chartClassifyId:0,
+            keyword:keyword.value
         }
     })
 }