|
@@ -2,55 +2,81 @@
|
|
|
<fs-page class="fs-page-custom">
|
|
|
<fs-crud ref="crudRef" v-bind="crudBinding">
|
|
|
<template #header-middle>
|
|
|
- <el-card style="margin-bottom: 5px;" shadow="hover">
|
|
|
- <div style="height: 500px;" ref="lineRef" id="line-changes"></div>
|
|
|
- </el-card>
|
|
|
+ <el-tabs v-model="tabActiveName" class="chart-tabs" type="border-card" @tab-change="changeTab">
|
|
|
+ <el-tab-pane label="数据趋势" name="dataTendency">
|
|
|
+ <MetricsCards v-model="metrics" :metric-items="options" @change="changeMetric"></MetricsCards>
|
|
|
+ <DataTendencyChart ref="dataTendencyRef"></DataTendencyChart>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="广告结构" name="adStruct">
|
|
|
+ <AdStructChart ref="adStructChartRef"/>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="散点视图" name="s"></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
</template>
|
|
|
+ <template #cell_campaignName="scope">
|
|
|
+ <el-link type="primary" :underline="false" @click="jumpGroup(scope.row)">{{ scope.row.campaignName }}</el-link>
|
|
|
+ </template>
|
|
|
</fs-crud>
|
|
|
</fs-page>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { ref, onMounted, onBeforeMount } from 'vue';
|
|
|
+import { ref, onMounted, onBeforeUnmount, watch,nextTick, onActivated } from 'vue';
|
|
|
import { useFs, FsPage } from '@fast-crud/fast-crud';
|
|
|
import { createCrudOptions } from './crud';
|
|
|
-import * as echarts from 'echarts';
|
|
|
+import { useShopInfo } from '/@/stores/shopInfo'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
+import MetricsCards from '/@/components/MetricsCards/index.vue'
|
|
|
+import AdStructChart from './chartComponents/adStruct.vue'
|
|
|
+import DataTendencyChart from './chartComponents/dataTendency.vue'
|
|
|
|
|
|
-const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} });
|
|
|
-const lineRef = ref()
|
|
|
-let chartObj:any = null
|
|
|
+const tabActiveName = ref("dataTendency")
|
|
|
+const shopInfo = useShopInfo()
|
|
|
+const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {query: { profile_id: shopInfo.profile.profile_id }} });
|
|
|
|
|
|
+const metrics = ref([{metric: 'ACOS', color: 'blue'}])
|
|
|
+const options = ref([
|
|
|
+ {label: 'ACOS', value: 'ACOS', metricVal: "18.00%", preVal: '20.15%', gapVal: '-2.00%', disabled:true},
|
|
|
+ {label: '点击量', value: 'clicks', metricVal: "19.00%", preVal: '20.15%', gapVal: '-1.00%', disabled:true},
|
|
|
+ {label: '曝光量', value: 'impression', metricVal: "20.00%", preVal: '15.00%', gapVal: '5.00%', disabled:true},
|
|
|
+ {label: '转化率1', value: 'rate1', metricVal: "1.00%", preVal: '15.00%', gapVal: '5.00%', disabled:true},
|
|
|
+ {label: '转化率2', value: 'rate2', metricVal: "2.00%", preVal: '15.00%', gapVal: '5.00%', disabled:true},
|
|
|
+ {label: '转化率3', value: 'rate3', metricVal: "3.00%", preVal: '15.00%', gapVal: '5.00%', disabled:true},
|
|
|
+ {label: '转化率4', value: 'rate4', metricVal: "4.00%", preVal: '15.00%', gapVal: '5.00%'},
|
|
|
+ {label: '转化率5', value: 'rate5', metricVal: "5.00%", preVal: '15.00%', gapVal: '5.00%'},
|
|
|
+ {label: '转化率6', value: 'rate6', metricVal: "6.00%", preVal: '15.00%', gapVal: '5.00%'},
|
|
|
+])
|
|
|
+const adStructChartRef = ref()
|
|
|
+const dataTendencyRef = ref()
|
|
|
+const route = useRoute()
|
|
|
+const router = useRouter()
|
|
|
onMounted(() => {
|
|
|
crudExpose.doRefresh();
|
|
|
- // initLine()
|
|
|
- setTimeout(() => { initLine() }, 0);
|
|
|
- window.addEventListener('resize', () => chartObj.resize())
|
|
|
-});
|
|
|
-
|
|
|
-onBeforeMount(() => {
|
|
|
- if(chartObj) {
|
|
|
- chartObj.dispose()
|
|
|
- chartObj = null
|
|
|
- }
|
|
|
})
|
|
|
|
|
|
-const initLine = () => {
|
|
|
- chartObj = echarts.init(lineRef.value)
|
|
|
- const option = {
|
|
|
- xAxis: {
|
|
|
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
|
- },
|
|
|
- yAxis: {},
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'bar',
|
|
|
- data: [23, 24, 18, 25, 27, 28, 25]
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- chartObj.setOption(option)
|
|
|
+const changeTab = () => {
|
|
|
+ nextTick(() => {
|
|
|
+ adStructChartRef.value.resizeChart()
|
|
|
+ dataTendencyRef.value.resizeChart()
|
|
|
+ })
|
|
|
+}
|
|
|
+const changeMetric = () => {
|
|
|
+ console.log(metrics.value)
|
|
|
+}
|
|
|
+const jumpGroup = (row: any) => {
|
|
|
+ router.push({
|
|
|
+ name: 'CampaignDetail',
|
|
|
+ query: { id: row.id, campaignId: row.campaignId, tagsViewName: row.campaignName },
|
|
|
+ })
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
+<style lang="scss">
|
|
|
+.chart-tabs {
|
|
|
+ margin: 5px 0;
|
|
|
+ .el-tabs__nav {
|
|
|
+ padding-left: 0 !important;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
</style>
|