<template>
  <div>
    <a-modal
      title="导入"
      :open="props.importOpen"
      :width="1000"
      :maskClosable="false"
      :centered="true"
    >
      <template #closeIcon>
        <CloseOutlined :style="{ fontSize: '20px' }" @click="importModalClose" />
      </template>
      <template #footer>
        <div class="footer">
          <a-button style="width: 100px" @click="importModalClose"> 取消 </a-button>
          <a-button
            style="width: 100px"
            type="primary"
            class="blue line-up"
            @click="importModalSubmit"
          >
            确认
          </a-button>
        </div>
      </template>
      <div style="margin: 10px">
        <div style="display: inline-block; margin-left: 20px">
          <a-radio-group v-model:value="radioValue" button-style="solid">
            <a-radio-button value="1">&emsp;我的&emsp;</a-radio-button>
            <a-radio-button value="2">&emsp;内置&emsp;</a-radio-button>
            <a-radio-button value="3">&emsp;发现&emsp;</a-radio-button>
          </a-radio-group>
          <span style="position: absolute; right: 20px">
            <a-input-search
              style="margin-right: 20px; width: 300px"
              v-model:value="searchValue"
              placeholder="请输入服务关键词"
              enter-button
              @search="onSearch"
            />
            <a-button style="width: 100px" type="primary" class="blue"> 新增图层 </a-button>
          </span>
        </div>
        <div style="margin-top: 30px; margin-left: 20px">
          <a-row>
            <a-col :span="2">类型</a-col>
            <a-col :span="22" class="container">
              <div
                :class="{ 'type-checked': type == 0, 'type-check': type != 0 }"
                @click="type = 0"
              >
                全部
              </div>
              <div
                :class="{ 'type-checked': type == 1, 'type-check': type != 1 }"
                @click="type = 1"
              >
                GeoJson
              </div>
              <div
                :class="{ 'type-checked': type == 2, 'type-check': type != 2 }"
                @click="type = 2"
              >
                XYZ
              </div>
              <div
                :class="{ 'type-checked': type == 3, 'type-check': type != 3 }"
                @click="type = 3"
              >
                WMS
              </div>
              <div
                :class="{ 'type-checked': type == 4, 'type-check': type != 4 }"
                @click="type = 4"
              >
                WFS
              </div>
              <div
                :class="{ 'type-checked': type == 5, 'type-check': type != 5 }"
                @click="type = 5"
              >
                WMTS
              </div>
            </a-col>
            <a-col :span="2" style="margin-top: 10px">未使用过</a-col>
            <a-col :span="22" style="margin-top: 10px">
              <a-radio-group v-model:value="shiyong" button-style="solid">
                <a-radio-button value="1">是</a-radio-button>
                <a-radio-button value="0">否</a-radio-button>
              </a-radio-group>
            </a-col>
          </a-row>
          <span></span>
          <span></span>
        </div>
        <div class="imagelist">
          <a-image
            style="width: 150px"
            v-for="d in list"
            :key="d"
            src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
          />
        </div>
      </div>
    </a-modal>
  </div>
</template>
<script lang="ts" setup>
  import { ref, defineEmits, defineProps, watch, onMounted } from 'vue';
  import { CheckOutlined, CloseOutlined } from '@ant-design/icons-vue';
  const props = defineProps(['importOpen']);
  const emits = defineEmits(['importModalClose']);

  const radioValue = ref('1');
  const searchValue = ref();
  const type = ref();
  const shiyong = ref('0');
  const list = ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0'];

  // 取消
  function importModalClose() {
    emits('importModalClose');
  }
  // 提交
  function importModalSubmit() {
    emits('importModalClose');
  }
</script>
<style lang="less" scoped>
  ::v-deep .ant-btn-primary {
    background-color: #0081ff !important;
  }
  ::v-deep .ant-radio-button-wrapper-checked {
    background-color: #0081ff !important;
    border-color: #0081ff !important;
  }
  .footer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  .blue {
    background-color: #0081ff;
  }
  .line-up {
    margin-left: 10px;
  }

  .container {
    display: flex;
    // 页面不能被选中
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE/Edge */
    user-select: none;

    .type-check {
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #e0e5ed;
      border-radius: 0px;
      width: 90px;
      height: 30px;
      margin-right: 10px;
    }

    .type-checked {
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #e0e5ed;
      color: #2a7dc9;
      border-radius: 0px;
      width: 90px;
      height: 30px;
      margin-right: 10px;
    }
  }

  .imagelist {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
    margin-left: 20px;
  }
</style>
