<template>
  <div class="modalSty" ref="refModel">
    <a-modal
      v-model:visible="visible"
      title="添加"
      @ok="handleOk"
      width="1300px"
      :bodyStyle="{ padding: '20px' }"
      :getContainer="() => $refs.refModel"
    >
      <a-row>
        <a-col :span="12">
          <div class="left">
            设备信息
            <a-form
              :model="formState"
              name="basic"
              :label-col="{ span: 8 }"
              :wrapper-col="{ span: 16 }"
              autocomplete="off"
              @finish="onFinish"
              @finishFailed="onFinishFailed"
            >
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="设备类型"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="监测类型"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="设备名称"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="设备编码"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="设备型号"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="出厂编码"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="巡检养护周期"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="使用寿命"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="生产厂家简称"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="生产厂家全称"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="购买时间"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="采购价格"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="安装时间"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="坐标"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12" />
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="备注"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="所属类别"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
                <a-col :span="12">
                  <a-form-item
                    label="所属对象"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col :span="12">
                  <a-form-item
                    label="设备状态"
                    name="username"
                    :rules="[{ required: true, message: 'Please input your username!' }]"
                  >
                    <a-input v-model:value="formState.username" />
                  </a-form-item>
                </a-col>
              </a-row>
            </a-form>
          </div>
        </a-col>
        <a-col :span="12">
          <div class="right">
            位置
            <div style="height: 400px; background: #f8f8f8"></div>
            附件
          </div>
        </a-col>
      </a-row>
    </a-modal>
  </div>
</template>
<script setup lang="ts">
  import { ref, reactive } from 'vue';
  const visible = ref(false);
  const handleOk = (e) => {
    console.log(e);
    visible.value = false;
  };
  //
  const formState = reactive({
    username: '',
    password: '',
    remember: true,
  });
  const onFinish = (values) => {
    console.log('Success:', values);
  };
  const onFinishFailed = (errorInfo) => {
    console.log('Failed:', errorInfo);
  };
  //
  function show() {
    visible.value = true;
  }
  //   编译器宏,暴露出方法
  defineExpose({
    show,
  });
</script>
<style lang="less" scoped>
  :deep(.ant-modal-header) {
    background-color: #2d74e7;
  }

  :deep(.ant-modal-title) {
    color: white;
  }
</style>
