camera.data.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. import { BasicColumn } from '/@/components/Table';
  2. const MANUFACTURER_HIKVISION = 'rtsp://admin:admin123@192.168.0.64:554/Streaming/Channels/1';
  3. const MANUFACTURER_DAHUA = 'http://0.0.0.0:8080/live/';
  4. const manufacturerOptions = [
  5. {
  6. label: '海康',
  7. value: MANUFACTURER_HIKVISION,
  8. },
  9. {
  10. label: '大华',
  11. value: MANUFACTURER_DAHUA,
  12. },
  13. ];
  14. /** 视频流类型 -> 厂家默认值 */
  15. const deviceKindManufacturerMap: Record<string, string> = {
  16. rtsp: MANUFACTURER_HIKVISION,
  17. };
  18. function syncManufacturerByDeviceKind(value: string, record: Recordable) {
  19. const manufacturer = deviceKindManufacturerMap[value];
  20. if (manufacturer && record?.editValueRefs?.label) {
  21. record.editValueRefs.label.value = manufacturer;
  22. }
  23. }
  24. export const columns = [
  25. {
  26. title: '设备id',
  27. dataIndex: 'deviceid',
  28. ifShow: false,
  29. editRow: true,
  30. textAlign: 'center',
  31. },
  32. {
  33. title: '摄像头名称',
  34. dataIndex: 'name',
  35. width: 100,
  36. editRow: true,
  37. editRule: true,
  38. textAlign: 'center',
  39. editComponent: 'Textarea',
  40. },
  41. {
  42. title: '视频流类型',
  43. dataIndex: 'devicekind',
  44. width: 100,
  45. editRow: true,
  46. editRule: true,
  47. editComponent: 'Select',
  48. textAlign: 'center',
  49. editComponentProps: {
  50. options: [
  51. {
  52. label: 'rtsp',
  53. value: 'rtsp',
  54. },
  55. {
  56. label: 'HLS ',
  57. value: 'HLS',
  58. },
  59. {
  60. label: 'flv',
  61. value: 'flv',
  62. },
  63. {
  64. label: '园子沟转URL',
  65. value: 'YZG_URL',
  66. },
  67. {
  68. label: '红柳林code转URl',
  69. value: 'HLL',
  70. },
  71. {
  72. label: '海康平台转换rtsp',
  73. value: 'toHKRtsp',
  74. },
  75. {
  76. label: '海康平台转换hls',
  77. value: 'toHKHLs',
  78. },
  79. ],
  80. },
  81. onEditChange: ({ value, record }) => {
  82. syncManufacturerByDeviceKind(value, record);
  83. },
  84. },
  85. {
  86. title: '摄像头地址',
  87. dataIndex: 'addr',
  88. width: 100,
  89. editRow: true,
  90. textAlign: 'center',
  91. editComponent: 'Textarea',
  92. },
  93. {
  94. title: '播放倍速',
  95. dataIndex: 'cameraRate',
  96. width: 70,
  97. editRow: true,
  98. textAlign: 'center',
  99. editComponent: 'Select',
  100. editComponentProps: {
  101. options: [
  102. {
  103. label: '0.5',
  104. value: 0.5,
  105. },
  106. {
  107. label: '1 ',
  108. value: 1,
  109. },
  110. {
  111. label: '1.5',
  112. value: 1.5,
  113. },
  114. {
  115. label: '2',
  116. value: 2,
  117. },
  118. ],
  119. },
  120. },
  121. {
  122. title: 'IP',
  123. dataIndex: 'ip',
  124. width: 100,
  125. editRow: true,
  126. editRule: true,
  127. textAlign: 'center',
  128. editComponent: 'Textarea',
  129. },
  130. {
  131. title: '端口号',
  132. width: 70,
  133. dataIndex: 'port',
  134. editRow: true,
  135. editRule: true,
  136. editComponent: 'InputNumber',
  137. textAlign: 'center',
  138. },
  139. {
  140. title: '摄像头用户',
  141. dataIndex: 'username',
  142. width: 70,
  143. editRow: true,
  144. textAlign: 'center',
  145. },
  146. {
  147. title: '控制密码',
  148. dataIndex: 'password',
  149. width: 70,
  150. editRow: true,
  151. editRule: true,
  152. textAlign: 'center',
  153. },
  154. {
  155. title: '厂家',
  156. dataIndex: 'label',
  157. width: 70,
  158. editRow: true,
  159. editRule: true,
  160. editComponent: 'Select',
  161. textAlign: 'center',
  162. editComponentProps: {
  163. options: manufacturerOptions,
  164. },
  165. },
  166. ];