From d6d989d4b8106b12b6855f3f8757a2ec6d862a24 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Wed, 8 Mar 2023 14:15:18 +0800 Subject: [PATCH 1/9] =?UTF-8?q?update:=20=E8=A7=86=E9=A2=91=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E4=BB=AA=E8=A1=A8=E7=9B=98=E7=BB=84=E4=BB=B6=E6=9B=B4?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/media/DashBoard/components/Card.vue | 79 +++++++++---------- .../media/DashBoard/components/TopCard.vue | 6 +- src/views/media/DashBoard/index.vue | 10 ++- 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/src/views/media/DashBoard/components/Card.vue b/src/views/media/DashBoard/components/Card.vue index 4c3c64bf..5b0ecf2c 100644 --- a/src/views/media/DashBoard/components/Card.vue +++ b/src/views/media/DashBoard/components/Card.vue @@ -3,26 +3,26 @@
{{ title }}
- - + - 今日 - 近一周 - 近一月 - 近一年 - - 今日 + 近一周 + 近一月 + 近一年 + + - +
- + @@ -56,52 +56,49 @@ const chartRef = ref(); const createChart = () => { nextTick(() => { const myChart = echarts.init(chartRef.value as HTMLElement); - + const sData: number[] = props.chartData.map( + (m: any) => m.value && m.value.toFixed(2), + ); + const maxY = Math.max.apply(null, sData.length ? sData : [0]); const options = { grid: { - left: '7%', + left: maxY > 100000 ? 90 : 50, right: '5%', top: '5%', bottom: '5%', }, tooltip: { trigger: 'axis', - // formatter: '{a}
{b}: {c}', - axisPointer: { - type: 'shadow', - }, + formatter: '{b0}
{a0}: {c0}', + }, + xAxis: { + type: 'category', + data: props.chartData.map((m: any) => m.x), + }, + yAxis: { + type: 'value', + // minInterval: 1, }, - xAxis: [ - { - data: props.chartData.map((m: any) => m.x), - }, - ], - yAxis: [ - { - show: false, - axisTick: { - show: false, - }, - axisLine: { - show: false, - }, - splitLine: { - lineStyle: { - type: 'solid', - }, - }, - }, - ], series: [ + { + name: '播放数量(人次)', + data: sData, + type: 'bar', + barWidth: 16, + itemStyle: { + color: '#2f54eb', + }, + }, { name: '播放数量(人次)', type: 'line', symbol: 'circle', showSymbol: false, smooth: true, - data: props.chartData.map( - (m: any) => m.value && m.value.toFixed(2), - ), + lineStyle: { + color: '#a5fff9', + }, + data: sData, }, ], }; @@ -116,8 +113,6 @@ const createChart = () => { watch( () => props.chartData, (val) => { - console.log('createChart', val); - createChart(); }, { deep: true }, diff --git a/src/views/media/DashBoard/components/TopCard.vue b/src/views/media/DashBoard/components/TopCard.vue index c82d296c..9614c455 100644 --- a/src/views/media/DashBoard/components/TopCard.vue +++ b/src/views/media/DashBoard/components/TopCard.vue @@ -4,12 +4,12 @@
{{ title }} - + - +
{{ value }}
@@ -20,7 +20,7 @@ diff --git a/src/views/media/DashBoard/index.vue b/src/views/media/DashBoard/index.vue index a63e690b..7d23194d 100644 --- a/src/views/media/DashBoard/index.vue +++ b/src/views/media/DashBoard/index.vue @@ -123,6 +123,7 @@ const getAggData = () => { { title: '总时长', value: timestampFormat(res.result.duration), + status: '', }, ]; }); @@ -139,6 +140,7 @@ const getAggPlayingData = () => { { title: '播放人数', value: res.result.playerTotal, + status: '', }, ]; }); @@ -188,9 +190,11 @@ const getPlayCount = async (params: any) => { ]) .then((res) => { let result: any = []; - res.result.forEach((item: any) => { - result = [...result, ...item.data]; - }); + res.result + .sort((a: any, b: any) => b.data.timestamp - a.data.timestamp) + .forEach((item: any) => { + result.push({ group: item.group, ...item.data }); + }); chartData.value = result.map((m: any) => ({ x: m.timeString, value: m.value, From dfdfbb30bd9774ebf81b9b36783d506e6a95af09 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Wed, 8 Mar 2023 14:59:21 +0800 Subject: [PATCH 2/9] =?UTF-8?q?update:=20=E8=A7=86=E9=A2=91=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=BB=84=E4=BB=B6=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/media/Home/index.vue | 135 +++++++++++++++++++++++- src/views/notice/Config/Log/index.vue | 3 +- src/views/notice/Template/Log/index.vue | 3 +- 3 files changed, 136 insertions(+), 5 deletions(-) diff --git a/src/views/media/Home/index.vue b/src/views/media/Home/index.vue index a6ba21cb..aa888616 100644 --- a/src/views/media/Home/index.vue +++ b/src/views/media/Home/index.vue @@ -21,6 +21,56 @@ /> + + + + + + + + @@ -33,6 +83,13 @@ import BasicCountCard from '@/views/media/Home/components/BasicCountCard.vue'; import { usePermissionStore } from '@/store/permission'; import type { bootConfig, recommendList } from '@/views/home/typing'; +import deviceApi from '@/api/media/device'; +import { message } from 'ant-design-vue'; + +import { useMenuStore } from 'store/menu'; + +const menuStory = useMenuStore(); + // 权限控制 const hasPermission = usePermissionStore().hasPermission; @@ -54,6 +111,7 @@ const deviceBootConfig: bootConfig[] = [ link: 'media/Cascade', }, ]; + const deviceStepDetails: recommendList[] = [ { title: '添加视频设备', @@ -66,8 +124,16 @@ const deviceStepDetails: recommendList[] = [ title: '查看通道', details: '查看设备下的通道数据,可以进行直播、录制等操作。', iconUrl: '/images/home/bottom-7.png', - linkUrl: 'media/Device/Channel', + // linkUrl: 'media/Device/Channel', + linkUrl: '', auth: hasPermission('media/Device:view'), + onClick: (row: any) => { + if (hasPermission('media/Device:view')) { + visible.value = true; + } else { + message.warning('暂无权限,请联系管理员'); + } + }, }, { title: '分屏展示', @@ -76,4 +142,71 @@ const deviceStepDetails: recommendList[] = [ linkUrl: 'media/SplitScreen', }, ]; + +// 选择设备 +const visible = ref(false); +const columns = [ + { + title: 'ID', + dataIndex: 'id', + key: 'id', + search: { + type: 'string', + }, + }, + { + title: '名称', + dataIndex: 'name', + key: 'name', + search: { + type: 'string', + }, + }, + { + title: '通道数量', + dataIndex: 'channelNumber', + key: 'channelNumber', + }, + { + title: '状态', + dataIndex: 'state', + key: 'state', + scopedSlots: true, + search: { + type: 'select', + options: [ + { label: '在线', value: 'online' }, + { label: '离线', value: 'offline' }, + ], + handleValue: (v: any) => { + return v; + }, + }, + }, +]; +const params = ref>({}); + +/** + * 搜索 + * @param params + */ +const handleSearch = (e: any) => { + params.value = e; +}; + +const deviceItem = ref(); +const handleSubmit = () => { + if (deviceItem.value && deviceItem.value.id) { + menuStory.jumpPage( + 'media/Device/Channel', + {}, + { + id: deviceItem.value.id, + type: deviceItem.value.provider, + }, + ); + } else { + message.warning('请选择设备'); + } +}; diff --git a/src/views/notice/Config/Log/index.vue b/src/views/notice/Config/Log/index.vue index 8865041d..c0edb899 100644 --- a/src/views/notice/Config/Log/index.vue +++ b/src/views/notice/Config/Log/index.vue @@ -1,9 +1,8 @@