@@ -37,6 +37,7 @@
-
-
-
-
diff --git a/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleBase.vue b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleBase.vue
new file mode 100644
index 00000000..72bbcab3
--- /dev/null
+++ b/src/views/home/electricityCostAnalysisComponents/operatingLineBarSaleBase.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
diff --git a/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue b/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue
index 0d0e43ca..b9ac60de 100644
--- a/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue
+++ b/src/views/home/electricityCostAnalysisComponents/relatedIndicatorsAnalysis.vue
@@ -124,11 +124,27 @@ export default {
},
methods: {
handleDashboardClick(path) {
+ // 从路径提取详情页名称,如 '/salesVolumeAnalysis/salesVolumeAnalysisBase' -> 'salesVolumeAnalysisBase'
+ const toPage = path.split('/').pop();
+ // 保存当前页面状态并入栈
+ const currentPath = this.$route.path;
+ const state = {
+ dateData: {
+ startTime: this.dateData.startTime,
+ endTime: this.dateData.endTime
+ },
+ factory: this.$route.query.factory ? this.$route.query.factory : this.factory,
+ toPage
+ };
+ pushNavigation(currentPath, state);
+ saveNavigationState(currentPath, state);
+ // query 仅支持字符串,时间范围用 startTime/endTime 传递
this.$router.push({
path: path,
query: {
factory: this.$route.query.factory ? this.$route.query.factory : this.factory,
- dateData: this.dateData
+ startTime: this.dateData && this.dateData.startTime != null ? String(this.dateData.startTime) : '',
+ endTime: this.dateData && this.dateData.endTime != null ? String(this.dateData.endTime) : ''
}
})
},
diff --git a/src/views/home/electricityCostAnalysisComponents/yearRelatedMetrics.vue b/src/views/home/electricityCostAnalysisComponents/yearRelatedMetrics.vue
deleted file mode 100644
index 68792250..00000000
--- a/src/views/home/electricityCostAnalysisComponents/yearRelatedMetrics.vue
+++ /dev/null
@@ -1,203 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/views/home/expenseAnalysis/expenseAnalysis.vue b/src/views/home/expenseAnalysis/expenseAnalysis.vue
index ec65bafa..ce06a390 100644
--- a/src/views/home/expenseAnalysis/expenseAnalysis.vue
+++ b/src/views/home/expenseAnalysis/expenseAnalysis.vue
@@ -40,6 +40,7 @@ import operatingLineChart from "../expenseAnalysisComponents/operatingLineChart"
import operatingLineChartCumulative from "../expenseAnalysisComponents/operatingLineChartCumulative.vue";
import { getExpenseAnalysisGroupData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -116,6 +117,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -124,7 +129,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData() {
@@ -134,7 +157,6 @@ export default {
sort: this.sort,
index: undefined,
factory: undefined
- // timeDim: obj.mode
}).then((res) => {
console.log(res);
this.monthData = res.data.month
diff --git a/src/views/home/expenseAnalysis/expenseAnalysisBase.vue b/src/views/home/expenseAnalysis/expenseAnalysisBase.vue
index 69c2b51f..3ad93b10 100644
--- a/src/views/home/expenseAnalysis/expenseAnalysisBase.vue
+++ b/src/views/home/expenseAnalysis/expenseAnalysisBase.vue
@@ -69,8 +69,10 @@ import profitLineChart from "../costComponents/profitLineChart.vue";
import { mapState } from "vuex";
import { getExpenseAnalysisFactoryData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -90,20 +92,25 @@ export default {
beilv: 1,
month:'',
value: 100,
- dateData: {},
index: '总费用',
monthData: undefined,
ytdData: undefined,
monthAnalysis: [],
ytdAnalysis: [],
trend: [],
- factory:null
+ // factory 和 dateData 由 mixin 提供
};
},
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -169,14 +176,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
@@ -198,8 +197,6 @@ export default {
this.monthAnalysis = res.data.monthAnalysis
this.ytdAnalysis = res.data.ytdAnalysis
this.trend = res.data.trend
-
- // this.monthData = res.data.month
});
},
@@ -208,7 +205,6 @@ export default {
this.dateData = {
startTime: obj.startTime,
endTime: obj.endTime,
- // mode: obj.mode,
}
this.getData()
@@ -265,8 +261,6 @@ export default {
},
changeDate(val) {
this.date = val;
- // this.weekDay = this.weekArr[moment(this.date).format('e')]
- // this.getData()
if (this.date === moment().format("yyyy-MM-DD")) {
this.loopTime();
} else {
diff --git a/src/views/home/expenseAnalysisComponents/dataTrendBar.vue b/src/views/home/expenseAnalysisComponents/dataTrendBar.vue
index 8a39814f..15c3f8b3 100644
--- a/src/views/home/expenseAnalysisComponents/dataTrendBar.vue
+++ b/src/views/home/expenseAnalysisComponents/dataTrendBar.vue
@@ -50,7 +50,7 @@
diff --git a/src/views/home/fullCostAnalysis/fullCostAnalysis.vue b/src/views/home/fullCostAnalysis/fullCostAnalysis.vue
index caaf6da2..ecc8a8a8 100644
--- a/src/views/home/fullCostAnalysis/fullCostAnalysis.vue
+++ b/src/views/home/fullCostAnalysis/fullCostAnalysis.vue
@@ -40,6 +40,7 @@ import operatingLineChartCumulative from "../fullCostAnalysisComponents/operatin
import { getUnitPriceAnalysisGroupData } from '@/api/cockpit'
import moment from "moment";
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -113,6 +114,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -121,7 +126,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData(obj) {
diff --git a/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue b/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue
index 4ef049bb..6258ea69 100644
--- a/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue
+++ b/src/views/home/fullCostAnalysis/fullCostAnalysisBase.vue
@@ -66,8 +66,10 @@ import dataTrend from "../fullCostAnalysisComponents/dataTrend.vue";
import { mapState } from "vuex";
import { getUnitPriceAnalysisBaseData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -84,8 +86,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: {},
@@ -96,6 +97,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -155,14 +162,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
diff --git a/src/views/home/fullCostAnalysisComponents/dataTrendBar.vue b/src/views/home/fullCostAnalysisComponents/dataTrendBar.vue
index 123a91db..9e68a7e2 100644
--- a/src/views/home/fullCostAnalysisComponents/dataTrendBar.vue
+++ b/src/views/home/fullCostAnalysisComponents/dataTrendBar.vue
@@ -50,7 +50,7 @@
-
-
-
-
diff --git a/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue b/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue
index e38d9341..d371cbdd 100644
--- a/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue
+++ b/src/views/home/fullCostAnalysisComponents/operatingLineBarSale.vue
@@ -4,6 +4,7 @@
diff --git a/src/views/home/fullCostAnalysisComponents/relatedIndicatorsAnalysis.vue b/src/views/home/fullCostAnalysisComponents/relatedIndicatorsAnalysis.vue
index 87ad39a4..6c28a15f 100644
--- a/src/views/home/fullCostAnalysisComponents/relatedIndicatorsAnalysis.vue
+++ b/src/views/home/fullCostAnalysisComponents/relatedIndicatorsAnalysis.vue
@@ -27,6 +27,7 @@
-
-
-
-
diff --git a/src/views/home/grossMargin/grossMargin.vue b/src/views/home/grossMargin/grossMargin.vue
index f7fa00ee..9621f4e6 100644
--- a/src/views/home/grossMargin/grossMargin.vue
+++ b/src/views/home/grossMargin/grossMargin.vue
@@ -40,6 +40,7 @@ import operatingLineChart from "../grossMarginComponents/operatingLineChart";
import operatingLineChartCumulative from "../grossMarginComponents/operatingLineChartCumulative.vue";
import { getGrossMarginGroupData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -97,7 +98,6 @@ export default {
return {
transform: `scale(${v})`,
transformOrigin: "left top",
- // overflow: hidden;
};
},
},
@@ -121,6 +121,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -129,7 +133,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData() {
diff --git a/src/views/home/grossMargin/grossMarginBase.vue b/src/views/home/grossMargin/grossMarginBase.vue
index cf2e5a2a..19c5c030 100644
--- a/src/views/home/grossMargin/grossMarginBase.vue
+++ b/src/views/home/grossMargin/grossMarginBase.vue
@@ -70,8 +70,10 @@ import profitLineChart from "../costComponents/profitLineChart.vue";
import { mapState } from "vuex";
import { getGrossMarginFactoryData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -82,7 +84,6 @@ export default {
monthlyRelatedMetrics,
yearRelatedMetrics,
dataTrend
- // psiLineChart
},
data() {
return {
@@ -91,10 +92,9 @@ export default {
beilv: 1,
month:'',
value: 100,
- dateData:{},
levelId:undefined,
index: '毛利率',
- factory: null,
+ // factory 和 dateData 由 mixin 提供
monthData: {},
ytdData: {},
monthAnalysis: [],
@@ -106,6 +106,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -171,14 +177,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
@@ -200,8 +198,6 @@ export default {
this.monthAnalysis = res.data.monthAnalysis
this.ytdAnalysis = res.data.ytdAnalysis
this.trend = res.data.trend
-
- // this.monthData = res.data.month
});
},
@@ -210,7 +206,6 @@ export default {
this.dateData = {
startTime: obj.startTime,
endTime: obj.endTime,
- // mode: obj.mode,
}
this.getData()
diff --git a/src/views/home/grossMarginComponents/dataTrendBar.vue b/src/views/home/grossMarginComponents/dataTrendBar.vue
index b6d61c34..4a382b8c 100644
--- a/src/views/home/grossMarginComponents/dataTrendBar.vue
+++ b/src/views/home/grossMarginComponents/dataTrendBar.vue
@@ -50,7 +50,7 @@
diff --git a/src/views/home/grossMarginComponents/yearRelatedMetrics.vue b/src/views/home/grossMarginComponents/yearRelatedMetrics.vue
index 953b1d50..34d0b33d 100644
--- a/src/views/home/grossMarginComponents/yearRelatedMetrics.vue
+++ b/src/views/home/grossMarginComponents/yearRelatedMetrics.vue
@@ -42,6 +42,7 @@
diff --git a/src/views/home/inventoryAnalysis/inventoryAnalysis.vue b/src/views/home/inventoryAnalysis/inventoryAnalysis.vue
index c2e4159b..7663086a 100644
--- a/src/views/home/inventoryAnalysis/inventoryAnalysis.vue
+++ b/src/views/home/inventoryAnalysis/inventoryAnalysis.vue
@@ -40,6 +40,7 @@ import operatingLineChart from "../inventoryAnalysisComponents/operatingLineChar
import operatingLineChartCumulative from "../inventoryAnalysisComponents/operatingLineChartCumulative.vue";
import { getInventoryData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "InventoryAnalysis",
components: {
@@ -117,6 +118,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -125,7 +130,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData() {
diff --git a/src/views/home/netPriceAnalysis/netPriceAnalysis.vue b/src/views/home/netPriceAnalysis/netPriceAnalysis.vue
index b81ad7fe..2e43dd6a 100644
--- a/src/views/home/netPriceAnalysis/netPriceAnalysis.vue
+++ b/src/views/home/netPriceAnalysis/netPriceAnalysis.vue
@@ -40,6 +40,7 @@ import operatingLineChart from "../netPriceAnalysisComponents/operatingLineChart
import operatingLineChartCumulative from "../netPriceAnalysisComponents/operatingLineChartCumulative.vue";
import { getUnitPriceAnalysisGroupData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -115,6 +116,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -123,7 +128,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData(obj) {
diff --git a/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue b/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue
index 70f886d7..ea6095c7 100644
--- a/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue
+++ b/src/views/home/netPriceAnalysis/netPriceAnalysisBase.vue
@@ -67,8 +67,10 @@ import dataTrend from "../netPriceAnalysisComponents/dataTrend.vue";
import { mapState } from "vuex";
import { getUnitPriceAnalysisBaseData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -86,8 +88,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
relatedMon: {},
relatedTotal: {},
@@ -100,6 +101,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -159,14 +166,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
@@ -177,12 +176,9 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
- // index: this.index,
- // sort: 1,
paramName: '净价',
paramList: this.paramList,
baseId: this.factory,
- // baseId: Number(this.factory),
};
// 调用接口
getUnitPriceAnalysisBaseData(requestParams).then((res) => {
@@ -200,7 +196,6 @@ export default {
this.dateData = {
startTime: obj.startTime,
endTime: obj.endTime,
- // mode: obj.mode,
}
this.getData()
diff --git a/src/views/home/netPriceAnalysisComponents/dataTrendBar.vue b/src/views/home/netPriceAnalysisComponents/dataTrendBar.vue
index 77c94f3d..341f530d 100644
--- a/src/views/home/netPriceAnalysisComponents/dataTrendBar.vue
+++ b/src/views/home/netPriceAnalysisComponents/dataTrendBar.vue
@@ -48,7 +48,7 @@
diff --git a/src/views/home/netPriceAnalysisComponents/yearRelatedMetrics.vue b/src/views/home/netPriceAnalysisComponents/yearRelatedMetrics.vue
index bd950269..6058450b 100644
--- a/src/views/home/netPriceAnalysisComponents/yearRelatedMetrics.vue
+++ b/src/views/home/netPriceAnalysisComponents/yearRelatedMetrics.vue
@@ -28,6 +28,7 @@
diff --git a/src/views/home/operatingComponents/yearRelatedMetrics.vue b/src/views/home/operatingComponents/yearRelatedMetrics.vue
index 2d02cf01..856d98ed 100644
--- a/src/views/home/operatingComponents/yearRelatedMetrics.vue
+++ b/src/views/home/operatingComponents/yearRelatedMetrics.vue
@@ -42,6 +42,7 @@
diff --git a/src/views/home/operatingProfitComponents/relatedIndicatorsAnalysis.vue b/src/views/home/operatingProfitComponents/relatedIndicatorsAnalysis.vue
index 702dd492..d90cb297 100644
--- a/src/views/home/operatingProfitComponents/relatedIndicatorsAnalysis.vue
+++ b/src/views/home/operatingProfitComponents/relatedIndicatorsAnalysis.vue
@@ -24,6 +24,7 @@
-
-
-
-
diff --git a/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue b/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue
index a4d30df0..e5020070 100644
--- a/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue
+++ b/src/views/home/procurementGainAnalysisComponents/operatingLineBarSale.vue
@@ -4,7 +4,7 @@
diff --git a/src/views/home/procurementGainAnalysisComponents/relatedIndicatorsAnalysis.vue b/src/views/home/procurementGainAnalysisComponents/relatedIndicatorsAnalysis.vue
index e5af6f9d..99777f98 100644
--- a/src/views/home/procurementGainAnalysisComponents/relatedIndicatorsAnalysis.vue
+++ b/src/views/home/procurementGainAnalysisComponents/relatedIndicatorsAnalysis.vue
@@ -27,6 +27,7 @@
-
-
-
-
diff --git a/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue b/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue
index 32bb3b6a..763aac38 100644
--- a/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/SIMFRMCostAnalysis.vue
@@ -66,8 +66,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendSingleFuelYL
import { mapState } from "vuex";
import { getSingleMaterialAnalysis } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -76,7 +78,6 @@ export default {
totalOverview,
relateSingleFuelCostAnalysis,
dataTrend
- // psiLineChart
},
data() {
return {
@@ -85,14 +86,16 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
+ navigationExtraFields: {
+ meterialName: '氢氧化铝' // 字段名: 默认值
+ },
monData: {},
totalData: {},
trend: [],
relatedData: {},
trendName: '成本',
- meterialName:'',
+ meterialName:'氢氧化铝',
materialOptions: [
{value:'氢氧化铝',label:'氢氧化铝'},
{value:'碎玻璃(外购)',label:'碎玻璃'},
@@ -111,6 +114,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -174,15 +183,7 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.meterialName = this.$route.query.name ? this.$route.query.name : '氢氧化铝'
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // this.meterialName = this.$route.query.name ? this.$route.query.name : '氢氧化铝'
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/combustible.vue b/src/views/home/productionCostAnalysis/combustible.vue
index 4ecd984f..9582b419 100644
--- a/src/views/home/productionCostAnalysis/combustible.vue
+++ b/src/views/home/productionCostAnalysis/combustible.vue
@@ -65,8 +65,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendCombustible.
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -83,8 +85,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -96,6 +97,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -161,14 +168,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
@@ -186,9 +185,7 @@ export default {
analysisObject: [
"原片燃料成本",
],
- // paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],
levelId: this.factory,
- // baseId: Number(this.factory),
};
// 调用接口
getCostAnalysisData(requestParams).then((res) => {
diff --git a/src/views/home/productionCostAnalysis/compositeClarifyingAgentCostAnalysis.vue b/src/views/home/productionCostAnalysis/compositeClarifyingAgentCostAnalysis.vue
index 692ac13f..cdafacd0 100644
--- a/src/views/home/productionCostAnalysis/compositeClarifyingAgentCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/compositeClarifyingAgentCostAnalysis.vue
@@ -66,8 +66,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendSingleCCA.vu
import { mapState } from "vuex";
import { getSingleMaterialAnalysis } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -85,8 +87,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -100,6 +101,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -163,14 +170,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue b/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue
index 33e26f8a..4e5a2673 100644
--- a/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/fuelCostAnalysis.vue
@@ -64,8 +64,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendFuel.vue";
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -83,8 +85,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -96,6 +97,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -161,14 +168,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
@@ -186,7 +185,6 @@ export default {
analysisObject: [
"原片原料成本",
],
- // paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],
levelId: this.factory,
};
// 调用接口
diff --git a/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue b/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue
index c2817bc7..14cc684a 100644
--- a/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/mfgOverheadCostAnalysis.vue
@@ -65,8 +65,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendFactoryBurde
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -84,8 +86,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -97,6 +98,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -162,14 +169,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue b/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue
index 61425461..52f8869b 100644
--- a/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/mfgOverheadSingleCostAnalysis.vue
@@ -3,7 +3,7 @@
{
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -158,15 +168,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.overheadName = this.$route.query.name ? this.$route.query.name : '包材'
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
@@ -179,27 +180,27 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
- trendName: '原片'+this.overheadName+'成本',
- analysisObject: ['原片'+this.overheadName],
+ trendName: '原片'+this.meterialName+'成本',
+ analysisObject: ['原片'+this.meterialName],
levelId: this.factory,
isOriginal:0,//0:原片 1:加工
};
// 调用接口
getSingleMaterialCostAnalysis(requestParams).then((res) => {
this.monData = res.data.currentMonthData.find(item => {
- return item.name === '原片'+this.overheadName+'成本';
+ return item.name === '原片'+this.meterialName+'成本';
});
this.totalData = res.data.totalMonthData.find(item => {
- return item.name === '原片'+this.overheadName+'成本';
+ return item.name === '原片'+this.meterialName+'成本';
});
// this.relatedMon = res.data.relatedMon
this.relatedData = {
relatedMon: res.data.currentMonthData.filter(item => {
- return item.name !== '原片'+this.overheadName+'成本';
+ return item.name !== '原片'+this.meterialName+'成本';
}), // 兜底月度数据
relatedTotal: res.data.totalMonthData.filter(item => {
- return item.name !== '原片'+this.overheadName+'成本';
+ return item.name !== '原片'+this.meterialName+'成本';
}) // 兜底累计数据
}
this.trend = res.data.dataTrend
@@ -217,7 +218,7 @@ export default {
this.getData()
},
handleOverheadChange(val) {
- this.overheadName = val
+ this.meterialName = val
this.getData()
},
selectChange(data) {
diff --git a/src/views/home/productionCostAnalysis/originalSheetCost.vue b/src/views/home/productionCostAnalysis/originalSheetCost.vue
index 0450f3ba..7a1c5bd9 100644
--- a/src/views/home/productionCostAnalysis/originalSheetCost.vue
+++ b/src/views/home/productionCostAnalysis/originalSheetCost.vue
@@ -41,6 +41,7 @@ import operatingLineChart from "../productionCostAnalysisComponents/operatingLin
import operatingLineChartCumulative from "../productionCostAnalysisComponents/operatingLineChartCumulative.vue";
import { getCostAnalysisData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -117,6 +118,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -125,7 +130,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData() {
diff --git a/src/views/home/productionCostAnalysis/originalSheetCostBase.vue b/src/views/home/productionCostAnalysis/originalSheetCostBase.vue
index df15a9cd..2fb92280 100644
--- a/src/views/home/productionCostAnalysis/originalSheetCostBase.vue
+++ b/src/views/home/productionCostAnalysis/originalSheetCostBase.vue
@@ -65,8 +65,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrend.vue";
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -84,8 +86,7 @@ export default {
beilv: 1,
month:'',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -97,6 +98,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -162,15 +169,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- console.log('this.$route.query.factory', this.$route.query.factory);
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
@@ -188,9 +186,7 @@ export default {
analysisObject: [
"原片成本",
],
- // paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],
levelId: this.factory,
- // baseId: Number(this.factory),
};
// 调用接口
getCostAnalysisData(requestParams).then((res) => {
diff --git a/src/views/home/productionCostAnalysis/originalSheetLabor.vue b/src/views/home/productionCostAnalysis/originalSheetLabor.vue
index a2bf92cc..f53f4f6d 100644
--- a/src/views/home/productionCostAnalysis/originalSheetLabor.vue
+++ b/src/views/home/productionCostAnalysis/originalSheetLabor.vue
@@ -54,8 +54,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProcessingLa
import { mapState } from "vuex";
import { getSingleMaterialCostAnalysis } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -71,8 +73,8 @@ export default {
beilv: 1,
month:'',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
+
monData: {},
totalData: {},
trend: [],
@@ -84,6 +86,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -149,14 +157,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue b/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue
index 01682641..766ef5ee 100644
--- a/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/osElectricityCostAnalysis.vue
@@ -64,8 +64,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendSingleFuelDi
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -82,8 +84,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -95,6 +96,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -160,14 +167,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/procAuxMatCost.vue b/src/views/home/productionCostAnalysis/procAuxMatCost.vue
index d2abe07e..571c3698 100644
--- a/src/views/home/productionCostAnalysis/procAuxMatCost.vue
+++ b/src/views/home/productionCostAnalysis/procAuxMatCost.vue
@@ -63,8 +63,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProcAuxMat.v
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -80,9 +82,8 @@ export default {
timer: null,
beilv: 1,
month: '',
- factory: null,
value: 100,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
trendName: '加工辅料',
monData: {},
totalData: {},
@@ -94,6 +95,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -158,14 +165,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
diff --git a/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue b/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue
index e5dc7523..bb372052 100644
--- a/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue
+++ b/src/views/home/productionCostAnalysis/procMfgOverheadCost.vue
@@ -66,8 +66,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendPro.vue";
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -85,8 +87,7 @@ export default {
beilv: 1,
month:'',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
trendName: '加工制造费用成本',
monData: {},
totalData: {},
@@ -99,6 +100,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -157,14 +164,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
diff --git a/src/views/home/productionCostAnalysis/procPackMatCost.vue b/src/views/home/productionCostAnalysis/procPackMatCost.vue
index 523f65e0..8afbe4f2 100644
--- a/src/views/home/productionCostAnalysis/procPackMatCost.vue
+++ b/src/views/home/productionCostAnalysis/procPackMatCost.vue
@@ -54,8 +54,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProcessingLa
import { mapState } from "vuex";
import { getSingleMaterialCostAnalysis } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -71,8 +73,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -87,6 +88,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -150,14 +157,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/processingCostAnalysis.vue b/src/views/home/productionCostAnalysis/processingCostAnalysis.vue
index e2565352..c714aa30 100644
--- a/src/views/home/productionCostAnalysis/processingCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/processingCostAnalysis.vue
@@ -41,6 +41,7 @@ import operatingLineChart from "../productionCostAnalysisComponents/operatingLin
import operatingLineChartCumulative from "../productionCostAnalysisComponents/operatingLineChartCumulative.vue";
import { getCostAnalysisData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -117,6 +118,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -125,7 +130,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData() {
diff --git a/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue b/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue
index 4c3b0019..2c226d77 100644
--- a/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue
+++ b/src/views/home/productionCostAnalysis/processingCostAnalysisBase.vue
@@ -65,8 +65,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProcess.vue"
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -83,8 +85,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -96,6 +97,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -161,16 +168,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- console.log('this.$route.query.factory', this.$route.query.factory);
-
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/processingFuel.vue b/src/views/home/productionCostAnalysis/processingFuel.vue
index 04d7d9e2..1361055b 100644
--- a/src/views/home/productionCostAnalysis/processingFuel.vue
+++ b/src/views/home/productionCostAnalysis/processingFuel.vue
@@ -66,8 +66,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProcessingFu
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -86,8 +88,7 @@ export default {
beilv: 1,
month:'',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
trendName: '加工燃料成本',
monData: {},
totalData: {},
@@ -100,6 +101,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -157,14 +164,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
diff --git a/src/views/home/productionCostAnalysis/processingLabor.vue b/src/views/home/productionCostAnalysis/processingLabor.vue
index 22edeebe..a5c83b0b 100644
--- a/src/views/home/productionCostAnalysis/processingLabor.vue
+++ b/src/views/home/productionCostAnalysis/processingLabor.vue
@@ -54,8 +54,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProcessingLa
import { mapState } from "vuex";
import { getSingleMaterialCostAnalysis } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -71,8 +73,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -84,6 +85,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -149,14 +156,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
changeItem(item) {
diff --git a/src/views/home/productionCostAnalysis/productionCostAnalysis.vue b/src/views/home/productionCostAnalysis/productionCostAnalysis.vue
index 5daabaf2..aed8b75c 100644
--- a/src/views/home/productionCostAnalysis/productionCostAnalysis.vue
+++ b/src/views/home/productionCostAnalysis/productionCostAnalysis.vue
@@ -39,6 +39,7 @@ import { mapState } from "vuex";
import operatingLineChart from "../productionCostAnalysisComponents/operatingLineChart";
import operatingLineChartCumulative from "../productionCostAnalysisComponents/operatingLineChartCumulative.vue";
import { getCostAnalysisData } from '@/api/cockpit'
+import { consumeNavigationState, clearNavigation } from '@/utils/navigationReturnState';
export default {
name: "DayReport",
components: {
@@ -116,6 +117,10 @@ export default {
this.destroy();
},
mounted() {
+ // 菜单入口时清空导航栈
+ if (this.$route.query.menu === '1') {
+ clearNavigation();
+ }
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
@@ -124,7 +129,25 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
+ // 从 sessionStorage 获取本页面保存的状态
+ const currentPath = this.$route.path;
+ const saved = consumeNavigationState(currentPath);
+ if (saved && saved.dateData && saved.dateData.startTime != null && saved.dateData.endTime != null) {
+ this.dateData = {
+ startTime: saved.dateData.startTime,
+ endTime: saved.dateData.endTime
+ };
+ } else if (this.$route.query.startTime && this.$route.query.endTime) {
+ this.dateData = {
+ startTime: Number(this.$route.query.startTime),
+ endTime: Number(this.$route.query.endTime)
+ };
+ }
+ this.$nextTick(() => {
+ if (this.dateData && this.dateData.startTime != null && this.dateData.endTime != null) {
+ this.getData();
+ }
+ });
},
methods: {
getData() {
diff --git a/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue b/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue
index 47914b52..2d2dee78 100644
--- a/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue
+++ b/src/views/home/productionCostAnalysis/productionCostAnalysisBase.vue
@@ -68,8 +68,10 @@ import dataTrend from "../productionCostAnalysisComponents/dataTrendProduct.vue"
import { mapState } from "vuex";
import { getCostAnalysisData } from '@/api/cockpit'
import moment from "moment";
+import navigationStateMixin from "@/utils/mixins/navigationStateMixin";
export default {
name: "DayReport",
+ mixins: [navigationStateMixin],
components: {
ReportHeader,
changeBase,
@@ -88,8 +90,7 @@ export default {
beilv: 1,
month: '',
value: 100,
- factory: null,
- dateData: {},
+ // factory 和 dateData 由 mixin 提供
monData: {},
totalData: {},
trend: [],
@@ -103,6 +104,12 @@ export default {
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
+ // 使用 mixin 初始化导航状态恢复
+ this._initNavigationStateMixin(({ factory, dateData }) => {
+ if (factory != null && dateData && dateData.startTime != null) {
+ this.getData();
+ }
+ });
},
computed: {
...mapState({
@@ -162,14 +169,6 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
- if(this.$route.query.factory){
- this.factory =Number(this.$route.query.factory)
- }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
- this.factory = this.$store.getters.levelList[0].id
- }else{
- this.factory = this.$store.getters.levelList[1].id
- }
- this.dateData = this.$route.query.dateData ? this.$route.query.dateData : undefined
},
methods: {
handleChange(value) {
@@ -186,15 +185,11 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
- // index: this.index,
- // sort: 1,
trendName: this.trendName,
analysisObject: [
"制造成本",
],
- // paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],
- levelId: this.factory,
- // baseId: Number(this.factory),
+ levelId: this.factory
};
// 调用接口
getCostAnalysisData(requestParams).then((res) => {
@@ -224,8 +219,7 @@ export default {
this.month = obj.targetMonth
this.dateData = {
startTime: obj.startTime,
- endTime: obj.endTime,
- // mode: obj.mode,
+ endTime: obj.endTime
}
this.getData()
@@ -282,8 +276,6 @@ export default {
},
changeDate(val) {
this.date = val;
- // this.weekDay = this.weekArr[moment(this.date).format('e')]
- // this.getData()
if (this.date === moment().format("yyyy-MM-DD")) {
this.loopTime();
} else {
diff --git a/src/views/home/productionCostAnalysis/singleCombustible.vue b/src/views/home/productionCostAnalysis/singleCombustible.vue
index f5660c3d..9d65d16f 100644
--- a/src/views/home/productionCostAnalysis/singleCombustible.vue
+++ b/src/views/home/productionCostAnalysis/singleCombustible.vue
@@ -3,7 +3,7 @@
-
+
@@ -48,7 +48,7 @@
gap: 12px;
grid-template-columns: 1624px;
">
-
+