xujunjie há 1 ano atrás
pai
commit
041a3e13d3

+ 3 - 3
src/components/ManagementPage/chartModule.js

@@ -92,7 +92,7 @@ const ChartModule = (props) => {
             ) + 1;
           option.xAxis.data = xData.map((item) => {
             if (timeFormat > 150 || chartType === 'bar') {
-              return `${dayjs(item).format('MM')}月 `;
+              return dayjs(item).format('YYYY-MM');
             }
             if (timeFormat >= 7) {
               return dayjs(item).format('YYYY-MM-DD');
@@ -121,7 +121,7 @@ const ChartModule = (props) => {
             };
           });
         } else {
-          option.grid.right = 30;
+          option.grid.right = 60;
           // 重置grid left 用于比对计算合适宽度
           option.grid.left = 70;
           option.yAxis = { ...option.yAxis[0], name: yName };
@@ -219,7 +219,7 @@ const defaultOption = {
   grid: {
     bottom: 30,
     left: 70,
-    right: 30,
+    right: 50,
   },
   xAxis: {
     type: 'category',

+ 3 - 1
src/pages/Center/index.js

@@ -7,6 +7,8 @@ import { UnityAction } from '@/utils/utils';
 import { useModel, useNavigate, useParams } from '@umijs/max';
 import styles from './index.less';
 
+const project = JSON.parse(localStorage.project || '{}');
+
 const Center = () => {
   const { initialState } = useModel('@@initialState');
   const user = initialState?.user || {};
@@ -31,7 +33,7 @@ const Center = () => {
 
   return (
     <PageContent>
-      <PageTitle>个人中心</PageTitle>
+      <PageTitle>个人中心-{project.Name}</PageTitle>
 
       <div className={styles.head}>
         <div className={styles.profile} />

+ 12 - 12
src/pages/Home/ChemCostComparison.js

@@ -85,8 +85,8 @@ export const ChemCost = ({ open, showTip = false }) => {
   const curMonth = dayjs().format('YYYY-MM');
 
   const defaultTime = {
-    s_time: `${dayjs().format('YYYY')}-${dayjs().startOf('year').format('MM')}`,
-    e_time: `${dayjs().format('YYYY')}-${dayjs().endOf('year').format('MM')}`,
+    s_time: dayjs().subtract(1, 'years').format('YYYY-MM'),
+    e_time: dayjs().format('YYYY-MM'),
   };
 
   const defaultParams = {
@@ -195,11 +195,11 @@ export const ChemCost = ({ open, showTip = false }) => {
         ),
       ].sort();
 
-      let year = `${dayjs(chemPerCost.xData[0]).year()}`;
-      chemPerCost.xData = [];
-      for (let index = 0; index < 12; index++) {
-        chemPerCost.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
-      }
+      // let year = `${dayjs(chemPerCost.xData[0]).year()}`;
+      // chemPerCost.xData = [];
+      // for (let index = 0; index < 12; index++) {
+      //   chemPerCost.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
+      // }
 
       let topVals = { ...topValues };
 
@@ -248,11 +248,11 @@ export const ChemCost = ({ open, showTip = false }) => {
         ),
       ].sort();
 
-      year = `${dayjs(chemUsed.xData[0]).year()}`;
-      chemUsed.xData = [];
-      for (let index = 0; index < 12; index++) {
-        chemUsed.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
-      }
+      // year = `${dayjs(chemUsed.xData[0]).year()}`;
+      // chemUsed.xData = [];
+      // for (let index = 0; index < 12; index++) {
+      //   chemUsed.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
+      // }
 
       // 确定保留的小数点
       const chemUsedMaxValue = [...planChem, ...actualChem]

+ 12 - 12
src/pages/Home/EnergyCostComparison.js

@@ -66,8 +66,8 @@ export const EnergyCost = ({ open, detailClick, showTip }) => {
   const [curElecUsed, setCurElecUsed] = useState(0); // 当前月实际用电量
 
   const defaultTime = {
-    s_time: `${dayjs().format('YYYY')}-${dayjs().startOf('year').format('MM')}`,
-    e_time: `${dayjs().format('YYYY')}-${dayjs().endOf('year').format('MM')}`,
+    s_time: dayjs().subtract(1, 'years').format('YYYY-MM'),
+    e_time: dayjs().format('YYYY-MM'),
   };
 
   const defaultParams = {
@@ -167,11 +167,11 @@ export const EnergyCost = ({ open, detailClick, showTip }) => {
         ),
       ].sort();
 
-      let year = `${dayjs(elecPerCost.xData[0]).year()}`;
-      elecPerCost.xData = [];
-      for (let index = 0; index < 12; index++) {
-        elecPerCost.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
-      }
+      // let year = `${dayjs(elecPerCost.xData[0]).year()}`;
+      // elecPerCost.xData = [];
+      // for (let index = 0; index < 12; index++) {
+      //   elecPerCost.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
+      // }
 
       // 确定保留的小数点
       const elecPerCostValue = [...planElecPerCost, ...actualElecPerCost]
@@ -216,11 +216,11 @@ export const EnergyCost = ({ open, detailClick, showTip }) => {
         ),
       ].sort();
 
-      year = `${dayjs(elecUsed.xData[0]).year()}`;
-      elecUsed.xData = [];
-      for (let index = 0; index < 12; index++) {
-        elecUsed.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
-      }
+      // let year = `${dayjs(elecUsed.xData[0]).year()}`;
+      // elecUsed.xData = [];
+      // for (let index = 0; index < 12; index++) {
+      //   elecUsed.xData.push(`${year}-${dayjs().month(index).format('MM')}`);
+      // }
 
       // 确定保留的小数点
       const elecUsedMaxValue = [...planElecUsed, ...actualElecUsed]

+ 3 - 1
src/pages/Projects/index.js

@@ -39,7 +39,9 @@ const Projects = () => {
   };
 
   const toProject = (item) => {
-    UnityAction.sendMsg('project', JSON.stringify(item));
+    const project = JSON.stringify(item)
+    localStorage.project = project
+    UnityAction.sendMsg('project', project);
   };
   useEffect(() => {
     localStorage.width = document.documentElement.getBoundingClientRect().width;