From 7308148b69df359dffa70033b48f0345c4cbf263 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Thu, 16 Feb 2023 13:45:34 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E8=A7=86=E9=A2=91=E4=B8=AD?= =?UTF-8?q?=E5=BF=83,=20=E4=BB=AA=E8=A1=A8=E7=9B=98=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/media/DashBoard/components/Card.vue | 79 ++++++++++++++-- src/views/media/DashBoard/index.vue | 90 ++++++++++++++----- src/views/media/DashBoard/typings.d.ts | 2 +- .../media/Home/components/BasicCountCard.vue | 4 +- 4 files changed, 142 insertions(+), 33 deletions(-) diff --git a/src/views/media/DashBoard/components/Card.vue b/src/views/media/DashBoard/components/Card.vue index 3ace789d..4c3c64bf 100644 --- a/src/views/media/DashBoard/components/Card.vue +++ b/src/views/media/DashBoard/components/Card.vue @@ -1,5 +1,5 @@ diff --git a/src/views/media/DashBoard/index.vue b/src/views/media/DashBoard/index.vue index e4190862..e9b1a75b 100644 --- a/src/views/media/DashBoard/index.vue +++ b/src/views/media/DashBoard/index.vue @@ -34,8 +34,12 @@ :value="aggPlayingTotal" /> - - + + @@ -50,6 +54,7 @@ import dashboardApi from '@/api/media/dashboard'; import type { Footer } from '@/views/media/DashBoard/typings'; import encodeQuery from '@/utils/encodeQuery'; import { timestampFormat } from '@/utils/utils'; +import moment from 'moment'; // 设备 const deviceFooter = ref([]); @@ -114,10 +119,12 @@ const aggTotal = ref(0); const getAggData = () => { dashboardApi.agg().then((res) => { aggTotal.value = res.result.total; - aggFooter.value.push({ - title: '总时长', - value: timestampFormat(res.result.duration), - }); + aggFooter.value = [ + { + title: '总时长', + value: timestampFormat(res.result.duration), + }, + ]; }); }; getAggData(); @@ -128,10 +135,12 @@ const aggPlayingTotal = ref(0); const getAggPlayingData = () => { dashboardApi.aggPlaying().then((res) => { aggTotal.value = res.result.playingTotal; - aggPlayingFooter.value.push({ - title: '播放人数', - value: res.result.playerTotal, - }); + aggPlayingFooter.value = [ + { + title: '播放人数', + value: res.result.playerTotal, + }, + ]; }); }; getAggPlayingData(); @@ -140,24 +149,61 @@ getAggPlayingData(); * 获取播放数量(人次) */ const chartData = ref([]); -const getPlayCount = async () => { - const params = {}; - dashboardApi.getPlayCount(params).then((res) => { - let result: any = []; - res.result.forEach((item: any) => { - result = [...result, ...item.data]; +const getPlayCount = async (params: any) => { + let _time = '1h'; + let _limit = 12; + const dt = params.time.end - params.time.start; + const hour = 60 * 60 * 1000; + const day = hour * 24; + const month = day * 30; + const year = 365 * day; + if (dt <= day) { + _limit = Math.abs(Math.ceil(dt / hour)); + } else if (dt > day && dt < year) { + _limit = Math.abs(Math.ceil(dt / day)); + _time = '1d'; + } else if (dt >= year) { + _limit = Math.abs(Math.floor(dt / month)); + _time = '1M'; + } + dashboardApi + .getPlayCount([ + { + dashboard: 'media_stream', + object: 'play_count', + measurement: 'quantity', + dimension: 'agg', + group: 'playCount', + params: { + time: _time, + from: moment(Number(params.time.start)).format( + 'YYYY-MM-DD HH:mm:ss', + ), + to: moment(Number(params.time.end)).format( + 'YYYY-MM-DD HH:mm:ss', + ), + limit: _limit, + }, + }, + ]) + .then((res) => { + let result: any = []; + res.result.forEach((item: any) => { + result = [...result, ...item.data]; + }); + chartData.value = result.map((m: any) => ({ + x: m.timeString, + value: m.value, + })); }); - chartData.value = result.map((m: any) => ({ - x: m.timeString, - value: m.value, - })); - }); }; -getPlayCount(); diff --git a/src/views/media/DashBoard/typings.d.ts b/src/views/media/DashBoard/typings.d.ts index 67b6e20c..f344c699 100644 --- a/src/views/media/DashBoard/typings.d.ts +++ b/src/views/media/DashBoard/typings.d.ts @@ -11,6 +11,6 @@ export type AggPlaying = { export type Footer = { title: string; value: number | string; - status?: "default" | "error" | "success" | "warning" | "processing" + status?: "default" | "error" | "success" | "warning" | "processing" | "" } diff --git a/src/views/media/Home/components/BasicCountCard.vue b/src/views/media/Home/components/BasicCountCard.vue index 53cb6d36..203b9a14 100644 --- a/src/views/media/Home/components/BasicCountCard.vue +++ b/src/views/media/Home/components/BasicCountCard.vue @@ -36,10 +36,10 @@ onMounted(() => { }); const getData = () => { - homeApi.deviceCount().then((resp) => { + homeApi.deviceCount({}).then((resp) => { deviceCount.value = resp.result; }); - homeApi.channelCount().then((resp) => { + homeApi.channelCount({}).then((resp) => { channelCount.value = resp.result; }); }; From b2653adda5543949e27560f40c0d1011874e95b0 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Thu, 16 Feb 2023 14:03:46 +0800 Subject: [PATCH 2/7] =?UTF-8?q?update:=20=E4=BB=A3=E7=A0=81=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E6=94=AF=E6=8C=81=E8=84=9A=E6=9C=AC=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MonacoEditor/index.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/MonacoEditor/index.vue b/src/components/MonacoEditor/index.vue index 9b8b725c..6762be92 100644 --- a/src/components/MonacoEditor/index.vue +++ b/src/components/MonacoEditor/index.vue @@ -13,7 +13,7 @@ import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'; import tsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker'; self.MonacoEnvironment = { - getWorker(workerId, label) { + getWorker(_, label) { if (label === 'json') { return new jsonWorker(); } @@ -23,7 +23,7 @@ self.MonacoEnvironment = { if (label === 'html') { return new htmlWorker(); } - if (label === 'ts') { + if (['typescript', 'javascript'].includes(label)) { return new tsWorker(); } return new editorWorker(); @@ -33,6 +33,7 @@ self.MonacoEnvironment = { const props = defineProps({ modelValue: [String, Number], theme: { type: String, default: 'vs-dark' }, + language: { type: String, default: 'json' }, }); const emit = defineEmits(['update:modelValue']); @@ -42,10 +43,10 @@ const dom = ref(); let instance; onMounted(() => { - const jsonModel = monaco.editor.createModel(props.modelValue, 'json'); + const _model = monaco.editor.createModel(props.modelValue, props.language); instance = monaco.editor.create(dom.value, { - model: jsonModel, + model: _model, tabSize: 2, automaticLayout: true, scrollBeyondLastLine: false, From bf6c705eda5d30881a2ee2b954de3e123e6cc078 Mon Sep 17 00:00:00 2001 From: wangshuaiswim Date: Thu, 16 Feb 2023 14:31:44 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DPermissionButton?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PermissionButton/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PermissionButton/index.vue b/src/components/PermissionButton/index.vue index ee9af547..57268e91 100644 --- a/src/components/PermissionButton/index.vue +++ b/src/components/PermissionButton/index.vue @@ -100,8 +100,8 @@ const isPermission = computed(() => { }) const _isPermission = computed(() => 'hasPermission' in props && isPermission.value - ? 'disabled' in buttonProps - ? buttonProps.disabled as boolean + ? 'disabled' in _buttonProps + ? _buttonProps.disabled as boolean : false : true ) From 40a62317d90ef8f095b1d1d0d9bfd616c9f32d25 Mon Sep 17 00:00:00 2001 From: leiqiaochu Date: Thu, 16 Feb 2023 16:05:29 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=E5=91=8A=E8=AD=A6=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E4=BB=AA=E8=A1=A8=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/rule-engine/Instance/index.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/rule-engine/Instance/index.vue b/src/views/rule-engine/Instance/index.vue index d47885f7..f0923f3f 100644 --- a/src/views/rule-engine/Instance/index.vue +++ b/src/views/rule-engine/Instance/index.vue @@ -1,6 +1,6 @@ @@ -209,8 +209,8 @@ const columns = [ }, { title: '说明', - dataIndex: 'describe', - key: 'describe', + dataIndex: 'description', + key: 'description', }, { title: '操作', From 293bba37a11ef2b0413836abe5ca65a9cbea542c Mon Sep 17 00:00:00 2001 From: leiqiaochu Date: Thu, 16 Feb 2023 16:07:14 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E5=91=8A=E8=AD=A6=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E4=BB=AA=E8=A1=A8=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/rule-engine/dashboard.ts | 20 + src/views/device/DashBoard/index.vue | 3 +- .../DashBoard/components/Charts.vue | 43 ++ .../DashBoard/components/Guide.vue | 60 ++ .../DashBoard/components/NewAlarm.vue | 152 +++++ .../DashBoard/components/TimeSelect.vue | 117 ++++ .../DashBoard/components/TopCard.vue | 106 ++++ src/views/rule-engine/DashBoard/index.vue | 547 ++++++++++++++++++ src/views/rule-engine/DashBoard/typings.d.ts | 5 + vite.config.ts | 4 +- 10 files changed, 1054 insertions(+), 3 deletions(-) create mode 100644 src/api/rule-engine/dashboard.ts create mode 100644 src/views/rule-engine/DashBoard/components/Charts.vue create mode 100644 src/views/rule-engine/DashBoard/components/Guide.vue create mode 100644 src/views/rule-engine/DashBoard/components/NewAlarm.vue create mode 100644 src/views/rule-engine/DashBoard/components/TimeSelect.vue create mode 100644 src/views/rule-engine/DashBoard/components/TopCard.vue create mode 100644 src/views/rule-engine/DashBoard/index.vue create mode 100644 src/views/rule-engine/DashBoard/typings.d.ts diff --git a/src/api/rule-engine/dashboard.ts b/src/api/rule-engine/dashboard.ts new file mode 100644 index 00000000..7563bbeb --- /dev/null +++ b/src/api/rule-engine/dashboard.ts @@ -0,0 +1,20 @@ +import server from '@/utils/request'; +/** + * 获取今日及当月告警数量 + */ +export const dashboard = (data:Record)=> server.post('/dashboard/_multi',data); + +/** + * + */ +export const getAlarm = (params:Record) => server.get('/alarm/record/_query',params); + +/** + * 获取告警数量 + */ +export const getAlarmConfigCount = (data:Record) => server.post('/alarm/config/_count',data); + +/** + * 获取报警等级 + */ +export const getAlarmLevel = () => server.get('/alarm/config/default/level'); \ No newline at end of file diff --git a/src/views/device/DashBoard/index.vue b/src/views/device/DashBoard/index.vue index e1a8a051..d1722caf 100644 --- a/src/views/device/DashBoard/index.vue +++ b/src/views/device/DashBoard/index.vue @@ -40,7 +40,7 @@ - +
@@ -452,6 +452,7 @@ const getEcharts = (data: any) => { _time = '1M'; format = 'yyyy年-M月'; } + dashboard([ { dashboard: 'device', diff --git a/src/views/rule-engine/DashBoard/components/Charts.vue b/src/views/rule-engine/DashBoard/components/Charts.vue new file mode 100644 index 00000000..9c5a4031 --- /dev/null +++ b/src/views/rule-engine/DashBoard/components/Charts.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/src/views/rule-engine/DashBoard/components/Guide.vue b/src/views/rule-engine/DashBoard/components/Guide.vue new file mode 100644 index 00000000..c423d252 --- /dev/null +++ b/src/views/rule-engine/DashBoard/components/Guide.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/src/views/rule-engine/DashBoard/components/NewAlarm.vue b/src/views/rule-engine/DashBoard/components/NewAlarm.vue new file mode 100644 index 00000000..6c7125d8 --- /dev/null +++ b/src/views/rule-engine/DashBoard/components/NewAlarm.vue @@ -0,0 +1,152 @@ + + + + \ No newline at end of file diff --git a/src/views/rule-engine/DashBoard/components/TimeSelect.vue b/src/views/rule-engine/DashBoard/components/TimeSelect.vue new file mode 100644 index 00000000..eaa86387 --- /dev/null +++ b/src/views/rule-engine/DashBoard/components/TimeSelect.vue @@ -0,0 +1,117 @@ + + + diff --git a/src/views/rule-engine/DashBoard/components/TopCard.vue b/src/views/rule-engine/DashBoard/components/TopCard.vue new file mode 100644 index 00000000..13c5fcac --- /dev/null +++ b/src/views/rule-engine/DashBoard/components/TopCard.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/src/views/rule-engine/DashBoard/index.vue b/src/views/rule-engine/DashBoard/index.vue new file mode 100644 index 00000000..b07a1130 --- /dev/null +++ b/src/views/rule-engine/DashBoard/index.vue @@ -0,0 +1,547 @@ + + + + \ No newline at end of file diff --git a/src/views/rule-engine/DashBoard/typings.d.ts b/src/views/rule-engine/DashBoard/typings.d.ts new file mode 100644 index 00000000..87e0dde4 --- /dev/null +++ b/src/views/rule-engine/DashBoard/typings.d.ts @@ -0,0 +1,5 @@ +export type Footer = { + title: string; + value: number | string; + status?: "default" | "error" | "success" | "warning" | "processing" +} \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 9c86c17e..3fca4903 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -82,8 +82,8 @@ export default defineConfig(({ mode}) => { // target: 'http://192.168.33.22:8800', // target: 'http://192.168.32.244:8881', // target: 'http://47.112.135.104:5096', // opcua - // target: 'http://120.77.179.54:8844', // 120测试 - target: 'http://47.108.63.174:8845', // 测试 + target: 'http://120.77.179.54:8844', // 120测试 + // target: 'http://47.108.63.174:8845', // 测试 changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '') } From 693c9d3311d4348cef2ecc39ea27af983d546015 Mon Sep 17 00:00:00 2001 From: JiangQiming <291854119@qq.com> Date: Thu, 16 Feb 2023 16:13:23 +0800 Subject: [PATCH 6/7] =?UTF-8?q?feat:=20=E8=A7=86=E9=A2=91=E4=B8=AD?= =?UTF-8?q?=E5=BF=83-=E8=A7=86=E9=A2=91=E8=AE=BE=E5=A4=87=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/media/device.ts | 13 + src/components/AIcon/index.tsx | 5 +- src/views/media/Device/Save/index.vue | 7 + src/views/media/Device/index.vue | 334 ++++++++++++++++++++++++++ src/views/media/Device/typings.d.ts | 24 ++ 5 files changed, 382 insertions(+), 1 deletion(-) create mode 100644 src/api/media/device.ts create mode 100644 src/views/media/Device/Save/index.vue create mode 100644 src/views/media/Device/index.vue create mode 100644 src/views/media/Device/typings.d.ts diff --git a/src/api/media/device.ts b/src/api/media/device.ts new file mode 100644 index 00000000..d16d117e --- /dev/null +++ b/src/api/media/device.ts @@ -0,0 +1,13 @@ +import server from '@/utils/request' + +export default { + // 列表 + list: (data: any) => server.post(`/media/device/_query/`, data), + // 详情 + detail: (id: string): any => server.get(`/media/device/${id}`), + // 新增 + save: (data: any) => server.post(`/media/device/${data.channel}`, data), + // 修改 + update: (data: any) => server.put(`/media/device/${data.channel}/${data.id}`, data), + del: (id: string) => server.remove(`/media/device/${id}`), +} \ No newline at end of file diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx index 7a8a21b3..4ebea3b2 100644 --- a/src/components/AIcon/index.tsx +++ b/src/components/AIcon/index.tsx @@ -45,7 +45,10 @@ const iconKeys = [ 'InfoCircleOutlined', 'SearchOutlined', 'EllipsisOutlined', - 'ClockCircleOutlined' + 'ClockCircleOutlined', + 'PartitionOutlined', + 'ShareAltOutlined', + 'playCircleOutlined', ] const Icon = (props: {type: string}) => { diff --git a/src/views/media/Device/Save/index.vue b/src/views/media/Device/Save/index.vue new file mode 100644 index 00000000..e84d2a3b --- /dev/null +++ b/src/views/media/Device/Save/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/media/Device/index.vue b/src/views/media/Device/index.vue new file mode 100644 index 00000000..141caa50 --- /dev/null +++ b/src/views/media/Device/index.vue @@ -0,0 +1,334 @@ + + + + diff --git a/src/views/media/Device/typings.d.ts b/src/views/media/Device/typings.d.ts new file mode 100644 index 00000000..995964b8 --- /dev/null +++ b/src/views/media/Device/typings.d.ts @@ -0,0 +1,24 @@ +type BaseItem = { + id: string; + name: string; +}; +type State = { + value: string; + text: string; +}; + +export type DeviceItem = { + photoUrl?: string; + channelNumber: number; + createTime: number; + firmware: string; + gatewayId: string; + host: string; + manufacturer: string; + model: string; + port: number; + provider: string; + state: State; + streamMode: string; + transport: string; +} & BaseItem; From 24690e1cdb1e43728859da49b1b5823fad51355f Mon Sep 17 00:00:00 2001 From: wangshuaiswim Date: Thu, 16 Feb 2023 16:22:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E9=87=8D=E5=A4=8D=E7=82=B9=E5=87=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PermissionButton/index.vue | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/components/PermissionButton/index.vue b/src/components/PermissionButton/index.vue index 57268e91..cd95769d 100644 --- a/src/components/PermissionButton/index.vue +++ b/src/components/PermissionButton/index.vue @@ -4,14 +4,14 @@ - + - +