<template>
  <div class="safe-check-home h100">
    <common-layout
      ref="layoutRef"
      :get-table-list="getTableData"
      :table-header="safeCheckDetailTableHeader"
      :filter-form="safeCheckHomeFilterForm"
    :form-attrs="{
      spanAttrs: {
        span:5
      }
    }"
    >
      <template #SAFE_AUDIT_NAME="{data}">
        {{ dangerArr.find(i => i.value === data['SAFE_AUDIT_NAME'])?.label }}
      </template>
    </common-layout>
  </div>
</template>

<script>
import CommonLayout from "@/components/CommonLayout.vue";
import {dangerArr, safeCheckHomeFilterForm} from "@/data/all-forms";
import {safeCheckDetailTableHeader} from "@/data/all-table-header";
import {ref} from "vue";
import {getSafeCheckHomeT} from "@/service/zsk/safe-check";

export default {
  name: "SafeCheckHome",
  methods: {
    dangerArr() {
      return dangerArr
    }
  },
  components: {CommonLayout},
  setup() {
    const layoutRef = ref(null)
    function getTableData(){
      getSafeCheckHomeT({
        pageIndex:layoutRef.value.pageIndex,
        pageSize:layoutRef.value.pageSize,
        START_DATE:layoutRef.value.form.START_DATE || '',
        END_DATE:layoutRef.value.form.END_DATE || '',
        SAFE_AUDIT_NAME:layoutRef.value.form.SAFE_AUDIT_NAME || '',

      }).then(res => {
        layoutRef.value.getResData(res.msg[0].Rows,res.msg[0].TotalRowCount)
      })

    }
    return {
      safeCheckHomeFilterForm,
      safeCheckDetailTableHeader,
      layoutRef,
      getTableData,
      dangerArr
    }
  }
}
</script>

<style scoped lang="scss">

</style>
