<!--
 * @Company: 沈阳信诚科技
 * @Email: html_venustar@163.com
 * @Author: Liuqiming
 * @Description: 生产实绩
 * @LastEditors: Liuqiming
 * @LastEditTime: 2024-03-29 11:16:03
 * @Date: 2024-02-26 12:25:10
-->
<template>
  <div class="app-container Information">
    <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="Achievements" lang="jsx">
import { init } from './index.jsx'

import { prodDataList, prodDataGetWeight } from '@A/digitalCasting/monitor/achievements.js'
const { proxy } = getCurrentInstance();
// 获取铸流号类型字典数据
const { material_casting_type } = proxy.useDict("material_casting_type");
const loading = ref(false)
const tableData = ref([])

// 表格数据获取
const getList = (searchVal) => {
  loading.value = true
  // 获取表格数据
  prodDataList(searchVal).then(res => {
    tableData.value = res.rows
    pageSet.value.total = res.total
    loading.value = false
  }).catch(err => {console.log(err)})
  prodDataGetWeight(searchVal).then(res => {
    tableOption.value.slotFooter = () => {
      return <span style="color: #606266">铸坯重量汇总：{ res }（kg）</span>
    }
  }).catch(err => {console.log(err)})
}
// 查询及重置翻页等回调方法
const getTableData = (searchVal) => {
  getList(searchVal)
}
getList({ pageSize:10, pageNum:1 })
const { 
  searchList,
  btnList,
  columns,
  pageSet,
  tableOption,
} = init({material_casting_type})
</script>

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