<!-- 电力碳核算 -->
<script lang="ts" setup name="electricCount">
import { ElMessage } from 'element-plus'
import page from './page.vue'
import tableList from './table.vue'
const $router = useRouter()
const carbonData = ref<any>([])
const countRef = ref()
const resultFun = () => {
  countRef.value.getData()
  // 固定燃烧
  const fixed = JSON.parse(sessionStorage.getItem('固定燃烧') as string)
  carbonData.value.push(fixed)
  // 移动燃烧
  const mobile = JSON.parse(sessionStorage.getItem('移动燃烧') as string)
  carbonData.value.push(mobile)
  // 能源加工转换
  const energy = JSON.parse(sessionStorage.getItem('能源加工转换') as string)
  carbonData.value.push(energy)
  // 购入电力
  const electricity = JSON.parse(sessionStorage.getItem('购入电力') as string)
  carbonData.value.push(electricity)
  // 购入电力
  const heat = JSON.parse(sessionStorage.getItem('购入热力') as string)
  carbonData.value.push(heat)
  // 光伏
  const guang = JSON.parse(sessionStorage.getItem('光伏') as string)
  carbonData.value.push(guang)
  sessionStorage.setItem('计算结果', JSON.stringify(carbonData.value))
  $router.push({ path: '/carbonCount/electricresult' })
}
const save = () => {
  countRef.value.saveData()
  ElMessage({
    message: '保存成功',
    type: 'success',
  })
}
</script>

<template>
  <div>
    <page />
    <table-list ref="countRef" />
    <div style="position: fixed; right: 100px; bottom: 10px;z-index: 99;">
      <el-button size="large" @click="save">
        保存
      </el-button>
      <el-button size="large" type="primary" @click="resultFun">
        计算结果
      </el-button>
    </div>
  </div>
  <!-- <result v-show="!isShowTable" ref="resultRef" :data="carbonData" @bak="resultFun" /> -->
</template>

