CameraEditSRSPopover.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <el-card v-if="props.modelValue" class="pop-card">
  3. <template #header>
  4. <div class="flex justify-between items-center pop-head">
  5. <span class="pop-head-name">编辑相机(通过rtsp添加)</span>
  6. <el-icon :size="16" class="mr-3" @click="updateValue(false)"><Close /></el-icon>
  7. </div>
  8. </template>
  9. <div class="pop-content">
  10. <SRSAddCamera
  11. :form-data="props.editData!"
  12. @cancel-execute="updateValue(false)"
  13. @confirm-execute="onUpdateSRSCamera"
  14. />
  15. </div>
  16. </el-card>
  17. </template>
  18. <script setup lang="ts">
  19. import { Close } from '@element-plus/icons-vue';
  20. import SRSAddCamera from './AddCameraBySRS.vue';
  21. import useCameraOverview from '../stores/useCameraOverview';
  22. import { CameraSRS } from '@/types/camera/type';
  23. import { ElMessage } from 'element-plus';
  24. const props = defineProps<{ modelValue: boolean; editData?: CameraSRS }>();
  25. const emits = defineEmits(['update:modelValue']);
  26. const cameraOverview = useCameraOverview();
  27. const { editCamera, getCameraItems } = cameraOverview;
  28. const updateValue = (value) => {
  29. emits('update:modelValue', value);
  30. };
  31. const onUpdateSRSCamera = (data) => {
  32. const temp = {
  33. id: data.id,
  34. name: data.name,
  35. code: data.code,
  36. rtspUrl: data.rtspUrl,
  37. cameraIp: data.cameraIp,
  38. videoServiceType: data.videoServiceType,
  39. sceneTemplateList: data.sceneTemplateList,
  40. workshopId: data.workshopId,
  41. workspaceId: data.workspaceId,
  42. videoStandard: data.videoStandard,
  43. remark: data.remark,
  44. sourceType: data.sourceType,
  45. };
  46. editCamera(temp)
  47. .then((res) => {
  48. if (res.code === 200) {
  49. updateValue(false);
  50. ElMessage({
  51. message: '修改成功',
  52. type: 'success',
  53. });
  54. getCameraItems();
  55. } else {
  56. return Promise.reject(res.msg || res.message);
  57. }
  58. })
  59. .catch((error) => {
  60. ElMessage.error(error);
  61. });
  62. };
  63. </script>
  64. <style scoped lang="scss">
  65. .pop-card {
  66. position: relative;
  67. margin-left: 21px !important;
  68. }
  69. .pop-head {
  70. height: 56px;
  71. &-name {
  72. margin-left: 24px;
  73. font-size: 16px;
  74. font-weight: 500;
  75. color: #252525;
  76. }
  77. &-tabs {
  78. margin-top: 18px;
  79. :first-child {
  80. border-radius: 8px 0px 0px 0px;
  81. }
  82. :last-child {
  83. border-radius: 0px 8px 0px 0px;
  84. }
  85. }
  86. }
  87. .tab-item {
  88. width: 188px;
  89. height: 38px;
  90. background: #fafafa;
  91. border: 1px solid #d9d9d9;
  92. cursor: pointer;
  93. &-active {
  94. background: #e2eefe;
  95. border: 1px solid #1890ff;
  96. }
  97. }
  98. .pop-content {
  99. height: 480px;
  100. display: flex;
  101. justify-content: center;
  102. padding: 35px;
  103. overflow: auto;
  104. }
  105. :deep(.el-card__header) {
  106. padding: 0;
  107. }
  108. :deep(.el-card__body) {
  109. padding: 0;
  110. }
  111. </style>