CameraSharedEdit.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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">添加相机</span>
  6. <div class="flex pop-head-tabs">
  7. <div
  8. v-for="item in sharedCaremaType"
  9. :key="item.value"
  10. class="flex justify-center items-center tab-item"
  11. :class="{ 'tab-item-active': item.value === addType }"
  12. @click="addType = item.value"
  13. >
  14. {{ item.label }}
  15. </div>
  16. </div>
  17. <el-icon :size="16" class="mr-3" @click="updateValue(false)"><Close /></el-icon>
  18. </div>
  19. </template>
  20. <div><SharedTable :addCameraType="addType" /></div>
  21. <!-- <div class="pop-content flex justify-center items-center">
  22. <IPAddCamera
  23. v-if="addType === 'ip'"
  24. @cancel-execute="updateValue(false)"
  25. @confirm-execute="onAddCamera"
  26. />
  27. <RangeAddCamera v-if="addType === 'ipRange'" @cancel-execute="updateValue(false)" />
  28. </div> -->
  29. </el-card>
  30. </template>
  31. <script setup lang="ts">
  32. import { ref } from 'vue';
  33. import { sharedCaremaType } from '../constant';
  34. import { Close } from '@element-plus/icons-vue';
  35. import SharedTable from './SharedTable.vue';
  36. import IPAddCamera from './AddCameraByIP.vue';
  37. import RangeAddCamera from './AddCameraByRange.vue';
  38. import useCameraOverview from '../stores/useCameraOverview';
  39. const props = defineProps<{ modelValue: boolean }>();
  40. const emits = defineEmits(['update:modelValue']);
  41. const cameraOverview = useCameraOverview();
  42. const { addCamera } = cameraOverview;
  43. const addType = ref(sharedCaremaType[0].value);
  44. const updateValue = (value) => {
  45. addType.value = sharedCaremaType[0].value;
  46. emits('update:modelValue', value);
  47. };
  48. const onAddCamera = (data) => {
  49. addCamera(data);
  50. updateValue(false);
  51. };
  52. </script>
  53. <style scoped lang="scss">
  54. .pop-card {
  55. position: relative;
  56. margin-left: 21px !important;
  57. }
  58. .pop-head {
  59. height: 56px;
  60. &-name {
  61. margin-left: 24px;
  62. font-size: 16px;
  63. font-weight: 500;
  64. color: #252525;
  65. }
  66. &-tabs {
  67. margin-top: 18px;
  68. :first-child {
  69. border-radius: 8px 0px 0px 0px;
  70. }
  71. :last-child {
  72. border-radius: 0px 8px 0px 0px;
  73. }
  74. }
  75. }
  76. .tab-item {
  77. width: 188px;
  78. height: 38px;
  79. background: #fafafa;
  80. border: 1px solid #d9d9d9;
  81. cursor: pointer;
  82. &-active {
  83. background: #e2eefe;
  84. border: 1px solid #1890ff;
  85. }
  86. }
  87. .pop-content {
  88. height: 566px;
  89. }
  90. :deep(.el-card__header) {
  91. padding: 0;
  92. }
  93. :deep(.el-card__body) {
  94. padding: 0;
  95. }
  96. </style>