Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e8af0b7a04
@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="https://api.tianditu.gov.cn/api?v=4.0&tk=c691040443c68cda625755c5c3e2acc3" type="text/javascript"></script>
|
<script src="https://api.tianditu.gov.cn/api?v=4.0&tk=1eb44fae5b9dc454442b322e9a41d233" type="text/javascript"></script>
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
|||||||
@ -1,44 +1,44 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询病害列表
|
// 查询病害日志列表
|
||||||
export function listDefect(query) {
|
export function listDefect(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/defect/list',
|
url: '/xj/defect/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询病害详细
|
// 查询病害日志详细
|
||||||
export function getDefect(id) {
|
export function getDefect(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/defect/' + id,
|
url: '/xj/defect/' + id,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增病害
|
// 新增病害日志
|
||||||
export function addDefect(data) {
|
export function addDefect(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/defect',
|
url: '/xj/defect',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改病害
|
// 修改病害日志
|
||||||
export function updateDefect(data) {
|
export function updateDefect(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/defect',
|
url: '/xj/defect',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除病害
|
// 删除病害日志
|
||||||
export function delDefect(id) {
|
export function delDefect(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/defect/' + id,
|
url: '/xj/defect/' + id,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
16
src/api/xj/metadata.js
Normal file
16
src/api/xj/metadata.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
// 查询病害日志列表
|
||||||
|
export function listMetadata(query) {
|
||||||
|
return request({
|
||||||
|
url: '/metadata/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function refreshCache () {
|
||||||
|
return request({
|
||||||
|
url: '/metadata/',
|
||||||
|
method: 'delete',
|
||||||
|
})
|
||||||
|
}
|
||||||
44
src/api/xj/route.js
Normal file
44
src/api/xj/route.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询道路线列表
|
||||||
|
export function listRoute(query) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/route/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询道路线详细
|
||||||
|
export function getRoute(id) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/route/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增道路线
|
||||||
|
export function addRoute(data) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/route',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改道路线
|
||||||
|
export function updateRoute(data) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/route',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除道路线
|
||||||
|
export function delRoute(id) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/route/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
44
src/api/xj/segment.js
Normal file
44
src/api/xj/segment.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询道路线列表
|
||||||
|
export function listSegment(query) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/segment/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询道路线详细
|
||||||
|
export function getSegment(id) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/segment/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增道路线
|
||||||
|
export function addSegment(data) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/segment',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改道路线
|
||||||
|
export function updateSegment(data) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/segment',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除道路线
|
||||||
|
export function delSegment(id) {
|
||||||
|
return request({
|
||||||
|
url: '/xj/segment/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
BIN
src/assets/xc.png
Normal file
BIN
src/assets/xc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 KiB |
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="mapContainer" style="width: 100%; height: 100%;"></div>
|
<div id="mapContainer" style="width: 100%; height: 100%;background-color:rgba(0,211,0,0.6)"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -11,15 +11,23 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initializeMap() {
|
initializeMap() {
|
||||||
|
|
||||||
// 创建地图对象
|
// 创建地图对象
|
||||||
const map = new T.Map('mapContainer');
|
const map = new T.Map('mapContainer');
|
||||||
|
|
||||||
// 设置地图中心点和缩放级别
|
// 设置地图中心点和缩放级别
|
||||||
map.centerAndZoom(new T.LngLat(116.404, 39.915), 12);
|
map.centerAndZoom(new T.LngLat(116.404, 39.915), 12);
|
||||||
|
map.setStyle("indigo")
|
||||||
// 添加图层(例如:底图层)
|
// 添加图层(例如:底图层)
|
||||||
// map.addLayer(new T.TileLayer());
|
// map.addLayer(new T.TileLayer());
|
||||||
|
|
||||||
|
const options = new T.Control.OverviewMapOptions();
|
||||||
|
options.anchor = "T_ANCHOR_TOP_RIGHT";
|
||||||
|
options.size = new T.Point(100, 100)
|
||||||
|
options.isOpen = true;
|
||||||
|
|
||||||
|
let a = T.Control.OverviewMap(options)
|
||||||
|
map.addControl(a);
|
||||||
let points = [];
|
let points = [];
|
||||||
points.push(new T.LngLat(116.41136, 39.97569));
|
points.push(new T.LngLat(116.41136, 39.97569));
|
||||||
points.push(new T.LngLat(116.411794, 39.9068));
|
points.push(new T.LngLat(116.411794, 39.9068));
|
||||||
@ -28,18 +36,17 @@ export default {
|
|||||||
var line = new T.Polyline(points);
|
var line = new T.Polyline(points);
|
||||||
line.addEventListener('mouseover', this.handleMouseOver);
|
line.addEventListener('mouseover', this.handleMouseOver);
|
||||||
line.addEventListener('mouseout', this.handleMouseOut);
|
line.addEventListener('mouseout', this.handleMouseOut);
|
||||||
|
|
||||||
//向地图上添加线
|
//向地图上添加线
|
||||||
map.addOverLay(line);
|
map.addOverLay(line);
|
||||||
|
|
||||||
},
|
},
|
||||||
handleMouseOver(event) {
|
handleMouseOver(event) {
|
||||||
const polyline = event.target;
|
const polyline = event.target;
|
||||||
polyline.setColor("red") ; // 鼠标悬停时颜色变为绿色
|
polyline.setColor("red"); // 鼠标悬停时颜色变为绿色
|
||||||
},
|
},
|
||||||
handleMouseOut(event) {
|
handleMouseOut(event) {
|
||||||
const polyline = event.target;
|
const polyline = event.target;
|
||||||
polyline.setColor("green") ; // 鼠标悬停时颜色变为绿色
|
polyline.setColor("green"); // 鼠标悬停时颜色变为绿色
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -46,6 +46,11 @@ export const constantRoutes = [
|
|||||||
component: () => import('@/views/login'),
|
component: () => import('@/views/login'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/bigscreen',
|
||||||
|
component: () => import('@/views/bigscreen'),
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/register',
|
path: '/register',
|
||||||
component: () => import('@/views/register'),
|
component: () => import('@/views/register'),
|
||||||
|
|||||||
@ -1,595 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="app-container">
|
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="病害类型" prop="defectType">
|
|
||||||
<el-select v-model="queryParams.defectType" placeholder="请选择病害类型(0,1,2,1000等)" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="路产类型" prop="equipmentType">
|
|
||||||
<el-select v-model="queryParams.equipmentType" placeholder="请选择路产类型" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害状态" prop="bhStatus">
|
|
||||||
<el-select v-model="queryParams.bhStatus" placeholder="请选择病害状态" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="开始桩号" prop="stakeStart">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.stakeStart"
|
|
||||||
placeholder="请输入开始桩号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="结束桩号" prop="stakeEnd">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.stakeEnd"
|
|
||||||
placeholder="请输入结束桩号"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害位置" prop="geometry">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.geometry"
|
|
||||||
placeholder="请输入病害位置"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害面积" prop="targetArea">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.targetArea"
|
|
||||||
placeholder="请输入病害面积"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害长度" prop="targetLen">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.targetLen"
|
|
||||||
placeholder="请输入病害长度"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害快照id" prop="snapshotId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.snapshotId"
|
|
||||||
placeholder="请输入病害快照id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="任务id" prop="taskId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.taskId"
|
|
||||||
placeholder="请输入任务id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="路段id" prop="segmentId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.segmentId"
|
|
||||||
placeholder="请输入路段id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="路段名称" prop="segmentName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.segmentName"
|
|
||||||
placeholder="请输入路段名称"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="上下行信息" prop="inspectDirection">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.inspectDirection"
|
|
||||||
placeholder="请输入上下行信息"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数据来源" prop="datafrom">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.datafrom"
|
|
||||||
placeholder="请输入数据来源,离线上传:offline,实时上传:Inspect"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否报警" prop="warningflag">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.warningflag"
|
|
||||||
placeholder="请输入是否报警"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="图片资源" prop="media">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.media"
|
|
||||||
placeholder="请输入图片资源"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="关联路产实体id" prop="equipmentId">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.equipmentId"
|
|
||||||
placeholder="请输入关联路产实体id"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="相比上次的变化状态" prop="transformation">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.transformation"
|
|
||||||
placeholder="请输入相比上次的变化状态"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数据状态" prop="dataStatus">
|
|
||||||
<el-select v-model="queryParams.dataStatus" placeholder="请选择数据状态" clearable>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害与车顶天线距离" prop="objDistance">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.objDistance"
|
|
||||||
placeholder="请输入病害与车顶天线距离"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="公里桩是否校准" prop="calibrated">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.calibrated"
|
|
||||||
placeholder="请输入公里桩是否校准0:未校准,1:已校准"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</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="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['api:defect:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['api:defect:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['api:defect:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['api:defect:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="defectList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
|
||||||
<el-table-column label="病害唯一id" align="center" prop="id" />
|
|
||||||
<el-table-column label="病害类型(0,1,2,1000等)" align="center" prop="defectType">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.bh_type" :value="scope.row.defectType"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="路产类型" align="center" prop="equipmentType">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.bh_type" :value="scope.row.equipmentType"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="病害状态" align="center" prop="bhStatus">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.bh_type" :value="scope.row.bhStatus"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="开始桩号" align="center" prop="stakeStart" />
|
|
||||||
<el-table-column label="结束桩号" align="center" prop="stakeEnd" />
|
|
||||||
<el-table-column label="病害位置" align="center" prop="geometry" />
|
|
||||||
<el-table-column label="病害面积" align="center" prop="targetArea" />
|
|
||||||
<el-table-column label="病害长度" align="center" prop="targetLen" />
|
|
||||||
<el-table-column label="病害快照id" align="center" prop="snapshotId" />
|
|
||||||
<el-table-column label="任务id" align="center" prop="taskId" />
|
|
||||||
<el-table-column label="路段id" align="center" prop="segmentId" />
|
|
||||||
<el-table-column label="路段名称" align="center" prop="segmentName" />
|
|
||||||
<el-table-column label="上下行信息" align="center" prop="inspectDirection" />
|
|
||||||
<el-table-column label="数据来源,离线上传:offline,实时上传:Inspect" align="center" prop="datafrom" />
|
|
||||||
<el-table-column label="是否报警" align="center" prop="warningflag" />
|
|
||||||
<el-table-column label="病害图片" width="150">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-popover
|
|
||||||
placement="top-start"
|
|
||||||
trigger="hover">
|
|
||||||
<img :src="scope.row.diseaseImage" />
|
|
||||||
|
|
||||||
<img :src="scope.row.diseaseImage" height="40px" slot="reference" />
|
|
||||||
</el-popover>
|
|
||||||
</template>
|
|
||||||
</el-table-column> <el-table-column label="关联路产实体id" align="center" prop="equipmentId" />
|
|
||||||
<el-table-column label="相比上次的变化状态" align="center" prop="transformation" />
|
|
||||||
<el-table-column label="数据状态" align="center" prop="dataStatus">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.bh_type" :value="scope.row.dataStatus"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="病害与车顶天线距离" align="center" prop="objDistance" />
|
|
||||||
<el-table-column label="公里桩是否校准0:未校准,1:已校准" align="center" prop="calibrated" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-edit"
|
|
||||||
@click="handleUpdate(scope.row)"
|
|
||||||
v-hasPermi="['api:defect:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
<el-button
|
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['api:defect:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination
|
|
||||||
v-show="total>0"
|
|
||||||
:total="total"
|
|
||||||
:page.sync="queryParams.pageNum"
|
|
||||||
:limit.sync="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 添加或修改病害对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="病害类型" prop="defectType">
|
|
||||||
<el-select v-model="form.defectType" placeholder="请选择病害类型(0,1,2,1000等)">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="路产类型" prop="equipmentType">
|
|
||||||
<el-select v-model="form.equipmentType" placeholder="请选择路产类型">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害状态" prop="bhStatus">
|
|
||||||
<el-select v-model="form.bhStatus" placeholder="请选择病害状态">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="开始桩号" prop="stakeStart">
|
|
||||||
<el-input v-model="form.stakeStart" placeholder="请输入开始桩号" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="结束桩号" prop="stakeEnd">
|
|
||||||
<el-input v-model="form.stakeEnd" placeholder="请输入结束桩号" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害位置" prop="geometry">
|
|
||||||
<el-input v-model="form.geometry" placeholder="请输入病害位置" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害面积" prop="targetArea">
|
|
||||||
<el-input v-model="form.targetArea" placeholder="请输入病害面积" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害长度" prop="targetLen">
|
|
||||||
<el-input v-model="form.targetLen" placeholder="请输入病害长度" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="路段名称" prop="segmentName">
|
|
||||||
<el-input v-model="form.segmentName" placeholder="请输入路段名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="上下行信息" prop="inspectDirection">
|
|
||||||
<el-input v-model="form.inspectDirection" placeholder="请输入上下行信息" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数据来源" prop="datafrom">
|
|
||||||
<el-input v-model="form.datafrom" placeholder="请输入数据来源,离线上传:offline,实时上传:Inspect" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="是否报警" prop="warningflag">
|
|
||||||
<el-input v-model="form.warningflag" placeholder="请输入是否报警" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="图片资源" prop="media">
|
|
||||||
<el-input v-model="form.media" placeholder="请输入图片资源" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="关联路产实体id" prop="equipmentId">
|
|
||||||
<el-input v-model="form.equipmentId" placeholder="请输入关联路产实体id" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="相比上次的变化状态" prop="transformation">
|
|
||||||
<el-input v-model="form.transformation" placeholder="请输入相比上次的变化状态" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="数据状态" prop="dataStatus">
|
|
||||||
<el-select v-model="form.dataStatus" placeholder="请选择数据状态">
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.bh_type"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="parseInt(dict.value)"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="病害与车顶天线距离" prop="objDistance">
|
|
||||||
<el-input v-model="form.objDistance" placeholder="请输入病害与车顶天线距离" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="公里桩是否校准" prop="calibrated">
|
|
||||||
<el-input v-model="form.calibrated" placeholder="请输入公里桩是否校准0:未校准,1:已校准" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { listDefect, getDefect, delDefect, addDefect, updateDefect } from "@/api/api/defect";
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: "Defect",
|
|
||||||
dicts: ['bh_type'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 选中数组
|
|
||||||
ids: [],
|
|
||||||
// 非单个禁用
|
|
||||||
single: true,
|
|
||||||
// 非多个禁用
|
|
||||||
multiple: true,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 病害表格数据
|
|
||||||
defectList: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 10,
|
|
||||||
defectType: null,
|
|
||||||
equipmentType: null,
|
|
||||||
bhStatus: null,
|
|
||||||
stakeStart: null,
|
|
||||||
stakeEnd: null,
|
|
||||||
geometry: null,
|
|
||||||
targetArea: null,
|
|
||||||
targetLen: null,
|
|
||||||
snapshotId: null,
|
|
||||||
taskId: null,
|
|
||||||
segmentId: null,
|
|
||||||
segmentName: null,
|
|
||||||
inspectDirection: null,
|
|
||||||
datafrom: null,
|
|
||||||
warningflag: null,
|
|
||||||
media: null,
|
|
||||||
equipmentId: null,
|
|
||||||
transformation: null,
|
|
||||||
dataStatus: null,
|
|
||||||
objDistance: null,
|
|
||||||
calibrated: null
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
stakeStart: [
|
|
||||||
{ required: true, message: "开始桩号不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
stakeEnd: [
|
|
||||||
{ required: true, message: "结束桩号不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
geometry: [
|
|
||||||
{ required: true, message: "病害位置不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
targetArea: [
|
|
||||||
{ required: true, message: "病害面积不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
targetLen: [
|
|
||||||
{ required: true, message: "病害长度不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 查询病害列表 */
|
|
||||||
getList() {
|
|
||||||
this.loading = true;
|
|
||||||
listDefect(this.queryParams).then(response => {
|
|
||||||
this.defectList = response.rows;
|
|
||||||
this.total = response.total;
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: null,
|
|
||||||
defectType: null,
|
|
||||||
equipmentType: null,
|
|
||||||
createTime: null,
|
|
||||||
updateTime: null,
|
|
||||||
bhStatus: null,
|
|
||||||
stakeStart: null,
|
|
||||||
stakeEnd: null,
|
|
||||||
geometry: null,
|
|
||||||
targetArea: null,
|
|
||||||
targetLen: null,
|
|
||||||
snapshotId: null,
|
|
||||||
taskId: null,
|
|
||||||
segmentId: null,
|
|
||||||
segmentName: null,
|
|
||||||
inspectDirection: null,
|
|
||||||
datafrom: null,
|
|
||||||
warningflag: null,
|
|
||||||
media: null,
|
|
||||||
equipmentId: null,
|
|
||||||
transformation: null,
|
|
||||||
dataStatus: null,
|
|
||||||
objDistance: null,
|
|
||||||
calibrated: null
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNum = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm("queryForm");
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
// 多选框选中数据
|
|
||||||
handleSelectionChange(selection) {
|
|
||||||
this.ids = selection.map(item => item.id)
|
|
||||||
this.single = selection.length!==1
|
|
||||||
this.multiple = !selection.length
|
|
||||||
},
|
|
||||||
/** 新增按钮操作 */
|
|
||||||
handleAdd() {
|
|
||||||
this.reset();
|
|
||||||
this.open = true;
|
|
||||||
this.title = "添加病害";
|
|
||||||
},
|
|
||||||
/** 修改按钮操作 */
|
|
||||||
handleUpdate(row) {
|
|
||||||
this.reset();
|
|
||||||
const id = row.id || this.ids
|
|
||||||
getDefect(id).then(response => {
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改病害";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateDefect(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addDefect(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const ids = row.id || this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除病害编号为"' + ids + '"的数据项?').then(function() {
|
|
||||||
return delDefect(ids);
|
|
||||||
}).then(() => {
|
|
||||||
this.getList();
|
|
||||||
this.$modal.msgSuccess("删除成功");
|
|
||||||
}).catch(() => {});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('api/defect/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `defect_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
215
src/views/bigscreen.vue
Normal file
215
src/views/bigscreen.vue
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
<template>
|
||||||
|
<div class="map-container">
|
||||||
|
<div id="map" class="map"></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
map: null,
|
||||||
|
currentLayer: null,
|
||||||
|
cars: [], // 存储多个小车的数组
|
||||||
|
carIcon: null,
|
||||||
|
pointIcon: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.initMap();
|
||||||
|
for (let i = 0; i < document.getElementsByClassName("tdt-iconLayers-layer").length; i++) {
|
||||||
|
//document.getElementsByClassName("tdt-iconLayers-layer")[i].style.display = "none"
|
||||||
|
}
|
||||||
|
setTimeout(function () {
|
||||||
|
let a = document.getElementsByName('[data-layerid="128"]');
|
||||||
|
console.log(a)
|
||||||
|
}, 2000)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initMap() {
|
||||||
|
// 初始化天地图
|
||||||
|
const center = new T.LngLat(116.40769, 39.89945); // 设置中心点为北京
|
||||||
|
let imageURL = 'http://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img' +
|
||||||
|
'&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=1eb44fae5b9dc454442b322e9a41d233';
|
||||||
|
let imageUrl2 = 'http://t0.tianditu.gov.cn/cia_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img' +
|
||||||
|
'&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=1eb44fae5b9dc454442b322e9a41d233'
|
||||||
|
this.currentLayer = new T.TileLayer(imageURL, {minZoom: 1, maxZoom: 18}); // 矢量底图
|
||||||
|
this.map = new T.Map('map', {layers: [this.currentLayer]});
|
||||||
|
|
||||||
|
this.map.centerAndZoom(center, 18);
|
||||||
|
|
||||||
|
var ctrl = new T.Control.MapType();
|
||||||
|
//<EFBFBD><EFBFBD>加控件
|
||||||
|
this.map.addControl(ctrl);
|
||||||
|
|
||||||
|
|
||||||
|
// 小车图标的自定义图标
|
||||||
|
this.carIcon = new T.Icon({
|
||||||
|
iconUrl: require('@/assets/xc.png'), // 替换为你的小车图标路径
|
||||||
|
iconSize: new T.Point(40, 40)
|
||||||
|
});
|
||||||
|
|
||||||
|
// 小点的图标
|
||||||
|
this.pointIcon = new T.DivIcon({
|
||||||
|
html: '<div class="point-icon"></div>',
|
||||||
|
iconSize: new T.Point(10, 10)
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化多个小车
|
||||||
|
const initialPositions = [
|
||||||
|
{ x: 116.40769, y: 39.89945 },
|
||||||
|
{ x: 116.40779, y: 39.89955 },
|
||||||
|
{ x: 116.40789, y: 39.89965 },
|
||||||
|
];
|
||||||
|
|
||||||
|
initialPositions.forEach((pos, index) => {
|
||||||
|
this.cars.push({
|
||||||
|
id: index,
|
||||||
|
marker: null,
|
||||||
|
lastPoint: null,
|
||||||
|
x: pos.x,
|
||||||
|
y: pos.y,
|
||||||
|
});
|
||||||
|
const point = new T.LngLat(pos.x, pos.y);
|
||||||
|
this.addCarAtPoint(index, point);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听地图缩放事件
|
||||||
|
this.map.addEventListener("zoomend", this.updateAllCarsDisplay);
|
||||||
|
|
||||||
|
// 模拟多个小车移动
|
||||||
|
setInterval(() => {
|
||||||
|
this.cars.forEach(car => {
|
||||||
|
const newPoint = new T.LngLat(car.x += 0.00001, car.y += 0.00001);
|
||||||
|
this.addCarAtPoint(car.id, newPoint);
|
||||||
|
});
|
||||||
|
}, 200);
|
||||||
|
},
|
||||||
|
|
||||||
|
addCarAtPoint(carId, currentPoint) {
|
||||||
|
const car = this.cars[carId];
|
||||||
|
if (car.lastPoint) {
|
||||||
|
const angle = this.calculateAngle(car.lastPoint, currentPoint);
|
||||||
|
this.updateCarPosition(carId, currentPoint, angle);
|
||||||
|
} else {
|
||||||
|
const zoomLevel = this.map.getZoom();
|
||||||
|
let markerIcon = this.createMarkerIcon(zoomLevel, 0);
|
||||||
|
car.marker = new T.Marker(currentPoint, {icon: markerIcon});
|
||||||
|
this.map.addOverLay(car.marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
car.marker.addEventListener('click', () => {
|
||||||
|
alert(`小车${carId}当前坐标:经度: ${currentPoint.lng}, 纬度: ${currentPoint.lat}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
car.lastPoint = currentPoint;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算两个坐标点之间的角度
|
||||||
|
calculateAngle(point1, point2) {
|
||||||
|
const deltaX = point2.lng - point1.lng;
|
||||||
|
const deltaY = point2.lat - point1.lat;
|
||||||
|
const angle = Math.atan2(deltaY, deltaX) * (180 / Math.PI); // 弧度转角度
|
||||||
|
return angle;
|
||||||
|
},
|
||||||
|
|
||||||
|
updateCarPosition(carId, point, angle) {
|
||||||
|
const car = this.cars[carId];
|
||||||
|
if (car.marker) {
|
||||||
|
this.map.removeOverLay(car.marker);
|
||||||
|
}
|
||||||
|
|
||||||
|
const zoomLevel = this.map.getZoom();
|
||||||
|
let markerIcon = this.createMarkerIcon(zoomLevel, angle);
|
||||||
|
|
||||||
|
car.marker = new T.Marker(point, {icon: markerIcon});
|
||||||
|
this.map.addOverLay(car.marker);
|
||||||
|
|
||||||
|
car.marker.addEventListener('click', () => {
|
||||||
|
alert(`小车${carId}当前坐标:经度: ${point.lng}, 纬度: ${point.lat}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
createMarkerIcon(zoomLevel, angle) {
|
||||||
|
if (zoomLevel >= 18) {
|
||||||
|
return new T.DivIcon({
|
||||||
|
html: `<div class="car-icon" style="transform: rotate(${angle}deg); width: 30px; height: 30px; background-color: transparent;">
|
||||||
|
<img src="${require('@/assets/xc.png')}" style="width: 100%; height: 100%; object-fit: contain;" />
|
||||||
|
</div>`,
|
||||||
|
iconSize: new T.Point(30, 30),
|
||||||
|
iconAnchor: new T.Point(15, 15)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return new T.DivIcon({
|
||||||
|
html: '<div class="point-icon" style="width: 10px; height: 10px; background-color: #007bff; border-radius: 50%;"></div>',
|
||||||
|
iconSize: new T.Point(10, 10),
|
||||||
|
iconAnchor: new T.Point(5, 5)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
updateAllCarsDisplay() {
|
||||||
|
this.cars.forEach(car => {
|
||||||
|
if (car.lastPoint) {
|
||||||
|
const angle = this.calculateAngle(car.lastPoint, car.lastPoint);
|
||||||
|
this.updateCarPosition(car.id, car.lastPoint, angle);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.map-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basemap-switcher {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
left: 10px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
margin: 5px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
:global(.custom-div-icon) {
|
||||||
|
background: none !important;
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-icon {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.car-icon img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.point-icon {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
background-color: #007bff;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,8 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
<div id="map" class="map">
|
<div id="map" class="map">
|
||||||
<map-component></map-component>
|
<map-component></map-component>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- // 这里的tk为你在天地图的官网申请的tk -->
|
<!-- // 这里的tk为你在天地图的官网申请的tk -->
|
||||||
<script>
|
<script>
|
||||||
@ -39,8 +40,11 @@ export default {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.map{
|
.map{
|
||||||
width: 2000px;
|
width: 100%;
|
||||||
height: 1800px;
|
height: 800px;
|
||||||
|
}
|
||||||
|
.app-container{
|
||||||
|
padding: 0px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
682
src/views/system/depect/index.vue
Normal file
682
src/views/system/depect/index.vue
Normal file
@ -0,0 +1,682 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
<el-form-item label="道路名称" prop="segmentName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.segmentName"
|
||||||
|
placeholder="请输入道路名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采集时间" prop="dateTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.dateTime"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
clearable
|
||||||
|
@change="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害类型" prop="defectType">
|
||||||
|
<el-select v-model="queryParams.defectType" placeholder="请选择" clearable multiple>
|
||||||
|
<el-option v-for="item in defectTypes" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="任务ID" prop="taskId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.taskId"
|
||||||
|
placeholder="请输入任务ID"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害状态" prop="state">
|
||||||
|
<el-select v-model="queryParams.state" placeholder="请选择" clearable multiple>
|
||||||
|
<el-option v-for="item in states" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上下行" prop="inspectDirection">
|
||||||
|
<el-select v-model="queryParams.inspectDirection" placeholder="请选择" clearable multiple>
|
||||||
|
<el-option label="上行" value="upstream" />
|
||||||
|
<el-option label="下行" value="downstream" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公里桩" prop="stakeRange">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.stakeStart"
|
||||||
|
placeholder="起始公里桩"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.stakeEnd"
|
||||||
|
placeholder="终止公里桩"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</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
|
||||||
|
v-model="queryParams.minLen"
|
||||||
|
placeholder="最小长度"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxLen"
|
||||||
|
placeholder="最大长度"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害面积" prop="areaRange">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.minArea"
|
||||||
|
placeholder="最小面积"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxArea"
|
||||||
|
placeholder="最大面积"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="距离车顶天线" prop="distanceRange">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.minDistance"
|
||||||
|
placeholder="最小距离"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxDistance"
|
||||||
|
placeholder="最大距离"
|
||||||
|
style="width: 100px;"
|
||||||
|
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="2">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:defect:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:defect:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:defect:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="2">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:defect:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<el-table v-loading="loading" :data="defectList" @selection-change="handleSelectionChange" 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" />
|
||||||
|
<el-table-column label="病害类型" align="center" prop="defectType" />
|
||||||
|
<el-table-column label="病害状态" align="center" prop="state" />
|
||||||
|
<el-table-column label="开始桩号" align="center" prop="stakeStart" />
|
||||||
|
<el-table-column label="结束桩号" align="center" prop="stakeEnd" />
|
||||||
|
<el-table-column label="病害长度" align="center" prop="targetLen" />
|
||||||
|
<el-table-column label="病害面积" align="center" prop="targetArea" />
|
||||||
|
<el-table-column label="预警标识" align="center" prop="warningFlag">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.warningFlag === 1 ? 'danger' : 'success'">
|
||||||
|
{{ scope.row.warningFlag === 1 ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:defect:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:defect:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改缺陷对话框 -->
|
||||||
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" append-to-body>
|
||||||
|
<el-form ref="defectForm" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="道路名称" prop="segmentName">
|
||||||
|
<el-input v-model="form.segmentName" placeholder="请输入道路名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害类型" prop="defectType">
|
||||||
|
<el-select v-model="form.defectType" placeholder="请选择病害类型" clearable>
|
||||||
|
<el-option v-for="item in defectTypes" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害状态" prop="state">
|
||||||
|
<el-select v-model="form.state" placeholder="请选择病害状态" clearable>
|
||||||
|
<el-option v-for="item in states" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采集时间" prop="createdTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.createdTime"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="选择采集时间"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开始桩号" prop="stakeStart">
|
||||||
|
<el-input v-model="form.stakeStart" placeholder="请输入开始桩号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束桩号" prop="stakeEnd">
|
||||||
|
<el-input v-model="form.stakeEnd" placeholder="请输入结束桩号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害长度" prop="targetLen">
|
||||||
|
<el-input-number v-model="form.targetLen" :min="0" placeholder="请输入病害长度" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害面积" prop="targetArea">
|
||||||
|
<el-input-number v-model="form.targetArea" :min="0" placeholder="请输入病害面积" style="width: 100%" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预警标识" prop="warningFlag">
|
||||||
|
<el-switch v-model="form.warningFlag" active-value="1" inactive-value="0" active-text="是" inactive-text="否" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害位置" prop="geometry">
|
||||||
|
<el-input v-model="form.geometry.coordinates" placeholder="请输入坐标 (e.g., [lng, lat])" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 根据需要,可以添加更多字段,如媒体资源等 -->
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 查看病害详细信息对话框 -->
|
||||||
|
<el-dialog title="查看病害详细信息" :visible.sync="openViewDialog" width="800px" append-to-body>
|
||||||
|
<div>
|
||||||
|
<!-- 上半部分 -->
|
||||||
|
<div style="display: flex; height: 50%;">
|
||||||
|
<!-- 左侧病害信息 -->
|
||||||
|
<div style="flex: 1; padding: 10px;">
|
||||||
|
<p>上报日期:{{ form.createdTime }}</p>
|
||||||
|
<p>路段名称:{{ form.segmentName }}</p>
|
||||||
|
<p>病害坐标:{{ form.geometry.coordinates }}</p>
|
||||||
|
<p>病害类型:{{ form.defectType }}</p>
|
||||||
|
<p>病害长度:{{ form.targetLen }} 米</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧图片展示 -->
|
||||||
|
<div style="flex: 1; padding: 10px;">
|
||||||
|
<el-carousel height="150px">
|
||||||
|
<el-carousel-item v-for="(img, index) in form.media" :key="index">
|
||||||
|
<img :src="img.img" alt="病害图片" style="width: 100%;" />
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 下半部分显示天地图 -->
|
||||||
|
<div id="mapContainer" style="height: 300px; margin-top: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="closeDialog">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listDefect,
|
||||||
|
getDefect,
|
||||||
|
delDefect,
|
||||||
|
addDefect,
|
||||||
|
updateDefect,
|
||||||
|
exportDefect
|
||||||
|
} from "@/api/xj/defect";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Defect",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
openViewDialog: false,
|
||||||
|
|
||||||
|
// 遮罩层
|
||||||
|
loading: false,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 缺陷表格数据
|
||||||
|
defectList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
dialogTitle: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
dialogVisible: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
segmentName: "",
|
||||||
|
dateTime: [],
|
||||||
|
defectType: [],
|
||||||
|
taskId: "",
|
||||||
|
state: [],
|
||||||
|
inspectDirection: [],
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
warningFlag: null,
|
||||||
|
minLen: null,
|
||||||
|
maxLen: null,
|
||||||
|
minArea: null,
|
||||||
|
maxArea: null,
|
||||||
|
minDistance: null,
|
||||||
|
maxDistance: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
id: null,
|
||||||
|
segmentName: "",
|
||||||
|
defectType: "",
|
||||||
|
equipmentType: "",
|
||||||
|
createdTime: "",
|
||||||
|
updatedTime: "",
|
||||||
|
state: "",
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
geometry: {
|
||||||
|
type: "Point",
|
||||||
|
coordinates: []
|
||||||
|
},
|
||||||
|
targetArea: null,
|
||||||
|
targetLen: null,
|
||||||
|
snapshotId: "",
|
||||||
|
taskId: "",
|
||||||
|
segmentId: "",
|
||||||
|
inspectDirection: "",
|
||||||
|
dataFrom: "",
|
||||||
|
warningFlag: 0,
|
||||||
|
equipmentId: "",
|
||||||
|
transformation: 0,
|
||||||
|
dataStatus: 0,
|
||||||
|
objDistance: null,
|
||||||
|
isCalibrated: 0,
|
||||||
|
count: 0,
|
||||||
|
media: []
|
||||||
|
},
|
||||||
|
// 表单校验规则
|
||||||
|
rules: {
|
||||||
|
segmentName: [
|
||||||
|
{ required: true, message: "请输入道路名称", trigger: "blur" }
|
||||||
|
],
|
||||||
|
defectType: [
|
||||||
|
{ required: true, message: "请选择病害类型", trigger: "change" }
|
||||||
|
],
|
||||||
|
state: [
|
||||||
|
{ required: true, message: "请选择病害状态", trigger: "change" }
|
||||||
|
],
|
||||||
|
createdTime: [
|
||||||
|
{ type: "array", required: false, message: "请选择采集时间", trigger: "change" }
|
||||||
|
],
|
||||||
|
stakeStart: [
|
||||||
|
{ required: false, message: "请输入开始桩号", trigger: "blur" }
|
||||||
|
],
|
||||||
|
stakeEnd: [
|
||||||
|
{ required: false, message: "请输入结束桩号", trigger: "blur" }
|
||||||
|
],
|
||||||
|
targetLen: [
|
||||||
|
{ type: "number", min: 0, message: "病害长度必须为正数", trigger: "change" }
|
||||||
|
],
|
||||||
|
targetArea: [
|
||||||
|
{ type: "number", min: 0, message: "病害面积必须为正数", trigger: "change" }
|
||||||
|
]
|
||||||
|
// 可以根据需要添加更多校验规则
|
||||||
|
},
|
||||||
|
// 下拉选项
|
||||||
|
defectTypes: [
|
||||||
|
{ label: "裂缝", value: "crack" },
|
||||||
|
{ label: "坑槽", value: "pothole" },
|
||||||
|
{ label: "脱皮", value: "peeling" }
|
||||||
|
// 添加更多病害类型
|
||||||
|
],
|
||||||
|
states: [
|
||||||
|
{ label: "未处理", value: "untreated" },
|
||||||
|
{ label: "处理中", value: "in_process" },
|
||||||
|
{ label: "已处理", value: "processed" }
|
||||||
|
// 添加更多病害状态
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询缺陷列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 处理日期范围
|
||||||
|
const params = { ...this.queryParams };
|
||||||
|
if (params.dateTime && params.dateTime.length === 2) {
|
||||||
|
params.startDate = params.dateTime[0];
|
||||||
|
params.endDate = params.dateTime[1];
|
||||||
|
}
|
||||||
|
delete params.dateTime;
|
||||||
|
delete params.lengthRange;
|
||||||
|
delete params.areaRange;
|
||||||
|
delete params.distanceRange;
|
||||||
|
|
||||||
|
listDefect(params)
|
||||||
|
.then(response => {
|
||||||
|
this.defectList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.resetFormData();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
resetForm(formName) {
|
||||||
|
this.$refs[formName].resetFields();
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.queryParams = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
segmentName: "",
|
||||||
|
dateTime: [],
|
||||||
|
defectType: [],
|
||||||
|
taskId: "",
|
||||||
|
state: [],
|
||||||
|
inspectDirection: [],
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
warningFlag: null,
|
||||||
|
minLen: null,
|
||||||
|
maxLen: null,
|
||||||
|
minArea: null,
|
||||||
|
maxArea: null,
|
||||||
|
minDistance: null,
|
||||||
|
maxDistance: null
|
||||||
|
};
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.resetFormData();
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.dialogTitle = "添加缺陷";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
if (row) {
|
||||||
|
// 通过行数据修改
|
||||||
|
this.loadDefect(row.id);
|
||||||
|
} else if (this.ids.length === 1) {
|
||||||
|
// 通过选中项修改
|
||||||
|
this.loadDefect(this.ids[0]);
|
||||||
|
} else {
|
||||||
|
this.$modal.msgWarning("请选择一条记录进行修改");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 加载缺陷数据 */
|
||||||
|
loadDefect(id) {
|
||||||
|
getDefect(id)
|
||||||
|
.then(response => {
|
||||||
|
this.form = { ...response.data };
|
||||||
|
// 处理日期格式
|
||||||
|
if (this.form.createdTime) {
|
||||||
|
this.form.createdTime = new Date(this.form.createdTime);
|
||||||
|
}
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.dialogTitle = "修改缺陷";
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$modal.msgError("加载缺陷数据失败");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["defectForm"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id) {
|
||||||
|
// 更新缺陷
|
||||||
|
updateDefect(this.form)
|
||||||
|
.then(() => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$modal.msgError("修改失败");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 添加缺陷
|
||||||
|
addDefect(this.form)
|
||||||
|
.then(() => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$modal.msgError("新增失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row ? [row.id] : this.ids;
|
||||||
|
if (!ids.length) {
|
||||||
|
this.$modal.msgWarning("请选择要删除的记录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$modal
|
||||||
|
.confirm(`是否确认删除选中的${ids.length}条记录?`)
|
||||||
|
.then(() => {
|
||||||
|
return delDefect(ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('xj/defect/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `defect_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
/** 重置表单数据 */
|
||||||
|
resetFormData() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
segmentName: "",
|
||||||
|
defectType: "",
|
||||||
|
equipmentType: "",
|
||||||
|
createdTime: "",
|
||||||
|
updatedTime: "",
|
||||||
|
state: "",
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
geometry: {
|
||||||
|
type: "Point",
|
||||||
|
coordinates: []
|
||||||
|
},
|
||||||
|
targetArea: null,
|
||||||
|
targetLen: null,
|
||||||
|
snapshotId: "",
|
||||||
|
taskId: "",
|
||||||
|
segmentId: "",
|
||||||
|
inspectDirection: "",
|
||||||
|
dataFrom: "",
|
||||||
|
warningFlag: 0,
|
||||||
|
equipmentId: "",
|
||||||
|
transformation: 0,
|
||||||
|
dataStatus: 0,
|
||||||
|
objDistance: null,
|
||||||
|
isCalibrated: 0,
|
||||||
|
count: 0,
|
||||||
|
media: []
|
||||||
|
};
|
||||||
|
this.resetForm("defectForm");
|
||||||
|
},
|
||||||
|
|
||||||
|
// 打开查看详情弹出框
|
||||||
|
viewDefect(defect) {
|
||||||
|
this.form = defect;
|
||||||
|
this.openViewDialog = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initMap();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 初始化天地图并标注病害位置
|
||||||
|
initMap() {
|
||||||
|
if (this.map) {
|
||||||
|
this.map.remove(); // 如果已经有地图实例,先移除再重新加载
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化天地图
|
||||||
|
this.map = new T.Map("mapContainer");
|
||||||
|
|
||||||
|
// 设置中心点为病害的坐标
|
||||||
|
const coordinates = this.form.geometry.coordinates;
|
||||||
|
if (coordinates && coordinates.length === 2) {
|
||||||
|
const lon = coordinates[0];
|
||||||
|
const lat = coordinates[1];
|
||||||
|
|
||||||
|
// 设置地图中心点
|
||||||
|
const center = new T.LngLat(lon, lat);
|
||||||
|
this.map.centerAndZoom(center, 15);
|
||||||
|
|
||||||
|
// 添加病害位置标注
|
||||||
|
const marker = new T.Marker(center);
|
||||||
|
this.map.addOverLay(marker);
|
||||||
|
} else {
|
||||||
|
console.error("无效的病害坐标");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 关闭对话框
|
||||||
|
closeDialog() {
|
||||||
|
this.openViewDialog = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.app-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
.mb8 {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.small-padding {
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
.fixed-width {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,99 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="字典名称" prop="dictName">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.dictName"
|
|
||||||
placeholder="请输入字典名称"
|
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="字典类型" prop="dictType">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.dictType"
|
|
||||||
placeholder="请输入字典类型"
|
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态" prop="status">
|
|
||||||
<el-select
|
|
||||||
v-model="queryParams.status"
|
|
||||||
placeholder="字典状态"
|
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in dict.type.sys_normal_disable"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="dateRange"
|
|
||||||
style="width: 240px"
|
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
type="daterange"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
></el-date-picker>
|
|
||||||
</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-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['system:dict:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['system:dict:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['system:dict:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['system:dict:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
@ -102,33 +10,19 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
@click="handleRefreshCache"
|
@click="handleRefreshCache"
|
||||||
v-hasPermi="['system:dict:remove']"
|
v-hasPermi="['system:dict:remove']"
|
||||||
>刷新缓存</el-button>
|
>刷新缓存
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="字典编号" align="center" prop="dictId" />
|
|
||||||
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
<el-table-column label="字典类型" align="center" prop="key" :show-overflow-tooltip="true"/>
|
||||||
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
|
|
||||||
<template slot-scope="scope">
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
|
||||||
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
|
|
||||||
<span>{{ scope.row.dictType }}</span>
|
|
||||||
</router-link>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -137,14 +31,9 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['system:dict:edit']"
|
v-hasPermi="['system:dict:edit']"
|
||||||
>修改</el-button>
|
>查看
|
||||||
<el-button
|
</el-button>
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['system:dict:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -159,44 +48,35 @@
|
|||||||
|
|
||||||
<!-- 添加或修改参数配置对话框 -->
|
<!-- 添加或修改参数配置对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-table v-loading="loading" :data="formList" @selection-change="handleSelectionChange">
|
||||||
<el-form-item label="字典名称" prop="dictName">
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-input v-model="form.dictName" placeholder="请输入字典名称" />
|
|
||||||
</el-form-item>
|
<el-table-column label="名称" align="center" prop="label" :show-overflow-tooltip="true"/>
|
||||||
<el-form-item label="字典类型" prop="dictType">
|
|
||||||
<el-input v-model="form.dictType" placeholder="请输入字典类型" />
|
<el-table-column label="编码" align="center" prop="value" :show-overflow-tooltip="true"/>
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态" prop="status">
|
</el-table>
|
||||||
<el-radio-group v-model="form.status">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in dict.type.sys_normal_disable"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>{{dict.label}}</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注" prop="remark">
|
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">关 闭</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
|
import {listType, getType, delType, addType, updateType} from "@/api/system/dict/type";
|
||||||
|
import {listMetadata,refreshCache} from "@/api/xj/metadata";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Dict",
|
name: "Dict",
|
||||||
dicts: ['sys_normal_disable'],
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
formList:[],
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: false,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
@ -228,10 +108,10 @@ export default {
|
|||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
dictName: [
|
dictName: [
|
||||||
{ required: true, message: "字典名称不能为空", trigger: "blur" }
|
{required: true, message: "字典名称不能为空", trigger: "blur"}
|
||||||
],
|
],
|
||||||
dictType: [
|
dictType: [
|
||||||
{ required: true, message: "字典类型不能为空", trigger: "blur" }
|
{required: true, message: "字典类型不能为空", trigger: "blur"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -240,15 +120,105 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
transformToDeepCategorizedLabelValue(data) {
|
||||||
|
const result = {};
|
||||||
|
|
||||||
|
data.items.forEach(item => {
|
||||||
|
Object.entries(item).forEach(([categoryKey, categoryValue]) => {
|
||||||
|
if (!result[categoryKey]) {
|
||||||
|
result[categoryKey] = {};
|
||||||
|
}
|
||||||
|
categoryValue.forEach(subCategory => {
|
||||||
|
Object.entries(subCategory).forEach(([subCategoryKey, subCategoryValue]) => {
|
||||||
|
if (!result[categoryKey][subCategoryKey]) {
|
||||||
|
result[categoryKey][subCategoryKey] = [];
|
||||||
|
}
|
||||||
|
// 处理嵌套的对象,将其转换为 label 和 value
|
||||||
|
if (typeof subCategoryValue === 'object') {
|
||||||
|
Object.entries(subCategoryValue).forEach(([key, value]) => {
|
||||||
|
result[categoryKey][subCategoryKey].push({
|
||||||
|
label: value,
|
||||||
|
value: key
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
result[categoryKey][subCategoryKey].push({
|
||||||
|
label: subCategoryValue,
|
||||||
|
value: subCategoryKey
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
transformToDeepCategorizedListLabelValue(data) {
|
||||||
|
const temp = {};
|
||||||
|
const result = [];
|
||||||
|
|
||||||
|
data.items.forEach(item => {
|
||||||
|
Object.entries(item).forEach(([categoryKey, categoryValue]) => {
|
||||||
|
|
||||||
|
categoryValue.forEach(subCategory => {
|
||||||
|
Object.entries(subCategory).forEach(([subCategoryKey, subCategoryValue]) => {
|
||||||
|
|
||||||
|
// 处理嵌套的对象,将其转换为 label 和 value
|
||||||
|
if (typeof subCategoryValue === 'object') {
|
||||||
|
if (!temp[categoryKey + ":" + subCategoryKey]) {
|
||||||
|
temp[categoryKey + ":" + subCategoryKey] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.entries(subCategoryValue).forEach(([key, value]) => {
|
||||||
|
temp[categoryKey + ":" + subCategoryKey].push({
|
||||||
|
label: value,
|
||||||
|
value: key
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
temp[categoryKey + ":" + subCategoryKey].push({
|
||||||
|
label: subCategoryValue,
|
||||||
|
value: subCategoryKey
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.entries(temp).forEach(([categoryKey, categoryValue]) => {
|
||||||
|
result.push({key: categoryKey, value: categoryValue});
|
||||||
|
})
|
||||||
|
|
||||||
|
this.total = result.length;
|
||||||
|
|
||||||
|
if (this.queryParams.pageNum *this.queryParams.pageSize > result.length) {
|
||||||
|
return result.slice((this.queryParams.pageNum -1)*this.queryParams.pageSize, result.length);
|
||||||
|
}else{
|
||||||
|
return result.slice((this.queryParams.pageNum -1)*this.queryParams.pageSize,this.queryParams.pageSize*this.queryParams.pageNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
getTypeInfo() {
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
/** 查询字典类型列表 */
|
/** 查询字典类型列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
|
||||||
this.typeList = response.rows;
|
|
||||||
this.total = response.total;
|
listMetadata().then(response => {
|
||||||
this.loading = false;
|
|
||||||
}
|
this.typeList = this.transformToDeepCategorizedListLabelValue(JSON.parse(response.data))
|
||||||
);
|
console.log(this.typeList)
|
||||||
|
this.loading = false;
|
||||||
|
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
@ -286,21 +256,24 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.dictId)
|
this.ids = selection.map(item => item.dictId)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
/* this.reset();
|
||||||
const dictId = row.dictId || this.ids
|
const dictId = row.dictId || this.ids
|
||||||
getType(dictId).then(response => {
|
getType(dictId).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改字典类型";
|
this.title = "修改字典类型";
|
||||||
});
|
});*/
|
||||||
|
|
||||||
|
this.formList = row.value;
|
||||||
|
this.open = true;
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function () {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictId != undefined) {
|
if (this.form.dictId != undefined) {
|
||||||
@ -322,12 +295,13 @@ export default {
|
|||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const dictIds = row.dictId || this.ids;
|
const dictIds = row.dictId || this.ids;
|
||||||
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function () {
|
||||||
return delType(dictIds);
|
return delType(dictIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
@ -344,4 +318,4 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
402
src/views/system/dict2/data.vue
Normal file
402
src/views/system/dict2/data.vue
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="字典名称" prop="dictType">
|
||||||
|
<el-select v-model="queryParams.dictType">
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeOptions"
|
||||||
|
:key="item.dictId"
|
||||||
|
:label="item.dictName"
|
||||||
|
:value="item.dictType"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典标签" prop="dictLabel">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dictLabel"
|
||||||
|
placeholder="请输入字典标签"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="数据状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</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="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:dict:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:dict:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:dict:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:dict:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-close"
|
||||||
|
size="mini"
|
||||||
|
@click="handleClose"
|
||||||
|
>关闭</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="字典编码" align="center" prop="dictCode" />
|
||||||
|
<el-table-column label="字典标签" align="center" prop="dictLabel">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="(scope.row.listClass == '' || scope.row.listClass == 'default') && (scope.row.cssClass == '' || scope.row.cssClass == null)">{{ scope.row.dictLabel }}</span>
|
||||||
|
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass" :class="scope.row.cssClass">{{ scope.row.dictLabel }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="字典键值" align="center" prop="dictValue" />
|
||||||
|
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:dict:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:dict:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改参数配置对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="字典类型">
|
||||||
|
<el-input v-model="form.dictType" :disabled="true" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据标签" prop="dictLabel">
|
||||||
|
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据键值" prop="dictValue">
|
||||||
|
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="样式属性" prop="cssClass">
|
||||||
|
<el-input v-model="form.cssClass" placeholder="请输入样式属性" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示排序" prop="dictSort">
|
||||||
|
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="回显样式" prop="listClass">
|
||||||
|
<el-select v-model="form.listClass">
|
||||||
|
<el-option
|
||||||
|
v-for="item in listClassOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label + '(' + item.value + ')'"
|
||||||
|
:value="item.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
|
||||||
|
import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Data",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 字典表格数据
|
||||||
|
dataList: [],
|
||||||
|
// 默认字典类型
|
||||||
|
defaultDictType: "",
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 数据标签回显样式
|
||||||
|
listClassOptions: [
|
||||||
|
{
|
||||||
|
value: "default",
|
||||||
|
label: "默认"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "primary",
|
||||||
|
label: "主要"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "success",
|
||||||
|
label: "成功"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "info",
|
||||||
|
label: "信息"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "warning",
|
||||||
|
label: "警告"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "danger",
|
||||||
|
label: "危险"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 类型数据字典
|
||||||
|
typeOptions: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
dictType: undefined,
|
||||||
|
dictLabel: undefined,
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
dictLabel: [
|
||||||
|
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dictValue: [
|
||||||
|
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dictSort: [
|
||||||
|
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const dictId = this.$route.params && this.$route.params.dictId;
|
||||||
|
this.getType(dictId);
|
||||||
|
this.getTypeList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询字典类型详细 */
|
||||||
|
getType(dictId) {
|
||||||
|
getType(dictId).then(response => {
|
||||||
|
this.queryParams.dictType = response.data.dictType;
|
||||||
|
this.defaultDictType = response.data.dictType;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 查询字典类型列表 */
|
||||||
|
getTypeList() {
|
||||||
|
getDictOptionselect().then(response => {
|
||||||
|
this.typeOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 查询字典数据列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listData(this.queryParams).then(response => {
|
||||||
|
this.dataList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
dictCode: undefined,
|
||||||
|
dictLabel: undefined,
|
||||||
|
dictValue: undefined,
|
||||||
|
cssClass: undefined,
|
||||||
|
listClass: 'default',
|
||||||
|
dictSort: 0,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 返回按钮操作 */
|
||||||
|
handleClose() {
|
||||||
|
const obj = { path: "/system/dict" };
|
||||||
|
this.$tab.closeOpenPage(obj);
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.queryParams.dictType = this.defaultDictType;
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加字典数据";
|
||||||
|
this.form.dictType = this.queryParams.dictType;
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.dictCode)
|
||||||
|
this.single = selection.length!=1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const dictCode = row.dictCode || this.ids
|
||||||
|
getData(dictCode).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改字典数据";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm: function() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.dictCode != undefined) {
|
||||||
|
updateData(this.form).then(response => {
|
||||||
|
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addData(this.form).then(response => {
|
||||||
|
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const dictCodes = row.dictCode || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
|
||||||
|
return delData(dictCodes);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
this.$store.dispatch('dict/removeDict', this.queryParams.dictType);
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/dict/data/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `data_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
347
src/views/system/dict2/index.vue
Normal file
347
src/views/system/dict2/index.vue
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="字典名称" prop="dictName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dictName"
|
||||||
|
placeholder="请输入字典名称"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典类型" prop="dictType">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dictType"
|
||||||
|
placeholder="请输入字典类型"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
placeholder="字典状态"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dateRange"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</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="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:dict:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:dict:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:dict:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:dict:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
size="mini"
|
||||||
|
@click="handleRefreshCache"
|
||||||
|
v-hasPermi="['system:dict:remove']"
|
||||||
|
>刷新缓存</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="字典编号" align="center" prop="dictId" />
|
||||||
|
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type">
|
||||||
|
<span>{{ scope.row.dictType }}</span>
|
||||||
|
</router-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:dict:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:dict:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改参数配置对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="字典名称" prop="dictName">
|
||||||
|
<el-input v-model="form.dictName" placeholder="请输入字典名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典类型" prop="dictType">
|
||||||
|
<el-input v-model="form.dictType" placeholder="请输入字典类型" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Dict",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 字典表格数据
|
||||||
|
typeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 日期范围
|
||||||
|
dateRange: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
dictName: undefined,
|
||||||
|
dictType: undefined,
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
dictName: [
|
||||||
|
{ required: true, message: "字典名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dictType: [
|
||||||
|
{ required: true, message: "字典类型不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询字典类型列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
|
this.typeList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
dictId: undefined,
|
||||||
|
dictName: undefined,
|
||||||
|
dictType: undefined,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRange = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加字典类型";
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.dictId)
|
||||||
|
this.single = selection.length!=1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const dictId = row.dictId || this.ids
|
||||||
|
getType(dictId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改字典类型";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm: function() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.dictId != undefined) {
|
||||||
|
updateType(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addType(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const dictIds = row.dictId || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
|
||||||
|
return delType(dictIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/dict/type/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `type_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
/** 刷新缓存按钮操作 */
|
||||||
|
handleRefreshCache() {
|
||||||
|
refreshCache().then(() => {
|
||||||
|
this.$modal.msgSuccess("刷新成功");
|
||||||
|
this.$store.dispatch('dict/cleanDict');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
784
src/views/xj/defect/index.vue
Normal file
784
src/views/xj/defect/index.vue
Normal file
@ -0,0 +1,784 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 搜索表单 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
<el-form-item label="道路名称" prop="segmentName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.segmentName"
|
||||||
|
placeholder="请输入道路名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采集时间" prop="dateTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.dateTime"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
clearable
|
||||||
|
@change="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害类型" prop="defectType">
|
||||||
|
<el-select v-model="queryParams.defectType" placeholder="请选择" clearable multiple>
|
||||||
|
<el-option v-for="item in defectTypes" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="任务ID" prop="taskId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.taskId"
|
||||||
|
placeholder="请输入任务ID"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害状态" prop="state">
|
||||||
|
<el-select v-model="queryParams.state" placeholder="请选择" clearable multiple>
|
||||||
|
<el-option v-for="item in states" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上下行" prop="inspectDirection">
|
||||||
|
<el-select v-model="queryParams.inspectDirection" placeholder="请选择" clearable multiple>
|
||||||
|
<el-option label="上行" value="upstream"/>
|
||||||
|
<el-option label="下行" value="downstream"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="公里桩" prop="stakeRange">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.stakeStart"
|
||||||
|
placeholder="起始公里桩"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.stakeEnd"
|
||||||
|
placeholder="终止公里桩"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</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
|
||||||
|
v-model="queryParams.minLen"
|
||||||
|
placeholder="最小长度"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxLen"
|
||||||
|
placeholder="最大长度"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害面积" prop="areaRange">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.minArea"
|
||||||
|
placeholder="最小面积"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxArea"
|
||||||
|
placeholder="最大面积"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="距离车顶天线" prop="distanceRange">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.minDistance"
|
||||||
|
placeholder="最小距离"
|
||||||
|
style="width: 100px;"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<span style="margin: 0 5px;">-</span>
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.maxDistance"
|
||||||
|
placeholder="最大距离"
|
||||||
|
style="width: 100px;"
|
||||||
|
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="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:defect:add']"
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:defect:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:defect:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:defect:export']"
|
||||||
|
>导出
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<el-table v-loading="loading" :data="defectList" @selection-change="handleSelectionChange" 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"/>
|
||||||
|
<el-table-column label="病害类型" align="center" prop="defectType"/>
|
||||||
|
<el-table-column label="病害状态" align="center" prop="state"/>
|
||||||
|
<el-table-column label="开始桩号" align="center" prop="stakeStart"/>
|
||||||
|
<el-table-column label="结束桩号" align="center" prop="stakeEnd"/>
|
||||||
|
<el-table-column label="病害长度" align="center" prop="targetLen"/>
|
||||||
|
<el-table-column label="病害面积" align="center" prop="targetArea"/>
|
||||||
|
<el-table-column label="预警标识" align="center" prop="warningFlag">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag :type="scope.row.warningFlag === 1 ? 'danger' : 'success'">
|
||||||
|
{{ scope.row.warningFlag === 1 ? '是' : '否' }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="viewDefect(scope.row)"
|
||||||
|
>查看
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:defect:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:defect:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改缺陷对话框 -->
|
||||||
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" append-to-body>
|
||||||
|
<el-form ref="defectForm" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="道路名称" prop="segmentName">
|
||||||
|
<el-input v-model="form.segmentName" placeholder="请输入道路名称"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害类型" prop="defectType">
|
||||||
|
<el-select v-model="form.defectType" placeholder="请选择病害类型" clearable>
|
||||||
|
<el-option v-for="item in defectTypes" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害状态" prop="state">
|
||||||
|
<el-select v-model="form.state" placeholder="请选择病害状态" clearable>
|
||||||
|
<el-option v-for="item in states" :key="item.value" :label="item.label" :value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="采集时间" prop="createdTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.createdTime"
|
||||||
|
type="datetime"
|
||||||
|
placeholder="选择采集时间"
|
||||||
|
format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开始桩号" prop="stakeStart">
|
||||||
|
<el-input v-model="form.stakeStart" placeholder="请输入开始桩号"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="结束桩号" prop="stakeEnd">
|
||||||
|
<el-input v-model="form.stakeEnd" placeholder="请输入结束桩号"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害长度" prop="targetLen">
|
||||||
|
<el-input-number v-model="form.targetLen" :min="0" placeholder="请输入病害长度" style="width: 100%"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害面积" prop="targetArea">
|
||||||
|
<el-input-number v-model="form.targetArea" :min="0" placeholder="请输入病害面积" style="width: 100%"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="预警标识" prop="warningFlag">
|
||||||
|
<el-switch v-model="form.warningFlag" active-value="1" inactive-value="0" active-text="是"
|
||||||
|
inactive-text="否"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="病害位置" prop="geometry">
|
||||||
|
<el-input v-model="form.geometry.coordinates" placeholder="请输入坐标 (e.g., [lng, lat])"/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 根据需要,可以添加更多字段,如媒体资源等 -->
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 查看病害详细信息对话框 -->
|
||||||
|
<el-dialog title="查看病害详细信息" :visible.sync="openViewDialog" width="800px" append-to-body>
|
||||||
|
<div>
|
||||||
|
<!-- 上半部分 -->
|
||||||
|
<div style="display: flex; height: 50%;">
|
||||||
|
<!-- 左侧病害信息 -->
|
||||||
|
<div style="flex: 1; padding: 10px;">
|
||||||
|
<p>上报日期:{{ form.createdTime }}</p>
|
||||||
|
<p>路段名称:{{ form.segmentName }}</p>
|
||||||
|
<p>病害坐标:{{ form.geometry.coordinates }}</p>
|
||||||
|
<p>病害类型:{{ form.defectType }}</p>
|
||||||
|
<p>病害长度:{{ form.targetLen }} 米</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧图片展示 -->
|
||||||
|
<div style="flex: 1; padding: 10px;">
|
||||||
|
<el-carousel height="150px">
|
||||||
|
<el-carousel-item v-for="(img, index) in form.media" :key="index">
|
||||||
|
<img :src="img.img" alt="病害图片" style="width: 100%;"/>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 下半部分显示天地图 -->
|
||||||
|
<div id="mapContainer" style="height: 300px; margin-top: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="closeDialog">关闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listDefect,
|
||||||
|
getDefect,
|
||||||
|
delDefect,
|
||||||
|
addDefect,
|
||||||
|
updateDefect,
|
||||||
|
} from "@/api/xj/defect";
|
||||||
|
|
||||||
|
import {listMetadata} from "@/api/xj/metadata"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Defect",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
typeInfo: [],
|
||||||
|
openViewDialog: false,
|
||||||
|
|
||||||
|
// 遮罩层
|
||||||
|
loading: false,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 缺陷表格数据
|
||||||
|
defectList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
dialogTitle: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
dialogVisible: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
segmentName: "",
|
||||||
|
dateTime: [],
|
||||||
|
defectType: [],
|
||||||
|
taskId: "",
|
||||||
|
state: [],
|
||||||
|
inspectDirection: [],
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
warningFlag: null,
|
||||||
|
minLen: null,
|
||||||
|
maxLen: null,
|
||||||
|
minArea: null,
|
||||||
|
maxArea: null,
|
||||||
|
minDistance: null,
|
||||||
|
maxDistance: null
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
id: null,
|
||||||
|
segmentName: "",
|
||||||
|
defectType: "",
|
||||||
|
equipmentType: "",
|
||||||
|
createdTime: "",
|
||||||
|
updatedTime: "",
|
||||||
|
state: "",
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
geometry: {
|
||||||
|
type: "Point",
|
||||||
|
coordinates: []
|
||||||
|
},
|
||||||
|
targetArea: null,
|
||||||
|
targetLen: null,
|
||||||
|
snapshotId: "",
|
||||||
|
taskId: "",
|
||||||
|
segmentId: "",
|
||||||
|
inspectDirection: "",
|
||||||
|
dataFrom: "",
|
||||||
|
warningFlag: 0,
|
||||||
|
equipmentId: "",
|
||||||
|
transformation: 0,
|
||||||
|
dataStatus: 0,
|
||||||
|
objDistance: null,
|
||||||
|
isCalibrated: 0,
|
||||||
|
count: 0,
|
||||||
|
media: []
|
||||||
|
},
|
||||||
|
// 表单校验规则
|
||||||
|
rules: {
|
||||||
|
segmentName: [
|
||||||
|
{required: true, message: "请输入道路名称", trigger: "blur"}
|
||||||
|
],
|
||||||
|
defectType: [
|
||||||
|
{required: true, message: "请选择病害类型", trigger: "change"}
|
||||||
|
],
|
||||||
|
state: [
|
||||||
|
{required: true, message: "请选择病害状态", trigger: "change"}
|
||||||
|
],
|
||||||
|
createdTime: [
|
||||||
|
{type: "array", required: false, message: "请选择采集时间", trigger: "change"}
|
||||||
|
],
|
||||||
|
stakeStart: [
|
||||||
|
{required: false, message: "请输入开始桩号", trigger: "blur"}
|
||||||
|
],
|
||||||
|
stakeEnd: [
|
||||||
|
{required: false, message: "请输入结束桩号", trigger: "blur"}
|
||||||
|
],
|
||||||
|
targetLen: [
|
||||||
|
{type: "number", min: 0, message: "病害长度必须为正数", trigger: "change"}
|
||||||
|
],
|
||||||
|
targetArea: [
|
||||||
|
{type: "number", min: 0, message: "病害面积必须为正数", trigger: "change"}
|
||||||
|
]
|
||||||
|
// 可以根据需要添加更多校验规则
|
||||||
|
},
|
||||||
|
// 下拉选项
|
||||||
|
defectTypes: [
|
||||||
|
{label: "裂缝", value: "crack"},
|
||||||
|
{label: "坑槽", value: "pothole"},
|
||||||
|
{label: "脱皮", value: "peeling"}
|
||||||
|
// 添加更多病害类型
|
||||||
|
],
|
||||||
|
states: [
|
||||||
|
{label: "未处理", value: "untreated"},
|
||||||
|
{label: "处理中", value: "in_process"},
|
||||||
|
{label: "已处理", value: "processed"}
|
||||||
|
// 添加更多病害状态
|
||||||
|
]
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getTypeInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 转换为按分类、子分类的label和value格式
|
||||||
|
transformToDeepCategorizedLabelValue(data) {
|
||||||
|
const result = {};
|
||||||
|
|
||||||
|
data.items.forEach(item => {
|
||||||
|
Object.entries(item).forEach(([categoryKey, categoryValue]) => {
|
||||||
|
if (!result[categoryKey]) {
|
||||||
|
result[categoryKey] = {};
|
||||||
|
}
|
||||||
|
categoryValue.forEach(subCategory => {
|
||||||
|
Object.entries(subCategory).forEach(([subCategoryKey, subCategoryValue]) => {
|
||||||
|
if (!result[categoryKey][subCategoryKey]) {
|
||||||
|
result[categoryKey][subCategoryKey] = [];
|
||||||
|
}
|
||||||
|
// 处理嵌套的对象,将其转换为 label 和 value
|
||||||
|
if (typeof subCategoryValue === 'object') {
|
||||||
|
Object.entries(subCategoryValue).forEach(([key, value]) => {
|
||||||
|
result[categoryKey][subCategoryKey].push({
|
||||||
|
label: value,
|
||||||
|
value: key
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
result[categoryKey][subCategoryKey].push({
|
||||||
|
label: subCategoryValue,
|
||||||
|
value: subCategoryKey
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
getTypeInfo() {
|
||||||
|
listMetadata().then(response => {
|
||||||
|
console.log(response)
|
||||||
|
console.log(this.transformToDeepCategorizedLabelValue(JSON.parse(response.data)));
|
||||||
|
})
|
||||||
|
|
||||||
|
},
|
||||||
|
/** 查询缺陷列表 */
|
||||||
|
getList() {
|
||||||
|
|
||||||
|
let list = {
|
||||||
|
rows: [
|
||||||
|
{
|
||||||
|
"state": "1",
|
||||||
|
"media": [],
|
||||||
|
"segmentId": "7064484787674677248",
|
||||||
|
"segmentName": "testroad",
|
||||||
|
"createdTime": "2023-05-17T06:34:12.000Z",
|
||||||
|
"updatedTime": "2023-05-17T06:34:12.000Z",
|
||||||
|
"defectType": "0",
|
||||||
|
"stakeStart": "K000+000",
|
||||||
|
"stakeEnd": "K000+123",
|
||||||
|
"targetArea": 1,
|
||||||
|
"targetLen": 1,
|
||||||
|
"warningFlag": "0",
|
||||||
|
"inspectDirection": "0",
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
120,
|
||||||
|
30
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"id": "7064488256724795392",
|
||||||
|
"snapshotId": "7064488256724795392",
|
||||||
|
"equipmentId": "123",
|
||||||
|
"transformation": "0",
|
||||||
|
"taskid": "123456"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
total: 1420,
|
||||||
|
}
|
||||||
|
|
||||||
|
this.defectList = list.rows;
|
||||||
|
this.total = list.total;
|
||||||
|
this.loading = false;
|
||||||
|
return;
|
||||||
|
this.loading = true;
|
||||||
|
// 处理日期范围
|
||||||
|
const params = {...this.queryParams};
|
||||||
|
if (params.dateTime && params.dateTime.length === 2) {
|
||||||
|
params.startDate = params.dateTime[0];
|
||||||
|
params.endDate = params.dateTime[1];
|
||||||
|
}
|
||||||
|
delete params.dateTime;
|
||||||
|
delete params.lengthRange;
|
||||||
|
delete params.areaRange;
|
||||||
|
delete params.distanceRange;
|
||||||
|
|
||||||
|
listDefect(params)
|
||||||
|
.then(response => {
|
||||||
|
this.defectList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.resetFormData();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
resetForm(formName) {
|
||||||
|
this.$refs[formName].resetFields();
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.queryParams = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
segmentName: "",
|
||||||
|
dateTime: [],
|
||||||
|
defectType: [],
|
||||||
|
taskId: "",
|
||||||
|
state: [],
|
||||||
|
inspectDirection: [],
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
warningFlag: null,
|
||||||
|
minLen: null,
|
||||||
|
maxLen: null,
|
||||||
|
minArea: null,
|
||||||
|
maxArea: null,
|
||||||
|
minDistance: null,
|
||||||
|
maxDistance: null
|
||||||
|
};
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.resetFormData();
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.dialogTitle = "添加缺陷";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
if (row) {
|
||||||
|
// 通过行数据修改
|
||||||
|
this.loadDefect(row.id);
|
||||||
|
} else if (this.ids.length === 1) {
|
||||||
|
// 通过选中项修改
|
||||||
|
this.loadDefect(this.ids[0]);
|
||||||
|
} else {
|
||||||
|
this.$modal.msgWarning("请选择一条记录进行修改");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 加载缺陷数据 */
|
||||||
|
loadDefect(id) {
|
||||||
|
getDefect(id)
|
||||||
|
.then(response => {
|
||||||
|
this.form = {...response.data};
|
||||||
|
// 处理日期格式
|
||||||
|
if (this.form.createdTime) {
|
||||||
|
this.form.createdTime = new Date(this.form.createdTime);
|
||||||
|
}
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.dialogTitle = "修改缺陷";
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$modal.msgError("加载缺陷数据失败");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["defectForm"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id) {
|
||||||
|
// 更新缺陷
|
||||||
|
updateDefect(this.form)
|
||||||
|
.then(() => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$modal.msgError("修改失败");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 添加缺陷
|
||||||
|
addDefect(this.form)
|
||||||
|
.then(() => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$modal.msgError("新增失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row ? [row.id] : this.ids;
|
||||||
|
if (!ids.length) {
|
||||||
|
this.$modal.msgWarning("请选择要删除的记录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$modal
|
||||||
|
.confirm(`是否确认删除选中的${ids.length}条记录?`)
|
||||||
|
.then(() => {
|
||||||
|
return delDefect(ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('xj/defect/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `defect_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
/** 重置表单数据 */
|
||||||
|
resetFormData() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
segmentName: "",
|
||||||
|
defectType: "",
|
||||||
|
equipmentType: "",
|
||||||
|
createdTime: "",
|
||||||
|
updatedTime: "",
|
||||||
|
state: "",
|
||||||
|
stakeStart: "",
|
||||||
|
stakeEnd: "",
|
||||||
|
geometry: {
|
||||||
|
type: "Point",
|
||||||
|
coordinates: []
|
||||||
|
},
|
||||||
|
targetArea: null,
|
||||||
|
targetLen: null,
|
||||||
|
snapshotId: "",
|
||||||
|
taskId: "",
|
||||||
|
segmentId: "",
|
||||||
|
inspectDirection: "",
|
||||||
|
dataFrom: "",
|
||||||
|
warningFlag: 0,
|
||||||
|
equipmentId: "",
|
||||||
|
transformation: 0,
|
||||||
|
dataStatus: 0,
|
||||||
|
objDistance: null,
|
||||||
|
isCalibrated: 0,
|
||||||
|
count: 0,
|
||||||
|
media: []
|
||||||
|
};
|
||||||
|
this.resetForm("defectForm");
|
||||||
|
},
|
||||||
|
|
||||||
|
// 打开查看详情弹出框
|
||||||
|
viewDefect(defect) {
|
||||||
|
this.form = defect;
|
||||||
|
this.openViewDialog = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initMap();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 初始化天地图并标注病害位置
|
||||||
|
initMap() {
|
||||||
|
if (this.map) {
|
||||||
|
this.map.remove(); // 如果已经有地图实例,先移除再重新加载
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化天地图
|
||||||
|
this.map = new T.Map("mapContainer");
|
||||||
|
|
||||||
|
// 设置中心点为病害的坐标
|
||||||
|
const coordinates = this.form.geometry.coordinates;
|
||||||
|
if (coordinates && coordinates.length === 2) {
|
||||||
|
const lon = coordinates[0];
|
||||||
|
const lat = coordinates[1];
|
||||||
|
|
||||||
|
// 设置地图中心点
|
||||||
|
const center = new T.LngLat(lon, lat);
|
||||||
|
this.map.centerAndZoom(center, 15);
|
||||||
|
|
||||||
|
// 添加病害位置标注
|
||||||
|
const marker = new T.Marker(center);
|
||||||
|
this.map.addOverLay(marker);
|
||||||
|
} else {
|
||||||
|
console.error("无效的病害坐标");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 关闭对话框
|
||||||
|
closeDialog() {
|
||||||
|
this.openViewDialog = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.app-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb8 {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-padding {
|
||||||
|
padding: 0 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-width {
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
592
src/views/xj/route/index.vue
Normal file
592
src/views/xj/route/index.vue
Normal file
@ -0,0 +1,592 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="路线编码" prop="routeCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.routeCode"
|
||||||
|
placeholder="请输入路线编码,唯一"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="路线名称" prop="routeName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.routeName"
|
||||||
|
placeholder="请输入路线名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="路线全称" prop="fullName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.fullName"
|
||||||
|
placeholder="请输入路线全称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['xj:route:add']"
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['xj:route:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['xj:route:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['xj:route:export']"
|
||||||
|
>导出
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="routeList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
|
<el-table-column label="路线编码" align="center" prop="routeCode"/>
|
||||||
|
<el-table-column label="路线名称" align="center" prop="routeName"/>
|
||||||
|
<el-table-column label="路线全称" align="center" prop="fullName"/>
|
||||||
|
<el-table-column label="方向" align="center" prop="direction"/>
|
||||||
|
<el-table-column label="起点" align="center" prop="startPoint"/>
|
||||||
|
<el-table-column label="终点" align="center" prop="endPoint"/>
|
||||||
|
<el-table-column label="起点桩号" align="center" prop="startMilepost"/>
|
||||||
|
<el-table-column label="止点桩号" align="center" prop="endMilepost"/>
|
||||||
|
<el-table-column label="创建人" align="center" prop="createdBy"/>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createdAt" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createdAt, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="修改人" align="center" prop="updatedBy"/>
|
||||||
|
<el-table-column label="修改时间" align="center" prop="updatedAt" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updatedAt, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['xj:route:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['xj:route:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改道路线对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="80%" append-to-body>
|
||||||
|
<div style="display: flex;">
|
||||||
|
<!-- 左侧表单部分 -->
|
||||||
|
<div style="flex: 1; padding-right: 40px;">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="70px">
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="路线编码">
|
||||||
|
<el-input v-model="form.routeCode"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="路线名称">
|
||||||
|
<el-input v-model="form.routeName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="路线类型">
|
||||||
|
<el-input v-model="form.routeType"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="5">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="路线全称">
|
||||||
|
<el-input v-model="form.fullName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="方向">
|
||||||
|
<el-input v-model="form.direction"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="起点">
|
||||||
|
<el-input v-model="form.startPoint"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="终点">
|
||||||
|
<el-input v-model="form.endPoint"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="起点桩号">
|
||||||
|
<el-input v-model="form.startMilepost"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="止点桩号">
|
||||||
|
<el-input v-model="form.endMilepost"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="坐标点">
|
||||||
|
<el-input type="textarea" :disabled="true" v-model="form.coordinates" rows="4"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form.remarks"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧地图部分 -->
|
||||||
|
<div style="flex: 1; position: relative;">
|
||||||
|
<div id="add_map" ref="mapContainer" class="no-hand-cursor"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {listRoute, getRoute, delRoute, addRoute, updateRoute} from "@/api/xj/route";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Route",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
menuOpen: false,
|
||||||
|
markers: [],
|
||||||
|
dialogVisible: false, // 控制dialog显示
|
||||||
|
routeForm: {
|
||||||
|
routeCode: '',
|
||||||
|
routeName: '',
|
||||||
|
routeFullName: '',
|
||||||
|
direction: '',
|
||||||
|
startPoint: '',
|
||||||
|
endPoint: '',
|
||||||
|
startStake: '',
|
||||||
|
endStake: '',
|
||||||
|
coordinates: '',
|
||||||
|
remark: ''
|
||||||
|
},
|
||||||
|
lines: [], // 保存所有添加的连线
|
||||||
|
map: null,
|
||||||
|
markerLayer: null,
|
||||||
|
previousPoint: null,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 道路线表格数据
|
||||||
|
routeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
routeCode: null,
|
||||||
|
routeName: null,
|
||||||
|
fullName: null,
|
||||||
|
routeType: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
coordinates: '',
|
||||||
|
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
routeCode: [
|
||||||
|
{required: true, message: "路线编码,唯一不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
routeName: [
|
||||||
|
{required: true, message: "路线名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
routeType: [
|
||||||
|
{required: true, message: "路线类型不能为空", trigger: "change"}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.dialogVisible = false;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
undoLastAction() {
|
||||||
|
// 撤销最后一次添加的点和连线
|
||||||
|
if (this.lines.length > 0) {
|
||||||
|
const lastLine = this.lines.pop();
|
||||||
|
this.map.removeOverLay(lastLine);// 从地图中移除最后一条线
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.lines.length == 0) {
|
||||||
|
this.resetMap();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.markers.pop();
|
||||||
|
// 更新上一个点为撤销后的点
|
||||||
|
this.previousPoint = this.markers.length > 0 ? this.markers[this.markers.length - 1].getLngLat() : null;
|
||||||
|
|
||||||
|
// 更新坐标点 textarea
|
||||||
|
const coordArr = this.form.coordinates.split(';');
|
||||||
|
coordArr.pop(); // 移除最后一个坐标
|
||||||
|
this.form.coordinates = coordArr.join(';');
|
||||||
|
},
|
||||||
|
|
||||||
|
resetMap() {
|
||||||
|
// 清空坐标点、地图上的所有覆盖物
|
||||||
|
this.form.coordinates = '';
|
||||||
|
this.previousPoint = null;
|
||||||
|
this.map.clearOverLays();
|
||||||
|
this.markers = [];
|
||||||
|
this.lines = [];
|
||||||
|
},
|
||||||
|
initMap() {
|
||||||
|
if (!this.map){
|
||||||
|
// 初始化天地图
|
||||||
|
|
||||||
|
this.map = new T.Map('add_map');
|
||||||
|
this.map.centerAndZoom(new T.LngLat(116.40769, 39.89945), 12); // 设置中心点和缩放级别
|
||||||
|
|
||||||
|
// 添加双击事件
|
||||||
|
this.map.on("click", this.onMapClick);
|
||||||
|
|
||||||
|
// 添加右键菜单
|
||||||
|
this.map.on("contextmenu", this.onMapRightClick);
|
||||||
|
}else{
|
||||||
|
this.resetMap()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
onMapClick(e) {
|
||||||
|
if (this.menuOpen) {
|
||||||
|
this.menuOpen = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const latLng = e.lnglat;
|
||||||
|
const point = `${latLng.lng},${latLng.lat}`;
|
||||||
|
|
||||||
|
// 追加经纬度到textarea
|
||||||
|
if(this.form.coordinates == null){
|
||||||
|
this.form.coordinates = '';
|
||||||
|
}
|
||||||
|
this.form.coordinates += this.form.coordinates ? `;${point}` : point;
|
||||||
|
|
||||||
|
// 绘制点和连线
|
||||||
|
|
||||||
|
const marker = new T.Marker(latLng);
|
||||||
|
|
||||||
|
|
||||||
|
this.markers.push(marker); // 保存点
|
||||||
|
// 连线
|
||||||
|
if (this.previousPoint) {
|
||||||
|
const line = new T.Polyline([this.previousPoint, latLng], {
|
||||||
|
strokeColor: "blue",
|
||||||
|
strokeWeight: 3,
|
||||||
|
strokeOpacity: 0.7
|
||||||
|
});
|
||||||
|
this.map.addOverLay(line);
|
||||||
|
this.lines.push(line)
|
||||||
|
}
|
||||||
|
if (this.lines.length == 0 ){
|
||||||
|
this.map.addOverLay(marker)
|
||||||
|
}
|
||||||
|
this.previousPoint = latLng; // 记录上一个点
|
||||||
|
},
|
||||||
|
drawExistingCoordinates() {
|
||||||
|
// 如果有保存的坐标点数据
|
||||||
|
if (this.form.coordinates) {
|
||||||
|
const coordArr = this.form.coordinates.split(';');
|
||||||
|
let previousLatLng = null;
|
||||||
|
|
||||||
|
coordArr.forEach((coord, index) => {
|
||||||
|
const [lng, lat] = coord.split(',').map(Number);
|
||||||
|
const latLng = new T.LngLat(lng, lat);
|
||||||
|
|
||||||
|
// 绘制点
|
||||||
|
const marker = new T.Marker(latLng);
|
||||||
|
this.markers.push(marker);
|
||||||
|
|
||||||
|
// 如果有上一个点,绘制连线
|
||||||
|
if (previousLatLng) {
|
||||||
|
const line = new T.Polyline([previousLatLng, latLng], {
|
||||||
|
strokeColor: "blue",
|
||||||
|
strokeWeight: 3,
|
||||||
|
strokeOpacity: 0.7
|
||||||
|
});
|
||||||
|
this.map.addOverLay(line);
|
||||||
|
this.lines.push(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将当前点设置为 previousPoint,最后一个点会被设置为最后的 previousPoint
|
||||||
|
previousLatLng = latLng;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置最后一个点为当前的 previousPoint,方便继续绘制
|
||||||
|
this.previousPoint = previousLatLng;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onMapRightClick(e) {
|
||||||
|
this.menuOpen = true;
|
||||||
|
var menu = new T.ContextMenu({
|
||||||
|
width: 50
|
||||||
|
});
|
||||||
|
var _MenuItem1 = new T.MenuItem("撤销", this.undoLastAction);
|
||||||
|
|
||||||
|
var _MenuItem2 = new T.MenuItem("重绘", this.resetMap);
|
||||||
|
|
||||||
|
menu.addItem(_MenuItem1);
|
||||||
|
|
||||||
|
menu.addItem(_MenuItem2);
|
||||||
|
this.map.addContextMenu(menu);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询道路线列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listRoute(this.queryParams).then(response => {
|
||||||
|
this.routeList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
routeCode: null,
|
||||||
|
routeName: null,
|
||||||
|
fullName: null,
|
||||||
|
routeType: null,
|
||||||
|
direction: null,
|
||||||
|
startPoint: null,
|
||||||
|
endPoint: null,
|
||||||
|
coordinates: null,
|
||||||
|
startMilepost: null,
|
||||||
|
endMilepost: null,
|
||||||
|
remarks: null,
|
||||||
|
createdBy: null,
|
||||||
|
createdAt: null,
|
||||||
|
updatedBy: null,
|
||||||
|
updatedAt: null,
|
||||||
|
deletedBy: null,
|
||||||
|
deletedAt: null,
|
||||||
|
isDeleted: null,
|
||||||
|
companyId: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.dialogVisible = true;
|
||||||
|
|
||||||
|
this.title = "添加道路线";
|
||||||
|
let that = this;
|
||||||
|
setTimeout(function () {
|
||||||
|
that.initMap();
|
||||||
|
}, 100)
|
||||||
|
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getRoute(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.title = "修改道路线";
|
||||||
|
let that = this;
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
that.initMap();
|
||||||
|
that.drawExistingCoordinates()
|
||||||
|
},200)
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateRoute(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addRoute(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除道路线编号为"' + ids + '"的数据项?').then(function () {
|
||||||
|
return delRoute(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('xj/route/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `route_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
.no-hand-cursor {
|
||||||
|
cursor: default !important;
|
||||||
|
width: 100%;
|
||||||
|
height: 500px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
543
src/views/xj/segment/index.vue
Normal file
543
src/views/xj/segment/index.vue
Normal file
@ -0,0 +1,543 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
|
||||||
|
<el-form-item label="路段名称" prop="routeName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.segname"
|
||||||
|
placeholder="请输入路线名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['xj:route:add']"
|
||||||
|
>新增
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['xj:route:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['xj:route:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['xj:route:export']"
|
||||||
|
>导出
|
||||||
|
</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="routeList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
|
<el-table-column label="路段名称" align="center" prop="segname"/>
|
||||||
|
<el-table-column label="路段编码" align="center" prop="segcode"/>
|
||||||
|
<el-table-column label="起始桩" align="center" prop="stakestart"/>
|
||||||
|
<el-table-column label="终止桩" align="center" prop="stakeend"/>
|
||||||
|
<el-table-column label="道路类型" align="center" prop="roadtype"/>
|
||||||
|
<el-table-column label="里程" align="center" prop="mileage"/>
|
||||||
|
<el-table-column label="车道数量" align="center" prop="lanecount"/>
|
||||||
|
<el-table-column label="城市" align="center" prop="city"/>
|
||||||
|
<el-table-column label="区县" align="center" prop="district"/>
|
||||||
|
<el-table-column label="最大限速" align="center" prop="maxspeedlimit"/>
|
||||||
|
|
||||||
|
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['xj:route:edit']"
|
||||||
|
>修改
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['xj:route:remove']"
|
||||||
|
>删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改道路线对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="dialogVisible" width="80%" append-to-body>
|
||||||
|
<div style="display: flex;">
|
||||||
|
<!-- 左侧表单部分 -->
|
||||||
|
<div style="flex: 1; padding-right: 20px;">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="路段编码">
|
||||||
|
<el-input v-model="form.segcode"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="路段名称">
|
||||||
|
<el-input v-model="form.segname"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="道路类型">
|
||||||
|
<el-input v-model="form.roadtype"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="里程">
|
||||||
|
<el-input v-model="form.mileage"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="车道数量">
|
||||||
|
<el-input v-model="form.lanecount"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="城市">
|
||||||
|
<el-input v-model="form.city"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="区县">
|
||||||
|
<el-input v-model="form.district"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="养护级别">
|
||||||
|
<el-input v-model="form.curinglevel"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="最大限速">
|
||||||
|
<el-input v-model="form.maxspeedlimit"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="备注">
|
||||||
|
<el-input v-model="form.mark"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧地图部分 -->
|
||||||
|
<div style="flex: 1; position: relative;">
|
||||||
|
<div id="add_map" ref="mapContainer" class="no-hand-cursor"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {listRoute, getRoute, delRoute, addRoute, updateRoute} from "@/api/xj/route";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Route",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
menuOpen: false,
|
||||||
|
markers: [],
|
||||||
|
dialogVisible: false, // 控制dialog显示
|
||||||
|
routeForm: {
|
||||||
|
routeCode: '',
|
||||||
|
routeName: '',
|
||||||
|
routeFullName: '',
|
||||||
|
direction: '',
|
||||||
|
startPoint: '',
|
||||||
|
endPoint: '',
|
||||||
|
startStake: '',
|
||||||
|
endStake: '',
|
||||||
|
coordinates: '',
|
||||||
|
remark: ''
|
||||||
|
},
|
||||||
|
lines: [], // 保存所有添加的连线
|
||||||
|
map: null,
|
||||||
|
markerLayer: null,
|
||||||
|
previousPoint: null,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 道路线表格数据
|
||||||
|
routeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
routeCode: null,
|
||||||
|
routeName: null,
|
||||||
|
fullName: null,
|
||||||
|
routeType: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
coordinates: '',
|
||||||
|
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
routeCode: [
|
||||||
|
{required: true, message: "路线编码,唯一不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
routeName: [
|
||||||
|
{required: true, message: "路线名称不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
routeType: [
|
||||||
|
{required: true, message: "路线类型不能为空", trigger: "change"}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.dialogVisible = false;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
undoLastAction() {
|
||||||
|
// 撤销最后一次添加的点和连线
|
||||||
|
if (this.lines.length > 0) {
|
||||||
|
const lastLine = this.lines.pop();
|
||||||
|
this.map.removeOverLay(lastLine);// 从地图中移除最后一条线
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.lines.length == 0) {
|
||||||
|
this.resetMap();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.markers.pop();
|
||||||
|
// 更新上一个点为撤销后的点
|
||||||
|
this.previousPoint = this.markers.length > 0 ? this.markers[this.markers.length - 1].getLngLat() : null;
|
||||||
|
|
||||||
|
// 更新坐标点 textarea
|
||||||
|
const coordArr = this.form.coordinates.split(';');
|
||||||
|
coordArr.pop(); // 移除最后一个坐标
|
||||||
|
this.form.coordinates = coordArr.join(';');
|
||||||
|
},
|
||||||
|
|
||||||
|
resetMap() {
|
||||||
|
// 清空坐标点、地图上的所有覆盖物
|
||||||
|
this.form.coordinates = '';
|
||||||
|
this.previousPoint = null;
|
||||||
|
this.map.clearOverLays();
|
||||||
|
this.markers = [];
|
||||||
|
this.lines = [];
|
||||||
|
},
|
||||||
|
initMap() {
|
||||||
|
if (!this.map){
|
||||||
|
// 初始化天地图
|
||||||
|
|
||||||
|
this.map = new T.Map('add_map');
|
||||||
|
this.map.centerAndZoom(new T.LngLat(116.40769, 39.89945), 12); // 设置中心点和缩放级别
|
||||||
|
|
||||||
|
// 添加双击事件
|
||||||
|
this.map.on("click", this.onMapClick);
|
||||||
|
|
||||||
|
// 添加右键菜单
|
||||||
|
this.map.on("contextmenu", this.onMapRightClick);
|
||||||
|
}else{
|
||||||
|
this.resetMap()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
onMapClick(e) {
|
||||||
|
if (this.menuOpen) {
|
||||||
|
this.menuOpen = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const latLng = e.lnglat;
|
||||||
|
const point = `${latLng.lng},${latLng.lat}`;
|
||||||
|
|
||||||
|
// 追加经纬度到textarea
|
||||||
|
if(this.form.coordinates == null){
|
||||||
|
this.form.coordinates = '';
|
||||||
|
}
|
||||||
|
this.form.coordinates += this.form.coordinates ? `;${point}` : point;
|
||||||
|
|
||||||
|
// 绘制点和连线
|
||||||
|
|
||||||
|
const marker = new T.Marker(latLng);
|
||||||
|
|
||||||
|
|
||||||
|
this.markers.push(marker); // 保存点
|
||||||
|
// 连线
|
||||||
|
if (this.previousPoint) {
|
||||||
|
const line = new T.Polyline([this.previousPoint, latLng], {
|
||||||
|
strokeColor: "blue",
|
||||||
|
strokeWeight: 3,
|
||||||
|
strokeOpacity: 0.7
|
||||||
|
});
|
||||||
|
this.map.addOverLay(line);
|
||||||
|
this.lines.push(line)
|
||||||
|
}
|
||||||
|
if (this.lines.length == 0 ){
|
||||||
|
this.map.addOverLay(marker)
|
||||||
|
}
|
||||||
|
this.previousPoint = latLng; // 记录上一个点
|
||||||
|
},
|
||||||
|
drawExistingCoordinates() {
|
||||||
|
// 如果有保存的坐标点数据
|
||||||
|
if (this.form.coordinates) {
|
||||||
|
const coordArr = this.form.coordinates.split(';');
|
||||||
|
let previousLatLng = null;
|
||||||
|
|
||||||
|
coordArr.forEach((coord, index) => {
|
||||||
|
const [lng, lat] = coord.split(',').map(Number);
|
||||||
|
const latLng = new T.LngLat(lng, lat);
|
||||||
|
|
||||||
|
// 绘制点
|
||||||
|
const marker = new T.Marker(latLng);
|
||||||
|
this.markers.push(marker);
|
||||||
|
|
||||||
|
// 如果有上一个点,绘制连线
|
||||||
|
if (previousLatLng) {
|
||||||
|
const line = new T.Polyline([previousLatLng, latLng], {
|
||||||
|
strokeColor: "blue",
|
||||||
|
strokeWeight: 3,
|
||||||
|
strokeOpacity: 0.7
|
||||||
|
});
|
||||||
|
this.map.addOverLay(line);
|
||||||
|
this.lines.push(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将当前点设置为 previousPoint,最后一个点会被设置为最后的 previousPoint
|
||||||
|
previousLatLng = latLng;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 设置最后一个点为当前的 previousPoint,方便继续绘制
|
||||||
|
this.previousPoint = previousLatLng;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onMapRightClick(e) {
|
||||||
|
this.menuOpen = true;
|
||||||
|
var menu = new T.ContextMenu({
|
||||||
|
width: 50
|
||||||
|
});
|
||||||
|
var _MenuItem1 = new T.MenuItem("撤销", this.undoLastAction);
|
||||||
|
|
||||||
|
var _MenuItem2 = new T.MenuItem("重绘", this.resetMap);
|
||||||
|
|
||||||
|
menu.addItem(_MenuItem1);
|
||||||
|
|
||||||
|
menu.addItem(_MenuItem2);
|
||||||
|
this.map.addContextMenu(menu);
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询道路线列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listRoute(this.queryParams).then(response => {
|
||||||
|
this.routeList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
routeCode: null,
|
||||||
|
routeName: null,
|
||||||
|
fullName: null,
|
||||||
|
routeType: null,
|
||||||
|
direction: null,
|
||||||
|
startPoint: null,
|
||||||
|
endPoint: null,
|
||||||
|
coordinates: null,
|
||||||
|
startMilepost: null,
|
||||||
|
endMilepost: null,
|
||||||
|
remarks: null,
|
||||||
|
createdBy: null,
|
||||||
|
createdAt: null,
|
||||||
|
updatedBy: null,
|
||||||
|
updatedAt: null,
|
||||||
|
deletedBy: null,
|
||||||
|
deletedAt: null,
|
||||||
|
isDeleted: null,
|
||||||
|
companyId: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.dialogVisible = true;
|
||||||
|
|
||||||
|
this.title = "添加道路线";
|
||||||
|
let that = this;
|
||||||
|
setTimeout(function () {
|
||||||
|
that.initMap();
|
||||||
|
}, 100)
|
||||||
|
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getRoute(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.title = "修改道路线";
|
||||||
|
let that = this;
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
that.initMap();
|
||||||
|
that.drawExistingCoordinates()
|
||||||
|
},200)
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateRoute(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addRoute(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除道路线编号为"' + ids + '"的数据项?').then(function () {
|
||||||
|
return delRoute(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('xj/route/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `route_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
|
||||||
|
.no-hand-cursor {
|
||||||
|
cursor: default !important;
|
||||||
|
width: 100%;
|
||||||
|
height: 500px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user