<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.xzqh" placeholder="请输入行政区划"/>
          </el-form-item>
          <el-form-item label="事故业务流水号码">
            <el-input v-model="listQuery.ywlsh" placeholder="请输入事故业务流水号码"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="登记日期">
            <el-date-picker v-model="listQuery.djrq" type="date" style="width:100%" placeholder="请选择登记日期"/>
          </el-form-item>
          <el-form-item label="人员顺序号">
            <el-input v-model="listQuery.ryxh" placeholder="请输入人员顺序号"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="姓名">
            <el-input v-model="listQuery.xm" 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-input-number v-model="listQuery.nl" :min="0" style="width:100%" placeholder="请输入年龄"/>
          </el-form-item>
          <el-form-item label="公民身份证号码">
            <el-input v-model="listQuery.sfzh" placeholder="请输入公民身份证号码"/>
          </el-form-item>
        </div>

        <div class="form-row">
          <el-form-item label="处理详细情况" label-width="230">
            <el-input
              type="textarea"
              v-model="listQuery.clxxqk"
              :rows="4"
              placeholder="请输入处理详细情况"
              style="width: 100%"
            />
          </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;
    }
  }

   ::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>
