<!-- 户籍管理 -->
<template>
  <div class="percentage-content">
    <div class="content">
      <div style="margin-bottom: 16px" class="h-layout space-between h-center">
        <div>
          <div class="h-layout">
            <div
              class="tool-item"
              @click="(currentItem = {}), (visible = true)"
            >
              <svg-icon name="add" class="icon" />
              <span>新增/迁入</span>
            </div>
            <div class="tool-item">
              <svg-icon name="refurbish" class="icon" />
              <span>刷新</span>
            </div>
          </div>
        </div>
        <div style="width: 30%">
          <div>
            <el-input
              v-model="search"
              placeholder="请输入关键字"
              class="search-input"
            >
              <template #append>
                <span class="search-bottom">
                  <svg-icon name="search" class="icon_class" />
                  <span>搜索</span>
                </span>
              </template>
            </el-input>
          </div>
        </div>
      </div>
      <!-- 表格 -->
      <el-table
        ref="loading"
        :data="tableData"
        header-row-class-name="el-one-header"
        border
      >
        <el-table-column
          type="index"
          align="center"
          label="序列"
          width="60"
        ></el-table-column>
        <el-table-column
          :resizable="true"
          align="center"
          label="姓名"
          prop="name"
        >
        </el-table-column>
        <el-table-column
          :resizable="true"
          align="center"
          label="性别"
          prop="sex"
          width="80"
        >
        </el-table-column>
        <el-table-column
          :resizable="true"
          align="center"
          label="出生日期"
          prop="birth"
        >
        </el-table-column>
        <el-table-column
          :resizable="true"
          align="center"
          label="婚姻状况"
          prop="tag"
        >
        </el-table-column>
        <el-table-column :resizable="true" label="户籍成员" prop="member">
        </el-table-column>
        <el-table-column
          :resizable="true"
          align="left"
          label="居住地址"
          prop="address"
        >
        </el-table-column>
        <el-table-column
          :resizable="true"
          align="center"
          label="操作"
          width="350"
        >
          <template #default="scope">
            <span
              class="operate"
              @click="(currentItem = scope.row), (visible = true)"
            >
              <svg-icon name="edit" class="icon"></svg-icon>
              <span class="edit">编辑</span>
            </span>
            <span
              class="operate"
              @click="(currentItem = scope.row), (visible = true)"
            >
              <svg-icon name="detail" class="icon"></svg-icon>
              <span class="detail">详情</span>
            </span>
            <span class="operate" @click="del(scope.row, '删除')">
              <svg-icon name="delete" class="icon"></svg-icon>
              <span class="func">删除</span>
            </span>
            <span class="operate" @click="del(scope.row, '注销')">
              <svg-icon name="detail" class="icon"></svg-icon>
              <span class="func">注销</span>
            </span>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination
        class="pagination"
        @size-change="getCompanyList"
        @current-change="getCompanyList"
        v-model:current-page.sync="currentPage"
        :page-sizes="[10, 15, 20, 30]"
        v-model:page-size.sync="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        background
      >
      </el-pagination>
    </div>
    <add-edit
      :visible="visible"
      :form="currentItem"
      @close="(visible = false), (currentItem = {})"
    />
  </div>
</template>
<script lang='ts' setup>
import { ElMessageBox } from "element-plus";
import { onMounted, reactive, ref } from "vue";
import AddEdit from "./dialog/add-edit.vue";

const visible = ref(false);
const currentItem = ref();

const search = ref([]);
const currentPage = ref(1);
const pageSize = ref(10);
const total = ref(0);
const tableData = ref([
  {
    id: 1,
    name: "张三",
    sex: "男",
    tag: "已婚",
    member: "父亲：张三丰 18140159608；母亲：张媛 18140156666",
    birth: "2023-12-15",
    address: "xxxxxxxxxxx地址",
  },
  {
    id: 1,
    name: "张三",
    sex: "男",
    tag: "已婚",
    member: "-",
    birth: "2023-12-15",
    address: "xxxxxxxxxxx地址",
  },
]);

/**
 * 删除
 */
const del = (item, tips) => {
  ElMessageBox.confirm(`是否确认${tips}?`, "提示", {
    confirmButtonText: "是",
    cancelButtonText: "否",
    type: "warning",
  }).then(() => {});
};

onMounted(() => {});
</script>
<style lang="scss" scoped>
.content {
  width: 100%;
  background: #fff;
  border-radius: 0.26042vw;
  box-shadow: 0 0 0.41667vw 0 rgb(8 33 85 / 10%);
  height: 100%;
  padding: 0.83333vw;
  overflow-y: auto;
  overflow-x: hidden !important;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -o-box-sizing: border-box;
  -ms-box-sizing: border-box;
  box-sizing: border-box;
}

.dialog-footer button:first-child {
  margin-right: 10px;
}

.content-top {
  padding: 16px;
  background: #ffffff;
  box-shadow: 0px 0px 6px rgba(0, 120, 255, 0.1);
  border-radius: 6px;
  display: flex;
  flex-direction: row;
}
</style>