Browse Source

feat:看板需求调整及优化;

fuyang
YOU 8 months ago
parent
commit
2d667ac038
  1. 25
      src/views/dashboard/common/model.ts
  2. 6
      src/views/dashboard/comp/pop.vue
  3. 61
      src/views/dashboard/main.vue

25
src/views/dashboard/common/model.ts

@ -30,7 +30,9 @@ export const monthEnergyUsageTrend = (data = [], unit?: string): IObject => {
let str = `<div>${axisValue}日</div><div>`; let str = `<div>${axisValue}日</div><div>`;
for (const item of params) { for (const item of params) {
const { data } = item; const { data } = item;
str += `<div style="display: flex;justify-content: space-between;"><span>${item.marker}</span> <span><b>${data}</b> ${unit}</span></div>`;
str += `<div style="display: flex;justify-content: space-between;"><span>${
item.marker
}</span> <span><b>${data ?? '--'}</b> ${unit}</span></div>`;
} }
return str + '</div>'; return str + '</div>';
} }
@ -193,7 +195,16 @@ export const costStatistic = (data = []): IObject => {
tooltip: { tooltip: {
formatter: (params) => { formatter: (params) => {
if (params.name !== '') { if (params.name !== '') {
return params.name + ' : ' + params.value + '\n' + '(' + params.percent + '%)';
return (
params.marker +
params.name +
' : ' +
(params.value ?? '--') +
' tce \n' +
'(' +
params.percent +
'%)'
);
} }
}, },
}, },
@ -294,7 +305,9 @@ export const usageRanking = (data = [], unit?: string): IObject => {
let str = `<div>${axisValue}</div><div>`; let str = `<div>${axisValue}</div><div>`;
for (const item of params) { for (const item of params) {
const { data } = item; const { data } = item;
str += `<div style="display: flex;justify-content: space-between;"><span>${item.marker}</span> <span><b>${data}</b> ${unit}</span></div>`;
str += `<div style="display: flex;justify-content: space-between;"><span>${
item.marker
}</span> <span><b>${data ?? '--'}</b> ${unit}</span></div>`;
} }
return str + '</div>'; return str + '</div>';
} }
@ -375,7 +388,9 @@ export const elecPayload = (data = []): IObject => {
let str = `<div>${moment().format('YYYY-MM-DD')} ${axisValue}时</div><div>`; let str = `<div>${moment().format('YYYY-MM-DD')} ${axisValue}时</div><div>`;
for (const item of params) { for (const item of params) {
const { seriesName, data } = item; const { seriesName, data } = item;
str += `<div style="display: flex;justify-content: space-between;"><span>${item.marker}电力负荷:</span> <span><b>${data}</b> kWh</span></div>`;
str += `<div style="display: flex;justify-content: space-between;"><span>${
item.marker
}</span> <span><b>${data ?? '--'}</b> kWh</span></div>`;
} }
return str + '</div>'; return str + '</div>';
} }
@ -492,7 +507,7 @@ export const energyUsageDistribution = (data = []): IObject => {
const { seriesName, data } = item; const { seriesName, data } = item;
str += `<div style="display: flex;justify-content: space-between;"><span>${ str += `<div style="display: flex;justify-content: space-between;"><span>${
item.marker item.marker
}${seriesName}</span> <span><b>${data}</b> ${
}${seriesName}</span> <span><b>${data ?? '--'}</b> ${
utilService.getTargetItemByKey(energyMap, seriesName, 'name')?.unit || '' utilService.getTargetItemByKey(energyMap, seriesName, 'name')?.unit || ''
}</span></div>`; }</span></div>`;
} }

6
src/views/dashboard/comp/pop.vue

@ -98,5 +98,11 @@ export default defineComponent({
} }
} }
} }
&:first-child {
b {
font-size: 20px !important;
}
}
} }
</style> </style>

61
src/views/dashboard/main.vue

