制造成本分析配合后端修改&添加顶部账号显示

This commit is contained in:
2026-04-20 13:02:19 +08:00
parent 8105e74122
commit 835d4efd5b
29 changed files with 258 additions and 111 deletions

View File

@@ -12,9 +12,9 @@ VUE_APP_TITLE = 洛玻集团驾驶舱
# 杨姗姗
# VUE_APP_BASE_API = 'http://172.16.20.218:7070'
# 小田
# VUE_APP_BASE_API = 'http://172.16.19.232:7070'
VUE_APP_BASE_API = 'http://172.16.19.232:7070'
# 测试
VUE_APP_BASE_API = 'http://192.168.0.35:8080'
# VUE_APP_BASE_API = 'http://192.168.0.35:8080'
# 闫阳
# VUE_APP_BASE_API = 'http://172.16.19.131:7070'

View File

@@ -14,15 +14,16 @@
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<!-- <router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
</router-link> -->
<!-- <el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item> -->
<el-dropdown-item divided @click.native="logout">
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
@@ -97,7 +98,12 @@ export default {
checkPermi(permissions) {
return this.$auth.hasPermi(permissions)
return true;
}
},
handleToggle() {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/index');
})
},
}
}
</script>

View File

@@ -8,13 +8,17 @@
<!-- 右侧区域全屏按钮 -->
<div class="right-content">
<el-dropdown trigger="click">
<el-button type="text" class="logout-btn" :title="'退出'">
<svg-icon style="color: #0B58FF;" icon-class="logout" />
</el-button>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="require(`../../../assets/images/choicepart/avatar.png`)" class="user-avatar">
<span v-if="nickname" class="user-nickname">{{ nickname }}</span>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native='logout'>退出登录</el-dropdown-item>
<el-dropdown-item @click.native='handleToggle'>切换账号</el-dropdown-item>
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" class="screen-btn" @click="changeHomeSider">
@@ -44,6 +48,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import moment from 'moment'
import {getPath} from "@/utils/ruoyi";
export default {
@@ -57,6 +62,9 @@ export default {
default: () => ({})
},
},
computed:{
...mapGetters(['nickname']),
},
data() {
return {
currentTime: '',
@@ -371,14 +379,35 @@ export default {
padding: 0;
margin: 0;
}
.avatar-container {
margin-right: 30px;
.logout-btn {
width: 30px;
height: 30px;
font-size: 30px;
padding: 0;
margin-top: 2px;
}
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 32px;
height: 32px;
border-radius: 50%;
}
.user-nickname{
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 10px;
font-size: 12px;
}
}
}
}
/* 日期选择器样式保持不变 */

View File

@@ -7,13 +7,17 @@
<!-- 右侧区域全屏按钮 -->
<div class="right-content">
<el-dropdown trigger="click">
<el-button type="text" class="logout-btn" :title="'退出'">
<svg-icon style="color: #0B58FF;" icon-class="logout" />
</el-button>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="require(`../../../assets/images/choicepart/avatar.png`)" class="user-avatar">
<span v-if="nickname" class="user-nickname">{{ nickname }}</span>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native='logout'>退出登录</el-dropdown-item>
<el-dropdown-item @click.native='handleToggle'>切换账号</el-dropdown-item>
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" class="return-btn" :title="'返回'" @click="handleReturn">
@@ -43,6 +47,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import moment from 'moment'; // 引入moment
import {getPath} from "@/utils/ruoyi";
export default {
@@ -57,6 +62,9 @@ export default {
},
isBudget: { type: Boolean, default: false },
},
computed:{
...mapGetters(['nickname']),
},
data() {
return {
currentTime: '',
@@ -360,12 +368,35 @@ export default {
padding: 0;
}
.logout-btn {
width: 28px;
height: 28px;
font-size: 28px;
padding: 0;
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 32px;
height: 32px;
border-radius: 50%;
}
.user-nickname{
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 10px;
font-size: 12px;
}
}
}
}
/* 自定义下拉框样式(替换原有日期选择器样式) */

View File

@@ -7,13 +7,17 @@
<!-- 右侧区域全屏按钮 -->
<div class="right-content">
<el-dropdown trigger="click">
<el-button type="text" class="logout-btn" :title="'退出'">
<svg-icon style="color: #0B58FF;" icon-class="logout" />
</el-button>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="require(`../../../assets/images/choicepart/avatar.png`)" class="user-avatar">
<span v-if="nickname" class="user-nickname">{{ nickname }}</span>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native='logout'>退出登录</el-dropdown-item>
<el-dropdown-item @click.native='handleToggle'>切换账号</el-dropdown-item>
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" class="return-btn" :title="'返回'" @click="handleReturn">
@@ -39,6 +43,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import moment from 'moment'; // 引入moment
import {getPath} from "@/utils/ruoyi";
export default {
@@ -64,6 +69,9 @@ export default {
activeTime: 1, // 默认月维度0=日1=月2=年)
}
},
computed:{
...mapGetters(['nickname']),
},
watch: {
activeTime(newVal, oldVal) {
if (newVal !== oldVal) {
@@ -346,12 +354,35 @@ export default {
padding: 0;
}
.logout-btn {
width: 28px;
height: 28px;
font-size: 28px;
padding: 0;
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 32px;
height: 32px;
border-radius: 50%;
}
.user-nickname{
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 10px;
font-size: 12px;
}
}
}
}

