Browse Source

增加巡视报告、报告详情,巡视任务里面跳转报告详情

master
douyage 1 month ago
parent
commit
78c6de04f9
8 changed files with 1267 additions and 27 deletions
  1. +8
    -0
      src/api/inspectionDataManage/inspectionReporter.js
  2. +14
    -3
      src/lang/index.js
  3. +1
    -0
      src/layout/components/Sidebar/Item.vue
  4. +21
    -0
      src/router/index.js
  5. +2
    -1
      src/store/modules/app.js
  6. +486
    -0
      src/views/cards/patrolReport/InspectionReporter.vue
  7. +696
    -0
      src/views/cards/patrolReport/patrolReportDetail.vue
  8. +39
    -23
      src/views/cards/taskSummary/inspectionTask.vue

+ 8
- 0
src/api/inspectionDataManage/inspectionReporter.js View File

@ -19,3 +19,11 @@ export function getPatrolReport(lineId,filter) {
params: {},
});
}
export function getPatrolReportShaoxing(url, lineId, filter) {
return request({
url: `/patrol/insreport/shaoxing/${url}/${lineId}/${filter}`,
method: "get",
params: {},
});
}

+ 14
- 3
src/lang/index.js View File

@ -20,13 +20,24 @@ const messages = {
}
}
const localeAliases = {
en: 'zh_CN',
zh: 'zh_CN',
'en-US': 'en_US',
'zh-CN': 'zh_CN'
}
const savedLocale = localStorage.getItem('language')
const locale = messages[savedLocale]
? savedLocale
: localeAliases[savedLocale] || 'zh_CN'
const i18n = new VueI18n({
// 设置语言 选项 en | zh
// locale: Cookies.get('language') || 'zh_CN',
locale: localStorage.getItem('language') || 'zh_CN',
fallbackLocale: localStorage.getItem('language') || 'zh_CN', // 使用localStorage作为fallbackLocale
locale,
fallbackLocale: 'zh_CN',
// 设置文本内容
messages
})
export default i18n
export default i18n

+ 1
- 0
src/layout/components/Sidebar/Item.vue View File

@ -8,6 +8,7 @@ const navIconMap = {
'巡检任务管理': require('@/assets/images/nav/task.png'),
'巡检任务': require('@/assets/images/nav/task.png'),
'巡视任务': require('@/assets/images/nav/task.png'),
'巡视报告': require('@/assets/images/nav/task.png'),
'设备管理': require('@/assets/images/nav/device.png'),
'点位管理': require('@/assets/images/nav/point.png'),
'点位管理(实施用)': require('@/assets/images/nav/point.png'),


+ 21
- 0
src/router/index.js View File

@ -133,6 +133,27 @@ export const constantRoutes = [
}
}
]
},
{
path: '/patrol-report',
component: Layout,
redirect: '/patrol-report/index',
meta: { title: '巡视报告', icon: 'task' },
children: [
{
path: 'index',
component: () => import('@/views/cards/patrolReport/InspectionReporter'),
name: 'PatrolReport',
meta: { title: '巡视报告', icon: 'task', activeMenu: '/patrol-report' }
},
{
path: 'detail',
component: () => import('@/views/cards/patrolReport/patrolReportDetail'),
name: 'patrolReportDetail',
hidden: true,
meta: { title: '巡视报告详情', activeMenu: '/patrol-report' }
}
]
}
]


+ 2
- 1
src/store/modules/app.js View File