@ -30,11 +30,11 @@
<component :is="item.comp" :key="index" :item="item" :option="item.option" tip-loop></component> <component :is="item.comp" :key="index" :item="item" :option="item.option" tip-loop></component>
</block> </block>
</div> </div>
<div class="bottom">
<!--<div class="bottom">
<block size-type="2" :item="bottom"> <block size-type="2" :item="bottom">
<component :is="bottom.comp" :item="bottom" :option="bottom.option" tip-loop></component> <component :is="bottom.comp" :item="bottom" :option="bottom.option" tip-loop></component>
</block> </block>
</div>
</div>-->
</div> </div>
<tooltip :data="toolTipData" /> <tooltip :data="toolTipData" />
</screen-adapter> </screen-adapter>
@ -116,7 +116,7 @@ export default defineComponent({
icon: 'elec', icon: 'elec',
label: '电用量', label: '电用量',
value: '', value: '',
unit: 'kWh',
unit: 'kWh',
}, },
{ {
key: 'waterDayValue', key: 'waterDayValue',
@ -157,7 +157,7 @@ export default defineComponent({
icon: 'elec', icon: 'elec',
label: '电用量', label: '电用量',
value: '', value: '',
unit: 'kWh',
unit: 'kWh',
}, },
{ {
key: 'waterDayValue', key: 'waterDayValue',
@ -190,11 +190,10 @@ export default defineComponent({
], ],
}, },
{ {
title: '当月用能趋势',
comp: 'chart', comp: 'chart',
option: monthEnergyUsageTrend(),
title: '当日电力负荷',
option: elecPayload(),
unit: 'kWh', unit: 'kWh',
select: true,
}, },
], ],
right: [ right: [
@ -212,10 +211,11 @@ export default defineComponent({
select: true, select: true,
}, },
{ {
title: '当月用能趋势',
comp: 'chart', comp: 'chart',
title: '当日电力负荷',
option: elecPayload(),
option: monthEnergyUsageTrend(),
unit: 'kWh', unit: 'kWh',
select: true,
}, },
], ],
bottom: { bottom: {
@ -242,7 +242,7 @@ export default defineComponent({
const d = res.currentMonthData; const d = res.currentMonthData;
const c = state.dataForm.code; const c = state.dataForm.code;
const u = state.dataForm.codeMap[c]; const u = state.dataForm.codeMap[c];
state.left[2].option = monthEnergyUsageTrend(d, u);
state.right[2].option = monthEnergyUsageTrend(d, u);
} }
}, },
}); });
@ -315,24 +315,24 @@ export default defineComponent({
cb: (res: any) => { cb: (res: any) => {
if (utilService.isValidObject(res) && utilService.isValidArray(res.currentMonthData)) { if (utilService.isValidObject(res) && utilService.isValidArray(res.currentMonthData)) {
const d = res.currentMonthData; const d = res.currentMonthData;
state.right[2].option = elecPayload(d);
state.left[2].option = elecPayload(d);
} }
}, },
}); });
}; };
//24 //24
useFetch('/board/dayEnergy/trend', {
data: {
//day: '2025-04-01',
day: moment().subtract(1, 'days').format('YYYY-MM-DD'),
},
cb: (res: any) => {
if (utilService.isValidObject(res)) {
state.bottom.option = energyUsageDistribution(res);
}
},
});
// useFetch('/board/dayEnergy/trend', {
// data: {
// //day: '2025-04-01',
// day: moment().subtract(1, 'days').format('YYYY-MM-DD'),
// },
// cb: (res: any) => {
// if (utilService.isValidObject(res)) {
// state.bottom.option = energyUsageDistribution(res);
// }
// },
// });
changeType(state.dataForm.code); changeType(state.dataForm.code);
fn(); fn();
@ -472,6 +472,23 @@ export default defineComponent({
cursor: move; cursor: move;
//background: url("@/assets/images/njhl/bg.png"); //background: url("@/assets/images/njhl/bg.png");
//transform: translate(-50%, -50%); //transform: translate(-50%, -50%);
/* 初始阴影设置(透明) */
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: inherit;
//opacity: 0;
//transition: opacity 0.4s;
box-shadow: inset 0 0 80px 30px #000b31;
}
&:hover::before {
// opacity: 1;
}
} }
.icon { .icon {

Loading…
Cancel
Save