Browse Source

王子文 生产月报 Cracker Raw Material 查询

wangggziwen 2 years ago
parent
commit
aa5c2bc72c

+ 10 - 0
master/src/main/java/com/ruoyi/project/production/controller/TMonthlyProductionReportController.java

@@ -33,6 +33,16 @@ public class TMonthlyProductionReportController extends BaseController
     @Autowired
     private ITMonthlyProductionReportService tMonthlyProductionReportService;
 
+    /**
+     * 按年份查询Cracker Raw Material
+     */
+    @PreAuthorize("@ss.hasPermi('production:monthly:query')")
+    @GetMapping(value = "/CrackerRawMaterial/{year}")
+    public AjaxResult getCrackerRawMaterialByYear(@PathVariable("year") Long year)
+    {
+        return AjaxResult.success(tMonthlyProductionReportService.selectCrackerRawMaterialByYear(year));
+    }
+
     /**
      * 查询每月生产报告列表
      */

+ 2 - 0
master/src/main/java/com/ruoyi/project/production/mapper/TMonthlyProductionReportMapper.java

@@ -60,4 +60,6 @@ public interface TMonthlyProductionReportMapper
      * @return 结果
      */
     public int deleteTMonthlyProductionReportByIds(Long[] ids);
+
+    public List<TMonthlyProductionReport> selectCrackerRawMaterialByYear(Long year);
 }

+ 3 - 0
master/src/main/java/com/ruoyi/project/production/service/ITMonthlyProductionReportService.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.production.service;
 
 import java.util.List;
 import com.ruoyi.project.production.domain.TMonthlyProductionReport;
+import com.ruoyi.project.production.service.impl.vo.CrackerRawMaterialVO;
 
 /**
  * 每月生产报告Service接口
@@ -58,4 +59,6 @@ public interface ITMonthlyProductionReportService
      * @return 结果
      */
     public int deleteTMonthlyProductionReportById(Long id);
+
+    public List<CrackerRawMaterialVO> selectCrackerRawMaterialByYear(Long year);
 }

+ 151 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/TMonthlyProductionReportServiceImpl.java

@@ -1,6 +1,13 @@
 package com.ruoyi.project.production.service.impl;
 
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
+
+import com.alibaba.druid.sql.ast.statement.SQLForeignKeyImpl;
+import com.ruoyi.project.production.service.impl.vo.CrackerRawMaterialVO;
+import org.junit.platform.commons.JUnitException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.project.production.mapper.TMonthlyProductionReportMapper;
@@ -90,4 +97,148 @@ public class TMonthlyProductionReportServiceImpl implements ITMonthlyProductionR
     {
         return tMonthlyProductionReportMapper.deleteTMonthlyProductionReportById(id);
     }
