Commit fe2fd1ce4d7132bea8a05f9a851cee48354ce6c2
Merge branch 'dev-ft' into 'main'
feat:新增视频管理 See merge request huang/yun-teng-iot-front!200
Showing
6 changed files
with
86 additions
and
65 deletions
| 1 | 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 | 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 | 13 | url: CameraManagerApi.CAMERA_GET_URL, |
| 15 | 14 | params, |
| 16 | 15 | }); |
| ... | ... | @@ -31,7 +30,7 @@ export const deleteCameraManage = (ids: string[]) => { |
| 31 | 30 | |
| 32 | 31 | // 创建或编辑视频 |
| 33 | 32 | export const createOrEditCameraManage = (data) => { |
| 34 | - return defHttp.post({ | |
| 33 | + return defHttp.post<CameraModel>({ | |
| 35 | 34 | url: CameraManagerApi.CAMERA_POST_URL, |
| 36 | 35 | data, |
| 37 | 36 | }); | ... | ... |
| 1 | 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 | 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 | 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 | 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 | 12 | export type DeviceProfileQueryParam = BasicPageParams & DeviceProfileParam & DeviceId; |
| 3 | 13 | export type DeviceQueryParam = BasicPageParams & DeviceParam; |
| 4 | 14 | export type DeviceParam = { |
| ... | ... | @@ -13,11 +23,24 @@ export type DeviceId = { |
| 13 | 23 | }; |
| 14 | 24 | |
| 15 | 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 | 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 | 46 | export type ChildDeviceParams = BasicPageParams & { | ... | ... |
| ... | ... | @@ -15,7 +15,8 @@ |
| 15 | 15 | import { BasicForm, useForm } from '/@/components/Form'; |
| 16 | 16 | import { formSchema } from './config.data'; |
| 17 | 17 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 18 | - import { saveOrEditAlarmContact } from '/@/api/alarm/contact/alarmContact'; | |
| 18 | + import { createOrEditCameraManage } from '/@/api/camera/cameraManager'; | |
| 19 | + | |
| 19 | 20 | import { useMessage } from '/@/hooks/web/useMessage'; |
| 20 | 21 | |
| 21 | 22 | export default defineComponent({ |
| ... | ... | @@ -54,7 +55,7 @@ |
| 54 | 55 | setDrawerProps({ confirmLoading: true }); |
| 55 | 56 | let saveMessage = '添加成功'; |
| 56 | 57 | let updateMessage = '修改成功'; |
| 57 | - await saveOrEditAlarmContact(values, unref(isUpdate)); | |
| 58 | + await createOrEditCameraManage(values); | |
| 58 | 59 | closeDrawer(); |
| 59 | 60 | emit('success'); |
| 60 | 61 | createMessage.success(unref(isUpdate) ? updateMessage : saveMessage); | ... | ... |
| ... | ... | @@ -6,22 +6,22 @@ import { copyTransFun } from '/@/utils/fnUtils'; |
| 6 | 6 | export const columns: BasicColumn[] = [ |
| 7 | 7 | { |
| 8 | 8 | title: '视频名字', |
| 9 | - dataIndex: 'email', | |
| 9 | + dataIndex: 'name', | |
| 10 | 10 | width: 120, |
| 11 | 11 | }, |
| 12 | 12 | { |
| 13 | 13 | title: '视频厂家', |
| 14 | - dataIndex: 'remark', | |
| 14 | + dataIndex: 'brand', | |
| 15 | 15 | width: 120, |
| 16 | 16 | }, |
| 17 | 17 | { |
| 18 | 18 | title: '摄像头编号', |
| 19 | - dataIndex: 'username', | |
| 19 | + dataIndex: 'sn', | |
| 20 | 20 | width: 120, |
| 21 | 21 | }, |
| 22 | 22 | { |
| 23 | 23 | title: '视频流', |
| 24 | - dataIndex: 'wechat', | |
| 24 | + dataIndex: 'videoUrl', | |
| 25 | 25 | width: 120, |
| 26 | 26 | }, |
| 27 | 27 | { | ... | ... |
| ... | ... | @@ -27,6 +27,11 @@ |
| 27 | 27 | <TableAction |
| 28 | 28 | :actions="[ |
| 29 | 29 | { |
| 30 | + label: '预览', | |
| 31 | + icon: 'clarity:note-edit-line', | |
| 32 | + onClick: handleViewVideo.bind(null, record), | |
| 33 | + }, | |
| 34 | + { | |
| 30 | 35 | label: '编辑', |
| 31 | 36 | icon: 'clarity:note-edit-line', |
| 32 | 37 | onClick: handleCreateOrEdit.bind(null, record), |
| ... | ... | @@ -57,7 +62,7 @@ |
| 57 | 62 | import { useDrawer } from '/@/components/Drawer'; |
| 58 | 63 | import ContactDrawer from './ContactDrawer.vue'; |
| 59 | 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 | 66 | import { searchFormSchema, columns } from './config.data'; |
| 62 | 67 | export default defineComponent({ |
| 63 | 68 | components: { |
| ... | ... | @@ -79,7 +84,7 @@ |
| 79 | 84 | // 表格hooks |
| 80 | 85 | const [registerTable, { reload }] = useTable({ |
| 81 | 86 | title: '视频列表', |
| 82 | - api: getAlarmContact, | |
| 87 | + api: cameraPage, | |
| 83 | 88 | columns, |
| 84 | 89 | clickToRowSelect: false, |
| 85 | 90 | formConfig: { |
| ... | ... | @@ -128,13 +133,13 @@ |
| 128 | 133 | const handleDeleteOrBatchDelete = async (record: Recordable | null) => { |
| 129 | 134 | if (record) { |
| 130 | 135 | try { |
| 131 | - await deleteAlarmContact([record.id]); | |
| 136 | + await deleteCameraManage([record.id]); | |
| 132 | 137 | createMessage.success('删除联系人成功'); |
| 133 | 138 | handleSuccess(); |
| 134 | 139 | } catch (e) {} |
| 135 | 140 | } else { |
| 136 | 141 | try { |
| 137 | - await deleteAlarmContact(selectedRowIds.value); | |
| 142 | + await deleteCameraManage(selectedRowIds.value); | |
| 138 | 143 | createMessage.success('批量删除联系人成功'); |
| 139 | 144 | selectedRowIds.value = []; |
| 140 | 145 | handleSuccess(); |
| ... | ... | @@ -147,6 +152,9 @@ |
| 147 | 152 | searchInfo.organizationId = organizationId; |
| 148 | 153 | handleSuccess(); |
| 149 | 154 | }; |
| 155 | + const handleViewVideo = (r) => { | |
| 156 | + console.log(r); | |
| 157 | + }; | |
| 150 | 158 | return { |
| 151 | 159 | searchInfo, |
| 152 | 160 | hasBatchDelete, |
| ... | ... | @@ -157,6 +165,7 @@ |
| 157 | 165 | registerTable, |
| 158 | 166 | registerDrawer, |
| 159 | 167 | organizationIdTreeRef, |
| 168 | + handleViewVideo, | |
| 160 | 169 | }; |
| 161 | 170 | }, |
| 162 | 171 | }); | ... | ... |