import { BasicColumn } from '/@/components/Table'; const MANUFACTURER_HIKVISION = 'rtsp://admin:admin123@192.168.0.64:554/Streaming/Channels/1'; const MANUFACTURER_DAHUA = 'http://0.0.0.0:8080/live/'; const manufacturerOptions = [ { label: '海康', value: MANUFACTURER_HIKVISION, }, { label: '大华', value: MANUFACTURER_DAHUA, }, ]; /** 视频流类型 -> 厂家默认值 */ const deviceKindManufacturerMap: Record = { rtsp: MANUFACTURER_HIKVISION, }; function syncManufacturerByDeviceKind(value: string, record: Recordable) { const manufacturer = deviceKindManufacturerMap[value]; if (manufacturer && record?.editValueRefs?.label) { record.editValueRefs.label.value = manufacturer; } } export const columns = [ { title: '设备id', dataIndex: 'deviceid', ifShow: false, editRow: true, textAlign: 'center', }, { title: '摄像头名称', dataIndex: 'name', width: 100, editRow: true, editRule: true, textAlign: 'center', editComponent: 'Textarea', }, { title: '视频流类型', dataIndex: 'devicekind', width: 100, editRow: true, editRule: true, editComponent: 'Select', textAlign: 'center', editComponentProps: { options: [ { label: 'rtsp', value: 'rtsp', }, { label: 'HLS ', value: 'HLS', }, { label: 'flv', value: 'flv', }, { label: '园子沟转URL', value: 'YZG_URL', }, { label: '红柳林code转URl', value: 'HLL', }, { label: '海康平台转换rtsp', value: 'toHKRtsp', }, { label: '海康平台转换hls', value: 'toHKHLs', }, ], }, onEditChange: ({ value, record }) => { syncManufacturerByDeviceKind(value, record); }, }, { title: '摄像头地址', dataIndex: 'addr', width: 100, editRow: true, textAlign: 'center', editComponent: 'Textarea', }, { title: '播放倍速', dataIndex: 'cameraRate', width: 70, editRow: true, textAlign: 'center', editComponent: 'Select', editComponentProps: { options: [ { label: '0.5', value: 0.5, }, { label: '1 ', value: 1, }, { label: '1.5', value: 1.5, }, { label: '2', value: 2, }, ], }, }, { title: 'IP', dataIndex: 'ip', width: 100, editRow: true, editRule: true, textAlign: 'center', editComponent: 'Textarea', }, { title: '端口号', width: 70, dataIndex: 'port', editRow: true, editRule: true, editComponent: 'InputNumber', textAlign: 'center', }, { title: '摄像头用户', dataIndex: 'username', width: 70, editRow: true, textAlign: 'center', }, { title: '控制密码', dataIndex: 'password', width: 70, editRow: true, editRule: true, textAlign: 'center', }, { title: '厂家', dataIndex: 'label', width: 70, editRow: true, editRule: true, editComponent: 'Select', textAlign: 'center', editComponentProps: { options: manufacturerOptions, }, }, ];