@ -1,5 +1,6 @@
import Cookies from 'js-cookie'
import { getConfigKey, getConfigByKeys } from "@/api/system/config";
const savedLanguage = Cookies.get('language')
const state = {
sidebar: {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
@ -8,7 +9,7 @@ const state = {
},
device: 'desktop',
size: Cookies.get('size') || 'medium',
language: Cookies.get('language') || 'en'
language: savedLanguage === 'en_US' ? 'en_US' : 'zh_CN'
}
const mutations = {


+ 486
- 0
src/views/cards/patrolReport/InspectionReporter.vue View File

@ -0,0 +1,486 @@
<template>
<CardBox
class="card-page"
:showTitle="false"
>
<div class="page-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="90px"
>
<el-form-item label="巡视任务" prop="inspectionTaskName">
<el-input
v-model="queryParams.inspectionTaskName"
placeholder="请输入巡视任务"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核时间">
<el-date-picker
v-model="dateRange"
size="small"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
:picker-options="dateRangePickerOptions"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
:clearable="true"
popper-class="card-date-editor"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button
class="task-toolbar-btn"
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
class="task-toolbar-btn"
type="primary"
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<div class="table-card" ref="tableCardRef">
<el-table
class="card-table"
v-loading="loading"
:data="dataList"
:height="tableHeight"
border
stripe
>
<el-table-column
label="序号"
type="index"
width="50"
align="center"
:index="table_index"
/>
<el-table-column
label="巡视任务"
align="left"
prop="inspectionTaskName"
width="700"
header-align="center"
/>
<el-table-column
label="巡视开始时间"
align="center"
prop="inspectionStartTime"
/>
<el-table-column
label="巡视结束时间"
align="center"
prop="inspectionEndTime"
/>
<el-table-column label="审核人" align="center" prop="checkPerson" />
<el-table-column label="审核时间" align="center" prop="checkTime" />
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click="lookReporter(scope.row)"
>查看</el-button
>
<el-button
size="mini"
type="primary"
@click="ftpImageViewUrl(scope.row, 'xls')"
:disabled="isLock"
>导出</el-button
>
</template>
</el-table-column>
</el-table>
<CardPagination
ref="paginationRef"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</div>
</CardBox>
</template>
<script>
import { listPatrolReport } from "@/api/inspectionDataManage/inspectionReporter";
import CardPagination from "../components/CardPagination/index.vue";
import debounce from "lodash.debounce";
import CardBox from "../components/cardBox.vue";
import { mapState } from "vuex";
export default {
name: "InspectionReporter",
dicts: ["patrol_type", "device_type"],
components: { CardPagination, CardBox },
data() {
return {
isLock: false,
//
loading: true,
//
total: 0,
//
dataList: [],
//
dateRange: [],
dateRangePickerOptions: {
disabledDate(selectDate) {
return new Date().getTime() < selectDate.getTime();
},
},
//
queryParams: {
pageNum: 1,
pageSize: 20,
inspectionTaskName: null,
areaName: null,
areaType: null,
deviceType: null,
type: null,
},
// table
tableHeight: null,
};
},
computed: {
...mapState("app", ["systemParams"]),
},
async created() {
//
this.setTableHeight = debounce(this.setTableHeight, 300);
window.addEventListener("resize", this.setTableHeight);
//
if (!this.systemParams || Object.keys(this.systemParams).length === 0) {
try {
await this.$store.dispatch("app/getSystemParams");
console.log("系统参数加载成功:", this.systemParams);
console.log("FTP地址:", this.systemParams?.ftpViewAddress);
} catch (error) {
console.error("加载系统参数失败:", error);
this.$modal.msgWarning("加载系统配置失败,请刷新页面重试");
}
}
// sessionStorage
const savedState = sessionStorage.getItem("inspectionReporterState");
if (savedState && this.$route.query.from === "back") {
try {
const state = JSON.parse(savedState);
if (state.queryParams) {
this.queryParams = { ...this.queryParams, ...state.queryParams };
}
if (state.dateRange && state.dateRange.length === 2) {
this.dateRange = state.dateRange;
}
// sessionStorage使
sessionStorage.removeItem("inspectionReporterState");
} catch (e) {
console.error("恢复状态失败", e);
}
}
//
await this.getList();
},
mounted() {
this.setTableHeight();
},
destroyed() {
if (this.setTableHeight.cancel) {
this.setTableHeight.cancel();
}
window.removeEventListener("resize", this.setTableHeight);
},
methods: {
table_index(index) {
return (
(this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
);
},
ftpImageViewUrl(row, suffix) {
//
if (!this.systemParams || !this.systemParams.ftpViewAddress) {
this.$modal.msgWarning("系统配置未加载,请稍后重试");
console.error("systemParams为空:", this.systemParams);
return;
}
console.log("使用FTP地址:", this.systemParams.ftpViewAddress);
if (row.filePath) {
var fileName = row.filePath.split(".")[0];
const url = this.systemParams.ftpViewAddress + fileName + "." + suffix;
console.log("导出URL:", url);
const a = document.createElement("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
a.click();
} else {
this.isLock = true;
this.getList(() => {
var it = this.dataList.find((item) => {
return item.lineId == row.lineId;
});
if (it && it.filePath) {
const url = this.systemParams.ftpViewAddress + it.filePath;
console.log("导出URL:", url);
const a = document.createElement("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
a.click();
this.isLock = false;
} else {
this.isLock = true;
this.$modal.msgWarning("巡视报告正在生成,请稍后");
}
});
}
},
setTableHeight() {
if (this.$refs.tableCardRef) {
const pagination = this.$refs.paginationRef;
const paginationHeight =
pagination && pagination.$el ? pagination.$el.offsetHeight : 0;
this.tableHeight = Math.max(
this.$refs.tableCardRef.clientHeight - paginationHeight,
160
);
}
},
/** 获取数据列表 */
getList(callback) {
this.loading = true;
const params = {};
for (const key in this.queryParams) {
if (Object.hasOwnProperty.call(this.queryParams, key)) {
const element = this.queryParams[key];
if (element) {
params[key] = element;
}
}
}
//
if (this.dateRange && this.dateRange.length === 2) {
params.cycleStartTime = this.dateRange[0];
params.cycleEndTime = this.dateRange[1];
}
listPatrolReport(params)
.then((response) => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
this.$nextTick(this.setTableHeight);
if (callback) {
callback();
}
})
.catch((error) => {
this.loading = false;
console.error("获取列表失败:", error);
// this.$modal.msgError("");
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
inspectionTaskName: null,
areaName: null,
areaType: null,
deviceType: null,
type: null,
};
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
//
lookReporter(info) {
// sessionStorage
const currentState = {
queryParams: { ...this.queryParams },
dateRange:
this.dateRange && this.dateRange.length > 0
? [...this.dateRange]
: [],
};
sessionStorage.setItem(
"inspectionReporterState",
JSON.stringify(currentState)
);
sessionStorage.setItem("reportLineId", JSON.stringify(info.lineId));
sessionStorage.setItem("reportType", JSON.stringify(info.filter));
this.$router.push({
name: "patrolReportDetail",
query: {
lineId: info.lineId,
filter: info.filter,
reportType: info.filter,
fromPage: "InspectionReporter",
fromComponent: "InspectionReporter",
},
});
},
//
resetForm(formName) {
if (this.$refs[formName]) {
this.$refs[formName].resetFields();
}
},
},
};
</script>
<style lang="scss" scoped>
.page-container {
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
.card-page {
height: 100%;
min-height: 0;
overflow: hidden;
}
.query-card {
margin-bottom: 15px;
::v-deep .el-form-item {
margin-bottom: 0;
}
}
.table-card {
flex: 1;
height: 0;
min-height: 0;
overflow: hidden;
::v-deep .el-card__body {
height: 100%;
}
}
.card-page ::v-deep .card-table,
.card-page ::v-deep .el-table {
width: 100% !important;
background: transparent !important;
color: #000000;
border-color: rgba(64, 146, 255, 0.95) !important;
}
.card-page ::v-deep .el-table::before,
.card-page ::v-deep .el-table::after,
.card-page ::v-deep .el-table--border::after,
.card-page ::v-deep .el-table--group::after {
background-color: rgba(64, 146, 255, 0.95) !important;
}
.card-page ::v-deep .el-table__header-wrapper,
.card-page ::v-deep .el-table__fixed-header-wrapper,
.card-page ::v-deep .el-table__body-wrapper,
.card-page ::v-deep .el-table__fixed,
.card-page ::v-deep .el-table__fixed-right,
.card-page ::v-deep .el-table__empty-block {
background: transparent !important;
background-color: transparent !important;
}
.card-page ::v-deep .el-table th.el-table__cell {
background: #06347f !important;
border-color: rgba(64, 146, 255, 0.95) !important;
}
.card-page ::v-deep .el-table th.el-table__cell .cell {
color: #ffffff !important;
}
.card-page ::v-deep .el-table td.el-table__cell {
background: transparent !important;
border-color: #c7d7f4 !important;
color: #000000 !important;
}
.card-page ::v-deep .el-table td.el-table__cell .cell {
color: #000000 !important;
font-weight: 500;
}
.card-page ::v-deep .el-table__row {
background: #e4edfc !important;
}
.card-page ::v-deep .el-table__row--striped td.el-table__cell {
background: #d7e4f8 !important;
}
.card-page ::v-deep .el-table__body tr:hover > td.el-table__cell {
background: #c5d9f6 !important;
}
.card-page ::v-deep .el-table__body-wrapper {
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: none;
-ms-overflow-style: none;
}
.card-page ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
width: 0;
height: 0;
display: none;
}
.task-toolbar-btn,
.card-page ::v-deep .el-table .el-button--primary {
border: 1px solid transparent !important;
background:
linear-gradient(#01016b, #01016b) padding-box,
linear-gradient(135deg, #3988ff, #0351c6) border-box !important;
color: #43c0ff !important;
}
.task-toolbar-btn:hover,
.task-toolbar-btn:focus,
.card-page ::v-deep .el-table .el-button--primary:hover,
.card-page ::v-deep .el-table .el-button--primary:focus {
border-color: transparent !important;
color: #43c0ff !important;
opacity: 0.9;
}
</style>

+ 696
- 0
src/views/cards/patrolReport/patrolReportDetail.vue View File

@ -0,0 +1,696 @@
<template>
<CardBox
class="card-page report-bg"
:showTitle="false"
>
<div class="report-toolbar">
<el-button
class="report-back-btn"
type="primary"
icon="el-icon-back"
size="mini"
@click="backPage"
>返回</el-button>
</div>
<el-table
class="report-table"
border
:data="pointInfo.headerInfoList"
:show-header="false"
:span-method="headerSpan"
>
<el-table-column prop="title1" label="">
<template slot-scope="scope">
<span class="header-title">{{ scope.row.title1 }}</span>
</template>
</el-table-column>
<el-table-column prop="info1" label=""> </el-table-column>
<el-table-column prop="title2" label="">
<template slot-scope="scope">
<span class="header-title">{{ scope.row.title2 }}</span>
</template>
</el-table-column>
<el-table-column prop="info2" label=""> </el-table-column>
</el-table>
<!-- 缺陷点位汇总 - 按任务分组 -->
<div
style="margin-top: 10px"
v-if="
pointInfo.errorPointsByTask &&
Object.keys(pointInfo.errorPointsByTask).length > 0
"
>
<div class="point-info-title">缺陷结果数量汇总</div>
<div
v-for="(taskPoints, taskName) in pointInfo.errorPointsByTask"
:key="'error_' + taskName"
class="task-group"
>
<div
class="task-group-title"
v-if="shouldShowTaskName(taskName, 'error')"
>
任务名称{{ taskName }}
</div>
<el-table class="report-table" border stripe :data="getPaginatedData('error', taskName)">
<el-table-column
prop="code"
label="编号"
align="center"
width="80"
></el-table-column>
<el-table-column
prop="area"
label="区域"
align="center"
></el-table-column>
<el-table-column
prop="pointName"
label="点位"
align="center"
></el-table-column>
<el-table-column
prop="inspectionResults"
label="巡视结果"
align="center"
></el-table-column>
<el-table-column prop="inspectionImg" label="巡视图像" align="center">
<template slot-scope="scope">
<div class="inspection-img-wrap">
<!-- 直接使用原来的 inspectionImg AsyncImage 自己处理 -->
<AsyncImage
class="inspection-img"
fit="contain"
:src="scope.row.inspectionImg"
@click="lookImageDetail(scope.row.inspectionImg)"
></AsyncImage>
</div>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<div
class="pagination-wrap"
v-if="getTotalCount('error', taskName) > pageSize"
>
<el-pagination
background
small
layout="total, prev, pager, next"
:total="getTotalCount('error', taskName)"
:page-size="pageSize"
:current-page.sync="currentPageMap[`error_${taskName}`]"
@current-change="() => $forceUpdate()"
>
</el-pagination>
</div>
</div>
</div>
<!-- 正常点位汇总 - 按任务分组 -->
<div
style="margin-top: 10px"
v-if="
pointInfo.normalPointsByTask &&
Object.keys(pointInfo.normalPointsByTask).length > 0
"
>
<div class="point-info-title">正常结果数量汇总</div>
<div
v-for="(taskPoints, taskName) in pointInfo.normalPointsByTask"
:key="'normal_' + taskName"
class="task-group"
>
<div
class="task-group-title"
v-if="shouldShowTaskName(taskName, 'normal')"
>
任务名称{{ taskName }}
</div>
<el-table class="report-table" border stripe :data="getPaginatedData('normal', taskName)">
<el-table-column
prop="code"
label="编号"
align="center"
width="80"
></el-table-column>
<el-table-column
prop="area"
label="区域"
align="center"
></el-table-column>
<el-table-column
prop="pointName"
label="点位"
align="center"
></el-table-column>
<el-table-column
prop="inspectionResults"
label="巡视结果"
align="center"
></el-table-column>
<el-table-column prop="inspectionImg" label="巡视图像" align="center">
<template slot-scope="scope">
<div class="inspection-img-wrap">
<!-- 直接使用原来的 inspectionImg AsyncImage 自己处理 -->
<AsyncImage
class="inspection-img"
fit="contain"
:src="scope.row.inspectionImg"
@click="lookImageDetail(scope.row.inspectionImg)"
></AsyncImage>
</div>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<div
class="pagination-wrap"
v-if="getTotalCount('normal', taskName) > pageSize"
>
<el-pagination
background
small
layout="total, prev, pager, next"
:total="getTotalCount('normal', taskName)"
:page-size="pageSize"
:current-page.sync="currentPageMap[`normal_${taskName}`]"
@current-change="() => $forceUpdate()"
>
</el-pagination>
</div>
</div>
</div>
<el-dialog
title="图片预览"
:visible.sync="showPreviewImages"
:close-on-click-modal="false"
:close-on-press-escape="false"
:destroy-on-close="true"
custom-class="card-dialog card-page"
width="70%"
append-to-body
>
<ImagePreview
v-if="showPreviewImages"
:imageUrls="showImgesUrls"
:selectImgPosition="previewImagePos"
:showTemperatureTool="false"
/>
</el-dialog>
</CardBox>
</template>
<script>
import ImagePreview from "@/views/cards/components/ImagePreview/index.vue";
import AsyncImage from "@/components/AsyncImage/index.vue";
import { getPatrolReportShaoxing } from "@/api/inspectionDataManage/inspectionReporter";
import CardBox from "../components/cardBox.vue";
export default {
name: "PatrolReportDetail",
components: { AsyncImage, ImagePreview, CardBox },
data() {
return {
lineId: null,
reportType: 0,
showPreviewImages: false,
showImgesUrls: [],
previewImagePos: 0,
reportInfo: {},
pointInfo: {},
code: "",
returnState: {},
urlFrom: "",
//
pageSize: 20,
currentPageMap: {},
//
originalDataCache: {
error: {},
normal: {},
},
};
},
created() {
this.lineId = this.$route.query.lineId;
this.urlFrom =
this.$route.query.fromComponent || this.$route.query.fromPage;
this.reportType =
this.$route.query.reportType ?? this.$route.query.filter;
if (!this.lineId) {
this.lineId = JSON.parse(sessionStorage.getItem("reportLineId"));
}
if (
this.reportType === undefined ||
this.reportType === null ||
this.reportType === ""
) {
const savedReportType = sessionStorage.getItem("reportType");
this.reportType = savedReportType ? JSON.parse(savedReportType) : 0;
}
this.getDetail();
if (
this.urlFrom === "InspectionTask" ||
this.urlFrom === "inspectionTask"
) {
const savedState = sessionStorage.getItem("inspectionTaskState");
if (savedState) {
console.log("已保存巡检任务页面状态,返回时会自动恢复");
}
}
},
methods: {
getDetail() {
if (!this.lineId) {
return;
}
let url = "";
if (this.urlFrom == "InspectionTask") {
url = `taskStatus`;
} else {
url = `report`;
}
getPatrolReportShaoxing(url, this.lineId, this.reportType || 0).then((res) => {
// Some deployments return detail as a JSON string; normalize it before grouping.
const report = res && res.data ? res.data : res;
if (report && typeof report.detail === "string") {
try {
report.detail = JSON.parse(report.detail);
} catch (error) {
console.warn("巡视报告详情解析失败", error);
}
}
this.reportInfo = report || {};
this.pointInfo = this.getPointInfo();
this.code = res.code;
//
this.initPagination();
}).catch((error) => {
this.reportInfo = {};
this.pointInfo = {};
console.error("获取巡视报告详情失败", error);
this.$modal && this.$modal.msgError("巡视报告详情加载失败");
});
},
getPointInfo() {
const headerInfoList = [
{
title1: "换流站",
info1: this.reportInfo.stationName,
title2: "",
info2: "",
},
{
title1: "审核人",
info1: this.reportInfo.checkPerson,
title2: "审核时间",
info2: this.reportInfo.checkTime,
},
{
title1: "巡视开始时间",
info1: this.reportInfo.inspectionStartTime,
title2: "巡视结束时间",
info2: this.reportInfo.inspectionEndTime,
},
{
title1: "巡视任务",
info1: this.reportInfo.inspectionTaskName,
title2: "巡视统计",
info2: this.reportInfo.patrolStatistics,
},
{
title1: "巡视结论",
info1: this.reportInfo.description,
title2: "",
info2: "",
},
];
const errorPointsByTask = {};
const normalPointsByTask = {};
if (this.reportInfo.detail) {
//
if (this.reportInfo.detail.缺陷) {
this.reportInfo.detail.缺陷.forEach((taskGroup) => {
Object.keys(taskGroup).forEach((taskName) => {
const points = taskGroup[taskName];
if (points && points.length > 0) {
if (!errorPointsByTask[taskName]) {
errorPointsByTask[taskName] = [];
}
points.forEach((point) => {
if (point.inspectionImg) {
point.inspectionImgList = [point.inspectionImg];
} else {
point.inspectionImgList = [];
}
errorPointsByTask[taskName].push(point);
});
}
});
});
}
//
if (this.reportInfo.detail.正常) {
this.reportInfo.detail.正常.forEach((taskGroup) => {
Object.keys(taskGroup).forEach((taskName) => {
const points = taskGroup[taskName];
if (points && points.length > 0) {
if (!normalPointsByTask[taskName]) {
normalPointsByTask[taskName] = [];
}
points.forEach((point) => {
if (point.inspectionImg) {
point.inspectionImgList = point.inspectionImg.split(",");
} else {
point.inspectionImgList = [];
}
normalPointsByTask[taskName].push(point);
});
}
});
});
}
} else {
//
const errorPointsList = [];
const normalPointsList = [];
if (this.reportInfo.info) {
this.reportInfo.info.forEach((element) => {
element.inspectionImgList = [];
if (element.inspectionImg) {
element.inspectionImgList = element.inspectionImg.split(",");
}
if (element.pointStatus == "正常") {
normalPointsList.push(element);
} else if (element.pointStatus == "缺陷") {
errorPointsList.push(element);
}
});
}
const groupByTask = (list) => {
const grouped = {};
list.forEach((item) => {
const taskName = item.taskName || "未分类任务";
if (!grouped[taskName]) {
grouped[taskName] = [];
}
grouped[taskName].push(item);
});
return grouped;
};
Object.assign(errorPointsByTask, groupByTask(errorPointsList));
Object.assign(normalPointsByTask, groupByTask(normalPointsList));
}
//
Object.keys(errorPointsByTask).forEach((taskName) => {
this.originalDataCache.error[taskName] = [
...errorPointsByTask[taskName],
];
});
Object.keys(normalPointsByTask).forEach((taskName) => {
this.originalDataCache.normal[taskName] = [
...normalPointsByTask[taskName],
];
});
return {
headerInfoList,
errorPointsByTask,
normalPointsByTask,
errorPointsList: Object.values(errorPointsByTask).flat(),
normalPointsList: Object.values(normalPointsByTask).flat(),
};
},
initPagination() {
const errorTasks = Object.keys(this.pointInfo.errorPointsByTask || {});
const normalTasks = Object.keys(this.pointInfo.normalPointsByTask || {});
[...errorTasks, ...normalTasks].forEach((task) => {
const type = errorTasks.includes(task) ? "error" : "normal";
const key = `${type}_${task}`;
if (!this.currentPageMap[key]) {
this.currentPageMap[key] = 1;
}
});
},
getTotalCount(type, taskName) {
return this.originalDataCache[type][taskName]?.length || 0;
},
getPaginatedData(type, taskName) {
const key = `${type}_${taskName}`;
const currentPage = this.currentPageMap[key] || 1;
const allData = this.originalDataCache[type][taskName] || [];
const start = (currentPage - 1) * this.pageSize;
const end = start + this.pageSize;
return allData.slice(start, end);
},
shouldShowTaskName(taskName, type) {
let taskCount = 0;
if (type === "error") {
taskCount = Object.keys(this.pointInfo.errorPointsByTask || {}).length;
} else if (type === "normal") {
taskCount = Object.keys(this.pointInfo.normalPointsByTask || {}).length;
}
if (taskCount === 1 && taskName === this.reportInfo.inspectionTaskName) {
return false;
}
return true;
},
handleClose(done) {
this.$emit("update:visible", false);
},
headerSpan({ row, column, rowIndex, columnIndex }) {
if (rowIndex === 0) {
if (columnIndex === 1) {
return [1, 3];
}
}
},
lookImageDetail(imgUrl) {
this.previewImagePos = 0;
this.showImgesUrls = [imgUrl];
this.showPreviewImages = true;
},
backPage() {
const fromComponent =
this.$route.query.fromComponent || this.urlFrom || "inspectionTask";
let targetRoute = {};
if (fromComponent === "InspectionReporter") {
targetRoute = {
name: "PatrolReport",
};
} else {
targetRoute = {
name: "InspectionTaskSummary",
};
}
this.$router.replace({
...targetRoute,
query: { from: "back" },
});
sessionStorage.removeItem("reportLineId");
sessionStorage.removeItem("reportType");
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .content {
overflow: scroll;
}
::v-deep .el-table__body-wrapper {
max-height: 450px;
overflow-y: scroll;
}
.report-bg {
height: 100%;
overflow: hidden;
}
.report-toolbar {
display: flex;
justify-content: flex-start;
margin-bottom: 12px;
}
.report-back-btn {
border: 1px solid transparent !important;
background:
linear-gradient(#01016b, #01016b) padding-box,
linear-gradient(135deg, #3988ff, #0351c6) border-box !important;
color: #43c0ff !important;
}
.header-title {
font-weight: bold;
}
.point-info-title {
font-size: 20px;
text-align: center;
padding: 10px;
}
.task-group {
margin-top: 20px;
&:first-of-type {
margin-top: 0;
}
.task-group-title {
font-size: 14px;
padding: 8px 0;
margin-bottom: 10px;
}
}
.inspection-img-wrap {
display: flex;
flex-direction: column;
align-items: center;
.inspection-img {
width: 60px;
height: 60px;
cursor: pointer;
}
.inspection-btn {
cursor: pointer;
display: block;
padding-bottom: 20px;
}
}
.pagination-wrap {
margin-top: 15px;
display: flex;
justify-content: flex-end;
}
// -
::v-deep .el-pagination {
.btn-prev,
.btn-next,
.el-pager li {
background-color: transparent;
color: #ffffff;
font-weight: normal;
&:not(.disabled):hover {
color: #40e5f0;
}
}
.el-pager li.active {
color: #40e5f0;
background-color: transparent;
cursor: default;
&:hover {
color: #40e5f0;
}
}
.el-pager li.disabled,
.btn-prev.disabled,
.btn-next.disabled {
color: #7f8c9a;
}
}
::v-deep .el-table {
width: 100% !important;
background: #edf4ff !important;
color: #17345f;
border-color: #6f9ed8 !important;
}
::v-deep .el-table::before,
::v-deep .el-table::after,
::v-deep .el-table--border::after,
::v-deep .el-table--group::after {
background-color: #6f9ed8 !important;
}
::v-deep .el-table__header-wrapper,
::v-deep .el-table__body-wrapper,
::v-deep .el-table__empty-block {
background: transparent !important;
background-color: transparent !important;
}
::v-deep .el-table th.el-table__cell {
background: #0b3d89 !important;
border-color: #6f9ed8 !important;
}
::v-deep .el-table th.el-table__cell .cell {
color: #ffffff !important;
}
::v-deep .el-table td.el-table__cell {
background: #edf4ff !important;
border-color: #a9c4e8 !important;
color: #17345f !important;
}
::v-deep .el-table td.el-table__cell .cell {
color: #17345f !important;
}
.card-page.report-bg ::v-deep .el-table__body .el-table__row,
.card-page.report-bg ::v-deep .el-table__body .el-table__row td.el-table__cell {
background: #edf4ff !important;
}
.card-page.report-bg ::v-deep .el-table__body .el-table__row--striped,
.card-page.report-bg ::v-deep .el-table__body .el-table__row--striped td.el-table__cell {
background: #dce9fa !important;
}
.card-page.report-bg ::v-deep .el-table__body tr:hover > td.el-table__cell {
background: #c8dcf5 !important;
}
::v-deep .el-table__body-wrapper,
::v-deep .content {
scrollbar-width: none;
-ms-overflow-style: none;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar,
::v-deep .content::-webkit-scrollbar {
width: 0;
height: 0;
display: none;
}
</style>

+ 39
- 23
src/views/cards/taskSummary/inspectionTask.vue View File

@ -468,7 +468,7 @@ import {
reportExport,
} from "@/api/inspectionDataManage/inspectionArchive";
export default {
name: "inspectionTask",
name: "InspectionTaskSummary",
components: {
CardPagination,
CardBox,
@ -490,6 +490,8 @@ export default {
dataList: [],
//
selectedRows: [],
//
pendingSelectedIds: [],
// table
tableHeight: null,
pickerOptions: {
@ -621,6 +623,7 @@ export default {
} else {
this.dateRange = [today, today];
}
this.pendingSelectedIds = state.selectedRows || [];
// sessionStorage使
sessionStorage.removeItem("inspectionTaskState");
} catch (e) {
@ -662,6 +665,19 @@ export default {
this.getAreaList();
}, 1000);
},
activated() {
sessionStorage.removeItem("inspectionTaskState");
if (!this.timer) {
this.timer = setInterval(this.getList, 10000);
}
this.$nextTick(this.setTableHeight);
},
deactivated() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
destroyed() {
this.setTableHeight.cancel();
window.removeEventListener("resize", this.setTableHeight);
@ -687,7 +703,9 @@ export default {
},
getList(showLoading = false) {
// ID
const selectedIds = this.selectedRows.map((row) => row.taskPatrolledId);
const selectedIds = this.pendingSelectedIds.length
? [...this.pendingSelectedIds]
: this.selectedRows.map((row) => row.taskPatrolledId);
const params = { ...this.queryParams };
if (this.dateRange && this.dateRange.length > 1) {
@ -713,6 +731,7 @@ export default {
}
});
}
this.pendingSelectedIds = [];
});
})
.catch(() => {
@ -857,12 +876,15 @@ export default {
if (process.env.VUE_APP_DIALOG == "true") {
this.$router.push(
{
path: "/card/patrolReportDetail",
name: "patrolReportDetail",
query: {
lineId: row.lineId,
filter: 0,
reportType: 0,
htmlType: "inspectionTask",
fromPage: "inspectionTask",
fromComponent: "InspectionTask",
},
query: { htmlType: "inspectionTask" }, // htmlType
}
// `/card/patrolReportDetail?lineId=${row.lineId}&filter=${0}`
);
@ -885,9 +907,10 @@ export default {
// lineId null undefined
const lineId = row.lineId;
const reportType = 0;
sessionStorage.setItem("reportLineId", JSON.stringify(lineId));
sessionStorage.setItem("reportType", 0);
sessionStorage.setItem("reportType", reportType);
//
const currentState = {
@ -903,24 +926,17 @@ export default {
JSON.stringify(currentState)
);
//
if (process.env.VUE_APP_DIALOG == "true") {
this.$router.push({
name: "patrolReportDetail",
query: {
lineId: lineId,
filter: 0,
fromPage: "inspectionTask",
fromComponent: "InspectionTask",
},
});
} else {
openDialog({
sourceCardId: "shaoxing@videoMonitor-card-80",
targetCardId: "shaoxing@videoMonitor-card-38",
dialogTitle: "初筛报告详情",
});
}
this.$router.push({
name: "patrolReportDetail",
query: {
lineId,
filter: reportType,
reportType,
htmlType: "inspectionTask",
fromPage: "inspectionTask",
fromComponent: "InspectionTask",
},
});
},
gotoTask(command, lineId, row) {
this.$confirm("确认操作吗?", {


Loading…
Cancel
Save