Commit 732fcbabd5002c48b60aef950904a72338215a85

Authored by fengtao
1 parent 6f565d8f

feat:新增视频管理

1 import { defHttp } from '/@/utils/http/axios'; 1 import { defHttp } from '/@/utils/http/axios';
2 -import { DeviceModel, DeviceQueryParam } from '/@/api/device/model/deviceModel';  
3 -import { ChildDeviceParams } from './model/cameraModel'; 2 +import { CameraModel, CameraQueryParam } from './model/cameraModel';
4 3
5 enum CameraManagerApi { 4 enum CameraManagerApi {
6 - CAMERA_POST_URL = '/yt/video',  
7 - CAMERA_GET_URL = '/yt/video',  
8 - CAMERA_DELETE_URL = '/yt/video',  
9 - CAMERA_GET_DETAIL_URL = '/yt/video', 5 + CAMERA_POST_URL = '/video',
  6 + CAMERA_GET_URL = '/video',
  7 + CAMERA_DELETE_URL = '/video',
  8 + CAMERA_GET_DETAIL_URL = '/video',
10 } 9 }
11 10
12 -export const cameraPage = (params: DeviceQueryParam) => {  
13 - return defHttp.get<DeviceModel>({ 11 +export const cameraPage = (params: CameraQueryParam) => {
  12 + return defHttp.get<CameraQueryParam>({
14 url: CameraManagerApi.CAMERA_GET_URL, 13 url: CameraManagerApi.CAMERA_GET_URL,
15 params, 14 params,
16 }); 15 });
@@ -31,7 +30,7 @@ export const deleteCameraManage = (ids: string[]) => { @@ -31,7 +30,7 @@ export const deleteCameraManage = (ids: string[]) => {
31 30
32 // 创建或编辑视频 31 // 创建或编辑视频
33 export const createOrEditCameraManage = (data) => { 32 export const createOrEditCameraManage = (data) => {
34 - return defHttp.post({ 33 + return defHttp.post<CameraModel>({
35 url: CameraManagerApi.CAMERA_POST_URL, 34 url: CameraManagerApi.CAMERA_POST_URL,
36 data, 35 data,
37 }); 36 });
1 import { BasicPageParams } from '/@/api/model/baseModel'; 1 import { BasicPageParams } from '/@/api/model/baseModel';
2 -export enum DeviceState {  
3 - INACTIVE = 'INACTIVE',  
4 - ONLINE = 'ONLINE',  
5 - OFFLINE = 'OFFLINE',  
6 -}  
7 -export enum DeviceTypeEnum {  
8 - GATEWAY = 'GATEWAY',  
9 - DIRECT_CONNECTION = 'DIRECT_CONNECTION',  
10 - SENSOR = 'SENSOR',  
11 -}  
12 -export type DeviceProfileQueryParam = BasicPageParams & DeviceProfileParam & DeviceId;  
13 -export type DeviceQueryParam = BasicPageParams & DeviceParam;  
14 -export type DeviceParam = {  
15 - name?: string;  
16 - deviceProfileId?: string;  
17 -};  
18 -export type DeviceProfileParam = {  
19 - name?: string;  
20 -};  
21 -export type DeviceId = {  
22 - id?: string;  
23 -}; 2 +export type CameraQueryParam = BasicPageParams & CameraParam;
24 3
25 -export interface DeviceModel {  
26 - id: string; 4 +export type CameraParam = {
  5 + status: true;
27 name: string; 6 name: string;
28 - deviceInfo: any;  
29 - activeTime: string;  
30 - deviceState: DeviceState;  
31 - alarmStatus: number;  
32 - profileId: string;  
33 - label: string;  
34 - lastConnectTime: string;  
35 - deviceType: DeviceTypeEnum;  
36 -} 7 + organizationId: string;
  8 + orderFiled: string;
  9 + orderType: string;
  10 +};
37 11
38 -export interface DeviceProfileModel {  
39 - id: string; 12 +export interface CameraModel {
  13 + avatar?: string;
  14 + brand: string;
  15 + createTime?: '2022-04-19T11:33:13.113Z';
  16 + creator?: string;
  17 + defaultConfig?: string;
  18 + description?: string;
  19 + deviceInfo?: string;
  20 + deviceType?: string;
  21 + enabled?: true;
  22 + icon?: string;
  23 + id?: string;
40 name: string; 24 name: string;
41 - transportType: string;  
42 - createTime: string;  
43 - description: string; 25 + organizationId: string;
  26 + organizationName?: string;
  27 + roleIds?: ['string'];
  28 + sn: string;
  29 + status?: false;
  30 + tenantExpireTime?: '2022-04-19T11:33:13.113Z';
  31 + tenantId?: string;
  32 + tenantProfileId?: string;
  33 + tenantStatus?: 'DISABLED';
  34 + updateTime?: '2022-04-19T11:33:13.113Z';
  35 + updater?: string;
  36 + videoUrl: string;
44 } 37 }
45 -  
46 -export type ChildDeviceParams = BasicPageParams & {  
47 - formId: string;  
48 -};  
1 import { BasicPageParams } from '/@/api/model/baseModel'; 1 import { BasicPageParams } from '/@/api/model/baseModel';
  2 +export enum DeviceState {
  3 + INACTIVE = 'INACTIVE',
  4 + ONLINE = 'ONLINE',
  5 + OFFLINE = 'OFFLINE',
  6 +}
  7 +export enum DeviceTypeEnum {
  8 + GATEWAY = 'GATEWAY',
  9 + DIRECT_CONNECTION = 'DIRECT_CONNECTION',
  10 + SENSOR = 'SENSOR',
  11 +}
2 export type DeviceProfileQueryParam = BasicPageParams & DeviceProfileParam & DeviceId; 12 export type DeviceProfileQueryParam = BasicPageParams & DeviceProfileParam & DeviceId;
3 export type DeviceQueryParam = BasicPageParams & DeviceParam; 13 export type DeviceQueryParam = BasicPageParams & DeviceParam;
4 export type DeviceParam = { 14 export type DeviceParam = {
@@ -13,11 +23,24 @@ export type DeviceId = { @@ -13,11 +23,24 @@ export type DeviceId = {
13 }; 23 };
14 24
15 export interface DeviceModel { 25 export interface DeviceModel {
16 - status: true; 26 + id: string;
  27 + name: string;
  28 + deviceInfo: any;
  29 + activeTime: string;
  30 + deviceState: DeviceState;
  31 + alarmStatus: number;
  32 + profileId: string;
  33 + label: string;
  34 + lastConnectTime: string;
  35 + deviceType: DeviceTypeEnum;
  36 +}
  37 +
  38 +export interface DeviceProfileModel {
  39 + id: string;
17 name: string; 40 name: string;
18 - organizationId: string;  
19 - orderFiled: string;  
20 - orderType: string; 41 + transportType: string;
  42 + createTime: string;
  43 + description: string;
21 } 44 }
22 45
23 export type ChildDeviceParams = BasicPageParams & { 46 export type ChildDeviceParams = BasicPageParams & {
@@ -15,7 +15,8 @@ @@ -15,7 +15,8 @@
15 import { BasicForm, useForm } from '/@/components/Form'; 15 import { BasicForm, useForm } from '/@/components/Form';
16 import { formSchema } from './config.data'; 16 import { formSchema } from './config.data';
17 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; 17 import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
18 - import { saveOrEditAlarmContact } from '/@/api/alarm/contact/alarmContact'; 18 + import { createOrEditCameraManage } from '/@/api/camera/cameraManager';
  19 +
19 import { useMessage } from '/@/hooks/web/useMessage'; 20 import { useMessage } from '/@/hooks/web/useMessage';
20 21
21 export default defineComponent({ 22 export default defineComponent({
@@ -54,7 +55,7 @@ @@ -54,7 +55,7 @@
54 setDrawerProps({ confirmLoading: true }); 55 setDrawerProps({ confirmLoading: true });
55 let saveMessage = '添加成功'; 56 let saveMessage = '添加成功';
56 let updateMessage = '修改成功'; 57 let updateMessage = '修改成功';
57 - await saveOrEditAlarmContact(values, unref(isUpdate)); 58 + await createOrEditCameraManage(values);
58 closeDrawer(); 59 closeDrawer();
59 emit('success'); 60 emit('success');
60 createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); 61 createMessage.success(unref(isUpdate) ? updateMessage : saveMessage);
@@ -6,22 +6,22 @@ import { copyTransFun } from '/@/utils/fnUtils'; @@ -6,22 +6,22 @@ import { copyTransFun } from '/@/utils/fnUtils';
6 export const columns: BasicColumn[] = [ 6 export const columns: BasicColumn[] = [
7 { 7 {
8 title: '视频名字', 8 title: '视频名字',
9 - dataIndex: 'email', 9 + dataIndex: 'name',
10 width: 120, 10 width: 120,
11 }, 11 },
12 { 12 {
13 title: '视频厂家', 13 title: '视频厂家',
14 - dataIndex: 'remark', 14 + dataIndex: 'brand',
15 width: 120, 15 width: 120,
16 }, 16 },
17 { 17 {
18 title: '摄像头编号', 18 title: '摄像头编号',
19 - dataIndex: 'username', 19 + dataIndex: 'sn',
20 width: 120, 20 width: 120,
21 }, 21 },
22 { 22 {
23 title: '视频流', 23 title: '视频流',
24 - dataIndex: 'wechat', 24 + dataIndex: 'videoUrl',
25 width: 120, 25 width: 120,
26 }, 26 },
27 { 27 {
@@ -27,6 +27,11 @@ @@ -27,6 +27,11 @@
27 <TableAction 27 <TableAction
28 :actions="[ 28 :actions="[
29 { 29 {
  30 + label: '预览',
  31 + icon: 'clarity:note-edit-line',
  32 + onClick: handleViewVideo.bind(null, record),
  33 + },
  34 + {
30 label: '编辑', 35 label: '编辑',
31 icon: 'clarity:note-edit-line', 36 icon: 'clarity:note-edit-line',
32 onClick: handleCreateOrEdit.bind(null, record), 37 onClick: handleCreateOrEdit.bind(null, record),
@@ -57,7 +62,7 @@ @@ -57,7 +62,7 @@
57 import { useDrawer } from '/@/components/Drawer'; 62 import { useDrawer } from '/@/components/Drawer';
58 import ContactDrawer from './ContactDrawer.vue'; 63 import ContactDrawer from './ContactDrawer.vue';
59 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree'; 64 import { useResetOrganizationTree, OrganizationIdTree } from '/@/views/common/organizationIdTree';
60 - import { getAlarmContact, deleteAlarmContact } from '/@/api/alarm/contact/alarmContact'; 65 + import { cameraPage, deleteCameraManage } from '/@/api/camera/cameraManager';
61 import { searchFormSchema, columns } from './config.data'; 66 import { searchFormSchema, columns } from './config.data';
62 export default defineComponent({ 67 export default defineComponent({
63 components: { 68 components: {
@@ -79,7 +84,7 @@ @@ -79,7 +84,7 @@
79 // 表格hooks 84 // 表格hooks
80 const [registerTable, { reload }] = useTable({ 85 const [registerTable, { reload }] = useTable({
81 title: '视频列表', 86 title: '视频列表',
82 - api: getAlarmContact, 87 + api: cameraPage,
83 columns, 88 columns,
84 clickToRowSelect: false, 89 clickToRowSelect: false,
85 formConfig: { 90 formConfig: {
@@ -128,13 +133,13 @@ @@ -128,13 +133,13 @@
128 const handleDeleteOrBatchDelete = async (record: Recordable | null) => { 133 const handleDeleteOrBatchDelete = async (record: Recordable | null) => {
129 if (record) { 134 if (record) {
130 try { 135 try {
131 - await deleteAlarmContact([record.id]); 136 + await deleteCameraManage([record.id]);
132 createMessage.success('删除联系人成功'); 137 createMessage.success('删除联系人成功');
133 handleSuccess(); 138 handleSuccess();
134 } catch (e) {} 139 } catch (e) {}
135 } else { 140 } else {
136 try { 141 try {
137 - await deleteAlarmContact(selectedRowIds.value); 142 + await deleteCameraManage(selectedRowIds.value);
138 createMessage.success('批量删除联系人成功'); 143 createMessage.success('批量删除联系人成功');
139 selectedRowIds.value = []; 144 selectedRowIds.value = [];
140 handleSuccess(); 145 handleSuccess();
@@ -147,6 +152,9 @@ @@ -147,6 +152,9 @@
147 searchInfo.organizationId = organizationId; 152 searchInfo.organizationId = organizationId;
148 handleSuccess(); 153 handleSuccess();
149 }; 154 };
  155 + const handleViewVideo = (r) => {
  156 + console.log(r);
  157 + };
150 return { 158 return {
151 searchInfo, 159 searchInfo,
152 hasBatchDelete, 160 hasBatchDelete,
@@ -157,6 +165,7 @@ @@ -157,6 +165,7 @@
157 registerTable, 165 registerTable,
158 registerDrawer, 166 registerDrawer,
159 organizationIdTreeRef, 167 organizationIdTreeRef,
  168 + handleViewVideo,
160 }; 169 };
161 }, 170 },
162 }); 171 });