Newer
Older
carbon-metering-front / src / views / count / electric.vue
liyaguang on 27 Mar 2023 1 KB feat(*): 电力碳核算页面
<!-- 电力碳核算 -->
<script lang="ts" setup name="electricCount">
import page from './page.vue'
import tableList from './table.vue'
import result from './components/result.vue'
const $router = useRouter()
const isShowTable = ref(true)
const resultRef = ref()
const carbonData = ref<any>([])
const resultFun = () => {
  // 固定燃烧
  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)
  // isShowTable.value = !isShowTable.value
  // 给子组件发送数据
  resultRef.value.requestData(carbonData.value)
  sessionStorage.setItem('计算结果', JSON.stringify(carbonData.value))
  $router.push({ path: '/carbonCount/electricresult' })
}
</script>

<template>
  <div v-show="isShowTable">
    <page />
    <table-list ref="countRef" />
    <div style="position: fixed; right: 100px; bottom: 10px;z-index: 99;">
      <el-button size="large">
        保存
      </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>