<template>
  <div class="dialog" v-if="dialogForm">
    <div class="head_box">
      <span class="title">涉爆重点人员{{ title }}</span>
      <div>
        <el-button size="small" @click="close">关闭</el-button>
      </div>
    </div>
    <div class="cntinfo">
      <el-form :model="listQuery" :label-width="230" label-position="left">
        <div class="form-row">
          <el-form-item label="业务流水号">
            <el-input v-model="listQuery.ywlsh" placeholder="请输入业务流水号"/>
          </el-form-item>
          <el-form-item label="行政区划">
            <el-input v-model="listQuery.xzqh" placeholder="请输入行政区划"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="单位名称">
            <el-input v-model="listQuery.dwmc" placeholder="请输入单位名称"/>
          </el-form-item>
          <el-form-item label="姓名">
            <el-input v-model="listQuery.xm" placeholder="请输入姓名"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="别名">
            <el-input v-model="listQuery.bm" placeholder="请输入别名"/>
          </el-form-item>
          <el-form-item label="性别">
            <el-select v-model="listQuery.xb" placeholder="请选择性别" style="width:100%">
              <el-option label="男" value="男"/>
              <el-option label="女" value="女"/>
            </el-select>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="出生日期">
            <el-date-picker v-model="listQuery.csrq" type="date" style="width:100%" placeholder="请选择出生日期"/>
          </el-form-item>
          <el-form-item label="民族">
            <el-input v-model="listQuery.mz" placeholder="请输入民族"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="文化程度">
            <el-input v-model="listQuery.whcd" placeholder="请输入文化程度"/>
          </el-form-item>
          <el-form-item label="职业">
            <el-input v-model="listQuery.zy" placeholder="请输入职业"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="身份证号">
            <el-input v-model="listQuery.sfzh" placeholder="请输入身份证号"/>
          </el-form-item>
          <el-form-item label="户籍地址">
            <el-input v-model="listQuery.hjdz" placeholder="请输入户籍地址"/>
          </el-form-item>
        </div>
        <div class="form-row">
          <el-form-item label="居住地址">
            <el-input v-model="listQuery.jzdz" placeholder="请输入居住地址"/>
          </el-form-item>
          <el-form-item label="身高">
            <el-input v-model="listQuery.sg" placeholder="请输入身高"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="口音">
            <el-input v-model="listQuery.ky" placeholder="请输入口音"/>
          </el-form-item>
          <el-form-item label="移动电话">
            <el-input v-model="listQuery.yddh" placeholder="请输入移动电话"/>
          </el-form-item>
        </div>

       

        <div class="form-row">
          <el-form-item label="重点人员体貌特征">
            <el-input v-model="listQuery.zdrytz" placeholder="请输入体貌特征"/>
          </el-form-item>
          <el-form-item label="列管依据_详细情况">
            <el-input v-model="listQuery.lgyj" placeholder="请输入列管依据"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="列管日期">
            <el-date-picker v-model="listQuery.lgrq" type="date" style="width:100%" placeholder="请选择列管日期"/>
          </el-form-item>
          <el-form-item label="填报人姓名">
            <el-input v-model="listQuery.tbrxm" placeholder="请输入填报人姓名"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="填报日期">
            <el-date-picker v-model="listQuery.tbrq" type="date" style="width:100%" placeholder="请选择填报日期"/>
          </el-form-item>
          <el-form-item label="填报单位名称">
            <el-input v-model="listQuery.tbdwmc" placeholder="请输入填报单位名称"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="备注">
            <el-input type="textarea" v-model="listQuery.bz" :rows="3" placeholder="请输入备注"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="照片">
            <div class="image-group">
              <div v-for="(url, index) in listQuery.photos" :key="index" class="image-item">
                <el-image :src="url" fit="cover"/>
              </div>
            </div>
          </el-form-item>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const dialogForm = ref(false);
const listQuery = ref({});
const title = ref('');
// 初始化数据
const init = (type, row) => {
  dialogForm.value = true;
  if (row) {
    title.value = type === 'edit' ? '编辑' : '详情';
    listQuery.value = { ...row };
  } else {
    title.value = '新增';
    listQuery.value = {};
  }
};

const close = () => {
  dialogForm.value = false;
  listQuery.value = {};
};

defineExpose({init});
</script>

<style lang="scss" scoped>
.dialog {
  padding: 20px;

  :deep(.el-form-item__label) {
    background-color: #F7FAFB;
    padding: 0px 8px;
    color: #000;
    font-weight: 500;
    border: 1px solid #E3E7ED;
  }

  .head_box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
  .cntinfo{
    height: calc(100% - 70px);
    overflow: hidden;
    overflow-y: auto;
  }

  .form-row {
    display: flex;
    
    .el-form-item {
      flex: 1;
    }
    .image-group {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    
      .image-item {
        width: 150px;
        height: 150px;
        border: 1px solid #dcdfe6;
        
        .el-image {
          width: 100%;
          height: 100%;
        }
      }
    }
  }

   ::v-deep .el-input__inner{
    height: 36px !important;
    line-height: 36px !important;
    border-radius: 0;
    color: #777575;
  }
}
.el-form-item--default{
  margin-bottom: 0px;
}
</style>
