<template>
  <BasicModal
    width="1600px"
    title="新增监测站点"
    @register="registerModal"
    v-bind="$attrs"
    @ok="handleSubmit"
  >
    <div>
      <div class="title">
        <span>基本信息</span>
      </div>
      <div class="info-box">
        <div class="info-form">
          <BasicForm @register="registerForm" />
        </div>
        <div class="map-box">
          <Map />
        </div>
      </div>
      <div class="title">
        <span>关联信息</span>
      </div>
      <div>
        <span>关联设备</span>
        <a-select placeholder="请选择关联设备" />
      </div>
      <div>
        <span>关联指标</span>
        <a-table :columns="columns" :dataSource="columnData" :pagination="false" />
      </div>
    </div>
  </BasicModal>
</template>
<script lang="ts" setup>
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { siteInfoFormSchema, columns } from './siteModalForm.data';
  import { BasicForm, useForm } from '/@/components/Form/index';
  import Map from '/@/views/lifeline/Map/index.vue';

  const columnData = [
    { site: '指标1', device: '设备指标2', index: '1', show: '是' },
    { site: '指标1', device: '设备指标21', index: '21', show: '否' },
  ];

  const [registerModal, { closeModal }] = useModalInner();
  const [registerForm] = useForm({
    labelWidth: 80,
    schemas: siteInfoFormSchema,
    showActionButtonGroup: false,
    actionColOptions: {
      span: 8,
    },
  });

  function handleSubmit() {
    closeModal();
  }
</script>
<style lang="less" scoped>
  .info-box {
    display: flex;

    .info-form {
      width: 50%;
      padding-right: 20px;
    }

    .map-box {
      width: 50%;
      // padding: 0px 0 20px 20px;
    }
  }
</style>
