|
|
@@ -3,7 +3,7 @@
|
|
|
<div class="mb-4 flex items-center gap-2 flex-wrap">
|
|
|
<el-select v-model="selectedChannel" placeholder="请选择渠道" @change="handleChannelChange" v-if="isAdmin">
|
|
|
<el-option label="全部渠道" value="" />
|
|
|
- <el-option v-for="item in channelOptions" :key="item" :label="item" :value="item" />
|
|
|
+ <el-option v-for="item in channelStore.channelOptions" :key="item" :label="item" :value="item" />
|
|
|
</el-select>
|
|
|
<el-button :icon="Refresh" circle @click="refreshData" :loading="loading" />
|
|
|
</div>
|
|
|
@@ -82,15 +82,16 @@ import { ref, onMounted, inject } from 'vue'
|
|
|
import * as echarts from 'echarts'
|
|
|
import { http } from '@/plugins/http'
|
|
|
import { Refresh } from '@vicons/tabler'
|
|
|
+import { useChannelStore } from '@/stores/channel'
|
|
|
|
|
|
const isAdmin = inject('isAdminAndOperator')
|
|
|
const chartRef = ref(null)
|
|
|
let chart = null
|
|
|
const selectedChannel = ref('')
|
|
|
-const channelOptions = ref([])
|
|
|
const loading = ref(false)
|
|
|
const selectedDate = ref(null)
|
|
|
const dateRange = ref(null)
|
|
|
+const channelStore = useChannelStore()
|
|
|
const todayData = ref({
|
|
|
date: '',
|
|
|
total: 0,
|
|
|
@@ -107,7 +108,7 @@ onMounted(() => {
|
|
|
})
|
|
|
|
|
|
// 获取渠道列表并加载全部渠道数据
|
|
|
- getChannelList()
|
|
|
+ channelStore.fetchChannelOptions()
|
|
|
handleChannelChange('')
|
|
|
})
|
|
|
|
|
|
@@ -130,17 +131,6 @@ async function getTodayData(channelName) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 获取渠道列表
|
|
|
-async function getChannelList() {
|
|
|
- try {
|
|
|
- const response = await http.post('/ocrChannel/names')
|
|
|
- console.log('获取渠道列表成功:', response.data)
|
|
|
- channelOptions.value = response.data || []
|
|
|
- } catch (error) {
|
|
|
- console.error('获取渠道列表失败:', error)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 处理日期变化
|
|
|
function handleDateChange() {
|
|
|
refreshData()
|