<template>
  <el-card v-if="props.modelValue" class="pop-card">
    <template #header>
      <div class="flex justify-between items-center pop-head">
        <span class="pop-head-name">编辑相机</span>
        <el-icon :size="16" class="mr-3" @click="updateValue"><Close /></el-icon>
      </div>
    </template>
    <div class="pop-content flex justify-center items-center">
      <EditSharedCamera @close-edit="updateValue" :form-data="props.editData" />
    </div>
  </el-card>
</template>

<script setup lang="ts">
  import { Close } from '@element-plus/icons-vue';
  import EditSharedCamera from './EditSharedCamera.vue';
  import { CameraShareType } from '@/api/camera/camera-share';

  const props = defineProps<{ modelValue: boolean; editData: CameraShareType }>();

  const emits = defineEmits(['update:modelValue']);

  const updateValue = () => {
    emits('update:modelValue', false as boolean);
  };
</script>

<style scoped lang="scss">
  .pop-card {
    position: relative;
    margin-left: 21px !important;
  }

  .pop-head {
    height: 56px;

    &-name {
      margin-left: 24px;
      font-size: 16px;
      font-weight: 500;
      color: #252525;
    }

    &-tabs {
      margin-top: 18px;

      :first-child {
        border-radius: 8px 0px 0px 0px;
      }

      :last-child {
        border-radius: 0px 8px 0px 0px;
      }
    }
  }

  .tab-item {
    width: 188px;
    height: 38px;
    background: #fafafa;
    border: 1px solid #d9d9d9;
    cursor: pointer;

    &-active {
      background: #e2eefe;
      border: 1px solid #1890ff;
    }
  }

  .pop-content {
    height: 566px;
  }

  :deep(.el-card__header) {
    padding: 0;
  }
  :deep(.el-card__body) {
    padding: 0;
  }
</style>
