Browse Source

feat: 碳排放bug修改

sunxiao 1 month ago
parent
commit
23c99c9988

+ 2 - 1
.env.development

@@ -1,4 +1,5 @@
 # 请求地址
-VITE_BASE_URL=http://10.0.0.28:8080
+# VITE_BASE_URL=http://10.0.0.28:8080
+VITE_BASE_URL=http://192.168.9.54:8080
 # 请求前缀
 VITE_BASE_PREFIX='' 

+ 11 - 1
src/views/carbon/components/TheDrawerForm.vue

@@ -482,8 +482,18 @@ const onReset = () => {
   }
 }
 
-const onSubmit = (e) => {
+const onSubmit = async (e) => {
   e.preventDefault();
+  const params = formatData();
+  try {
+    await carbonApi.postCarbonSmart(params);
+    onReset();
+    emit('on-submit');
+    message.success("提交成功");
+  } catch (e) {
+    message.error(e.msg, { duration: 3500 });
+  }
+  return
   const isVerifying = !validateTableData();
   formRef.value?.validate(async (errors) => {
     if (!errors) {

+ 9 - 8
src/views/carbon/echartOptions/index.js

@@ -46,14 +46,14 @@ export const echartLineOptions = (data) => {
         fontSize: "12px",
         color: "rgba(217, 247, 255, 0.7)",
       },
-      data: ["碳排放强度", "碳排放量"],
+      data: ["碳排放量", "碳排放强度"],
     },
     grid: {
       top: "20%",
-      bottom: "5%",
-      left: "5%",
-      right: "5%",
-      containLabel: true,
+      bottom: "20%",
+      left: "10%",
+      right: "10%",
+      // containLabel: true,
     },
     xAxis: {
       show: data.length,
@@ -91,7 +91,7 @@ export const echartLineOptions = (data) => {
         name: "tCO₂-eq",
         scale: true,
         axisLabel: {
-          margin: -10,
+          // margin: -10,
           color: "#fff",
         },
         axisLine: {
@@ -115,7 +115,7 @@ export const echartLineOptions = (data) => {
         name: "kg CO₂-eq/m³",
         scale: true,
         axisLabel: {
-          margin: -20,
+          // margin: -20,
           color: "#fff",
         },
         axisTick: {
@@ -134,7 +134,7 @@ export const echartLineOptions = (data) => {
       {
         name: "碳排放量",
         type: "line",
-        yAxisIndex: 1,
+        yAxisIndex: 0,
         smooth: true,
         showSymbol: false,
         symbol: "circle",
@@ -176,6 +176,7 @@ export const echartLineOptions = (data) => {
         symbol: "circle",
         symbolSize: 6,
         data: seriesDataTwo,
+        yAxisIndex: 1,
         // data: [14,44,56,67,22,19,41],
         areaStyle: {
           color: new echarts.graphic.LinearGradient(

+ 8 - 7
src/views/carbon/index.vue

@@ -121,12 +121,12 @@ const initEchart = () => {
 
   // 污泥处理-生化反应
   echartMdu.setOption(echartColumnarOptions([
-    wnclYyzqCo2.toFixed(2),
-    wnclDdclCo2.toFixed(2),
-    (wnclHyfjCh4Co2 + wnclHyfjN2oCo2).toFixed(2),
-    (wnclWnfsCo2).toFixed(2),
-    (wnclBwqrsCh4Co2 + wnclBwqrsN2oCo2 + wnclWnrjByhCo2).toFixed(2),
-    (wnclWnrjQtCh4Co2 + wnclWnrjQtN2oCo2).toFixed(2)
+    (wnclYyzqCo2 || 0).toFixed(2),
+    (wnclDdclCo2 || 0).toFixed(2),
+    (wnclHyfjCh4Co2 || 0 + wnclHyfjN2oCo2 || 0).toFixed(2),
+    (wnclWnfsCo2 || 0).toFixed(2),
+    (wnclBwqrsCh4Co2 || 0 + wnclBwqrsN2oCo2 || 0 + wnclWnrjByhCo2 || 0).toFixed(2),
+    (wnclWnrjQtCh4Co2 || 0 + wnclWnrjQtN2oCo2 || 0).toFixed(2)
   ]));
 
   const baseEnum = {
@@ -204,7 +204,8 @@ const onSubmit = async () => {
 
     initPageData();
   } else {
-    initAllMonth();
+    const [ firstMonth ] = await initAllMonth();
+    inpVal.value = firstMonth;
     initPageData();
   }
 }