CameraAddPopover.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 cameraAddType"
  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 class="pop-content flex justify-center items-center">
  21. <IPAddCamera v-if="addType === 'ip'" />
  22. <RangeAddCamera v-if="addType === 'ipRange'" />
  23. <span class="pop-footer">
  24. <el-button @click="updateValue(false)">取消</el-button>
  25. <el-button type="primary" @click="addCamera">确定</el-button>
  26. </span>
  27. </div>
  28. </el-card>
  29. </template>
  30. <script setup lang="ts">
  31. import { ref } from 'vue';
  32. import { cameraAddType } from '../constant';
  33. import { Close } from '@element-plus/icons-vue';
  34. import IPAddCamera from './AddCameraByIP.vue';
  35. import RangeAddCamera from './AddCameraByRange.vue';
  36. const props = defineProps<{ modelValue: boolean }>();
  37. const emits = defineEmits(['update:modelValue']);
  38. const addType = ref(cameraAddType[0].value);
  39. const updateValue = (value) => {
  40. emits('update:modelValue', value);
  41. };
  42. const addCamera = () => {};
  43. </script>
  44. <style scoped lang="scss">
  45. .pop-card {
  46. margin-left: 21px !important;
  47. }
  48. .pop-head {
  49. height: 56px;
  50. &-name {
  51. margin-left: 24px;
  52. font-size: 16px;
  53. font-weight: 500;
  54. color: #252525;
  55. }
  56. &-tabs {
  57. margin-top: 18px;
  58. :first-child {
  59. border-radius: 8px 0px 0px 0px;
  60. }
  61. :last-child {
  62. border-radius: 0px 8px 0px 0px;
  63. }
  64. }
  65. }
  66. .tab-item {
  67. width: 188px;
  68. height: 38px;
  69. background: #fafafa;
  70. border: 1px solid #d9d9d9;
  71. &-active {
  72. background: #e2eefe;
  73. border: 1px solid #1890ff;
  74. }
  75. }
  76. .pop-content {
  77. height: 566px;
  78. }
  79. .pop-footer {
  80. position: absolute;
  81. right: 24px;
  82. bottom: 27px;
  83. display: flex;
  84. justify-content: flex-end;
  85. }
  86. :deep(.el-card__header) {
  87. padding: 0;
  88. }
  89. :deep(.el-card__body) {
  90. padding: 0;
  91. }
  92. </style>