This commit is contained in:
‘937886381’ 2025-09-11 08:40:41 +08:00
parent 1b6e6702ed
commit 1a0d786774
3 changed files with 55 additions and 11 deletions

BIN
dist.rar

Binary file not shown.

View File

@ -59,6 +59,9 @@ export default {
}, },
beforeDestroy() { beforeDestroy() {
this.closeSSE(); this.closeSSE();
},
destroyed() {
window.removeEventListener('resize', this.boxReset);
}, },
computed: { computed: {
sidebarOpened() { sidebarOpened() {
@ -145,7 +148,9 @@ export default {
return data.trim().startsWith('data:{') && !data.includes('heartbeat'); return data.trim().startsWith('data:{') && !data.includes('heartbeat');
}, },
upDateMsg(data) { upDateMsg(data) {
const jsonStr = data.replace(/^data:/, '').trim(); const jsonStr = data.replace(/^data:/, '').trim();
console.log('jsonStr', jsonStr);
try { try {
const dataObj = JSON.parse(jsonStr); const dataObj = JSON.parse(jsonStr);
this.dataObj = dataObj this.dataObj = dataObj
@ -229,6 +234,6 @@ export default {
background-size: cover; background-size: cover;
background-position: 0 0; background-position: 0 0;
overflow: auto; overflow: auto;
} }
} }
</style> </style>

View File

@ -48,7 +48,7 @@ const tableProps = [
prop: 'reportDate', prop: 'reportDate',
label: '日期', label: '日期',
width: 130, width: 130,
fixed: true fixed: true,
}, },
{ {
prop: 'factoryName', prop: 'factoryName',
@ -289,7 +289,11 @@ export default {
{ {
type: 'select', type: 'select',
label: '维度', label: '维度',
selectOptions: [ selectOptions: [
// {
// id: '0',
// name: '',
// },
{ {
id: 1, id: 1,
name: '日', name: '日',
@ -413,14 +417,18 @@ export default {
}, },
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
this.listQuery.pageNo = 1; this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10; this.listQuery.pageSize = 10;
this.listQuery.factoryId = val.factoryId || undefined; this.listQuery.factoryId = val.factoryId || undefined;
this.listQuery.lineId = val.lineId ? [val.lineId] : []; this.listQuery.lineId = val.lineId ? [val.lineId] : [];
this.listQuery.reportType = val.reportType || undefined; console.log(val.reportType);
this.listQuery.reportType = val.reportType ? Number(val.reportType) :undefined
this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined; this.listQuery.startTime = val.timeVal ? val.timeVal[0] : undefined;
this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined; this.listQuery.endTime = val.timeVal ? val.timeVal[1] : undefined;
console.log(this.listQuery.reportType);
this.getDataList(); this.getDataList();
break; break;
case 'export': case 'export':
@ -433,10 +441,41 @@ export default {
// //
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
const arr = ['日', '周', '月', '年']; const arr = [
{
id: 0,
name: '班',
},
{
id: 1,
name: '日',
},
{
id: 2,
name: '周',
},
{
id: 3,
name: '月',
},
{
id: 4,
name: '年',
},
]
const reportTypeNameMap = arr.reduce((map, item) => {
map[item.id] = item.name;
return map;
}, {});
this.urlOptions.getDataListURL(this.listQuery).then((response) => { this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list.map((item, index) => { this.tableData = response.data.list.map((item, index) => {
item.reportType = arr[item.reportType - 1]; const typeId = item.reportType;
item.reportType = reportTypeNameMap[typeId] || '未知';
// item.reportType = arr[item.reportType - 1];
item.reportDate = item.reportDate;
item.originalLossNum = item.original?.lossNum; item.originalLossNum = item.original?.lossNum;
item.originalLossArea = item.original?.lossArea; item.originalLossArea = item.original?.lossArea;
item.edgeLossNum = item.edge?.lossNum; item.edgeLossNum = item.edge?.lossNum;