修改bug

This commit is contained in:
2026-03-12 15:07:18 +08:00
parent 2a316f89c6
commit 660bc4b58b
14 changed files with 623 additions and 134 deletions

View File

@@ -10,11 +10,11 @@ VUE_APP_TITLE = 洛玻集团驾驶舱
# VUE_APP_BASE_API = 'http://172.16.33.83:7070' # VUE_APP_BASE_API = 'http://172.16.33.83:7070'
# 杨姗姗 # 杨姗姗
# VUE_APP_BASE_API = 'http://172.16.20.218:7070' 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'
# 路由懒加载 # 路由懒加载

View File

@@ -2,7 +2,7 @@
<div id="dayReport" class="dayReport" :style="styles"> <div id="dayReport" class="dayReport" :style="styles">
<div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" /> <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
<sidebar v-if="!sidebar.hide" class="sidebar-container" /> <sidebar v-if="!sidebar.hide" class="sidebar-container" />
<ReportHeader :dateData="dateData" size="psi" @timeRangeChange="handleTimeChange" top-title="单项原片原料成本分析" <ReportHeader :dateData="dateData" size="psi" @timeRangeChange="handleTimeChange" @meterialChange='handleMeterialChange' :meterialName='meterialName' top-title="单项原片原料成本分析"
:is-full-screen="isFullScreen" @screenfullChange="screenfullChange" :leftMargin=" '280px' " /> :is-full-screen="isFullScreen" @screenfullChange="screenfullChange" :leftMargin=" '280px' " />
<div class="main-body" style=" <div class="main-body" style="
margin-top: -20px; margin-top: -20px;
@@ -36,7 +36,6 @@
gap: 12px; gap: 12px;
grid-template-columns: 1624px; grid-template-columns: 1624px;
"> ">
<!-- <monthlyRelatedMetrics :itemData="renderList" :title="'月度·相关指标分析'" /> -->
<relateSingleFuelCostAnalysis :relatedData="relatedData" :title="'相关指标分析'" /> <relateSingleFuelCostAnalysis :relatedData="relatedData" :title="'相关指标分析'" />
</div> </div>
@@ -51,38 +50,20 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <div class="centerImg" style="
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1; /* 确保在 backp 之上、内容之下 */
"></div> -->
</div> </div>
</template> </template>
<script> <script>
import ReportHeader from "../components/noRouterHeader.vue"; import ReportHeader from "../productionCostAnalysisComponents/noRouterHeader.vue";
import { Sidebar } from "../../../layout/components"; import { Sidebar } from "../../../layout/components";
import screenfull from "screenfull"; import screenfull from "screenfull";
import changeBase from "../components/changeBase.vue"; import changeBase from "../components/changeBase.vue";
import monthlyOverview from "../productionCostAnalysisComponents/monthlyOverview.vue"; import monthlyOverview from "../productionCostAnalysisComponents/monthlyOverview.vue";
import totalOverview from "../productionCostAnalysisComponents/totalOverview.vue"; import totalOverview from "../productionCostAnalysisComponents/totalOverview.vue";
// import totalOverview from "../operatingComponents/totalOverview.vue";
// import monthlyRelatedMetrics from "../procurementGainAnalysisComponents/monthlyRelatedMetrics.vue";
import relateSingleFuelCostAnalysis from "../productionCostAnalysisComponents/relateSingleFuelCostAnalysis.vue"; import relateSingleFuelCostAnalysis from "../productionCostAnalysisComponents/relateSingleFuelCostAnalysis.vue";
import dataTrend from "../productionCostAnalysisComponents/dataTrendSingleFuel.vue"; import dataTrend from "../productionCostAnalysisComponents/dataTrendSingleFuel.vue";
import { mapState } from "vuex"; import { mapState } from "vuex";
import { getSingleMaterialAnalysis } from '@/api/cockpit' import { getSingleMaterialAnalysis } from '@/api/cockpit'
// import PSDO from "./components/PSDO.vue";
// import psiLineChart from "./components/psiLineChart.vue";
// import coreBottomLeft from "./components/coreBottomLeft.vue";
// import orderProgress from "./components/orderProgress.vue";
// import keyWork from "./components/keyWork.vue";
import moment from "moment"; import moment from "moment";
// import html2canvas from 'html2canvas'
// import JsPDF from 'jspdf'
export default { export default {
name: "DayReport", name: "DayReport",
components: { components: {
@@ -109,8 +90,7 @@ export default {
trend: [], trend: [],
relatedData: {}, relatedData: {},
trendName: '采购单价', trendName: '采购单价',
// monthRelatedData: [], meterialName:'',
// totalRelatedData: [],
}; };
}, },
@@ -144,13 +124,11 @@ export default {
variables() { variables() {
return variables; return variables;
}, },
// ...mapGetters(['sidebar']),
styles() { styles() {
const v = Math.floor(this.value * this.beilv * 100) / 10000; const v = Math.floor(this.value * this.beilv * 100) / 10000;
return { return {
transform: `scale(${v})`, transform: `scale(${v})`,
transformOrigin: "left top", transformOrigin: "left top",
// overflow: hidden;
}; };
}, },
}, },
@@ -182,7 +160,7 @@ export default {
this.beilv = _this.clientWidth / 1920; this.beilv = _this.clientWidth / 1920;
})(); })();
}; };
console.log(this.$route.query.name, 'name'); this.meterialName = this.$route.query.name ? this.$route.query.name : '硅砂'
if(this.$route.query.factory){ if(this.$route.query.factory){
this.factory =Number(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) { }else if(this.$store.getters.levelList.length > 0 && this.$store.getters.levelList[0].id !== 1) {
@@ -194,8 +172,6 @@ export default {
}, },
methods: { methods: {
changeItem(item) { changeItem(item) {
console.log('item', item);
this.trendName = item this.trendName = item
this.getData() this.getData()
}, },
@@ -203,63 +179,26 @@ export default {
const requestParams = { const requestParams = {
startTime: this.dateData.startTime, startTime: this.dateData.startTime,
endTime: this.dateData.endTime, endTime: this.dateData.endTime,
// index: this.index, trendName: '原料' + this.meterialName + this.trendName,
// sort: 1, analysisObject: ['原料' + this.meterialName],
trendName: this.$route.query.name ? '原料' + this.$route.query.name + this.trendName : '原料硅砂采购单价',
analysisObject: [
this.$route.query.name ? '原料' + this.$route.query.name : '原料硅砂'
],
// paramList: ['制造成本', '财务费用', '销售费用', '管理费用', '运费'],
levelId: this.factory, levelId: this.factory,
// baseId: Number(this.factory),
}; };
// 调用接口 // 调用接口
getSingleMaterialAnalysis(requestParams).then((res) => { getSingleMaterialAnalysis(requestParams).then((res) => {
this.monData = res.data.currentMonthData.find(item => { this.monData = res.data.currentMonthData.find(item => {
if (this.$route.query.name) { return item.name === '原料' + this.meterialName;
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name === '原料' + this.$route.query.name;
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name === '原料硅砂';
}
}); });
console.log('this.monData', this.monData, this.$route.query.name ? '原料' + this.$route.query.name : '原料硅砂');
this.totalData = res.data.totalMonthData.find(item => { this.totalData = res.data.totalMonthData.find(item => {
if (this.$route.query.name) { return item.name === '原料' + this.meterialName;
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name === '原料' + this.$route.query.name;
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name === '原料硅砂';
}
}); });
// this.relatedMon = res.data.relatedMon
this.relatedData = { this.relatedData = {
relatedMon: res.data.currentMonthData.filter(item => { relatedMon: res.data.currentMonthData.filter(item => {
if (this.$route.query.name) { return item.name !== '原料' + this.meterialName;
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name !== '原料' + this.$route.query.name;
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name !== '原料硅砂';
}
}), // 兜底月度数据 }), // 兜底月度数据
relatedTotal: res.data.totalMonthData.filter(item => { relatedTotal: res.data.totalMonthData.filter(item => {
if (this.$route.query.name) { return item.name !== '原料' + this.meterialName;
// 如果有查询参数,查找 "原料" + 查询参数 的项
return item.name !== '原料' + this.$route.query.name;
} else {
// 如果没有查询参数,查找 name 为 "原料硅砂" 的项
return item.name !== '原料硅砂';
}
}) // 兜底累计数据 }) // 兜底累计数据
} }
;
this.trend = res.data.dataTrend this.trend = res.data.dataTrend
}); });
}, },
@@ -274,8 +213,11 @@ export default {
this.getData() this.getData()
}, },
handleMeterialChange(val) {
this.meterialName = val
this.getData()
},
selectChange(data) { selectChange(data) {
console.log('选中的数据:', data);
this.factory = data this.factory = data
if (this.dateData.startTime && this.dateData.endTime) { if (this.dateData.startTime && this.dateData.endTime) {
this.getData(); this.getData();
@@ -333,28 +275,7 @@ export default {
} else { } else {
clearInterval(this.timer); clearInterval(this.timer);
} }
}, }
// 导出
// () {
// this.$message.success('正在导出,请稍等!')
// const element = document.getElementById('dayRepDom')
// element.style.display = 'block'
// const fileName = '株洲碲化镉生产日报' + moment().format('yyMMDD') + '.pdf'
// html2canvas(element, {
// dpi: 300, // Set to 300 DPI
// scale: 3 // Adjusts your resolution
// }).then(function(canvas) {
// const imgWidth = 595.28
// const imgHeight = 841.89
// const pageData = canvas.toDataURL('image/jpeg', 1.0)
// const PDF = new JsPDF('', 'pt', [imgWidth, imgHeight])
// PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight)
// setTimeout(() => {
// PDF.save(fileName) // 导出文件名
// }, 1000)
// })
// element.style.display = 'none'
// }
}, },
}; };
</script> </script>

View File

@@ -201,12 +201,12 @@ export default {
// 调用接口 // 调用接口
getSingleMaterialCostAnalysis(requestParams).then((res) => { getSingleMaterialCostAnalysis(requestParams).then((res) => {
this.monData = res.data.currentMonthData.find(item => { this.monData = res.data.currentMonthData.find(item => {
return item.name === "加工包材成本"; return item.name === "包材成本";
}); });
console.log('this.monData', this.monData); console.log('this.monData', this.monData);
this.totalData = res.data.totalMonthData.find(item => { this.totalData = res.data.totalMonthData.find(item => {
return item.name === "加工包材成本"; return item.name === "包材成本";
}); });
// this.relatedMon = res.data.relatedMon // this.relatedMon = res.data.relatedMon
; ;

View File

@@ -246,6 +246,7 @@ export default {
}, },
methods: { methods: {
selectProfit(item) { selectProfit(item) {
console.log('aaaaaa',item)
this.selectedProfit = item; this.selectedProfit = item;
this.isDropdownShow = false; this.isDropdownShow = false;
this.$emit('handleGetItemData', item) this.$emit('handleGetItemData', item)

View File

@@ -91,6 +91,7 @@ export default {
return `${year}-${month}`; return `${year}-${month}`;
}, },
getData(value) { getData(value) {
console.log('bbbbbbbbbbbbb=================',value)
this.$emit('getData', value) this.$emit('getData', value)
}, },
}, },

View File

@@ -7,7 +7,7 @@
<div class="topItem-container" style="display: flex; gap: 8px;"> <div class="topItem-container" style="display: flex; gap: 8px;">
<div class="dashboard left" @click="handleDashboardClick('备品丶机物料')"> <div class="dashboard left" @click="handleDashboardClick('备品丶机物料')">
<div class="title"> <div class="title">
品丶机物料·/ 机物料·/
</div> </div>
<div class="line"> <div class="line">
<!-- 绑定备件丶机物料对应数据新增数据绑定样式不变 --> <!-- 绑定备件丶机物料对应数据新增数据绑定样式不变 -->

View File

@@ -0,0 +1,479 @@
<template>
<header class="report-header" :class="['report-header__' + size]">
<!-- 左侧区域标题 -->
<div class="left-content" :style="{ marginLeft: leftMargin }">
<div class="top-title">{{ topTitle }}</div>
</div>
<!-- 右侧区域全屏按钮 -->
<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-menu slot="dropdown">
<el-dropdown-item @click.native='logout'>退出登录</el-dropdown-item>
<el-dropdown-item @click.native='handleToggle'>切换账号</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="text" class="return-btn" :title="'返回'" @click="handleReturn">
<svg-icon style="color: #0B58FF;" icon-class="returnIcon" />
</el-button>
<el-button type="text" class="screen-btn" :title="isFullScreen ? '退出全屏' : '全屏'" @click="changeFullScreen">
<svg-icon style="color: #0B58FF;" v-if="isFullScreen" icon-class="unFullScreenView" />
<svg-icon style="color: #0B58FF;" v-else icon-class="fullScreenView" />
</el-button>
</div>
<div class='materialType'>
<div class="materialP">
<el-select class="label-text" v-model="materialValue" placeholder="请选择原料" @change='selectMeterial'>
<el-option
v-for="item in materialOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
<!-- 时间选择区域//年按钮 + 日期选择器 -->
<div class="timeType">
<div class="dateP">
<div class="label">
<span class="label-text">月份选择</span>
</div>
<el-date-picker v-model="date" type="month" placeholder="请选择月份" class="custom-date-picker"
value-format="timestamp" :clearable="false" style="width: 132px;height: 29px;" @change="emitTimeRange" />
</div>
</div>
</header>
</template>
<script>
import moment from 'moment'; // 引入moment
import {getPath} from "@/utils/ruoyi";
export default {
name: 'Header',
props: {
isFullScreen: { type: Boolean, default: false },
topTitle: { type: String, default: '' },
size: { type: String, default: 'basic' },
leftMargin: {
type: [String, Number],
default: '350px' // 默认值设为350px
},
dateData: {
type: Object,
default: () => ({})
},
meterialName:{
type: String,
default: '硅砂'
}
},
data() {
return {
currentTime: '',
timeTimer: null,
date: Date.now(), // 使用当前时间戳作为初始值
activeTime: 1, // 默认月维度0=日1=月2=年)
materialValue:'硅砂',
materialOptions: [
{value:'硅砂',label:'硅砂'},
{value:'海砂',label:'海砂'},
{value:'纯碱',label:'纯碱'},
{value:'白云石',label:'白云石'},
{value:'石灰石',label:'石灰石'}
]
}
},
watch: {
activeTime(newVal, oldVal) {
if (newVal !== oldVal) {
this.date = Date.now();
this.emitTimeRange();
}
},
dateData: {
immediate: true, // 初始化时立即执行
handler(newVal) {
console.log('dateData 变化:', newVal);
if (newVal && (newVal.startTime || newVal.endTime)) {
// 优先使用 startTime如果没有则使用 endTime
const timeStamp = newVal.startTime || newVal.endTime;
if (timeStamp && timeStamp !== 0) {
console.log('设置日期选择器时间为:', timeStamp);
this.date = timeStamp; // 直接使用时间戳
}
}
}
},
meterialName:{
immediate: true, // 初始化时立即执行
handler(newVal) {
if (newVal) {
this.materialValue = newVal;
}
}
}
},
mounted() {
// 初始化默认日期为当前月份
console.log('初始化日期选择器,当前时间戳:', this.date);
this.$nextTick(() => {
this.emitTimeRange();
});
},
beforeDestroy() {
// 清理定时器
if (this.timeTimer) {
clearInterval(this.timeTimer);
}
},
methods: {
changeFullScreen() {
this.$emit('screenfullChange');
},
handleReturn() {
console.log('返回上一页');
if (this.$router) {
this.$router.go(-1);
}
},
async logout() {
this.$modal.confirm('确定注销并退出系统吗?', '提示').then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/index');
})
}).catch(() => {});
},
handleToggle() {
this.$store.dispatch('LogOut').then(() => {
location.href = getPath('/index');
})
},
/**
* 计算时间范围(时间戳格式)
* 固定为月维度当月1日00:00:00 → 当月最后一天23:59:59
*/
calculateTimeRange() {
// 固定为月维度
const mode = 2;
// 初始化时间戳为0兜底值
let startTime = 0;
let endTime = 0;
// 存储目标月份仅数字如10、12
let targetMonth = '';
try {
// 使用 this.date时间戳创建 moment 对象
let targetMoment = this.date
? moment(this.date)
: moment(); // 如果 date 无效,使用当前时间
// 验证日期是否有效
if (!targetMoment.isValid()) {
console.warn('无效的日期,已使用当前月份:', this.date);
targetMoment = moment();
}
// 获取月份数字格式1-12
targetMonth = targetMoment.format('M');
console.log('当前选择的月份:', targetMonth);
// 计算当月第一天00:00:00的时间戳
startTime = targetMoment.startOf('month').valueOf();
// 计算当月最后一天23:59:59的时间戳
endTime = targetMoment.clone()
.endOf('month')
.set({
hour: 23,
minute: 59,
second: 59,
millisecond: 0 // 毫秒设为0
})
.valueOf();
// 调试输出
console.log('月份时间范围计算结果:', {
startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss'),
endTime: moment(endTime).format('YYYY-MM-DD HH:mm:ss'),
startTimeStamp: startTime,
endTimeStamp: endTime,
targetMonth: targetMonth
});
} catch (error) {
console.error('计算月份时间范围时出错:', error);
}
// 返回月份相关的所有信息:时间戳、维度、月份值
return {
startTime,
endTime,
mode,
targetMonth
};
},
// 传递时间范围给父组件
emitTimeRange() {
const timeRange = this.calculateTimeRange();
console.log('触发时间范围变化:', timeRange);
this.$emit('timeRangeChange', timeRange);
},
selectMeterial(val){
this.$emit('meterialChange', val);
}
}
}
</script>
<style scoped lang="scss">
/* 字体引入 */
@font-face {
font-family: "YouSheBiaoTiHei";
src: url('../../../assets/fonts/YouSheBiaoTiHe.ttf') format('truetype');
}
/* 头部容器基础样式 */
.report-header {
height: 117px;
width: 100%;
display: flex;
justify-content: space-between;
box-sizing: border-box;
position: relative;
&__basic {
background: url(../../../assets/img/topBg.png) no-repeat;
background-size: cover;
background-position: 0 0;
}
&__psi {
background: url(../../../assets/img/psiTopTitle.png) no-repeat;
background-size: 100% 100%;
background-position: 0 0;
}
/* 左侧标题区域 */
.left-content {
margin-top: 11px;
height: 55px;
display: flex;
align-items: center;
gap: 16px;
}
.top-title {
height: 55px;
font-family: "YouSheBiaoTiHei", sans-serif;
font-size: 42px;
color: #1E1651;
line-height: 55px;
letter-spacing: 6px;
text-align: left;
}
.materialType{
position: absolute;
display: flex;
align-items: center;
top: 42px;
right: 200px;
margin-top: 18px;
gap: 0;
.materialP {
width: 160px;
height: 28px;
background: rgba(236, 244, 254, 1);
transform: skew(-25deg);
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #0B58FF;
line-height: 28px;
text-align: center;
overflow: hidden;
::v-deep .label-text {
display: inline-block;
transform: skew(25deg);
padding-left: 10px;
.el-input__inner {
border: none;
font-size: 16px;
font-weight: bold;
color:#0B58FF;
height: 28px;
line-height: 28px;
background-color: transparent;
}
}
}
}
/* 时间选择区域 */
.timeType {
position: absolute;
display: flex;
align-items: center;
top: 42px;
right: 0px;
margin-top: 18px;
gap: 0;
}
.timeType .item {
width: 50px;
height: 28px;
background: rgba(236, 244, 254, 1);
transform: skew(-25deg);
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: rgba(11, 88, 255, 1);
line-height: 28px;
letter-spacing: 2px;
text-align: center;
cursor: pointer;
overflow: hidden;
}
.timeType .item .item-text {
display: inline-block;
transform: skew(25deg);
transition: all 0.2s ease;
}
.timeType .item.no-skew {
background: rgba(11, 88, 255, 1);
color: rgba(249, 252, 255, 1);
transform: skew(-25deg) !important;
box-shadow: 0 2px 8px rgba(11, 88, 255, 0.3);
}
.timeType .item.no-skew .item-text {
transform: skew(25deg) !important;
}
.dateP {
position: relative;
margin-left: 10px;
display: flex;
align-items: center;
gap: 0;
}
.dateP .label {
width: 80px;
height: 28px;
background: rgba(236, 244, 254, 1);
transform: skew(-25deg);
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #0B58FF;
line-height: 28px;
text-align: center;
overflow: hidden;
}
.dateP .label-text {
display: inline-block;
transform: skew(25deg);
}
/* 右侧全屏按钮区域 */
.right-content {
display: flex;
margin-top: 12px;
margin-right: 10px;
gap: 21px;
height: 35px;
}
.screen-btn {
width: 26px;
height: 26px;
color: #00fff0;
font-size: 26px;
padding: 0;
margin: 0;
}
.home-btn {
width: 26px;
height: 26px;
color: #00fff0;
font-size: 26px;
padding: 0;
}
.return-btn {
width: 26px;
height: 26px;
color: #00fff0;
font-size: 26px;
padding: 0;
}
.logout-btn {
width: 28px;
height: 28px;
font-size: 28px;
padding: 0;
}
}
/* 日期选择器自定义样式 */
::v-deep .custom-date-picker {
position: absolute;
right: 8px;
width: 110px !important;
height: 28px !important;
position: relative;
margin: 0 !important;
.el-input__inner {
height: 28px !important;
width: 110px !important;
text-align: center;
padding-left: 15px !important;
padding-right: 32px !important;
font-size: 14px !important;
line-height: 28px !important;
color: rgba(237, 245, 253, 1) !important;
vertical-align: middle !important;
clip-path: polygon(18px 0, 100% 0, 100% 100%, 0 100%);
border: none !important;
box-shadow: none !important;
background-color: rgba(11, 88, 255, 1) !important;
border-left: 1px solid rgba(255, 255, 255, 0.2);
}
.el-input__prefix {
left: auto !important;
right: 8px !important;
top: 50% !important;
transform: translateY(-50%) !important;
display: inline-flex !important;
align-items: center !important;
height: 28px !important;
}
.el-input__icon {
color: #ffffff !important;
font-size: 16px !important;
line-height: 28px !important;
vertical-align: middle !important;
}
.el-icon-date::before {
color: #ffffff !important;
font-size: 16px !important;
line-height: inherit !important;
}
}
</style>

View File

@@ -95,17 +95,17 @@ export default {
} }
// 路由跳转时携带序号(或名称+序号) // 路由跳转时携带序号(或名称+序号)
this.$router.push({ // this.$router.push({
path: 'productionCostAnalysisBase', // path: 'productionCostAnalysisBase',
query: { // 使用query传递参数推荐也可使用params // query: { // 使用query传递参数推荐也可使用params
// baseName: itemName, // // baseName: itemName,
factory: baseIndex, // factory: baseIndex,
dateData: this.dateData // dateData: this.dateData
} // }
// 若仍需用base作为参数 // // 若仍需用base作为参数
// base: itemName, // // base: itemName,
// params: { baseIndex: baseIndex } // // params: { baseIndex: baseIndex }
}); // });
}); });
// 定义resize处理函数命名函数方便移除 // 定义resize处理函数命名函数方便移除

