<!--
 * @Company: 沈阳信诚科技
 * @Email: html_venustar@163.com
 * @Author: Liuqiming
 * @Description: 铸坯报告
 * @LastEditors: Liuqiming
 * @LastEditTime: 2024-03-21 09:09:25
 * @Date: 2024-02-26 12:25:10
-->
<template>
  <div class="app-container CastingFrom">
    <els-table
      :btnList="btnList"
      :columns="columns"
      :tableData="tableData"
      :searchList="searchList"
      @getTableData="getTableData"
      :pageSet="pageSet"
      :option="tableOption"
      :tableLoading="loading"
    ></els-table>
  </div>
</template>

<script setup name="CastingFrom">
import { init } from './index.jsx'
import { reportList } from '@A/digitalCasting/report/report.js'
import { useRouter } from "vue-router";

const router = useRouter();

const loading = ref(false)
const tableData = ref([])

// 表格数据获取
const getList = (searchVal) => {
  loading.value = true
  // 获取表格数据
  reportList(searchVal).then(res => {
    tableData.value = res.rows
    pageSet.value.total = res.total
    loading.value = false
  }).catch(err => {console.log(err)})
}
// 查询及重置翻页等回调方法
const getTableData = (searchVal) => {
  getList(searchVal)
}
// 切片查询
const section = (row) => {
  console.log('切片查询')
  router.push({
    path:'/digitalCasting/from/castingFrom-detail',
    query:{
      id: row.id,
      pageType: 0,
    }
  })
}
// 时间查询
const timeSearch = (row) => {
  console.log('时间查询')
  router.push({
    path:'/digitalCasting/from/castingFrom-detail',
    query:{
      id: row.id,
      pageType: 1,
    }
  })
}
getList({ pageSize:10, pageNum:1 })
const {
  searchList,
  btnList,
  columns,
  pageSet,
  tableOption,
} = init({
  section,
  timeSearch,
})
</script>

<style lang="scss" scoped>
</style>
