<!--  -->
<template>
  <div class="explorate" v-if="data">
    <div>
      <h2 class="title">道路交通事故现场勘查笔录(续页)</h2>

      <div class="container">
        <div class="table-excel">
          <p style="margin-bottom: 10px">六、对车辆驾驶人进行酒精含量、国家管制的精神药品和麻醉药品测试的结果以及提取血样、 尿样情况</p>
          <table>
            <tr>
              <td>编号</td>
              <td>姓名</td>
              <td style="width: 170px">身份证号码</td>
              <td>联系电话</td>
              <td>交通方式</td>
              <td style="width: 100px">酒精、 国家管制精神药品和麻醉药品测试结果</td>
              <td style="width: 110px">是否抽血或提取尿样</td>
              <td>备注</td>
            </tr>

            <tr v-for="(i, index) in data.driversInfoList">
              <td v-for="(j, j_index) in i">
                <div><input type="text" /></div>
              </td>
              <!-- <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td> -->
            </tr>
            <!-- <tr>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
            </tr>
            <tr>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
            </tr>
            <tr>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
            </tr>
            <tr>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
            </tr> -->
          </table>
        </div>
        <div class="table-excel">
          <p style="margin-bottom: 10px">七、肇事车辆驶离的方向、 车型、 车号、 车身颜色等情况</p>
          <table>
            <tr>
              <td>编号</td>
              <td>牌号</td>
              <td>车型</td>
              <td>车身颜色</td>
              <td>驶离路线、方向</td>
              <td>驾乘人员情况</td>
              <td>其他信息</td>
            </tr>
            <tr v-for="(i, index) in data.carsInfoList">
              <td v-for="(j, j_index) in i">
                <div><input type="text" /></div>
              </td>
              <!-- <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td> -->
            </tr>
            <!-- <tr>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
            </tr>
            <tr>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
              <td><div contenteditable></div></td>
            </tr> -->
          </table>
        </div>
        <div class="table-body">
          <div class="item column">
            <span>八、现场采取强制措施情况</span>
            <div>
              <textarea v-model="data.measureDesc" name="" id="" cols="30" rows="10"></textarea>
            </div>
          </div>
        </div>
        <div class="table-body no-border">
          <div class="item column">
            <span>九、勘查现场的交通警察认为应当记录的其他情况</span>
            <div>
              <textarea v-model="data.otherDesc" name="" id="" cols="30" rows="10"></textarea>
            </div>
          </div>
        </div>
        <div class="sign-box">
          <div>
            <span>现场勘查人员签名：</span>
            <div>
              <input type="text" v-model="data.explorateSign" />
            </div>
          </div>
          <div>
            <span>记录人签名：</span>
            <div>
              <input type="text" v-model="data.reportSign" />
            </div>
          </div>
        </div>
        <div class="sign-box">
          <div>
            <span>当事人签名：</span>
            <div>
              <input type="text" v-model="data.clientSign" />
            </div>
          </div>
          <div>
            <span>见证人签名：</span>
            <div>
              <input type="text" v-model="data.witnessSign" />
            </div>
          </div>
        </div>
      </div>

      <div class="footer">
        <span>共<span>肆</span>页</span>
        <span>第<span>肆</span>页</span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref, toRefs, onBeforeMount, onMounted, nextTick } from "vue";
import { tables } from "@/store/tables";
import { tablesInfo, setData } from "./data";

const props = defineProps({
  downMode: { type: Boolean, default: false },
  isDownloadShow: { type: Boolean, default: false },
});
const data = ref(null);
const saveHandler = () => {
  return { type: "explorateFour", data: data.value };
};
const saveStore = () => {
  // return new Promise((res, rej) => {
  // origin["legacy"] = JSON.parse(JSON.stringify(data.value));
  // });
};
defineExpose({ saveHandler, data });
onMounted(() => {
  if (props.isDownloadShow) {
  } else {
    setData("explorateFour");
  }
  if (tablesInfo.explorateFour) {
    data.value = tablesInfo.explorateFour;
  }
});
</script>
<style lang="scss" scoped>
.explorate {
  color: #000;
  width: 100%;
  height: 100%;

  font-family: sr, st;

  .title {
    text-align: center;
    margin-bottom: 10px;
  }
  .container {
    border: 1px solid #000;
    font-size: 20px;
    .table-excel {
      padding: 10px;
      table {
        width: 100%;
        border-collapse: collapse;
        border: 1px solid #000;
        tr {
          // border-bottom: 1px solid #000;
          &:first-of-type {
            td {
              padding: 10px 14px;
            }
          }
          &:last-of-type {
            td {
              border-bottom: none;
            }
          }
        }
        td {
          padding: 0 5px;
          box-sizing: border-box;
          text-align: center;
          max-width: 11%;
          height: 40px;
          border-right: 1px solid #000;
          border-bottom: 1px solid #000;
          &:last-of-type {
            border-right: none;
          }
          > div {
            outline: none;
            input {
              width: 100%;
              height: 100%;
              text-align: center;
            }
          }
        }
      }
    }
    .sign-box {
      padding: 0 10px;
      display: flex;
      align-items: center;
      justify-content: flex-start;
      border-top: 1px solid #000;
      min-height: 40px;
      > div {
        width: 50%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        > div {
          flex: 1;
          height: 100%;
          outline: none;
          display: flex;
          align-items: center;
          justify-content: flex-start;
          line-height: 40px;
        }
      }
    }
    .table-body {
      // border-top: 1px solid #000;
      padding: 10px;
      border-bottom: 1px solid #000;
      &.no-border {
        border-bottom: none;
      }
      .item {
        // display: flex;
        margin-bottom: 10px;
        > span {
          display: block;
        }
        > div {
          height: 110px;
          textarea {
            width: 100%;
            height: 100%;
          }
        }
        &.column {
          // flex-direction: column;
          height: 130px;
          // > div {
          //   outline: none;
          //   height: 100%;
          // }
        }
      }
    }
  }
  .footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px;
    margin-top: 10px;
    > span {
      > span {
        margin: 0 24px;
      }
    }
  }
}
</style>
