制造成本分析修改

This commit is contained in:
2026-03-25 14:10:27 +08:00
parent bb66f97b95
commit 4f7466bb29
59 changed files with 3909 additions and 1779 deletions

View File

@@ -0,0 +1,297 @@
<template>
<div id="dayReport" class="dayReport" :style="styles">
<div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
<ReportHeader :dateData="dateData" size="psi" @timeRangeChange="handleTimeChange" top-title="复合澄清剂成本分析"
:is-full-screen="isFullScreen" @screenfullChange="screenfullChange" />
<div class="main-body" style="
margin-top: -20px;
flex: 1;
display: flex;
padding: 0px 16px 0 272px;
flex-direction: column;
">
<div class="top" style="display: flex; gap: 16px">
<div class="top-three" style="
display: grid;
gap: 12px;
grid-template-columns: 1624px;
">
<changeBase :factory="factory" @baseChange="selectChange" />
</div>
</div>
<div class="top" style="display: flex; gap: 16px;margin-top: -20px;">
<div class="left-three" style="
display: grid;
gap: 12px;
grid-template-columns: 804px 804px;
">
<monthlyOverview :month="month" :monData="monData" :title="'月度概览'" />
<totalOverview :totalData="totalData" :title="'累计概览'" />
</div>
</div>
<div class="middle" style="display: flex; gap: 16px;margin-top: 6px;">
<div class="left-three" style="
display: grid;
gap: 12px;
grid-template-columns: 804px 804px;
">
<monthlyRelatedMetrics :dateData="dateData" :factory="factory" :relatedData="monthRelatedData"
:title="'月度·相关指标分析'" />
<yearRelatedMetrics :dateData="dateData" :factory="factory" :relatedData="totalRelatedData" :title="'累计·相关指标分析'" />
</div>
</div>
<div class="bottom" style="display: flex; gap: 16px;margin-top: 6px;">
<div class="left-three" style="
display: grid;
gap: 12px;
grid-template-columns: 1624px;
">
<dataTrend @getData="changeItem" :trendData="trend" :title="'数据趋势'" />
</div>
</div>
</div>
</div>
</template>
<script>
import ReportHeader from "../components/noRouterHeader.vue";
import { Sidebar } from "../../../layout/components";
import screenfull from "screenfull";
import changeBase from "../components/changeBase.vue";
import monthlyOverview from "../productionCostAnalysisComponents/monthlyOverview.vue";
import totalOverview from "../productionCostAnalysisComponents/totalOverview.vue";
import monthlyRelatedMetrics from "../productionCostAnalysisComponents/monthlyThreeRelatedMetricsCCA.vue";
import yearRelatedMetrics from "../productionCostAnalysisComponents/yearThreeRelatedMetricsCCA.vue";
import dataTrend from "../productionCostAnalysisComponents/dataTrendSingleCCA.vue";
import { mapState } from "vuex";
import { getSingleMaterialAnalysis } from '@/api/cockpit'
import moment from "moment";
export default {
name: "DayReport",
components: {
ReportHeader,
changeBase,
monthlyOverview,
Sidebar,
totalOverview,
monthlyRelatedMetrics,
yearRelatedMetrics,
dataTrend
// psiLineChart
},
data() {
return {
isFullScreen: false,
timer: null,
beilv: 1,
month: '',
value: 100,
factory: null,
dateData: {},
monData: {},
totalData: {},
trend: [],
monthRelatedData: [],
totalRelatedData: [],
trendName: '复合澄清剂',
meterialName:'复合澄清剂',
};
},
created() {
this.init();
this.windowWidth(document.documentElement.clientWidth);
},
computed: {
...mapState({
theme: (state) => state.settings.theme,
sideTheme: (state) => state.settings.sideTheme,
sidebar: (state) => state.app.sidebar,
device: (state) => state.app.device,
needTagsView: (state) => state.settings.tagsView,
fixedHeader: (state) => state.settings.fixedHeader,
}),
renderList() {
if (this.itemData && this.itemData.length > 0) {
return this.itemData;
}
return this.parentItemList;
},
classObj() {
return {
hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === "mobile",
};
},
variables() {
return variables;
},
styles() {
const v = Math.floor(this.value * this.beilv * 100) / 10000;
return {
transform: `scale(${v})`,
transformOrigin: "left top",
};
},
},
watch: {
clientWidth(val) {
if (!this.timer) {
this.clientWidth = val;
this.beilv2 = this.clientWidth / 1920;
this.timer = true;
let _this = this;
setTimeout(function () {
_this.timer = false;
}, 500);
}
// 这里可以添加修改时的方法
this.windowWidth(val);
},
},
beforeDestroy() {
clearInterval(this.timer);
this.destroy();
},
mounted() {
const _this = this;
_this.beilv = document.documentElement.clientWidth / 1920;
window.onresize = () => {
return (() => {
_this.clientWidth = `${document.documentElement.clientWidth}`;
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) {
this.trendName = item
this.getData()
},
getData() {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName+'成本',
analysisObject: ['复合澄清剂成本'],
levelId: this.factory,
};
// 调用接口
getSingleMaterialAnalysis(requestParams).then((res) => {
this.monData = res.data.currentMonthData.find(item => {
return item.name === '复合澄清剂成本';
});
this.totalData = res.data.totalMonthData.find(item => {
return item.name === '复合澄清剂成本';
});
this.monthRelatedData = res.data.currentMonthData
this.totalRelatedData = res.data.totalMonthData
this.trend = res.data.dataTrend
});
},
handleTimeChange(obj) {
this.month = obj.targetMonth
this.dateData = {
startTime: obj.startTime,
endTime: obj.endTime,
mode: obj.mode,
}
this.getData()
},
selectChange(data) {
this.factory = data
if (this.dateData.startTime && this.dateData.endTime) {
this.getData();
}
},
handleClickOutside() {
this.$store.dispatch("app/closeSideBar", { withoutAnimation: false });
},
windowWidth(value) {
this.clientWidth = value;
this.beilv2 = this.clientWidth / 1920;
},
change() {
this.isFullScreen = screenfull.isFullscreen;
},
init() {
if (!screenfull.isEnabled) {
this.$message({
message: "you browser can not work",
type: "warning",
});
return false;
}
screenfull.on("change", this.change);
},
destroy() {
if (!screenfull.isEnabled) {
this.$message({
message: "you browser can not work",
type: "warning",
});
return false;
}
screenfull.off("change", this.change);
},
// 全屏
screenfullChange() {
console.log("screenfull.enabled", screenfull.isEnabled);
if (!screenfull.isEnabled) {
this.$message({
message: "you browser can not work",
type: "warning",
});
return false;
}
screenfull.toggle(this.$refs.dayReportB);
},
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 {
clearInterval(this.timer);
}
}
},
};
</script>
<style scoped lang="scss">
@import "~@/assets/styles/mixin.scss";
@import "~@/assets/styles/variables.scss";
.dayReport {
width: 1920px;
height: 1080px;
background: url("../../../assets/img/backp.png") no-repeat;
background-size: cover;
}
.hideSidebar .fixed-header {
width: calc(100% - 54px);
}
.sidebarHide .fixed-header {
width: calc(100%);
}
.mobile .fixed-header {
width: 100%;
}
</style>