|
@@ -0,0 +1,65 @@
|
|
|
+<script setup> // 图表预览页面和东吴的预览页面一样,但是怕后期有个性化修改,所以直接复制过来
|
|
|
+import { reactive, onMounted, ref } from 'vue';
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
+import chart from '@/components/chart.vue';
|
|
|
+import { ChartApi } from '@/request/api';
|
|
|
+import { useChartRender } from '@/hooks/chart/useChartRender';
|
|
|
+
|
|
|
+const route=useRoute()
|
|
|
+
|
|
|
+const state = reactive({
|
|
|
+ options: {},
|
|
|
+ chartInfo: {},
|
|
|
+ dataList: [],
|
|
|
+ sourceName: ''
|
|
|
+});
|
|
|
+
|
|
|
+/* 获取图表数据信息 */
|
|
|
+const loading = ref(false);
|
|
|
+const haveData = ref(false);
|
|
|
+const code = ref(route.query.code);
|
|
|
+
|
|
|
+// 语言 中英文 ch en 默认中文
|
|
|
+const language = ref('zh');
|
|
|
+const getChartInfo = async (type = '') => {
|
|
|
+
|
|
|
+ if (!code.value) {
|
|
|
+ haveData.value = false;
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ loading.value = true;
|
|
|
+ try {
|
|
|
+ const { Data } = await ChartApi.getChart({
|
|
|
+ UniqueCode: code.value || '',
|
|
|
+ });
|
|
|
+ loading.value = false;
|
|
|
+ state.chartInfo = Data.ChartInfo;
|
|
|
+ state.dataList = Data.ChartInfo.Source === 1 ? Data.EdbInfoList : [Data.EdbInfoList[0]];
|
|
|
+
|
|
|
+ state.options = useChartRender(Data, language.value)
|
|
|
+
|
|
|
+ haveData.value = true;
|
|
|
+
|
|
|
+
|
|
|
+ } catch (e) {
|
|
|
+ loading.value = false;
|
|
|
+ haveData.value = false;
|
|
|
+ }
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getChartInfo();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="chart-detail-preivew-page">
|
|
|
+ <chart
|
|
|
+ :options="state.options"
|
|
|
+ :chartId="state.chartInfo.ChartInfoId || 0"
|
|
|
+ :chartInfo="state.chartInfo"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+</template>
|