View File

@@ -17,7 +17,7 @@
</div> </div>
<div class="dashboard right" @click="handleDashboardClick('备品丶机物料')"> <div class="dashboard right" @click="handleDashboardClick('备品丶机物料')">
<div class="title"> <div class="title">
品丶机物料·/ 机物料·/
</div> </div>
<div class="line"> <div class="line">
<!-- 绑定对应数据新增数据绑定样式不变 --> <!-- 绑定对应数据新增数据绑定样式不变 -->

View File

@@ -7,7 +7,7 @@
<div class="topItem-container" style="display: flex; gap: 8px;"> <div class="topItem-container" style="display: flex; gap: 8px;">
<div class="dashboard left" @click="handleDashboardClick('备品丶机物料')"> <div class="dashboard left" @click="handleDashboardClick('备品丶机物料')">
<div class="title"> <div class="title">
品丶机物料·/ 机物料·/
</div> </div>
<div class="line"> <div class="line">
<!-- 绑定备件丶机物料对应数据新增数据绑定样式不变 --> <!-- 绑定备件丶机物料对应数据新增数据绑定样式不变 -->

View File

@@ -137,9 +137,10 @@ export default {
}, },
grid: { grid: {
top: 30, top: 30,
bottom: 30, bottom: 5,
right: 70, right: 5,
left: 60 left: 15,
containLabel: true
}, },
xAxis: [ xAxis: [
{ {

View File

@@ -86,10 +86,49 @@ export default {
normal: { normal: {
align: 'left', align: 'left',
distanceToLabelLine: 2, distanceToLabelLine: 2,
formatter: (params) => [ formatter: (params) => {
`{b|${params.value.toLocaleString()}}`, // 数值(格式化千分位) const wrapMixedText = (text, maxUnits = 9, maxLines = 2) => {
`{hr|■}{c|${params.name}}` // 名称 + 颜色标识 if (!text) return ''
].join('\n'), let line = ''
let units = 0
const lines = []
const charUnit = (ch) => {
// 简单权重:中文/全角更“宽”
if (/[\u4e00-\u9fa5]/.test(ch)) return 1
if (/[A-Z]/.test(ch)) return 0.85
if (/[a-z0-9]/.test(ch)) return 0.65
if (/\s/.test(ch)) return 0.3
return 0.8
}
for (let i = 0; i < text.length; i++) {
const ch = text[i]
const u = charUnit(ch)
// 超过阈值就换行
if (units + u > maxUnits && line) {
lines.push(line)
line = ch
units = u
if (lines.length >= maxLines) {
// 还有剩余就省略
const rest = text.slice(i + 1)
if (rest) lines[maxLines - 1] = (lines[maxLines - 1] + '...').replace(/\.\.\.\.+$/, '...')
return lines.join('\n')
}
} else {
line += ch
units += u
}
}
if (line) lines.push(line)
return lines.slice(0, maxLines).join('\n')
}
const nameWrapped = wrapMixedText(params.name, 6, 1)
return [
`{b|${Number(params.value || 0).toLocaleString()}}`,
// 第2行放色块 + 名称第1行如果名称有第2行会自然变成第3行
`{hr|■}{c|${nameWrapped}}`
].join('\n')
},
rich: { rich: {
hr: { hr: {
color: color, color: color,
@@ -112,8 +151,8 @@ export default {
// 标签线样式(动态匹配颜色) // 标签线样式(动态匹配颜色)
labelLine: { labelLine: {
lineStyle: { color: color }, lineStyle: { color: color },
length: 10, length: 5,
length2: 20, length2: 5,
}, },
// 扇区样式(动态匹配颜色) // 扇区样式(动态匹配颜色)
itemStyle: { color: color } itemStyle: { color: color }
@@ -129,7 +168,7 @@ export default {
left: 'center', left: 'center',
top: '35%', top: '35%',
textStyle: { textStyle: {
fontSize: 18, fontSize: 15,
letterSpacing: 5, letterSpacing: 5,
color: 'rgba(0, 0, 0, 0.55)', color: 'rgba(0, 0, 0, 0.55)',
fontFamily: 'PingFangSC, PingFang SC' fontFamily: 'PingFangSC, PingFang SC'
@@ -140,7 +179,7 @@ export default {
left: 'center', left: 'center',
top: '50%', top: '50%',
textStyle: { textStyle: {
fontSize: 16, fontSize: 14,
color: 'rgba(0, 0, 0, 0.55)', color: 'rgba(0, 0, 0, 0.55)',
fontFamily: 'PingFangSC, PingFang SC' fontFamily: 'PingFangSC, PingFang SC'
} }
@@ -150,7 +189,7 @@ export default {
{ {
name: '销量', name: '销量',
type: 'pie', type: 'pie',
radius: ['60%', '80%'], radius: ['50%', '70%'],
center: ['50%', '50%'], center: ['50%', '50%'],
avoidLabelOverlap: false, avoidLabelOverlap: false,
label: { label: {
@@ -167,8 +206,6 @@ export default {
}, },
labelLine: { labelLine: {
show: true, show: true,
length: 0,
length2: 10,
lineStyle: { lineStyle: {
// 若未单独配置标签线颜色,默认取对应数据项的颜色 // 若未单独配置标签线颜色,默认取对应数据项的颜色
color: (params) => this.customColors[params.dataIndex % this.customColors.length] color: (params) => this.customColors[params.dataIndex % this.customColors.length]

View File

@@ -12,7 +12,7 @@
<el-button @click="cancelEdit" :loading="dataListLoading">取消</el-button> <el-button @click="cancelEdit" :loading="dataListLoading">取消</el-button>
</div> </div>
</div> </div>
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table @emitFun="inputChange" class="right-aside" :table-props="tableProps" :page="listQuery.pageNo" <base-table @emitFun="inputChange" class="right-aside" :table-props="tableProps" :page="listQuery.pageNo"
:limit="listQuery.pageSize" :table-data="tableData" v-loading="dataListLoading" ref="baseTable"></base-table> :limit="listQuery.pageSize" :table-data="tableData" v-loading="dataListLoading" ref="baseTable"></base-table>
<pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="total" @pagination="getData" :background="true" /> <pagination :limit.sync="listQuery.pageSize" :page.sync="listQuery.pageNo" :total="total" @pagination="getData" :background="true" />
@@ -21,7 +21,7 @@
<script> <script>
import inputArea from './inputArea.vue' import inputArea from './inputArea.vue'
import { getDataBackUpDetail, updateDataBackUpDetail } from '@/api/cockpit'; import { getDataBackUpDetail, updateDataBackUpDetail, getLevelStruc } from '@/api/cockpit';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
export default { export default {
@@ -37,22 +37,70 @@ export default {
time: undefined, time: undefined,
timeDim: 10, timeDim: 10,
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 20,
name: undefined,
levelId: undefined,
status: undefined
}, },
total:0, total:0,
isEditMode: false, isEditMode: false,
dataListLoading: false // 新增:加载状态 dataListLoading: false, // 新增:加载状态
formConfig: [
{
type: 'input',
label: '指标名称',
placeholder: '指标名称',
param: 'name'
},
{
type: 'select',
label: '所属层级',
onchange: true,
defaultSelect: null,
selectOptions: [],
param: 'levelId'
},
{
type: 'select',
label: '数据状态',
onchange: true,
selectOptions: [
{ id: '0', name: '正常' },
{ id: '1', name: '已修改' },
],
param: 'status',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
}
]
}; };
}, },
mounted() { mounted() {
this.listQuery.time = this.$route.query.time || undefined this.listQuery.time = this.$route.query.time || undefined
this.listQuery.timeDim = this.$route.query.timeDim || undefined this.listQuery.timeDim = this.$route.query.timeDim || undefined
this.isEditMode = this.$route.query.edit === 'true' || false; // 修复:路由参数是字符串,需转布尔 this.isEditMode = this.$route.query.edit === 'true' || false; // 修复:路由参数是字符串,需转布尔
console.log('this.isEditMode', this.isEditMode);
this.initTableProps(this.isEditMode) this.initTableProps(this.isEditMode)
this.getLevel()
this.getData() this.getData()
}, },
methods: { methods: {
getLevel() {
getLevelStruc().then((res) => {
this.formConfig[1].selectOptions = res.data || []
}).catch(err => {
console.error('获取所属层级失败:', err);
});
},
buttonClick(val){
this.listQuery.name = val.name
this.listQuery.levelId = val.levelId
this.listQuery.status = val.status
this.getData()
},
inputChange(val) { inputChange(val) {
console.log('修改的数据:', val); console.log('修改的数据:', val);
let no = val._pageIndex - 1 - (this.listQuery.pageNo - 1) * this.listQuery.pageSize let no = val._pageIndex - 1 - (this.listQuery.pageNo - 1) * this.listQuery.pageSize

View File

@@ -38,7 +38,7 @@ export default {
urlOptions: {}, urlOptions: {},
tableData: [], tableData: [],
listQuery: { listQuery: {
pageSize: 10, pageSize: 20,
pageNo: 1, pageNo: 1,
timeDim: 2, timeDim: 2,
startTime: undefined, startTime: undefined,
@@ -126,7 +126,8 @@ export default {
type: 'button', type: 'button',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
color: 'warning', color: 'primary',
plain: true
} }
], ],
}; };
@@ -192,7 +193,7 @@ export default {
return this.$modal.msgWarning('请选择统计时间'); return this.$modal.msgWarning('请选择统计时间');
} }
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 20;
this.listQuery.status = val.status ? val.status : undefined; this.listQuery.status = val.status ? val.status : undefined;
this.listQuery.startTime = moment(val.timeValMonth[0]).startOf('day').valueOf(); this.listQuery.startTime = moment(val.timeValMonth[0]).startOf('day').valueOf();
this.listQuery.endTime = moment(val.timeValMonth[1]).endOf('day').valueOf(); this.listQuery.endTime = moment(val.timeValMonth[1]).endOf('day').valueOf();