feat: carbon 添加分值
This commit is contained in:
parent
731af1b2fc
commit
a3cc4f6d74
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<t-row style="height: 100%;">
|
||||
<t-col :span="2" style="height: 100%;">
|
||||
<t-col :flex="2" style="height: 100%;min-height: 700px;">
|
||||
<t-card style="height: 100%;">
|
||||
<t-form label-align="left" label-width="0" style="height: 600px;">
|
||||
<t-form label-align="left" label-width="0">
|
||||
<t-form-item style="height: 70px;">
|
||||
<t-upload v-model="file1" :autoUpload="false" :max="1" accept=".docx,.pdf,.txt"
|
||||
tips="企业低碳转型战略与总体规划" />
|
||||
|
|
@ -33,7 +33,25 @@
|
|||
</t-form>
|
||||
</t-card>
|
||||
</t-col>
|
||||
<t-col :span="10" style="height: 100%;">
|
||||
<t-col :flex="10" style="height: 100%;">
|
||||
<t-card style="font-size: 24px;">
|
||||
<span v-if="score === null">暂无评分数据,请上传相关文件后计算</span>
|
||||
<span v-else>
|
||||
贵企业的双碳贷前得分为
|
||||
<span :style="{
|
||||
color: levelColor,
|
||||
fontWeight: 'bold',
|
||||
fontSize: '32px',
|
||||
}">{{ score }}</span> 分;
|
||||
等级: <span :style="{
|
||||
color: levelColor,
|
||||
fontWeight: 'bold',
|
||||
fontSize: '32px',
|
||||
}">
|
||||
{{ level }}
|
||||
</span>
|
||||
</span>
|
||||
</t-card>
|
||||
<t-card>
|
||||
<t-table :data="tableData" :columns="columns" row-key="id" :hover="true" size="small"
|
||||
:rowspan-and-colspan="colSpan">
|
||||
|
|
@ -49,7 +67,7 @@
|
|||
</t-row>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import http from "@/api/request.js";
|
||||
onMounted(() => {
|
||||
getStandard();
|
||||
|
|
@ -112,6 +130,24 @@ const file4 = ref([]);
|
|||
const file5 = ref([]);
|
||||
const file6 = ref([]);
|
||||
const calLoading = ref(false);
|
||||
const score = ref(null);
|
||||
const level = ref("较差");
|
||||
const levelColor = ref('#000')
|
||||
watch(score, (newScore) => {
|
||||
if (newScore >= 80) {
|
||||
level.value = '领先'
|
||||
levelColor.value = '#4caf50'
|
||||
} else if (newScore >= 60) {
|
||||
level.value = '良好'
|
||||
levelColor.value = '#2196f3'
|
||||
} else if (newScore >= 30) {
|
||||
level.value = '一般'
|
||||
levelColor.value = '#ff9800'
|
||||
} else {
|
||||
level.value = '较差'
|
||||
levelColor.value = '#f44336'
|
||||
}
|
||||
}, { immediate: true })
|
||||
const handleCal = () => {
|
||||
let formData = new FormData();
|
||||
formData.append('file1', file1.value?.[0]?.raw);
|
||||
|
|
@ -124,6 +160,7 @@ const handleCal = () => {
|
|||
http.postForm("/cal/", formData).then(res => {
|
||||
calLoading.value = false;
|
||||
tableData.value = res.data;
|
||||
score.value = res.total_score;
|
||||
}).catch(e=>{calLoading.value = false;})
|
||||
console.log(formData);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue