This commit is contained in:
parent
60909c08d5
commit
0cfd460156
|
|
@ -0,0 +1,11 @@
|
||||||
|
const isCamera = false; // 是否开启相机限制
|
||||||
|
const cameraLon = 116.3974;
|
||||||
|
const cameraLat = 39.9042;
|
||||||
|
const cameraRadius = 40000;
|
||||||
|
|
||||||
|
window.mapConfig = {
|
||||||
|
isCamera: isCamera,
|
||||||
|
cameraLon: cameraLon,
|
||||||
|
cameraLat: cameraLat,
|
||||||
|
cameraRadius: cameraRadius
|
||||||
|
};
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="">
|
<html lang="">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<meta base="/platform/">
|
<meta base="/platform/">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title>
|
||||||
|
<%= htmlWebpackPlugin.options.title %>
|
||||||
|
</title>
|
||||||
|
<script src="/config.js"></script>
|
||||||
|
|
||||||
<!-- <link rel="stylesheet" href="/dep/mars3d/mars3d/divGraphic.css" /> -->
|
<!-- <link rel="stylesheet" href="/dep/mars3d/mars3d/divGraphic.css" /> -->
|
||||||
<!-- ***_*** -->
|
<!-- ***_*** -->
|
||||||
|
|
@ -26,6 +30,7 @@
|
||||||
<script src="http://mars3d.cn/lib/mars3d/mars3d.js" type="text/javascript"></script> -->
|
<script src="http://mars3d.cn/lib/mars3d/mars3d.js" type="text/javascript"></script> -->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
<strong>htmlWebpackPlugin.options</strong>
|
<strong>htmlWebpackPlugin.options</strong>
|
||||||
|
|
@ -33,4 +38,5 @@
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export function whitListList(data) {
|
||||||
|
return request({
|
||||||
|
url: "/api/WhitList/list",
|
||||||
|
method: "get",
|
||||||
|
params: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function whitListAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: "/api/WhitList/add",
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function whitListUpdate(data) {
|
||||||
|
return request({
|
||||||
|
url: "/api/WhitList/update",
|
||||||
|
method: "post",
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function whitListDelete(data) {
|
||||||
|
return request({
|
||||||
|
url: "/api/WhitList/delete",
|
||||||
|
method: "delete",
|
||||||
|
params: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -315,6 +315,9 @@
|
||||||
.el-time-spinner__item.active:not(.disabled) {
|
.el-time-spinner__item.active:not(.disabled) {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
.el-time-panel {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
.el-time-panel__btn {
|
.el-time-panel__btn {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
@ -464,6 +467,16 @@
|
||||||
.el-cascader {
|
.el-cascader {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.el-date-editor {
|
||||||
|
width: 100% !important;
|
||||||
|
.el-range-input {
|
||||||
|
background-color: transparent;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.el-range-separator {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
.avatar-uploader {
|
.avatar-uploader {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
@ -510,7 +523,11 @@
|
||||||
.el-date-table td.in-range div:hover,
|
.el-date-table td.in-range div:hover,
|
||||||
.el-date-table.is-week-mode .el-date-table__row.current div,
|
.el-date-table.is-week-mode .el-date-table__row.current div,
|
||||||
.el-date-table.is-week-mode .el-date-table__row:hover div {
|
.el-date-table.is-week-mode .el-date-table__row:hover div {
|
||||||
background-color: rgb(50, 77, 109) !important;
|
background-color: rgb(13, 49, 211) !important;
|
||||||
|
}
|
||||||
|
.el-date-range-picker__time-picker-wrap {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
.el-time-range-picker__header {
|
.el-time-range-picker__header {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
|
||||||
|
|
@ -119,11 +119,11 @@ body {
|
||||||
margin-right: 40px;
|
margin-right: 40px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
.menuItem {
|
.menuItem {
|
||||||
width: 283px;
|
width: 305px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-right: 20px;
|
margin-right: 10px;
|
||||||
.menuFor {
|
.menuFor {
|
||||||
width: 41px;
|
width: 41px;
|
||||||
height: 41px;
|
height: 41px;
|
||||||
|
|
@ -363,11 +363,14 @@ body {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: flex-start;
|
||||||
|
align-content: flex-start;
|
||||||
.device-item {
|
.device-item {
|
||||||
//一排三个
|
//一排三个
|
||||||
width: 30%;
|
width: 30%;
|
||||||
height: 30%;
|
height: 30%;
|
||||||
|
margin-left: 3%;
|
||||||
|
margin-top: 2%;
|
||||||
.device-icon {
|
.device-icon {
|
||||||
width: 66px;
|
width: 66px;
|
||||||
height: 66px;
|
height: 66px;
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,7 @@ export default {
|
||||||
deviceManufacturerQuery() {
|
deviceManufacturerQuery() {
|
||||||
return this.deviceManufacturer;
|
return this.deviceManufacturer;
|
||||||
},
|
},
|
||||||
// 根据城市编码查询地图位置
|
|
||||||
changeCascader(row) {
|
changeCascader(row) {
|
||||||
console.log(row);
|
console.log(row);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ export default {
|
||||||
this.mapMars.clock.stopTime = stop.clone();
|
this.mapMars.clock.stopTime = stop.clone();
|
||||||
this.mapMars.clock.currentTime = start.clone();
|
this.mapMars.clock.currentTime = start.clone();
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
this.mapMars.clock.clockRange = Cesium.ClockRange.UNBOUNDED;
|
this.mapMars.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
|
||||||
this.mapMars.clock.multiplier = 1;
|
this.mapMars.clock.multiplier = 1;
|
||||||
if (this.mapMars.controls.timeline) {
|
if (this.mapMars.controls.timeline) {
|
||||||
this.mapMars.controls.timeline.zoomTo(start, stop);
|
this.mapMars.controls.timeline.zoomTo(start, stop);
|
||||||
|
|
|
||||||
|
|
@ -73,26 +73,39 @@ export default {
|
||||||
deviceStatus: [],
|
deviceStatus: [],
|
||||||
positionData: [],
|
positionData: [],
|
||||||
isContracted: false,
|
isContracted: false,
|
||||||
homeView: {}
|
lastPositionsHash: null // 初始化为 null,避免首次误判
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
homeData: {
|
"homeData.positions": {
|
||||||
handler(newVal) {
|
handler(newPositions) {
|
||||||
this.homeView = newVal;
|
newPositions = newPositions || [];
|
||||||
this.positionData = newVal.positions;
|
|
||||||
},
|
const currentHash = JSON.stringify(newPositions);
|
||||||
deep: true
|
|
||||||
|
// 比较新旧数据(首次加载时 lastPositionsHash 为 null)
|
||||||
|
if (
|
||||||
|
this.lastPositionsHash !== null &&
|
||||||
|
currentHash === this.lastPositionsHash
|
||||||
|
) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
},
|
|
||||||
mounted() {
|
// 数据变化或首次加载
|
||||||
let time = setInterval(() => {
|
if (newPositions.length > 0) {
|
||||||
if (this.positionData.length > 0) {
|
this.lastPositionsHash = currentHash; // 更新缓存
|
||||||
clearInterval(time);
|
this.positionData = newPositions;
|
||||||
|
this.homeView = this.homeData;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
console.log("Calling handleTitleClick due to positions change");
|
||||||
this.handleTitleClick(true, "all");
|
this.handleTitleClick(true, "all");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, 500);
|
|
||||||
},
|
},
|
||||||
|
immediate: true // 初始加载时触发
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
handleContractClick() {
|
handleContractClick() {
|
||||||
this.isContracted = !this.isContracted; // 切换状态
|
this.isContracted = !this.isContracted; // 切换状态
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ import LogDialog from "../../menuData/LogDialog.vue"; // ID: 3
|
||||||
import AlertDialog from "../../menuData/AlertDialog.vue"; // ID: 5
|
import AlertDialog from "../../menuData/AlertDialog.vue"; // ID: 5
|
||||||
import PositionDialog from "../../menuData/PositionDialog.vue"; // ID: 6
|
import PositionDialog from "../../menuData/PositionDialog.vue"; // ID: 6
|
||||||
import AnalysisDialog from "../../menuData/AnalysisDialog.vue"; // ID: 7
|
import AnalysisDialog from "../../menuData/AnalysisDialog.vue"; // ID: 7
|
||||||
|
import WhitListDialog from "../../menuData/WhitListDialog.vue"; // ID: 8
|
||||||
import { userUpdatepwd } from "@/api/user.js";
|
import { userUpdatepwd } from "@/api/user.js";
|
||||||
export default {
|
export default {
|
||||||
name: "header-top",
|
name: "header-top",
|
||||||
|
|
@ -120,7 +121,8 @@ export default {
|
||||||
LogDialog,
|
LogDialog,
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
PositionDialog,
|
PositionDialog,
|
||||||
AnalysisDialog
|
AnalysisDialog,
|
||||||
|
WhitListDialog
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
homeData: {
|
homeData: {
|
||||||
|
|
@ -172,6 +174,12 @@ export default {
|
||||||
name: "统计分析",
|
name: "统计分析",
|
||||||
icon: require("@/assets/img/menu/tjfx.png"),
|
icon: require("@/assets/img/menu/tjfx.png"),
|
||||||
iconActive: require("@/assets/img/menu/tjfx-hove.png")
|
iconActive: require("@/assets/img/menu/tjfx-hove.png")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 8,
|
||||||
|
name: "白名单",
|
||||||
|
icon: require("@/assets/img/menu/tjfx.png"),
|
||||||
|
iconActive: require("@/assets/img/menu/tjfx-hove.png")
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
quanping: [
|
quanping: [
|
||||||
|
|
@ -303,6 +311,9 @@ export default {
|
||||||
this.currentDialog = "LogDialog";
|
this.currentDialog = "LogDialog";
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
this.showDialog = false;
|
||||||
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
this.currentDialog = "AlertDialog";
|
this.currentDialog = "AlertDialog";
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
|
|
@ -315,9 +326,9 @@ export default {
|
||||||
this.currentDialog = "AnalysisDialog";
|
this.currentDialog = "AnalysisDialog";
|
||||||
this.showDialog = true;
|
this.showDialog = true;
|
||||||
break;
|
break;
|
||||||
case 4:
|
|
||||||
case 8:
|
case 8:
|
||||||
this.showDialog = false;
|
this.currentDialog = "WhitListDialog";
|
||||||
|
this.showDialog = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,7 @@ export function mapUavFiex(options) {
|
||||||
graphicLayer.remove();
|
graphicLayer.remove();
|
||||||
} else {
|
} else {
|
||||||
options.forEach((item) => {
|
options.forEach((item) => {
|
||||||
|
if (item.drone_lon !== 0 || item.drone_lat !== 0) {
|
||||||
let graphic = graphicLayer.getGraphicById(item.BatchId);
|
let graphic = graphicLayer.getGraphicById(item.BatchId);
|
||||||
// let startPoint = graphicLayer.getGraphicById(item.BatchId + "start"); // 起始点
|
// let startPoint = graphicLayer.getGraphicById(item.BatchId + "start"); // 起始点
|
||||||
|
|
||||||
|
|
@ -307,11 +308,12 @@ export function mapUavFiex(options) {
|
||||||
|
|
||||||
graphic.attr = item;
|
graphic.attr = item;
|
||||||
bindLayerPopup(graphicLayer, graphic);
|
bindLayerPopup(graphicLayer, graphic);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.app_lon !== 0 || item.app_lat !== 0) {
|
||||||
let app_graphic = graphicLayer.getGraphicById(item.BatchId + "_app");
|
let app_graphic = graphicLayer.getGraphicById(item.BatchId + "_app");
|
||||||
// let startPoint = graphicLayer.getGraphicById(item.BatchId + "start"); // 起始点
|
// let startPoint = graphicLayer.getGraphicById(item.BatchId + "start"); // 起始点
|
||||||
|
//发现飞手
|
||||||
//发现无人机
|
|
||||||
if (!app_graphic) {
|
if (!app_graphic) {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
app_graphic = new mars3d.graphic.Route({
|
app_graphic = new mars3d.graphic.Route({
|
||||||
|
|
@ -340,40 +342,8 @@ export function mapUavFiex(options) {
|
||||||
});
|
});
|
||||||
graphicLayer.addGraphic(app_graphic);
|
graphicLayer.addGraphic(app_graphic);
|
||||||
}
|
}
|
||||||
// 起始点位
|
}
|
||||||
// if (item.lon !== 0 && item.lat !== 0) {
|
// 更新发现无人机设备的大小
|
||||||
// if (!startPoint) {
|
|
||||||
// // eslint-disable-next-line no-undef
|
|
||||||
// startPoint = new mars3d.graphic.BillboardEntity({
|
|
||||||
// id: item.BatchId + "start",
|
|
||||||
// // eslint-disable-next-line no-undef
|
|
||||||
// position: new mars3d.LngLatPoint(item.lon, item.lat, item.alt),
|
|
||||||
// style: {
|
|
||||||
// image: require("@/assets/img/uav.svg"),
|
|
||||||
// scale: 1,
|
|
||||||
// // eslint-disable-next-line no-undef
|
|
||||||
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
||||||
// // eslint-disable-next-line no-undef
|
|
||||||
// verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
||||||
// label: {
|
|
||||||
// text: "起始点",
|
|
||||||
// font: "14px Arial",
|
|
||||||
// color: "#ffffff",
|
|
||||||
// outline: true,
|
|
||||||
// outlineColor: "#000000",
|
|
||||||
// outlineWidth: 2,
|
|
||||||
// // eslint-disable-next-line no-undef
|
|
||||||
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
||||||
// // eslint-disable-next-line no-undef
|
|
||||||
// verticalOrigin: Cesium.VerticalOrigin.BOTTOM
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// show: false,
|
|
||||||
// attr: item
|
|
||||||
// });
|
|
||||||
// graphicLayer.addGraphic(startPoint);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
let graphicDevice = window.marsMap.getLayerById("devLog");
|
let graphicDevice = window.marsMap.getLayerById("devLog");
|
||||||
if (graphicDevice) {
|
if (graphicDevice) {
|
||||||
let deviceGraphic = graphicDevice.getGraphicById(item.DeviceId);
|
let deviceGraphic = graphicDevice.getGraphicById(item.DeviceId);
|
||||||
|
|
@ -391,6 +361,7 @@ export function mapUavFiex(options) {
|
||||||
// 取出对应无人机的轨迹列表
|
// 取出对应无人机的轨迹列表
|
||||||
options.map((item) => {
|
options.map((item) => {
|
||||||
if (item.BatchId === car.id) {
|
if (item.BatchId === car.id) {
|
||||||
|
if (item.drone_lon !== 0 || item.drone_lat !== 0) {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const point = new mars3d.LngLatPoint(
|
const point = new mars3d.LngLatPoint(
|
||||||
item.drone_lon,
|
item.drone_lon,
|
||||||
|
|
@ -398,11 +369,14 @@ export function mapUavFiex(options) {
|
||||||
item.height
|
item.height
|
||||||
);
|
);
|
||||||
car.addDynamicPosition(point, 0);
|
car.addDynamicPosition(point, 0);
|
||||||
|
}
|
||||||
} else if (item.BatchId + "_app" === car.id) {
|
} else if (item.BatchId + "_app" === car.id) {
|
||||||
|
if (item.app_lon !== 0 || item.app_lat !== 0) {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const point = new mars3d.LngLatPoint(item.app_lon, item.app_lat, 0);
|
const point = new mars3d.LngLatPoint(item.app_lon, item.app_lat, 0);
|
||||||
car.addDynamicPosition(point, 0);
|
car.addDynamicPosition(point, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@ export default {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
map.on(mars3d.EventType.click, this.map_clickHandler, map);
|
map.on(mars3d.EventType.click, this.map_clickHandler, map);
|
||||||
map.on(mars3d.EventType.cameraMoveEnd, this.map_zoomHandler, map);
|
map.on(mars3d.EventType.cameraMoveEnd, this.map_zoomHandler, map);
|
||||||
|
// map.scene.screenSpaceCameraController.enableTranslate = false;
|
||||||
|
// map.scene.screenSpaceCameraController.enableRotate = false; // 禁用旋转
|
||||||
|
// map.scene.screenSpaceCameraController.enableTilt = false; // 禁用倾斜
|
||||||
|
// map.scene.screenSpaceCameraController.enableZoom = false; // 禁用缩放
|
||||||
},
|
},
|
||||||
map_clickHandler(event) {
|
map_clickHandler(event) {
|
||||||
console.log(event);
|
console.log(event);
|
||||||
|
|
@ -72,6 +76,26 @@ export default {
|
||||||
},
|
},
|
||||||
onMapLoad(map) {
|
onMapLoad(map) {
|
||||||
map.changeMouseModel(true);
|
map.changeMouseModel(true);
|
||||||
|
// 在地图初始化后禁用平移
|
||||||
|
let camera = window.mapConfig;
|
||||||
|
console.log(camera, "camera");
|
||||||
|
if (camera.isCamera) {
|
||||||
|
let cameraHistory = new mars3d.thing.CameraHistory({
|
||||||
|
limit: {
|
||||||
|
// 限定视角范围
|
||||||
|
position: Cesium.Cartesian3.fromDegrees(
|
||||||
|
camera.cameraLon,
|
||||||
|
camera.cameraLat,
|
||||||
|
0
|
||||||
|
),
|
||||||
|
radius: camera.cameraRadius,
|
||||||
|
debugExtent: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map.addThing(cameraHistory);
|
||||||
|
map.scene.screenSpaceCameraController.minimumZoomDistance = 1000; //相机的高度的最小值
|
||||||
|
map.scene.screenSpaceCameraController.maximumZoomDistance = 500000; //相机高度的最大值
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@
|
||||||
:visible.sync="drawer"
|
:visible.sync="drawer"
|
||||||
append-to-body
|
append-to-body
|
||||||
direction="rtl"
|
direction="rtl"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
>
|
>
|
||||||
<div class="demo-drawer__content">
|
<div class="demo-drawer__content">
|
||||||
<my-mars :historyList="historyList"> </my-mars>
|
<my-mars :historyList="historyList"> </my-mars>
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@
|
||||||
:visible.sync="drawer"
|
:visible.sync="drawer"
|
||||||
append-to-body
|
append-to-body
|
||||||
direction="rtl"
|
direction="rtl"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
>
|
>
|
||||||
<div class="demo-drawer__content">
|
<div class="demo-drawer__content">
|
||||||
<my-form
|
<my-form
|
||||||
|
|
@ -191,24 +193,37 @@ export default {
|
||||||
key: 9,
|
key: 9,
|
||||||
imageUrl: require("@/assets/img/device/9.png")
|
imageUrl: require("@/assets/img/device/9.png")
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: "请选择关联防区", trigger: "change" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "设备协议",
|
label: "设备协议",
|
||||||
type: "select",
|
type: "select",
|
||||||
model: "protocol",
|
model: "protocol",
|
||||||
options: []
|
options: [],
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: "请选择关联防区", trigger: "change" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "端口",
|
||||||
|
type: "input",
|
||||||
|
model: "port",
|
||||||
|
rules: [{ required: true, message: "请输入设备名称" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "ip",
|
||||||
|
type: "input",
|
||||||
|
model: "ip",
|
||||||
|
rules: [{ required: true, message: "请输入设备名称" }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "机型",
|
label: "机型",
|
||||||
type: "input",
|
type: "input",
|
||||||
model: "model"
|
model: "model"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "端口",
|
|
||||||
type: "input",
|
|
||||||
model: "port"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "账号",
|
label: "账号",
|
||||||
type: "input",
|
type: "input",
|
||||||
|
|
@ -219,11 +234,6 @@ export default {
|
||||||
type: "input",
|
type: "input",
|
||||||
model: "password"
|
model: "password"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "ip",
|
|
||||||
type: "input",
|
|
||||||
model: "ip"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: "详细地址",
|
label: "详细地址",
|
||||||
type: "input",
|
type: "input",
|
||||||
|
|
@ -245,10 +255,6 @@ export default {
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
coloumData: [
|
coloumData: [
|
||||||
// {
|
|
||||||
// slot: "img",
|
|
||||||
// label: "设备图片"
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
label: "设备名称",
|
label: "设备名称",
|
||||||
|
|
@ -428,10 +434,10 @@ export default {
|
||||||
// 新增 搜索
|
// 新增 搜索
|
||||||
headdenForm(value, type) {
|
headdenForm(value, type) {
|
||||||
let params = {};
|
let params = {};
|
||||||
this.initPosition();
|
|
||||||
if (type === "add") {
|
if (type === "add") {
|
||||||
this.isType = "add";
|
this.isType = "add";
|
||||||
this.title = "新增设备";
|
this.title = "新增设备";
|
||||||
|
this.initPosition();
|
||||||
this.initDeviceProtocol();
|
this.initDeviceProtocol();
|
||||||
this.fromItem = {};
|
this.fromItem = {};
|
||||||
this.drawer = true;
|
this.drawer = true;
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,8 @@
|
||||||
:visible.sync="drawer"
|
:visible.sync="drawer"
|
||||||
append-to-body
|
append-to-body
|
||||||
direction="rtl"
|
direction="rtl"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
>
|
>
|
||||||
<div class="demo-drawer__content">
|
<div class="demo-drawer__content">
|
||||||
<my-form
|
<my-form
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@
|
||||||
:visible.sync="drawer"
|
:visible.sync="drawer"
|
||||||
append-to-body
|
append-to-body
|
||||||
direction="rtl"
|
direction="rtl"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
>
|
>
|
||||||
<div class="demo-drawer__content">
|
<div class="demo-drawer__content">
|
||||||
<my-form
|
<my-form
|
||||||
|
|
@ -270,7 +272,7 @@ export default {
|
||||||
}
|
}
|
||||||
console.log(value);
|
console.log(value);
|
||||||
},
|
},
|
||||||
// 停用 编辑 删除
|
// 编辑 删除
|
||||||
handleClick(value, type) {
|
handleClick(value, type) {
|
||||||
if (type === "edit") {
|
if (type === "edit") {
|
||||||
this.isType = "edit";
|
this.isType = "edit";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,381 @@
|
||||||
|
<template>
|
||||||
|
<div class="dictionary">
|
||||||
|
<div class="demo-formName">
|
||||||
|
<my-form
|
||||||
|
:formNewList="formList"
|
||||||
|
:fromItem="formItem"
|
||||||
|
@headdenForm="headdenForm"
|
||||||
|
searchFive
|
||||||
|
ref="myForm"
|
||||||
|
>
|
||||||
|
</my-form>
|
||||||
|
</div>
|
||||||
|
<div class="count">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="headdenForm({ page: 1, pageSize: 10 }, 'search')"
|
||||||
|
>
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="headdenForm({}, 'add')"
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div class="table-container">
|
||||||
|
<my-table
|
||||||
|
:tableData="tableData"
|
||||||
|
:coloumData="coloumData"
|
||||||
|
isShowPagination
|
||||||
|
:paginationParam="paginationParam"
|
||||||
|
@changeSize="handleSizeChange"
|
||||||
|
@changePage="handlePageChange"
|
||||||
|
@selectionChange="handleSelectionChange"
|
||||||
|
>
|
||||||
|
</my-table>
|
||||||
|
</div>
|
||||||
|
<el-drawer
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="drawer"
|
||||||
|
append-to-body
|
||||||
|
direction="rtl"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
>
|
||||||
|
<div class="demo-drawer__content">
|
||||||
|
<my-form
|
||||||
|
:formNewList="formDrawerList"
|
||||||
|
:fromItem="fromItem"
|
||||||
|
dialogImageUrl
|
||||||
|
@determine="determine"
|
||||||
|
@handleClose="handleClose"
|
||||||
|
@changeSelect="changeSelect"
|
||||||
|
labelWidth="120px"
|
||||||
|
:disabled="isEditFlag"
|
||||||
|
>
|
||||||
|
</my-form>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
"use script";
|
||||||
|
import {
|
||||||
|
whitListList,
|
||||||
|
whitListAdd,
|
||||||
|
whitListUpdate,
|
||||||
|
whitListDelete
|
||||||
|
} from "@/api/whitList.js";
|
||||||
|
import { devPositionList } from "@/api/position.js";
|
||||||
|
export default {
|
||||||
|
name: "whitListDialog",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formList: [
|
||||||
|
{
|
||||||
|
label: "名称",
|
||||||
|
type: "input",
|
||||||
|
model: "key"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
tableData: [],
|
||||||
|
coloumData: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "sn",
|
||||||
|
prop: "sn",
|
||||||
|
width: 150
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "描述",
|
||||||
|
prop: "message"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
paginationParam: {
|
||||||
|
currentPage: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
formItem: {},
|
||||||
|
formDrawerList: [
|
||||||
|
{
|
||||||
|
label: "sn",
|
||||||
|
type: "input",
|
||||||
|
model: "sn",
|
||||||
|
rules: [{ required: true, message: "请输入sn" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否全天",
|
||||||
|
type: "select",
|
||||||
|
model: "allDay",
|
||||||
|
options: [
|
||||||
|
{ label: "是", key: "0" },
|
||||||
|
{ label: "否", key: "1" }
|
||||||
|
],
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: "请选择是否全天", trigger: "change" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "关联防区",
|
||||||
|
type: "select",
|
||||||
|
model: "positionId",
|
||||||
|
options: [],
|
||||||
|
disabled: false,
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: "请选择关联防区", trigger: "change" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "时间日期",
|
||||||
|
type: "datetimerange",
|
||||||
|
model: "date",
|
||||||
|
format: "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
drawer: false,
|
||||||
|
title: "",
|
||||||
|
fromItem: {},
|
||||||
|
isType: "",
|
||||||
|
isEditFlag: false,
|
||||||
|
PositionList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
components: {},
|
||||||
|
mounted() {
|
||||||
|
this.headdenForm({}, "search");
|
||||||
|
this.search();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeSelect(value) {
|
||||||
|
const lastItem = this.formDrawerList[this.formDrawerList.length - 1];
|
||||||
|
const dateTimeItem = {
|
||||||
|
label: "时间日期",
|
||||||
|
type: "datetimerange",
|
||||||
|
model: "date",
|
||||||
|
format: "yyyy-MM-dd HH:mm:ss"
|
||||||
|
};
|
||||||
|
|
||||||
|
if (value === "0") {
|
||||||
|
if (lastItem.label === "时间日期") {
|
||||||
|
this.formDrawerList.pop();
|
||||||
|
this.$set(this.fromItem, "date", null); // 清除 date 数据
|
||||||
|
}
|
||||||
|
} else if (value === "1") {
|
||||||
|
if (lastItem.label !== "时间日期") {
|
||||||
|
this.formDrawerList.push(dateTimeItem);
|
||||||
|
this.$set(this.fromItem, "date", []); // 初始化 date 数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initPosition() {
|
||||||
|
devPositionList().then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.PositionList = res.data.items;
|
||||||
|
this.formDrawerList.forEach((item) => {
|
||||||
|
if (item.label === "关联防区") {
|
||||||
|
item.options = res.data.items.map((item) => {
|
||||||
|
item.label = item.name;
|
||||||
|
item.key = item.id;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
search() {
|
||||||
|
this.headdenForm({}, "search");
|
||||||
|
},
|
||||||
|
// 搜索
|
||||||
|
headdenForm(value, type) {
|
||||||
|
let params = {};
|
||||||
|
if (type === "search") {
|
||||||
|
params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
|
||||||
|
if (params.dateRange) {
|
||||||
|
params.startTime = params.dateRange[0];
|
||||||
|
params.endTime = params.dateRange[1];
|
||||||
|
}
|
||||||
|
if (value.page !== undefined) {
|
||||||
|
this.paginationParam.currentPage = value.page;
|
||||||
|
this.paginationParam.size = value.pageSize;
|
||||||
|
}
|
||||||
|
params.page = this.paginationParam.currentPage;
|
||||||
|
params.pageSize = this.paginationParam.size;
|
||||||
|
this.$delete(params, "dateRange");
|
||||||
|
whitListList(params).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.tableData = res.data.items;
|
||||||
|
this.paginationParam.total = res.data.total;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (type === "add") {
|
||||||
|
this.isType = "add";
|
||||||
|
this.title = "新增白名单";
|
||||||
|
this.initPosition();
|
||||||
|
this.fromItem = {};
|
||||||
|
this.formDrawerList = this.getDefaultFormDrawerList();
|
||||||
|
this.isEditFlag = false;
|
||||||
|
this.drawer = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 确定按钮
|
||||||
|
determine(value) {
|
||||||
|
const params = { ...value };
|
||||||
|
console.log(params, "params");
|
||||||
|
|
||||||
|
// 设置 positionName
|
||||||
|
const position = this.PositionList.find(
|
||||||
|
(item) => item.id === params.positionId
|
||||||
|
);
|
||||||
|
params.positionName = position ? position.name : "";
|
||||||
|
|
||||||
|
// 处理 allDay 和时间
|
||||||
|
if (params.allDay === "0") {
|
||||||
|
params.allDay = true;
|
||||||
|
params.startTime = "";
|
||||||
|
params.endTime = "";
|
||||||
|
} else {
|
||||||
|
params.allDay = false;
|
||||||
|
if (Array.isArray(params.date) && params.date.length === 2) {
|
||||||
|
params.startTime = params.date[0];
|
||||||
|
params.endTime = params.date[1];
|
||||||
|
} else {
|
||||||
|
params.startTime = "";
|
||||||
|
params.endTime = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete params.date; // 移除 date 字段
|
||||||
|
const apiCall = this.isType === "add" ? whitListAdd : whitListUpdate;
|
||||||
|
apiCall(params)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(
|
||||||
|
`${this.isType === "add" ? "新增" : "编辑"}成功`
|
||||||
|
);
|
||||||
|
this.search();
|
||||||
|
} else {
|
||||||
|
this.$message.error(
|
||||||
|
`${this.isType === "add" ? "新增" : "编辑"}失败`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(`${this.isType === "add" ? "新增" : "编辑"}错误:`, err);
|
||||||
|
this.$message.error(
|
||||||
|
`${this.isType === "add" ? "新增" : "编辑"}时发生错误`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
this.drawer = false;
|
||||||
|
},
|
||||||
|
// 编辑 删除
|
||||||
|
handleClick(value, type) {
|
||||||
|
if (type === "edit") {
|
||||||
|
this.isType = "edit";
|
||||||
|
this.title = "编辑白名单";
|
||||||
|
this.isEditFlag = false;
|
||||||
|
this.fromItem = { ...value };
|
||||||
|
this.formDrawerList = this.getDefaultFormDrawerList();
|
||||||
|
value.allDay = value.allDay ? "0" : "1";
|
||||||
|
this.changeSelect(value.allDay); // 根据 allDay 调整时间日期字段
|
||||||
|
this.initPosition();
|
||||||
|
this.drawer = true;
|
||||||
|
} else if (type === "delete") {
|
||||||
|
console.log(value);
|
||||||
|
let params = {
|
||||||
|
id: value.id
|
||||||
|
};
|
||||||
|
this.$confirm("此操作将永久删除该白名单, 是否继续?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
whitListDelete(params).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success("删除成功");
|
||||||
|
this.headdenForm({}, "search");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: "info",
|
||||||
|
message: "已取消删除"
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 关闭抽屉
|
||||||
|
handleClose() {
|
||||||
|
this.drawer = false;
|
||||||
|
},
|
||||||
|
//分页
|
||||||
|
handleSizeChange(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.paginationParam.size = value;
|
||||||
|
this.headdenForm({}, "search");
|
||||||
|
},
|
||||||
|
handlePageChange(value) {
|
||||||
|
console.log(value);
|
||||||
|
this.paginationParam.currentPage = value;
|
||||||
|
this.headdenForm({}, "search");
|
||||||
|
},
|
||||||
|
handleSelectionChange(value) {
|
||||||
|
console.log(value);
|
||||||
|
}, // 初始化 formDrawerList 的公共方法
|
||||||
|
getDefaultFormDrawerList() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: "sn",
|
||||||
|
type: "input",
|
||||||
|
model: "sn",
|
||||||
|
rules: [{ required: true, message: "请输入sn" }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否全天",
|
||||||
|
type: "select",
|
||||||
|
model: "allDay",
|
||||||
|
options: [
|
||||||
|
{ label: "是", key: "0" },
|
||||||
|
{ label: "否", key: "1" }
|
||||||
|
],
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: "请选择是否全天", trigger: "change" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "关联防区",
|
||||||
|
type: "select",
|
||||||
|
model: "positionId",
|
||||||
|
options: [],
|
||||||
|
disabled: false,
|
||||||
|
rules: [
|
||||||
|
{ required: true, message: "请选择关联防区", trigger: "change" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "时间日期",
|
||||||
|
type: "datetimerange",
|
||||||
|
model: "date",
|
||||||
|
format: "yyyy-MM-dd HH:mm:ss"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.dictionary {
|
||||||
|
width: 95%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 20px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue