|
@@ -1,6 +1,6 @@
|
|
|
<script setup>
|
|
|
import { useRoute } from 'vue-router'
|
|
|
-import apiChart from '@/api/modules/chart'
|
|
|
+import apiReport from '@/api/modules/report'
|
|
|
import apiCommon from '@/api/modules/common'
|
|
|
import { Message } from 'tdesign-mobile-vue';
|
|
|
|
|
@@ -20,29 +20,30 @@ function getSystemConfig() {
|
|
|
}
|
|
|
getSystemConfig()
|
|
|
|
|
|
-const chartInfo = ref(null)
|
|
|
-function getChartDetail() {
|
|
|
- chartInfo.value=null
|
|
|
- apiChart.getChartDetail({
|
|
|
- UniqueCode: route.query.UniqueCode,
|
|
|
- MiniSource: 'ht'
|
|
|
- }).then(res => {
|
|
|
- if (res.Ret === 200) {
|
|
|
- chartInfo.value = res.Data
|
|
|
- }
|
|
|
- })
|
|
|
+const chartInfo = ref({
|
|
|
+ UniqueCode: route.query.UniqueCode,
|
|
|
+ ChartName: route.query.ChartName,
|
|
|
+ IsCollect: true,
|
|
|
+ chartId: route.query.chartId
|
|
|
+})
|
|
|
+
|
|
|
+function getChartDetail(obj) {
|
|
|
+ const {chartInfoId, chartName, uniqueCode} = obj
|
|
|
+ chartInfo.value = {
|
|
|
+ chartId: chartInfoId,
|
|
|
+ ChartName: chartName,
|
|
|
+ UniqueCode: uniqueCode,
|
|
|
+ IsCollect: true
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-getChartDetail()
|
|
|
|
|
|
async function handleCollect() {
|
|
|
- const params={
|
|
|
- UniqueCode:chartInfo.value.UniqueCode,
|
|
|
- ChartName:chartInfo.value.ChartName,
|
|
|
- ChartImage:chartInfo.value.ChartImage
|
|
|
+ const data = {
|
|
|
+ sourceType: 'chart',
|
|
|
+ sourceId: Number(chartInfo.value.chartId)
|
|
|
}
|
|
|
- const res=chartInfo.value.IsCollect?await apiChart.chartCollectCancel({
|
|
|
- UniqueCode:chartInfo.value.UniqueCode,
|
|
|
- }):await apiChart.chartCollect(params)
|
|
|
+ const res = chartInfo.value.IsCollect ? await apiReport.reportCollectCancel(data) : await apiReport.reportCollect(data)
|
|
|
if(res.Ret===200){
|
|
|
Message.success(chartInfo.value.IsCollect?'取消收藏成功':'收藏成功')
|
|
|
chartInfo.value.IsCollect=!chartInfo.value.IsCollect
|
|
@@ -61,27 +62,25 @@ const chartRenderUrl = computed(() => {
|
|
|
// 获取图列表切换用
|
|
|
let changeChartList=ref([])
|
|
|
async function getChangeChartList(){
|
|
|
- if(route.query.fromPage!=='myCollect') return
|
|
|
- let res=await apiChart.myChartLocate()
|
|
|
+ // if(route.query.fromPage!=='myCollect') return
|
|
|
+ let res=await apiReport.myChartLocate()
|
|
|
if(res.Ret===200){
|
|
|
- changeChartList.value=res.Data||[]
|
|
|
+ changeChartList.value=res.data.Data||[]
|
|
|
}
|
|
|
}
|
|
|
getChangeChartList()
|
|
|
|
|
|
// 切换上一张下一张
|
|
|
function handleChangeChart(type){
|
|
|
- const index=changeChartList.value.findIndex(e=>e.ChartInfoId==chartId)
|
|
|
+ const index=changeChartList.value.findIndex(e=>e.chartInfoId==chartInfo.value.chartId)
|
|
|
if(type==='pre'){
|
|
|
if(index<1) return Message.warning('当前已是第一张')
|
|
|
const obj=changeChartList.value[index-1]
|
|
|
- chartId=obj.ChartInfoId
|
|
|
- getChartDetail()
|
|
|
+ getChartDetail(obj)
|
|
|
}else{
|
|
|
if(index===changeChartList.value.length-1) return Message.warning('当前已是最后一张')
|
|
|
const obj=changeChartList.value[index+1]
|
|
|
- chartId=obj.ChartInfoId
|
|
|
- getChartDetail()
|
|
|
+ getChartDetail(obj)
|
|
|
}
|
|
|
}
|
|
|
|