+
+    @Override
+    public List<CrackerRawMaterialVO> selectCrackerRawMaterialByYear(Long year) {
+        // 从数据库中查出的当前year的月报数据集合,每个元素对应当前year某个月的数据
+        List<TMonthlyProductionReport> tMonthlyProductionReports = tMonthlyProductionReportMapper.selectCrackerRawMaterialByYear(year);
+        // 前端月报数据集合,每个元素对应当前某个指标的title、unit、1~12月的数据以及年度汇总数据
+        List<CrackerRawMaterialVO> crackerRawMaterialVOs = new ArrayList<>();
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Cracker Raw Material", ""));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("NAP", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C5", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("NA", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Wison Ethane", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("LPG to Furnace", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C4 Raff3 fr bd and 2ph", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C2 fr LDPE", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C3 fr OXO", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Mixed C3/C4 fr BD", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("HC9", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Offgas fr AEU", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("wash oil", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("toluene", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("C4 Recycle(ton)", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("input total", "t"));
+        crackerRawMaterialVOs.add(new CrackerRawMaterialVO("Total feed", ""));
+        // 遍历从数据库中查出的月报数据集合,结果为0~12条数据不等
+        for (int i = 0; i < tMonthlyProductionReports.size(); i++) {
+            TMonthlyProductionReport tMonthlyProductionReport = tMonthlyProductionReports.get(i);
+            String nap = tMonthlyProductionReport.getNap();
+            String c5 = tMonthlyProductionReport.getC5();
+            String c6C8Na = tMonthlyProductionReport.getC6C8Na();
+            String wisonEthane = tMonthlyProductionReport.getWisonEthane();
+            String lpgToFurnace = tMonthlyProductionReport.getLpgToFurnace();
+            String raff3FrBd = tMonthlyProductionReport.getRaff3FrBd();
+            String raffinate2pFr2ph = tMonthlyProductionReport.getRaffinate2pFr2ph();
+            String c2FrLdpe = tMonthlyProductionReport.getC2FrLdpe();
+            String c3FrOxo = tMonthlyProductionReport.getC3FrOxo();
+            String mixedC3C4 = tMonthlyProductionReport.getMixedC3C4();
+            String hyC9 = tMonthlyProductionReport.getHyC9();
+            String pguOffgas = tMonthlyProductionReport.getPguOffgas();
+            String washOil = tMonthlyProductionReport.getWashOil();
+            String toluene = tMonthlyProductionReport.getToluene();
+            String hyC4FrR800 = tMonthlyProductionReport.getHyC4FrR800();
+            String crackerRawInput = tMonthlyProductionReport.getCrackerRawInput();
+            String crackerRawFeed = tMonthlyProductionReport.getCrackerRawFeed();
+            // 前端数据集合的class
+            Class clazz = null;
+            // 当前元素调用的set方法
+            Method method = null;
+            try {
+                clazz = Class.forName("com.ruoyi.project.production.service.impl.vo.CrackerRawMaterialVO");
+                switch (tMonthlyProductionReport.getReportMonth().toString()) { // 当前元素的所属月份
+                    case "1":   // 一月
+                        method = clazz.getDeclaredMethod("setJan", String.class);
+                        break;
+                    case "2":   // 二月
+                        method = clazz.getDeclaredMethod("setFeb", String.class);
+                        break;
+                    case "3":   // 三月
+                        method = clazz.getDeclaredMethod("setMar", String.class);
+                        break;
+                    case "4":   // 四月
+                        method = clazz.getDeclaredMethod("setApr", String.class);
+                        break;
+                    case "5":   // 五月
+                        method = clazz.getDeclaredMethod("setMay", String.class);
+                        break;
+                    case "6":   // 六月
+                        method = clazz.getDeclaredMethod("setJun", String.class);
+                        break;
+                    case "7":   // 七月
+                        method = clazz.getDeclaredMethod("setJul", String.class);
+                        break;
+                    case "8":   // 八月
+                        method = clazz.getDeclaredMethod("setAug", String.class);
+                        break;
+                    case "9":   // 九月
+                        method = clazz.getDeclaredMethod("setSep", String.class);
+                        break;
+                    case "10":   // 十月
+                        method = clazz.getDeclaredMethod("setOct", String.class);
+                        break;
+                    case "11":   // 十一月
+                        method = clazz.getDeclaredMethod("setNov", String.class);
+                        break;
+                    case "12":   // 十二月
+                        method = clazz.getDeclaredMethod("setDec", String.class);
+                        break;
+                }
+                // 按照当前元素的所属月份调取相应set方法
+                method.invoke(crackerRawMaterialVOs.get(0), crackerRawInput);
+                method.invoke(crackerRawMaterialVOs.get(1), nap);
+                method.invoke(crackerRawMaterialVOs.get(2), c5);
+                method.invoke(crackerRawMaterialVOs.get(3), c6C8Na);
+                method.invoke(crackerRawMaterialVOs.get(4), wisonEthane);
+                method.invoke(crackerRawMaterialVOs.get(5), lpgToFurnace);
+                method.invoke(crackerRawMaterialVOs.get(6), raff3FrBd);
+                method.invoke(crackerRawMaterialVOs.get(7), raffinate2pFr2ph);
+                method.invoke(crackerRawMaterialVOs.get(8), c2FrLdpe);
+                method.invoke(crackerRawMaterialVOs.get(9), c3FrOxo);
+                method.invoke(crackerRawMaterialVOs.get(10), mixedC3C4);
+                method.invoke(crackerRawMaterialVOs.get(11), hyC9);
+                method.invoke(crackerRawMaterialVOs.get(12), pguOffgas);
+                method.invoke(crackerRawMaterialVOs.get(13), washOil);
+                method.invoke(crackerRawMaterialVOs.get(14), toluene);
+                method.invoke(crackerRawMaterialVOs.get(15), hyC4FrR800);
+                method.invoke(crackerRawMaterialVOs.get(16), crackerRawInput);
+                method.invoke(crackerRawMaterialVOs.get(17), crackerRawFeed);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        // 遍历前端月报数据集合,计算total的值1~12月之和)
+        for (int i = 0; i < crackerRawMaterialVOs.size(); i++) {
+            CrackerRawMaterialVO crackerRawMaterialVO = crackerRawMaterialVOs.get(i);
+            BigDecimal total = new BigDecimal("0");
+            String janStr = crackerRawMaterialVO.getJan();
+            String febStr = crackerRawMaterialVO.getFeb();
+            String marStr = crackerRawMaterialVO.getMar();
+            String aprStr = crackerRawMaterialVO.getApr();
+            String mayStr = crackerRawMaterialVO.getMay();
+            String junStr = crackerRawMaterialVO.getJun();
+            String julStr = crackerRawMaterialVO.getJul();
+            String augStr = crackerRawMaterialVO.getAug();
+            String sepStr = crackerRawMaterialVO.getSep();
+            String octStr = crackerRawMaterialVO.getOct();
+            String novStr = crackerRawMaterialVO.getNov();
+            String decStr = crackerRawMaterialVO.getDec();
+            BigDecimal jan = new BigDecimal(janStr == null ? "0" : janStr);
+            BigDecimal feb = new BigDecimal(febStr == null ? "0" : febStr);
+            BigDecimal mar = new BigDecimal(marStr == null ? "0" : marStr);
+            BigDecimal apr = new BigDecimal(aprStr == null ? "0" : aprStr);
+            BigDecimal may = new BigDecimal(mayStr == null ? "0" : mayStr);
+            BigDecimal jun = new BigDecimal(junStr == null ? "0" : junStr);
+            BigDecimal jul = new BigDecimal(julStr == null ? "0" : julStr);
+            BigDecimal aug = new BigDecimal(augStr == null ? "0" : augStr);
+            BigDecimal sep = new BigDecimal(sepStr == null ? "0" : sepStr);
+            BigDecimal oct = new BigDecimal(octStr == null ? "0" : octStr);
+            BigDecimal nov = new BigDecimal(novStr == null ? "0" : novStr);
+            BigDecimal dec = new BigDecimal(decStr == null ? "0" : decStr);
+            total = jan.add(feb).add(mar).add(apr).add(may).add(jun).add(jul).add(aug).add(sep).add(oct).add(nov).add(dec);
+            crackerRawMaterialVO.setTotal(total.toString());
+        }
+        return crackerRawMaterialVOs;
+    }
 }

+ 177 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/vo/CrackerRawMaterialVO.java

@@ -0,0 +1,177 @@
+package com.ruoyi.project.production.service.impl.vo;
+
+/**
+ * @author: Wang Zi Wen
+ * @email: wangggziwen@163.com
+ * @datetime: 2022/10/31 14:16
+ */
+public class CrackerRawMaterialVO {
+
+    private String title;
+
+    private String unit;
+
+    private String currently;
+
+    private String jan;
+
+    private String feb;
+
+    private String mar;
+
+    private String apr;
+
+    private String may;
+
+    private String jun;
+
+    private String jul;
+
+    private String aug;
+
+    private String sep;
+
+    private String oct;
+
+    private String nov;
+
+    private String dec;
+
+    private String total;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public String getCurrently() {
+        return currently;
+    }
+
+    public void setCurrently(String currently) {
+        this.currently = currently;
+    }
+
+    public String getJan() {
+        return jan;
+    }
+
+    public void setJan(String jan) {
+        this.jan = jan;
+    }
+
+    public String getFeb() {
+        return feb;
+    }
+
+    public void setFeb(String feb) {
+        this.feb = feb;
+    }
+
+    public String getMar() {
+        return mar;
+    }
+
+    public void setMar(String mar) {
+        this.mar = mar;
+    }
+
+    public String getApr() {
+        return apr;
+    }
+
+    public void setApr(String apr) {
+        this.apr = apr;
+    }
+
+    public String getMay() {
+        return may;
+    }
+
+    public void setMay(String may) {
+        this.may = may;
+    }
+
+    public String getJun() {
+        return jun;
+    }
+
+    public void setJun(String jun) {
+        this.jun = jun;
+    }
+
+    public String getJul() {
+        return jul;
+    }
+
+    public void setJul(String jul) {
+        this.jul = jul;
+    }
+
+    public String getAug() {
+        return aug;
+    }
+
+    public void setAug(String aug) {
+        this.aug = aug;
+    }
+
+    public String getSep() {
+        return sep;
+    }
+
+    public void setSep(String sep) {
+        this.sep = sep;
+    }
+
+    public String getOct() {
+        return oct;
+    }
+
+    public void setOct(String oct) {
+        this.oct = oct;
+    }
+
+    public String getNov() {
+        return nov;
+    }
+
+    public void setNov(String nov) {
+        this.nov = nov;
+    }
+
+    public String getDec() {
+        return dec;
+    }
+
+    public void setDec(String dec) {
+        this.dec = dec;
+    }
+
+    public String getTotal() {
+        return total;
+    }
+
+    public void setTotal(String total) {
+        this.total = total;
+    }
+
+    public CrackerRawMaterialVO() {
+    }
+
+    public CrackerRawMaterialVO(String title, String unit) {
+        this.title = title;
+        this.unit = unit;
+    }
+}

+ 14 - 2
master/src/main/resources/mybatis/production/TMonthlyProductionReportMapper.xml

@@ -29,10 +29,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTMonthlyProductionReportVo">
-        select d.id, d.report_month, d.report_year, d.nap, d.c5, d.c6_c8_na, d.wison_ethane, d.lpg_to_furnace, d.raff3_fr_bd, d.raffinate2p_fr_2ph, d.c2_fr_ldpe, d.c3_fr_oxo, d.mixed_c3_c4, d.hy_c9, d.pgu_offgas, d.wash_oil, d.toluene, d.hy_c4_fr_r800, d.cracker_raw_input, d.cracker_raw_feed ,s.dept_name from t_monthly_production_report d
-      left join sys_dept s on s.dept_id = d.dept_id
+        select d.id, d.report_month, d.report_year, d.nap, d.c5, d.c6_c8_na, d.wison_ethane, d.lpg_to_furnace, d.raff3_fr_bd, d.raffinate2p_fr_2ph, d.c2_fr_ldpe, d.c3_fr_oxo, d.mixed_c3_c4, d.hy_c9, d.pgu_offgas, d.wash_oil, d.toluene, d.hy_c4_fr_r800, d.cracker_raw_input, d.cracker_raw_feed from t_monthly_production_report d
     </sql>
 
+    <select id="selectCrackerRawMaterialByYear" parameterType="Long" resultMap="TMonthlyProductionReportResult">
+        select
+          d.id, d.report_month, d.report_year, d.nap, d.c5, d.c6_c8_na, d.wison_ethane, d.lpg_to_furnace,
+          d.raff3_fr_bd, d.raffinate2p_fr_2ph, d.c2_fr_ldpe, d.c3_fr_oxo, d.mixed_c3_c4, d.hy_c9, d.pgu_offgas,
+          d.wash_oil, d.toluene, d.hy_c4_fr_r800, d.cracker_raw_input, d.cracker_raw_feed
+        from
+          t_monthly_production_report d
+        where d.report_year = #{year}
+    </select>
+
     <select id="selectTMonthlyProductionReportList" parameterType="TMonthlyProductionReport" resultMap="TMonthlyProductionReportResult">
         <include refid="selectTMonthlyProductionReportVo"/>
         <where>  
@@ -67,6 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
         
     <insert id="insertTMonthlyProductionReport" parameterType="TMonthlyProductionReport">
+        <selectKey keyProperty="id" resultType="long" order="BEFORE">
+            SELECT SEQ_T_MONTHLY_REPORT.NEXTVAL as id FROM DUAL
+        </selectKey>
         insert into t_monthly_production_report
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>

+ 8 - 0
ui/src/api/production/monthly.js

@@ -1,5 +1,13 @@
 import request from '@/utils/request'
 
+// 按年份查询Cracker Raw Material
+export function getCrackerRawMaterial(year) {
+  return request({
+    url: '/production/monthly/CrackerRawMaterial/' + year,
+    method: 'get'
+  })
+}
+
 // 查询每月生产报告列表
 export function listReport(query) {
   return request({

+ 368 - 345
ui/src/views/production/monthly/index.vue

@@ -3,6 +3,7 @@
     <el-form :inline="true" label-width="68px">
       <el-form-item label="报告年份" prop="reportDate">
         <el-date-picker
+          clearable
           v-model="year"
           @change="handleQueryYear()"
           size="small"
@@ -443,352 +444,374 @@
 </template>
 
 <script>
-  export default {
-    name: "Monthly",
-      data() {
-        return {
-          // 年份
-          year: null,
-          // 月份的固定表示
-          monthList: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
-          tableCrackerRawMaterial: [
-            {title: "Cracker Raw Material"},
-            {title: "NAP"},
-            {title: "C5"},
-            {title: "NA"},
-            {title: "Wison Ethane"},
-            {title: "LPG to Furnace"},
-            {title: "C4 Raff3  fr bd and 2ph"},
-            {title: "C2 fr LDPE"},
-            {title: "C3 fr OXO"},
-            {title: "Mixed C3/C4 fr BD"},
-            {title: "HC9"},
-            {title: "Offgas fr AEU"},
-            {title: "wash oil"},
-            {title: "toluene"},
-            {title: "C4 Recycle(ton)"},
-            {title: "input total"},
-            {title: "Total feed"},
-          ],
-          tableCrackerOutputProduct: [
-            {title: "Cracker Output Product"},
-            {title: "H2"},
-            {title: "C2="},
-            {title: "C3="},
-            {title: "C3/C4 LPG"},
-            {title: "C4'S"},
-            {title: "RPG"},
-            {title: "PO"},
-            {title: "Naphthalene"},
-            {title: "EBO"},
-            {title: "Cracker Residue "},
-            {title: "Methane"},
-            {title: "OFFAGE"},
-            {title: "output total"},
-          ],
-          tableAromaticsRawMaterial: [
-            {title: "Aromatics Raw Material"},
-            {title: "RPG fr EU"},
-            {title: "H2 to PGU"},
-            {title: "Mix BTX Product"},
-            {title: "Mix BTX to AEU"},
-            {title: "input total"},
-          ],
-          tableAromaticsOutputProduct: [
-            {title:"Aromatics Output Product"},
-            {title:"Benzene"},
-            {title:"Toluene"},
-            {title:"Xylene"},
-            {title:"C6-C8 NA"},
-            {title:"C5"},
-            {title:"C9"},
-            {title:"Wash oil"},
-            {title:"offags"},
-            {title:"MIX BTX change"},
-            {title:"BTX Product"},
-            {title:"Toluene Product(- EU)"},
-            {title:"output total"},
-          ],
-          tableEligibleProductRate: [
-            {title: "C2="},
-            {title: "C3="},
-            {title: "C4's"},
-          ],
-          tableProductYield: [
-            {title: "gaseity"},
-            {title: "tatal"},
-            {title: "C3/C2"},
-            {title: "H2"},
-            {title: "ethylene"},
-            {title: "propylene"},
-            {title: "C3/C4 LPG"},
-            {title: "C4'S"},
-            {title: "PO"},
-            {title: "Naphthalene"},
-            {title: "EBO"},
-            {title: "WS"},
-            {title: "Methane"},
-            {title: "OFFAGE"},
-            {title: "RPG"},
-            {title: "Benzene"},
-            {title: "Toluene"},
-            {title: "Xylene"},
-            {title: "C6-C8 NA"},
-            {title: "C5"},
-            {title: "C9"},
-          ],
-          tableCrackerUtilityConsumption: [
-            {title: "FG(include NG+Offage)"},
-            {title: "SS"},
-            {title: "HS"},
-            {title: "MS"},
-            {title: "LS"},
-            {title: "Electricity"},
-            {title: "coiling water"},
-            {title: "Instru. Air"},
-            {title: "Plant Air"},
-            {title: "N2"},
-            {title: "BFW"},
-            {title: "Polished Condensate"},
-            {title: "P. W. Water"},
-            {title: "TC"},
-            {title: "CNWW"},
-            {title: "DWW"},
-            {title: "waste oil"},
-            {title: "Potable Water"},
-            {title: "Production Water"},
-            {title: "NG to furnace or offags to SUB"},
-            {title: "offage product"},
-          ],
-          tableCrackerEnergyConsumption: [
-            {title: "total energy"},
-            {title: "total energy"},
-            {title: "Energy/ethylene"},
-            {title: "Energy/ethylene"},
-          ],
-          tableAromaticsUtilityConsumption: [
-            {title: "SS"},
-            {title: "HS"},
-            {title: "MS"},
-            {title: "LS"},
-            {title: "Electricity"},
-            {title: "coiling water"},
-            {title: "Potable Water"},
-            {title: "Production Water"},
-            {title: "BFW"},
-            {title: "N2"},
-            {title: "PA&IA"},
-            {title: "Turbine Condensate"},
-            {title: "Contaminated WW"},
-            {title: "Production WW"},
-            {title: "DWW"},
-            {title: "Waste Liquid"},
-          ],
-          tableAromaticsEnergyConsumption: [
-            {title: "total energy"},
-            {title: "total energy"},
-            {title: "Energy/ethylene"},
-            {title: "Energy/ethylene"},
-          ],
-          tablePlantLoad: [
-            {title: "Cracker load"},
-            {title: "C2+C3 Capacity"},
-            {title: "Ethylene load"},
-            {title: "Ethylene Capacity"},
-            {title: "AEU load"},
-            {title: "BTX Capacity"},
-          ],
-          tableCostFrEthylene: [
-            {title: "the cost"},
-          ],
-          tableRuningRate: [
-            {title: "run hour"},
-            {title: "run rate"},
-            {title: "calendar hour"},
-          ],
-          tableShoudownHour: [
-            {title: "operation time"},
-            {title: "hour"},
-            {title: "equipment time"},
-            {title: "hour"},
-            {title: "instrument time"},
-            {title: "hour"},
-            {title: "electric time"},
-            {title: "hour"},
-            {title: "otherwise time"},
-            {title: "hour"},
-            {title: "total time"},
-            {title: "total hour"},
-          ],
-          tableOtherside: [
-            {title: "EU loss"},
-            {title: "EU loss rate"},
-            {title: "AEU loss"},
-            {title: "AEU loss rate"},
-            {title: "Total loss"},
-            {title: "Total loss rate"},
-          ],
-          tableChemicalConsume: [
-            {title: "Cracker and PGU"},
-            {title: "PT-3000"},
-            {title: "NAOH"},
-            {title: "PT-4000"},
-            {title: "EC3392A"},
-            {title: "2W906"},
-            {title: "EC1489A"},
-            {title: "EC1486A"},
-            {title: "20Y3483"},
-            {title: "8Q202"},
-            {title: "20Y97A"},
-            {title: "EC3269A"},
-            {title: "20Y25"},
-            {title: "20Y77"},
-            {title: "510WS"},
-            {title: "N130"},
-            {title: "H2SO4"},
-            {title: "NaOH"},
-            {title: "CH3OH"},
-            {title: ""},
-            {title: "PT-3000"},
-            {title: ""},
-            {title: ""},
-          ],
-          tableSCTUUtilityConsumption: [
-            {title: "FG ( NG+Offage)"},
-            {title: "MP"},
-            {title: "LP"},
-            {title: "Electric"},
-            {title: "CW"},
-            {title: "PA&IA"},
-            {title: "SUB"},
-          ],
-          tableSUBUtilityConsumption: [
-            {title: "Electric"},
-            {title: "NG"},
-            {title: "FG fr EU"},
-            {title: "LPG"},
-            {title: "HHP Steam"},
-            {title: "MP Steam"},
-            {title: "LP Steam"},
-            {title: "P. Condensate"},
-            {title: "CW"},
-            {title: "N2"},
-            {title: "IA&PA"},
-            {title: "HPPA"},
-            {title: "Production Water"},
-            {title: "HP Steam fr SuB-net"},
-            {title: "BFW"},
-            {title: "EO/EG purge gas"},
-            {title: "H2 fr Syngas as fule"},
-            {title: "HP product"},
-            {title: "SUB1# FG FIC1302"},
-            {title: "SUB2#FG  FIC2302"},
-            {title: "total NG FC3702"},
-            {title: "COST(output)"},
-            {title: "总费用"},
-            {title: "锅炉净产量"},
-            {title: "产汽"},
-            {title: "输出"},
-          ],
-          tableSCTFUtilityConsumption: [
-            {title: "Electric"},
-            {title: "NG"},
-            {title: "FG fr EU"},
-            {title: "LPG"},
-            {title: "HHP Steam"},
-            {title: "MP Steam"},
-            {title: "LP Steam"},
-            {title: "P. Condensate"},
-            {title: "CW"},
-            {title: "N2"},
-            {title: "IA&PA"},
-            {title: "HPPA"},
-            {title: "Production Water"},
-            {title: "HP Steam fr SuB-net"},
-            {title: "BFW"},
-            {title: "Contaminated WW"},
-            {title: "Production WW"},
-          ],
-          tableKBI: [
-            {kbi: "Plant capacity utilization rate"},
-            {kbi: "Energy Consumption"},
-            {kbi: "Product of Ethylene and Propylene and C4's base FEED"},
-            {kbi: "C2+C3 Production"},
-            {kbi: "C2+C3 target"},
-            {kbi: "C2+C3 target"},
-            {kbi: "C2 target"},
-            {kbi: "C2 target"},
-            {kbi: "LTI"},
-            {kbi: "Yields of Ethylene and propylene base on furnace feeds"},
-            {kbi: "Yields of Ethylene  base on furnace feeds"},
-            {kbi: "AEU Energy Consumption"},
-            {kbi: "BTX Production"},
-            {kbi: "BTX target"},
-            {kbi: "BTX target"},
-          ],
-          tableSummary: [
-            {item: "乙丙产量"},
-            {item: "石脑油"},
-            {item: "C5 raff"},
-            {item: "乙烷"},
-            {item: "加氢碳九"},
-            {item: "乙烯焦油"},
-            {item: "混合C4"},
-            {item: "三苯"},
-            {item: "裂解碳五"},
-            {item: "裂解碳九"},
-            {item: "重整石脑油"},
-            {item: "蒸汽综合"},
-            {item: "冷却水"},
-            {item: "电"},
-            {item: "燃料气"},
-            {item: "精制水"},
-            {item: "透平凝液"},
-            {item: "乙丙收率"},
-            {item: "石脑油"},
-            {item: "C5 raff"},
-            {item: "乙烷"},
-            {item: "加氢碳九"},
-            {item: "乙烯焦油"},
-            {item: "混合C4"},
-            {item: "三苯"},
-            {item: "裂解碳五"},
-            {item: "裂解碳九"},
-            {item: "非芳"},
-            {item: "蒸汽综合"},
-            {item: "冷却水"},
-            {item: "电"},
-            {item: "燃料气"},
-            {item: "精制水"},
-            {item: "透平凝液"},
-          ],
-        }
-      },
-      created() {
-        this.year = new Date();
-        this.getMonthlyReport();
-      },
-    methods: {
-      /** 设置表头 */
-      setTableTitle() {
-        let monthListTemp = [];
-        for (let i = 0; i < this.monthList.length; i++) {
-          // 拼接后的格式:月份-年份,如Feb-2022
-          monthListTemp.push(this.monthList[i] + "-" + this.year.getFullYear());
-        }
-        this.monthList = monthListTemp;
-      },
-      /** 处理年份控件change事件 */
-      handleQueryYear() {
-        this.getMonthlyReport();
-      },
-      /** 获取月度报告 */
-      getMonthlyReport() {
-        this.setTableTitle();
-        console.log(this.year.getFullYear());
-      },
+import {
+  getCrackerRawMaterial,
+} from "@/api/production/monthly";
+
+export default {
+  name: "Monthly",
+  data() {
+    return {
+      // 年份
+      year: null,
+      // 月份的固定表示
+      monthList: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
+      tableCrackerRawMaterial:[],
+      // [
+      //   {title: "Cracker Raw Material"},
+      //   {title: "NAP"},
+      //   {title: "C5"},
+      //   {title: "NA"},
+      //   {title: "Wison Ethane"},
+      //   {title: "LPG to Furnace"},
+      //   {title: "C4 Raff3  fr bd and 2ph"},
+      //   {title: "C2 fr LDPE"},
+      //   {title: "C3 fr OXO"},
+      //   {title: "Mixed C3/C4 fr BD"},
+      //   {title: "HC9"},
+      //   {title: "Offgas fr AEU"},
+      //   {title: "wash oil"},
+      //   {title: "toluene"},
+      //   {title: "C4 Recycle(ton)"},
+      //   {title: "input total"},
+      //   {title: "Total feed"},
+      // ],
+      tableCrackerOutputProduct: [
+        {title: "Cracker Output Product"},
+        {title: "H2"},
+        {title: "C2="},
+        {title: "C3="},
+        {title: "C3/C4 LPG"},
+        {title: "C4'S"},
+        {title: "RPG"},
+        {title: "PO"},
+        {title: "Naphthalene"},
+        {title: "EBO"},
+        {title: "Cracker Residue "},
+        {title: "Methane"},
+        {title: "OFFAGE"},
+        {title: "output total"},
+      ],
+      tableAromaticsRawMaterial: [
+        {title: "Aromatics Raw Material"},
+        {title: "RPG fr EU"},
+        {title: "H2 to PGU"},
+        {title: "Mix BTX Product"},
+        {title: "Mix BTX to AEU"},
+        {title: "input total"},
+      ],
+      tableAromaticsOutputProduct: [
+        {title:"Aromatics Output Product"},
+        {title:"Benzene"},
+        {title:"Toluene"},
+        {title:"Xylene"},
+        {title:"C6-C8 NA"},
+        {title:"C5"},
+        {title:"C9"},
+        {title:"Wash oil"},
+        {title:"offags"},
+        {title:"MIX BTX change"},
+        {title:"BTX Product"},
+        {title:"Toluene Product(- EU)"},
+        {title:"output total"},
+      ],
+      tableEligibleProductRate: [
+        {title: "C2="},
+        {title: "C3="},
+        {title: "C4's"},
+      ],
+      tableProductYield: [
+        {title: "gaseity"},
+        {title: "tatal"},
+        {title: "C3/C2"},
+        {title: "H2"},
+        {title: "ethylene"},
+        {title: "propylene"},
+        {title: "C3/C4 LPG"},
+        {title: "C4'S"},
+        {title: "PO"},
+        {title: "Naphthalene"},
+        {title: "EBO"},
+        {title: "WS"},
+        {title: "Methane"},
+        {title: "OFFAGE"},
+        {title: "RPG"},
+        {title: "Benzene"},
+        {title: "Toluene"},
+        {title: "Xylene"},
+        {title: "C6-C8 NA"},
+        {title: "C5"},
+        {title: "C9"},
+      ],
+      tableCrackerUtilityConsumption: [
+        {title: "FG(include NG+Offage)"},
+        {title: "SS"},
+        {title: "HS"},
+        {title: "MS"},
+        {title: "LS"},
+        {title: "Electricity"},
+        {title: "coiling water"},
+        {title: "Instru. Air"},
+        {title: "Plant Air"},
+        {title: "N2"},
+        {title: "BFW"},
+        {title: "Polished Condensate"},
+        {title: "P. W. Water"},
+        {title: "TC"},
+        {title: "CNWW"},
+        {title: "DWW"},
+        {title: "waste oil"},
+        {title: "Potable Water"},
+        {title: "Production Water"},
+        {title: "NG to furnace or offags to SUB"},
+        {title: "offage product"},
+      ],
+      tableCrackerEnergyConsumption: [
+        {title: "total energy"},
+        {title: "total energy"},
+        {title: "Energy/ethylene"},
+        {title: "Energy/ethylene"},
+      ],
+      tableAromaticsUtilityConsumption: [
+        {title: "SS"},
+        {title: "HS"},
+        {title: "MS"},
+        {title: "LS"},
+        {title: "Electricity"},
+        {title: "coiling water"},
+        {title: "Potable Water"},
+        {title: "Production Water"},
+        {title: "BFW"},
+        {title: "N2"},
+        {title: "PA&IA"},
+        {title: "Turbine Condensate"},
+        {title: "Contaminated WW"},
+        {title: "Production WW"},
+        {title: "DWW"},
+        {title: "Waste Liquid"},
+      ],
+      tableAromaticsEnergyConsumption: [
+        {title: "total energy"},
+        {title: "total energy"},
+        {title: "Energy/ethylene"},
+        {title: "Energy/ethylene"},
+      ],
+      tablePlantLoad: [
+        {title: "Cracker load"},
+        {title: "C2+C3 Capacity"},
+        {title: "Ethylene load"},
+        {title: "Ethylene Capacity"},
+        {title: "AEU load"},
+        {title: "BTX Capacity"},
+      ],
+      tableCostFrEthylene: [
+        {title: "the cost"},
+      ],
+      tableRuningRate: [
+        {title: "run hour"},
+        {title: "run rate"},
+        {title: "calendar hour"},
+      ],
+      tableShoudownHour: [
+        {title: "operation time"},
+        {title: "hour"},
+        {title: "equipment time"},
+        {title: "hour"},
+        {title: "instrument time"},
+        {title: "hour"},
+        {title: "electric time"},
+        {title: "hour"},
+        {title: "otherwise time"},
+        {title: "hour"},
+        {title: "total time"},
+        {title: "total hour"},
+      ],
+      tableOtherside: [
+        {title: "EU loss"},
+        {title: "EU loss rate"},
+        {title: "AEU loss"},
+        {title: "AEU loss rate"},
+        {title: "Total loss"},
+        {title: "Total loss rate"},
+      ],
+      tableChemicalConsume: [
+        {title: "Cracker and PGU"},
+        {title: "PT-3000"},
+        {title: "NAOH"},
+        {title: "PT-4000"},
+        {title: "EC3392A"},
+        {title: "2W906"},
+        {title: "EC1489A"},
+        {title: "EC1486A"},
+        {title: "20Y3483"},
+        {title: "8Q202"},
+        {title: "20Y97A"},
+        {title: "EC3269A"},
+        {title: "20Y25"},
+        {title: "20Y77"},
+        {title: "510WS"},
+        {title: "N130"},
+        {title: "H2SO4"},
+        {title: "NaOH"},
+        {title: "CH3OH"},
+        {title: ""},
+        {title: "PT-3000"},
+        {title: ""},
+        {title: ""},
+      ],
+      tableSCTUUtilityConsumption: [
+        {title: "FG ( NG+Offage)"},
+        {title: "MP"},
+        {title: "LP"},
+        {title: "Electric"},
+        {title: "CW"},
+        {title: "PA&IA"},
+        {title: "SUB"},
+      ],
+      tableSUBUtilityConsumption: [
+        {title: "Electric"},
+        {title: "NG"},
+        {title: "FG fr EU"},
+        {title: "LPG"},
+        {title: "HHP Steam"},
+        {title: "MP Steam"},
+        {title: "LP Steam"},
+        {title: "P. Condensate"},
+        {title: "CW"},
+        {title: "N2"},
+        {title: "IA&PA"},
+        {title: "HPPA"},
+        {title: "Production Water"},
+        {title: "HP Steam fr SuB-net"},
+        {title: "BFW"},
+        {title: "EO/EG purge gas"},
+        {title: "H2 fr Syngas as fule"},
+        {title: "HP product"},
+        {title: "SUB1# FG FIC1302"},
+        {title: "SUB2#FG  FIC2302"},
+        {title: "total NG FC3702"},
+        {title: "COST(output)"},
+        {title: "总费用"},
+        {title: "锅炉净产量"},
+        {title: "产汽"},
+        {title: "输出"},
+      ],
+      tableSCTFUtilityConsumption: [
+        {title: "Electric"},
+        {title: "NG"},
+        {title: "FG fr EU"},
+        {title: "LPG"},
+        {title: "HHP Steam"},
+        {title: "MP Steam"},
+        {title: "LP Steam"},
+        {title: "P. Condensate"},
+        {title: "CW"},
+        {title: "N2"},
+        {title: "IA&PA"},
+        {title: "HPPA"},
+        {title: "Production Water"},
+        {title: "HP Steam fr SuB-net"},
+        {title: "BFW"},
+        {title: "Contaminated WW"},
+        {title: "Production WW"},
+      ],
+      tableKBI: [
+        {kbi: "Plant capacity utilization rate"},
+        {kbi: "Energy Consumption"},
+        {kbi: "Product of Ethylene and Propylene and C4's base FEED"},
+        {kbi: "C2+C3 Production"},
+        {kbi: "C2+C3 target"},
+        {kbi: "C2+C3 target"},
+        {kbi: "C2 target"},
+        {kbi: "C2 target"},
+        {kbi: "LTI"},
+        {kbi: "Yields of Ethylene and propylene base on furnace feeds"},
+        {kbi: "Yields of Ethylene  base on furnace feeds"},
+        {kbi: "AEU Energy Consumption"},
+        {kbi: "BTX Production"},
+        {kbi: "BTX target"},
+        {kbi: "BTX target"},
+      ],
+      tableSummary: [
+        {item: "乙丙产量"},
+        {item: "石脑油"},
+        {item: "C5 raff"},
+        {item: "乙烷"},
+        {item: "加氢碳九"},
+        {item: "乙烯焦油"},
+        {item: "混合C4"},
+        {item: "三苯"},
+        {item: "裂解碳五"},
+        {item: "裂解碳九"},
+        {item: "重整石脑油"},
+        {item: "蒸汽综合"},
+        {item: "冷却水"},
+        {item: "电"},
+        {item: "燃料气"},
+        {item: "精制水"},
+        {item: "透平凝液"},
+        {item: "乙丙收率"},
+        {item: "石脑油"},
+        {item: "C5 raff"},
+        {item: "乙烷"},
+        {item: "加氢碳九"},
+        {item: "乙烯焦油"},
+        {item: "混合C4"},
+        {item: "三苯"},
+        {item: "裂解碳五"},
+        {item: "裂解碳九"},
+        {item: "非芳"},
+        {item: "蒸汽综合"},
+        {item: "冷却水"},
+        {item: "电"},
+        {item: "燃料气"},
+        {item: "精制水"},
+        {item: "透平凝液"},
+      ],
     }
-   }
+  },
+  created() {
+    // 加载时设置year为今年
+    this.year = new Date();
+    // 加载月报数据
+    this.getMonthlyReport();
+  },
+  methods: {
+    /** 设置表头 */
+    setTableTitle() {
+      // 拼接年份后的数组
+      let monthListTemp = [];
+      // 重置月份数组
+      this.monthList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+      for (let i = 0; i < this.monthList.length; i++) {
+        // 拼接后:月份-年份,如Feb-2022
+        monthListTemp.push(this.monthList[i] + "-" + this.year.getFullYear());
+      }
+      this.monthList = monthListTemp;
+    },
+    /** 处理年份控件change事件 */
+    handleQueryYear() {
+      // 点击clear按钮,设置year为今年
+      if (this.year == null) {
+        this.year = new Date();
+      }
+      this.getMonthlyReport();
+    },
+    /** 获取月报 */
+    getMonthlyReport() {
+      // 设置表头
+      this.setTableTitle();
+      // 获取选中的年份
+      let year = this.year.getFullYear();
+      // 根据年份获取月报数据
+      getCrackerRawMaterial(year).then(response => {
+        this.tableCrackerRawMaterial = response.data;
+      });
+
+
+    },
+  }
+}
 </script>
 
 <style scoped>