config.data.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import { PlayProtocol } from '../manage/config.data';
  2. import type { StreamingMediaModel } from '/@/api/camera/model/cameraModel';
  3. import { BasicColumn, FormSchema } from '/@/components/Table';
  4. export interface DrawerParams {
  5. createFlag: boolean;
  6. record?: StreamingMediaModel;
  7. }
  8. export const streamingMediaTypeMapping = {
  9. 0: '海康ISC平台',
  10. };
  11. export const streamingMediaSSLMapping = {
  12. 0: 'http',
  13. 1: 'https',
  14. };
  15. export const formatSecret = (string: string) => {
  16. if (string.length < 6) {
  17. return string;
  18. } else {
  19. const reg = /(^\S{2}).*(\S{4}$)/;
  20. const prefix = string.match(reg)?.at(1);
  21. const suffix = string.match(reg)?.at(2);
  22. return `${prefix}${''.padStart(string.length - 6, '*')}${suffix}`;
  23. }
  24. };
  25. export const columnSchema: BasicColumn[] = [
  26. {
  27. title: '平台地址',
  28. dataIndex: 'host',
  29. width: 80,
  30. },
  31. {
  32. title: '用户Key',
  33. dataIndex: 'appKey',
  34. width: 80,
  35. },
  36. {
  37. title: '用户密钥',
  38. dataIndex: 'appSecret',
  39. width: 80,
  40. format(text) {
  41. return formatSecret(text);
  42. },
  43. },
  44. {
  45. title: '平台类型',
  46. dataIndex: 'type',
  47. width: 80,
  48. slots: { customRender: 'type' },
  49. },
  50. {
  51. title: '部署环境',
  52. dataIndex: 'ssl',
  53. width: 80,
  54. slots: { customRender: 'ssl' },
  55. },
  56. ];
  57. export const formSchema: FormSchema[] = [
  58. {
  59. field: 'host',
  60. label: '平台地址',
  61. component: 'Input',
  62. colProps: { span: 8 },
  63. },
  64. ];
  65. export const formDetailSchema: FormSchema[] = [
  66. {
  67. label: '平台类型',
  68. field: 'type',
  69. component: 'Select',
  70. rules: [{ required: true, message: '平台类型为必填项', type: 'number' }],
  71. componentProps: {
  72. options: [{ label: '海康ISC平台', value: 0 }],
  73. placeholder: '请输入选择平台类型',
  74. },
  75. },
  76. {
  77. label: '部署环境',
  78. field: 'ssl',
  79. component: 'RadioGroup',
  80. rules: [{ required: true, message: '流媒体部署环境为必填项', type: 'number' }],
  81. defaultValue: PlayProtocol.HTTP,
  82. componentProps: {
  83. defaultValue: PlayProtocol.HTTP,
  84. options: [
  85. { label: 'http', value: PlayProtocol.HTTP },
  86. { label: 'https', value: PlayProtocol.HTTPS },
  87. ],
  88. },
  89. },
  90. {
  91. label: '平台地址',
  92. field: 'host',
  93. component: 'Input',
  94. helpMessage: ['平台IP + 端口'],
  95. rules: [{ required: true, message: '平台地址为必填项' }],
  96. componentProps: {
  97. maxLength: 36,
  98. placeholder: '请输入平台地址',
  99. },
  100. },
  101. {
  102. label: '用户Key',
  103. field: 'appKey',
  104. component: 'Input',
  105. rules: [{ required: true, message: '用户Key为必填项' }],
  106. componentProps: {
  107. maxLength: 36,
  108. placeholder: '请输入用户Key',
  109. },
  110. },
  111. {
  112. label: '用户密钥',
  113. field: 'appSecret',
  114. component: 'Input',
  115. rules: [
  116. { required: true, message: '用户密钥为必填项' },
  117. { required: true, min: 20, message: '用户密钥不能少于20位字符' },
  118. ],
  119. componentProps: {
  120. maxLength: 36,
  121. placeholder: '请输入用户密钥',
  122. },
  123. },
  124. ];