<template>
  <el-dialog :visible.sync="visible">
    <el-table
      :data="dataForm.dataPeo"
      v-if="dataForm.dataPeo != null && dataForm.dataPeo !== ''"
      border
      style="width: 100%"
    >
      <el-table-column
        prop="name"
        header-align="center"
        align="center"
        label="姓名"
        :show-overflow-tooltip="true"
      ></el-table-column>
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form>
            <el-form-item label="房间序号">
              <span>{{ props.row.roomPos }}</span>
            </el-form-item>
            <el-form-item label="证件类型">
              <span v-if="props.row.idType === 1">身份证</span>
              <span v-if="props.row.idType === 2">军人证</span>
              <span v-if="props.row.idType === 3">护照</span>
            </el-form-item>
            <el-form-item label="证件号码">
              <span>{{ props.row.idCode }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        id: 0,
        dataPeo: ""
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0
      this.visible = true
      this.$nextTick(() => {
        this.$http({
          url: this.$http.adornUrl("/ord/order/peo"),
          method: "get",
          params: this.$http.adornParams({
            orderCode: id
          })
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.dataForm.dataPeo = data.peo
          } else {
            this.$message.error(data.msg)
          }
        })
      })
    }
  }
}
</script>
<style>
.demo-table-expand {
  font-size: 0;
}
.demo-table-expand label {
  width: 90px;
  color: #99a9bf;
}
.demo-table-expand .el-form-item {
  margin-right: 0;
  margin-bottom: 0;
  width: 50%;
}
</style>
