yudao-init/src/views/copilot/yield/index.vue
2024-05-29 17:05:55 +08:00

114 lines
2.6 KiB
Vue

<!--
* @Author: zhp
* @Date: 2024-05-10 11:10:54
* @LastEditTime: 2024-05-28 13:36:07
* @LastEditors: zhp
* @Description:
-->
<template>
<div class="yield-copilot">
<section class="top flex">
<db-container class="std-yield" title="标准组件产出" icon="std">
<std-output v-if="show" :period="period" :than="than" />
</db-container>
<db-container class="chip-yield" title="芯片产出" icon="chip2">
<chip-output v-if="show" :period="period" :than="than" />
</db-container>
<db-container class="bipv-yield" title="BIPV产出" icon="bipv">
<bipv-output v-if="show" :period="period" :than="than" />
</db-container>
</section>
<section class="bottom flex">
<db-container class="fto-involve" title="FTO投入">
<fto-invest :period="period" :than="than" />
</db-container>
<db-container class="chip-involve" title="芯片投入" icon="chip">
<chip-invest :period="period" :than="than" />
</db-container>
</section>
</div>
</template>
<script>
import Container from "@/views/copilot/components/Container.vue";
import StdOutput from "./components/StdOutput.vue";
import ChipOutput from "./components/ChipOutput.vue";
import FtoInvest from "./components/FtoInvest.vue";
import BipvOutput from "./components/BipvOutput.vue";
import ChipInvest from "./components/ChipInvest.vue";
export default {
name: "YieldCopilot",
components: {
DbContainer: Container,
StdOutput,
ChipOutput,
BipvOutput,
FtoInvest,
ChipInvest,
},
props: {
period: {
type: String,
default: "日",
},
than: {
type: String,
default: "同比",
},
},
data() {
return {
show:false,
};
},
watch: {
period: {
handler(val) {
val && this.fetchData(val,this.than);
},
immediate: true,
},
than: {
handler(val) {
console.log(val)
val && this.fetchData(this.period,val);
},
immediate: true,
},
},
methods: {
fetchData(period = "日", than) {
// this.$store.commit('copilot/clearState')
console.log(`产量驾驶舱,获取${period}数据`);
this.$store.dispatch("copilot/initCopilot", { period, source: "yield", than }).then(() => {
this.$nextTick(() => {
this.show = true
})
})
},
},
};
</script>
<style scoped>
.yield-copilot {
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
}
.flex {
display: flex;
gap: 16px;
flex: 1;
}
.top > div,
.bottom > div {
height: 100%;
}
</style>