714 lines
18 KiB
Vue

<!--
* @Author: SunTao 328867980@qq.com
* @Date: 2024-11-01 13:17:41
* @LastEditors: SunTao 328867980@qq.com
* @LastEditTime: 2024-12-27 14:25:36
* @FilePath: \znxjxt-ui\src\views\xj\inspection\confirmation-management\index.vue
* @Description: 巡检信息-病害确认
-->
<template>
<div class="confirmation-content">
<!-- 搜索表单 -->
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
label-width="100px"
>
<el-form-item label="道路名称" prop="segmentName">
<el-select
v-model="queryParams.segmentName"
placeholder="请选择路段"
clearable
filterable
>
<el-option
v-for="item in segmentList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="采集时间" prop="dateTime">
<el-date-picker
v-model="dateTime"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
clearable
/>
</el-form-item>
<el-form-item label="病害类型" prop="paramsDefectType">
<el-cascader
v-model="paramsDefectType"
:options="tableDefect"
:props="{
checkStrictly: true,
emitPath: true,
children: 'subTypes',
}"
clearable
></el-cascader>
</el-form-item>
<el-form-item label="上下行" prop="inspectDirection">
<el-select
v-model="queryParams.inspectDirection"
placeholder="请选择"
clearable
>
<el-option label="上行" value="0" />
<el-option label="下行" value="1" />
</el-select>
</el-form-item>
<el-form-item label="公里桩" prop="stakeRange">
<el-input
v-model="queryParams.stakeStart"
placeholder="起始公里桩"
style="width: 10rem"
clearable
/>
<span style="margin: 0 5px">-</span>
<el-input
v-model="queryParams.stakeEnd"
placeholder="终止公里桩"
style="width: 10rem"
clearable
/>
<el-tooltip
class="item"
effect="dark"
content="格式为K0000+000"
placement="top"
>
<i class="el-icon-info"></i>
</el-tooltip>
</el-form-item>
<!-- <el-form-item label="预警标识" prop="warningFlag">
<el-select
v-model="queryParams.warningFlag"
placeholder="请选择"
clearable
>
<el-option label="是" :value="1" />
<el-option label="否" :value="0" />
</el-select>
</el-form-item> -->
<el-form-item label="病害长度" prop="lengthRange">
<el-input-number
v-model="queryParams.minLen"
controls-position="right"
placeholder="最小长度"
:min="0"
></el-input-number>
<span style="margin: 0 5px">-</span>
<el-input-number
v-model="queryParams.maxLen"
controls-position="right"
placeholder="最大长度"
:min="0"
></el-input-number>
</el-form-item>
<el-form-item label="病害面积" prop="areaRange">
<el-input-number
v-model="queryParams.minArea"
controls-position="right"
placeholder="最小面积"
:min="0"
></el-input-number>
<span style="margin: 0 5px">-</span>
<el-input-number
v-model="queryParams.maxArea"
controls-position="right"
placeholder="最大面积"
:min="0"
></el-input-number>
</el-form-item>
<el-form-item label="病害id" prop="id">
<el-input
v-model="queryParams.id"
placeholder="请填写病害id"
style="width: 10rem"
clearable
/>
</el-form-item>
<el-form-item label="快照id" prop="snapshotId">
<el-input
v-model="queryParams.snapshotId"
placeholder="请填写快照id"
style="width: 10rem"
clearable
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<!-- 操作按钮 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-check"
size="mini"
:disabled="multiple"
@click="handleConfirm(2)"
>是病害
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-close"
size="mini"
:disabled="multiple"
@click="handleConfirm(3)"
>不是病害
</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-picture-outline"
size="mini"
@click="handleBatch()"
>影像模式
</el-button>
</el-col> -->
</el-row>
<!-- 数据表格 -->
<el-table
ref="defectTable"
v-loading="loading"
:data="confirmationtList"
@selection-change="handleSelectionChange"
@sort-change="filterHandler"
style="width: 100%"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="路段名称" align="center" prop="segmentName" />
<el-table-column label="采集时间" align="center" prop="createdTime">
<template slot-scope="scope">
<span>{{ new Date(scope.row.createdTime).toLocaleString() }}</span>
</template>
</el-table-column>
<el-table-column label="病害类型" align="center" prop="defectTypeName">
</el-table-column>
<el-table-column label="校验状态" align="center" prop="dataStatus">
<template slot-scope="scope">
<span>{{
scope.row.dataStatus
? scope.row.dataStatus === 1
? "未校验"
: "已校验"
: ""
}}</span>
</template>
</el-table-column>
<el-table-column
label="开始桩号"
sortable="custom"
align="center"
prop="stake_start"
>
<template slot-scope="scope">
{{ scope.row.stakeStart }}
</template>
</el-table-column>
<el-table-column
label="结束桩号"
sortable="custom"
align="center"
prop="stake_end"
>
<template slot-scope="scope">
{{ scope.row.stakeEnd }}
</template>
</el-table-column>
<el-table-column label="病害图片" align="center" prop="media">
<template slot-scope="scope">
<img
@click="showScreenImg(scope.row, scope.$index)"
height="50"
:src="scope.row.mediaUrl"
/>
</template>
</el-table-column>
<el-table-column
label="病害长度"
sortable="custom"
align="center"
prop="target_len"
>
<template slot-scope="scope">
{{ scope.row.targetLen * 1 <= 0 ? "" : `${scope.row.targetLen}` }}
</template>
</el-table-column>
<el-table-column
label="病害面积"
sortable="custom"
align="center"
prop="target_area"
>
<template slot-scope="scope">
{{ scope.row.targetArea }}
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<div class="pagination-part">
<el-pagination
background
:current-page.sync="pagination.page"
@current-change="handleCurrentChange"
:page-sizes="[10, 20, 30, 40]"
:page-size.sync="pagination.size"
@size-change="handleSizeChange"
layout="total, sizes, prev, pager, next, jumper"
:total="tableTotal"
>
</el-pagination>
</div>
<!-- 详情图片弹窗 -->
<el-dialog
title="详情"
:visible.sync="showImageDialog"
width="73%"
append-to-body
:close-on-click-modal="false"
destroy-on-close
@close="imgCancel"
>
<img-dialog
v-if="showImageDialog"
:segmentList="segmentList"
:imageItem="imageItem"
:searchForm="searchForm"
></img-dialog>
</el-dialog>
</div>
</template>
<script>
import {
getDefectList,
getSegment,
listDefect,
mergeDefect,
} from "@/api/xj/confirmation";
import imgDialog from "./components/img-dialog.vue";
export default {
components: { imgDialog },
name: "ConfirmationManagement",
data() {
return {
// 搜索表单参数
queryParams: {
segmentName: "",
classType: "",
defectType: "",
state: "",
inspectDirection: "",
stakeStart: "",
stakeEnd: "",
warningFlag: null,
minLen: undefined,
maxLen: undefined,
minArea: undefined,
maxArea: undefined,
id: "",
snapshotId: "",
sortedFld: "",
sorted: "",
},
// 查询接收表单参数
searchForm: {},
// 病害类型绑定
paramsDefectType: [],
// 采集时间绑定
dateTime: [],
// 列表病害状态数据
tableDefect: [],
// 路段下拉选项
segmentList: [],
// 列表数据绑定
confirmationtList: [],
// 非多个禁用
multiple: true,
// 选择框选中数据
checkIds: [],
// 表格数据加载状态
loading: false,
// 分页-页数页码
pagination: {
page: 1,
size: 10,
},
// 分页-列表总数据
tableTotal: 0,
// 查看图片大图弹窗显隐控制
showImageDialog: false,
// 查看大图片路径
currentImageItem: "",
// 图片病害位置信息
rects: [],
};
},
created() {
this.getTableDefect();
this.getSegmentList();
this.getTableList();
this.getTableDefect();
},
methods: {
/**
* @description: 获取列表病害类型对应数据
* @param {*}
* @return {*}
*/
getTableDefect() {
getDefectList().then(({ code, data }) => {
if (code === 200) {
this.tableDefect = data;
}
});
},
/**
* @description: 获取路段下拉数据
* @param {*}
* @return {*}
*/
getSegmentList() {
getSegment().then(({ code, data }) => {
if (code === 200) {
this.segmentList = data;
}
});
},
/**
* @description: 获取列表行数据
* @param {*}
* @return {*}
*/
getTableList() {
this.loading = true;
// 处理日期范围
const params = {
...this.searchForm,
...this.pagination,
startTime: this.dateTime ? this.dateTime[0] : "",
endTime: this.dateTime ? this.dateTime[1] : "",
};
listDefect(params)
.then(({ code, rows, total }) => {
if (code === 200) {
this.confirmationtList = rows;
this.tableTotal = total;
this.loading = false;
}
})
.catch(() => {
this.loading = false;
});
},
/**
* @description: 点击搜索事件
* @param {*}
* @return {*}
*/
handleQuery() {
const phonereg = /^K\d{4}\+\d{3}$/;
if (this.queryParams.stakeStart) {
if (phonereg.test(this.queryParams.stakeStart)) {
this.queryParams.classType = this.paramsDefectType
? this.paramsDefectType[0]
: "";
this.queryParams.defectType = this.paramsDefectType
? this.paramsDefectType.length > 1
? this.paramsDefectType[1]
: ""
: "";
this.pagination.page = 1;
this.searchForm = JSON.parse(JSON.stringify(this.queryParams));
this.getTableList();
} else {
this.$modal.msgWarning("请按照格式填写公里桩进行修改");
}
} else if (this.queryParams.stakeEnd) {
if (phonereg.test(this.queryParams.stakeEnd)) {
this.queryParams.classType = this.paramsDefectType
? this.paramsDefectType[0]
: "";
this.queryParams.defectType = this.paramsDefectType
? this.paramsDefectType.length > 1
? this.paramsDefectType[1]
: ""
: "";
this.pagination.page = 1;
this.searchForm = JSON.parse(JSON.stringify(this.queryParams));
this.getTableList();
} else {
this.$modal.msgWarning("请按照格式填写公里桩进行修改");
}
} else {
this.queryParams.classType = this.paramsDefectType
? this.paramsDefectType[0]
: "";
this.queryParams.defectType = this.paramsDefectType
? this.paramsDefectType.length > 1
? this.paramsDefectType[1]
: ""
: "";
this.pagination.page = 1;
this.searchForm = JSON.parse(JSON.stringify(this.queryParams));
this.getTableList();
}
},
/**
* @description: 点击重置事件
* @param {*}
* @return {*}
*/
resetQuery() {
this.queryParams = {
segmentName: "",
defectType: "",
state: "",
inspectDirection: "",
stakeStart: "",
stakeEnd: "",
warningFlag: null,
minLen: undefined,
maxLen: undefined,
minArea: undefined,
maxArea: undefined,
id: "",
snapshotId: "",
sortedFld: "",
sorted: "",
};
this.paramsDefectType = [];
this.searchForm = {};
this.dateTime = [];
this.getTableList();
this.$refs.defectTable.clearSort();
},
/**
* @description: 列表过滤事件
* @param {*}
* @return {*}
*/
filterHandler(column) {
if (column.order) {
this.queryParams.sortedFld = column.prop;
this.queryParams.sorted = column.order === "ascending" ? "ASC" : "DESC";
this.handleQuery();
} else {
this.queryParams.sortedFld = "";
this.queryParams.sorted = "";
this.handleQuery();
}
},
/**
* @description: 多选框选中数据
* @param {*}
* @return {*}
*/
handleSelectionChange(selection) {
this.checkIds = selection.map((item) => item.id);
this.multiple = !selection.length;
},
/**
* @description: 是病害/不是病害
* @param {*}
* @return {*}
*/
handleConfirm(value) {
mergeDefect({ status: value, snapShotIds: this.checkIds })
.then(({ code, msg }) => {
if (code === 200) {
this.checkIds = [];
this.$modal.msgSuccess("修改成功");
} else {
this.$modal.msgWarning(msg);
}
})
.finally(() => {
this.getTableList();
});
},
/**
* @description: 切换分页
* @param {*}
* @return {*}
*/
handleCurrentChange(arg) {
this.pagination.page = arg;
this.getTableList();
},
/**
* @description: 切换每页条数
* @param {*}
* @return {*}
*/
handleSizeChange(arg) {
this.pagination.size = arg;
this.getTableList();
},
/**
* @description: 打开查看图片弹窗
* @param {*}
* @return {*}
*/
showScreenImg(item, index) {
this.imageItem = {
...item,
index,
pageTip: this.pagination.page,
params: this.pagination,
};
this.showImageDialog = true;
},
/**
* @description: 关闭查看图片弹窗
* @param {*}
* @return {*}
*/
imgCancel() {
this.showImageDialog = false;
this.currentImageItem = {};
this.rects = [];
this.imageItem = {};
this.getTableList();
},
},
};
</script>
<style lang="scss" scoped>
.confirmation-content {
padding: 20px;
}
.mb8 {
margin-bottom: 8px;
}
/* 分页样式 */
.pagination-part {
width: 100%;
display: flex;
padding-top: 1rem;
justify-content: flex-end;
}
/* 查看大图弹窗 */
.image-container {
position: relative;
width: 100%;
height: 80%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
}
.image-container img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
.rect-overlay {
position: absolute;
pointer-events: none;
border: 2px solid red;
}
// 图片信息
.rect-image {
width: 90%;
position: absolute;
top: 0;
font-size: 1.2rem;
color: #ffffff;
background-color: rgba(0, 0, 0, 0.5);
}
/* 修改弹窗样式 */
::v-deep .el-dialog {
background-color: transparent;
margin-top: 1vh !important;
}
::v-deep .el-dialog__header {
padding: 10px;
background-color: #113463;
span,
i {
color: #ffffff;
}
}
::v-deep .el-dialog__body {
padding: 0;
// background-color: #113463;
/* 查看点位大图弹窗 */
.view-image-container {
position: relative;
width: 100%;
height: 50rem;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
overflow: hidden;
}
.view-image-container img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
.rect-overlay {
position: absolute;
// pointer-events: none;
border: 2px solid red;
}
}
</style>