View File

@@ -152,7 +152,7 @@ export default {
yAxis: [
{
type: 'value',
name: '元',
name: '元',
nameTextStyle: {
color: 'rgba(0, 0, 0, 0.45)',
fontSize: 12,

View File

@@ -98,7 +98,7 @@ export default {
// 左侧Y轴营业收入、成本单位万元
{
type: 'value',
name: '元',
name: '元',
nameTextStyle: {
color: 'rgba(0, 0, 0, 0.45)',
fontSize: 12,

View File

@@ -95,7 +95,7 @@ export default {
meterialName:'',
materialOptions: [
{value:'氢氧化铝',label:'氢氧化铝'},
{value:'碎玻璃',label:'碎玻璃'},
{value:'碎玻璃(外购)',label:'碎玻璃'},
{value:'助熔剂',label:'助熔剂'},
{value:'白云石',label:'白云石'},
{value:'石灰石',label:'石灰石'},
@@ -196,6 +196,7 @@ export default {
trendName: '原料' + this.meterialName + this.trendName,
analysisObject: [this.meterialName],
levelId: this.factory,
isOriginal:0,//0:原片 1:加工
};
// 调用接口
getSingleMaterialAnalysis(requestParams).then((res) => {

View File

@@ -89,9 +89,7 @@ export default {
totalData: {},
trend: [],
relatedData: {},
trendName: '天然气',
// monthRelatedData: [],
// totalRelatedData: [],
trendName: '原片燃料成本'
};
},
@@ -183,8 +181,7 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
// index: this.index,
// sort: 1,
isOriginal:0,//0:原片 1:加工
trendName: this.trendName +'成本',
analysisObject: [
"原片燃料成本",

View File

@@ -181,8 +181,7 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
// index: this.index,
// sort: 1,
isOriginal:0,//0:原片 1:加工
trendName: this.trendName,
analysisObject: [
"原片原料成本",

View File

@@ -183,6 +183,7 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:0,//0:原片 1:加工
analysisObject: [
"原片制造费用成本",
],

View File

@@ -180,8 +180,9 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
analysisObject: [this.overheadName + '成本'],
analysisObject: [this.overheadName],
levelId: this.factory,
isOriginal:0,//0:原片 1:加工
};
// 调用接口
getSingleMaterialCostAnalysis(requestParams).then((res) => {

View File

@@ -183,8 +183,7 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
// index: this.index,
// sort: 1,
isOriginal:0,//0:原片 1:加工
trendName: this.trendName,
analysisObject: [
"原片成本",

View File

@@ -77,7 +77,7 @@ export default {
totalData: {},
trend: [],
relatedData: {},
trendName: '人工成本',
trendName: '原片人工成本',
};
},
@@ -170,8 +170,9 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:0,//0:原片 1:加工
analysisObject: [
'人工成本'
'原片人工成本'
],
levelId: this.factory,
};

View File

@@ -181,6 +181,7 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:0,//0:原片 1:加工
analysisObject: [
"原片电成本",
],

View File

@@ -183,6 +183,7 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:1,//0:原片 1:加工
analysisObject: [
"加工辅料成本",
],

View File

@@ -186,6 +186,7 @@ export default {
"加工制造费用成本",
],
levelId: this.factory,
isOriginal:1,//0:原片 1:加工
};
// 调用接口
getCostAnalysisData(requestParams).then((res) => {

View File

@@ -175,6 +175,7 @@ export default {
'包材成本'
],
levelId: this.factory,
isOriginal:1,//0:原片 1:加工
};
// 调用接口
getSingleMaterialCostAnalysis(requestParams).then((res) => {

View File

@@ -184,6 +184,7 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:1,//0:原片 1:加工
analysisObject: [
"加工成本",
],

View File

@@ -182,6 +182,7 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:1,//0:原片 1:加工
analysisObject: [
"加工燃料成本",
],

View File

@@ -170,6 +170,7 @@ export default {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.trendName,
isOriginal:1,//0:原片 1:加工
analysisObject: [
'加工人工成本'
],

View File

@@ -221,8 +221,7 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
// index: this.index,
// sort: 1,
isOriginal:0,//0:原片 1:加工
trendName: this.trendName,
analysisObject: [this.fuelName],
// paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],

View File

@@ -190,9 +190,10 @@ export default {
const requestParams = {
startTime: this.dateData.startTime,
endTime: this.dateData.endTime,
trendName: this.auxMatName + '成本' + this.trendName,
analysisObject: [this.auxMatName + '成本'],
trendName: this.auxMatName + this.trendName,
analysisObject: [this.auxMatName],
levelId: this.factory,
isOriginal:1,//0:原片 1:加工
};
// 调用接口
getSingleMaterialAnalysis(requestParams).then((res) => {

View File

@@ -82,7 +82,7 @@ export default {
trendName: '',
overheadName:'',
overheadOptions: [
{value:'备件机物料',label:'备件机物料'},
{value:'备件机物料',label:'备件机物料'},
{value:'折旧',label:'折旧'},
{value:'其他',label:'其他'}
]
@@ -151,7 +151,7 @@ export default {
this.beilv = _this.clientWidth / 1920;
})();
};
this.overheadName = this.$route.query.name ? this.$route.query.name : '备件机物料'
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) {
@@ -169,15 +169,16 @@ export default {
trendName: this.overheadName+'成本',
analysisObject: ['加工制造费用成本'],
levelId: this.factory,
isOriginal:1,//0:原片 1:加工
};
// 调用接口
getSingleMaterialCostAnalysis(requestParams).then((res) => {
this.monData = res.data.currentMonthData.find(item => {
return item.name === "加工制造费用成本";
return item.name === this.overheadName+'成本';
});
this.totalData = res.data.totalMonthData.find(item => {
return item.name === "加工制造费用成本";
return item.name === this.overheadName+'成本';
});
this.trend = res.data.dataTrend
});

View File

@@ -191,6 +191,7 @@ export default {
trendName: this.trendName,
analysisObject: [this.fuelName],
levelId: this.factory,
isOriginal:1,//0:原片 1:加工
};
// 调用接口
getSingleMaterialAnalysis(requestParams).then((res) => {

View File

@@ -56,41 +56,52 @@ import * as echarts from 'echarts';
export default {
name: "Container",
components: { operatingLineBar },
props: ["chartData","fuelName"],
props: ["chartData", "fuelName"],
data() {
return {
isDropdownShow: false,
selectedProfit: '采购单价', // 选中的名称初始为null
unit:'元/度'
selectedProfit: '', // 初始化为空,由 watch 填充
unit: '' // 初始化为空,由 watch 填充
};
},
watch: {
// 监听 fuelName 变化,动态设置默认选中项和单位
fuelName: {
handler(newVal) {
this.profitOptions.forEach(item => {
if (item.name === this.selectedProfit) {
this.unit = item.unit
if (newVal === '电') {
this.selectedProfit = '原片电成本';
this.unit = '元/㎡';
} else {
this.selectedProfit = '采购单价';
this.unit = '元/m³'; // 注意:原代码非电情况下单位逻辑可能需要确认,这里暂定为 m³ 或根据 profitOptions 动态获取
// 更严谨的做法是根据 profitOptions 查找默认项的单位
const defaultOption = this.profitOptions.find(item => item.name === this.selectedProfit);
if (defaultOption) {
this.unit = defaultOption.unit;
}
})
}
}
},
immediate: true // 组件创建时立即执行一次,解决初始化取值问题
}
},
computed: {
profitOptions() {
if (this.fuelName==='电') {
if (this.fuelName === '电') {
return [
{name:'采购单价',unit:'元/'},
{name:'产量',unit:''},
{name:'单耗',unit:'度/㎡'},
{name:'消耗量',unit:'度'}
]
}else{
{ name: '原片电成本', unit: '元/' },
{ name: '采购单价', unit: '元/度' },
{ name: '产量', unit: '㎡' },
{ name: '单耗', unit: '度/㎡' },
{ name: '消耗量', unit: '度' }
]
} else {
return [
{name:'采购单价',unit:'元/m³'},
{name:'产量',unit:'㎡'},
{name:'单耗',unit:'m³/㎡'},
{name:'消耗量',unit:'m³'}
]
{ name: '采购单价', unit: '元/m³' },
{ name: '产量', unit: '㎡' },
{ name: '单耗', unit: 'm³/㎡' },
{ name: '消耗量', unit: 'm³' }
]
}
},
currentDataSource() {
@@ -108,7 +119,7 @@ export default {
const salesData = {
allPlaceNames: this.locations,
unit:this.unit,
unit: this.unit,
series: [
// 1. 完成率(折线图)
{

View File

@@ -7,13 +7,17 @@
<!-- 右侧区域全屏按钮 -->
<div class="right-content">
<el-dropdown trigger="click">
<el-button type="text" class="logout-btn" :title="'退出'">
<svg-icon style="color: #0B58FF;" icon-class="logout" />
</el-button>
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
<div class="avatar-wrapper">
<img :src="require(`../../../assets/images/choicepart/avatar.png`)" class="user-avatar">
<span v-if="nickname" class="user-nickname">{{ nickname }}</span>
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native='logout'>退出登录</el-dropdown-item>
<el-dropdown-item @click.native='handleToggle'>切换账号</el-dropdown-item>
<el-dropdown-item @click.native="logout">
<span>退出登录</span>
</el-dropdown-item>
<el-dropdown-item divided @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" class="return-btn" :title="'返回'" @click="handleReturn">
@@ -51,6 +55,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import moment from 'moment'; // 引入moment
import {getPath} from "@/utils/ruoyi";
export default {
@@ -76,6 +81,9 @@ export default {
default: () => []
}
},
computed:{
...mapGetters(['nickname']),
},
data() {
return {
currentTime: '',
@@ -414,12 +422,35 @@ export default {
padding: 0;
}
.logout-btn {
width: 28px;
height: 28px;
font-size: 28px;
padding: 0;
}
.avatar-container {
margin-right: 30px;
.avatar-wrapper {
display: flex;
justify-content: center;
align-items: center;
position: relative;
.user-avatar {
cursor: pointer;
width: 32px;
height: 32px;
border-radius: 50%;
}
.user-nickname{
margin-left: 5px;
font-size: 14px;
}
.el-icon-caret-bottom {
cursor: pointer;
position: absolute;
right: -20px;
top: 10px;
font-size: 12px;
}
}
}
}

View File

@@ -67,18 +67,18 @@ export default {
computed: {
indicatorDefs() {
return [
{ key: 'naturalGas', name: '天然气', unit: '元/㎡',route:'singleCombustible'},
{ key: 'lng', name: 'LNG液化天然气', unit: '元/㎡',route:'singleCombustible'},
{ key: 'heavyOil', name: '重油', unit: '元/㎡',route:'singleCombustible'},
{ key: 'water', name: '水', unit: '元/m³',route:'singleCombustible'}
{ key: 'naturalGas', name: '天然气', label:'天然气成本',unit: '元/㎡',route:'singleCombustible'},
{ key: 'lng', name: 'LNG液化天然气', label:'LNG液化天然气成本', unit: '元/㎡',route:'singleCombustible'},
{ key: 'heavyOil', name: '重油', label:'重油成本', unit: '元/㎡',route:'singleCombustible'},
{ key: 'water', name: '水', label:'水成本', unit: '元/m³',route:'singleCombustible'}
]
},
indicators() {
const fallback = { targetValue: 0, value: 0, completed: 0, diffValue: 0 }
const list = (Array.isArray(this.activeData) ? this.activeData : [])
console.log('数据集:', list);
return this.indicatorDefs.map(def => {
const data = list.find(item => item && item.name.includes(def.name)) || fallback
const data = list.find(item => item.name === def.label) || fallback;
return {
...def,
data,

View File

@@ -68,11 +68,11 @@ export default {
computed: {
indicatorDefs() {
return [
{ key: 'rawMaterialCost', name: '原料成本', unit: '元/㎡', route: 'fuelCostAnalysis/fuelCostAnalysis'},
{ key: 'fuelCost', name: '燃料成本', unit: '元/㎡', route: 'combustible/combustible'},
{ key: 'electricityCost', name: '电成本', unit: '元/㎡', route: 'osElectricityCostAnalysis'},
{ key: 'laborCost', name: '人工成本', unit: '元/㎡', route: 'originalSheetLabor'},
{ key: 'manufacturingCost', name: '制造成本', unit: '元/㎡', route: 'mfgOverheadCostAnalysis/mfgOverheadCostAnalysis'},
{ key: 'rawMaterialCost', name: '原料成本',label:'原料成本', unit: '元/㎡', route: 'fuelCostAnalysis/fuelCostAnalysis'},
{ key: 'fuelCost', name: '燃料成本',label:'原片燃料成本', unit: '元/㎡', route: 'combustible/combustible'},
{ key: 'electricityCost', name: '电成本',label:'原片电成本', unit: '元/㎡', route: 'osElectricityCostAnalysis'},
{ key: 'laborCost', name: '人工成本',label:'人工成本', unit: '元/㎡', route: 'originalSheetLabor'},
{ key: 'manufacturingCost', name: '制造成本',label:'制造成本', unit: '元/㎡', route: 'mfgOverheadCostAnalysis/mfgOverheadCostAnalysis'},
]
},
indicators() {
@@ -80,7 +80,7 @@ export default {
const list = (Array.isArray(this.activeData) ? this.activeData : [])
return this.indicatorDefs.map(def => {
const data = list.find(item => item && item.name === def.name) || fallback
const data = list.find(item => item && item.name === def.label) || fallback
return {
...def,
data,