8.27问题更改
This commit is contained in:
parent
18da5b9d48
commit
6868111813
|
|
@ -16,6 +16,15 @@
|
||||||
:rules="detail ? false : item.rules"
|
:rules="detail ? false : item.rules"
|
||||||
v-show="item.show === undefined ? true : item.show"
|
v-show="item.show === undefined ? true : item.show"
|
||||||
>
|
>
|
||||||
|
<template #label>
|
||||||
|
<span v-if="item.label && typeof item.label === 'string'">
|
||||||
|
<span v-if="item.label.includes('*')">
|
||||||
|
<span style="color: #f56c6c"> * </span>
|
||||||
|
{{ item.label.replace("*", "") }}
|
||||||
|
</span>
|
||||||
|
<span v-else>{{ item.label }}</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
<!-- 输入框 -->
|
<!-- 输入框 -->
|
||||||
<template v-if="item.type === 'input'">
|
<template v-if="item.type === 'input'">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
<script>
|
<script>
|
||||||
"use script";
|
"use script";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import { Homeview } from "@/api/home.js";
|
||||||
export default {
|
export default {
|
||||||
name: "myMars",
|
name: "myMars",
|
||||||
props: {
|
props: {
|
||||||
|
|
@ -25,7 +26,9 @@ export default {
|
||||||
return {
|
return {
|
||||||
inputs: "",
|
inputs: "",
|
||||||
checkInterval: null,
|
checkInterval: null,
|
||||||
time: null
|
time: null,
|
||||||
|
matchedNames: [],
|
||||||
|
historyData: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
|
|
@ -33,9 +36,11 @@ export default {
|
||||||
historyList: {
|
historyList: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
let value = JSON.parse(JSON.stringify(val));
|
let value = JSON.parse(JSON.stringify(val));
|
||||||
|
console.log(value, "value");
|
||||||
if (value) {
|
if (value) {
|
||||||
this.startCheckTimer(value);
|
this.startCheckTimer(value[1]);
|
||||||
}
|
}
|
||||||
|
this.historyData = value;
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true
|
immediate: true
|
||||||
|
|
@ -102,15 +107,14 @@ export default {
|
||||||
let newMapList = (mapList = mapList.filter(
|
let newMapList = (mapList = mapList.filter(
|
||||||
(item) => Number(item.lon) !== 0 && Number(item.lat) !== 0
|
(item) => Number(item.lon) !== 0 && Number(item.lat) !== 0
|
||||||
));
|
));
|
||||||
console.log(newMapList, "newMapList");
|
// if (newMapList.length === 0) {
|
||||||
if (newMapList.length === 0) {
|
// this.clearDraw();
|
||||||
this.clearDraw();
|
// this.$message({
|
||||||
this.$message({
|
// message: "暂无数据",
|
||||||
message: "暂无数据",
|
// type: "warning"
|
||||||
type: "warning"
|
// });
|
||||||
});
|
// return;
|
||||||
return;
|
// }
|
||||||
}
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const property = new Cesium.SampledPositionProperty();
|
const property = new Cesium.SampledPositionProperty();
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
|
|
@ -252,10 +256,85 @@ export default {
|
||||||
});
|
});
|
||||||
this.graphicLayer.addGraphic(app_pathEntity);
|
this.graphicLayer.addGraphic(app_pathEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Homeview().then((res) => {
|
||||||
|
console.log(res.data.positions, "res.data.positions");
|
||||||
|
this.matchedNames = res.data.positions.filter((m) =>
|
||||||
|
this.historyData[0].positionId.includes(m.id)
|
||||||
|
);
|
||||||
|
console.log(this.matchedNames, "this.matchedNames");
|
||||||
|
if (this.matchedNames.length > 0) {
|
||||||
|
let item = this.matchedNames[0];
|
||||||
|
let graphiczhendi = this.mapMars.getLayerById("zhendi");
|
||||||
|
if (!graphiczhendi) {
|
||||||
|
graphiczhendi = new mars3d.layer.GeoJsonLayer({
|
||||||
|
id: "zhendi",
|
||||||
|
name: "zhendi",
|
||||||
|
data: {
|
||||||
|
type: "FeatureCollection",
|
||||||
|
features: [
|
||||||
|
{
|
||||||
|
type: "Feature",
|
||||||
|
properties: {},
|
||||||
|
geometry: JSON.parse(item.regionJson)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
symbol: {
|
||||||
|
styleOptions: {
|
||||||
|
fill: true,
|
||||||
|
color: "#3388cc",
|
||||||
|
opacity: 0.5,
|
||||||
|
outline: true,
|
||||||
|
outlineStyle: {
|
||||||
|
width: 2,
|
||||||
|
opacity: 0.1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.mapMars.addLayer(graphiczhendi);
|
||||||
|
}
|
||||||
|
item.devices.forEach((deviceItem) => {
|
||||||
|
// 设备
|
||||||
|
let graphic = this.graphicLayer.getGraphicById(
|
||||||
|
deviceItem.id + "shebei"
|
||||||
|
);
|
||||||
|
if (!graphic) {
|
||||||
|
graphic = new mars3d.graphic.BillboardEntity({
|
||||||
|
id: deviceItem.id + "shebei",
|
||||||
|
name: "设备",
|
||||||
|
position: new mars3d.LngLatPoint(
|
||||||
|
deviceItem.lon,
|
||||||
|
deviceItem.lat,
|
||||||
|
0
|
||||||
|
),
|
||||||
|
style: {
|
||||||
|
image: require(`@/assets/img/device/deviceIcon/${deviceItem.icon}.png`),
|
||||||
|
scale: 1,
|
||||||
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
||||||
|
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
||||||
|
clampToGround: true,
|
||||||
|
scaleByDistance: true,
|
||||||
|
scaleByDistance_near: 100,
|
||||||
|
scaleByDistance_nearValue: 0.5
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(graphic, "graphic");
|
||||||
|
this.graphicLayer.addGraphic(graphic);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
clearDraw() {
|
clearDraw() {
|
||||||
if (this.graphics) {
|
// if (this.graphics) {
|
||||||
this.mapMars.removeLayer(this.graphics);
|
// this.mapMars.removeLayer(this.graphics);
|
||||||
|
// }
|
||||||
|
let graphiczhendi = this.mapMars.getLayerById("zhendi");
|
||||||
|
console.log(graphiczhendi, "layer");
|
||||||
|
if (graphiczhendi !== undefined) {
|
||||||
|
this.mapMars.removeLayer(graphiczhendi);
|
||||||
}
|
}
|
||||||
if (this.graphicLayer) {
|
if (this.graphicLayer) {
|
||||||
this.graphicLayer.clear();
|
this.graphicLayer.clear();
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@
|
||||||
:border="border"
|
:border="border"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
|
<el-table-column label="序号" type="index" align="center" width="50">
|
||||||
|
</el-table-column>
|
||||||
<el-table-column type="expand" v-if="isShowExpand">
|
<el-table-column type="expand" v-if="isShowExpand">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<slot name="expand" :rowData="scope"></slot>
|
<slot name="expand" :rowData="scope"></slot>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="left-sidebar" :class="{ contracted: isContracted }">
|
<div class="left-sidebar" :class="{ contracted: isContracted }">
|
||||||
|
<div class="alarm-border warningAnimatBox" v-if="iswarning"></div>
|
||||||
<div class="stats">
|
<div class="stats">
|
||||||
<div class="stat-item" v-for="(item, index) in warningDay" :key="index">
|
<div class="stat-item" v-for="(item, index) in warningDay" :key="index">
|
||||||
<div class="stat-name">{{ item.name }}</div>
|
<div class="stat-name">{{ item.name }}</div>
|
||||||
|
|
@ -309,6 +310,28 @@ export default {
|
||||||
.left-sidebar.contracted {
|
.left-sidebar.contracted {
|
||||||
transform: translateX(-90%);
|
transform: translateX(-90%);
|
||||||
}
|
}
|
||||||
|
.alarm-border {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
pointer-events: none; /* Prevent interaction with the border */
|
||||||
|
z-index: 9999; /* Ensure it appears above other elements */
|
||||||
|
&.warningAnimatBox {
|
||||||
|
animation: greenanimated-shadow 2s infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes greenanimated-shadow {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 #ff0000 inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
85% {
|
||||||
|
box-shadow: 0px 0px 100px 0px #ff0000 inset;
|
||||||
|
}
|
||||||
|
}
|
||||||
.audio-prompt {
|
.audio-prompt {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
|
||||||
|
|
@ -318,21 +318,21 @@ function bindLayerPopup(graphicLayer, graphic) {
|
||||||
}" /></div>
|
}" /></div>
|
||||||
<div class="device-type">
|
<div class="device-type">
|
||||||
<div class="txt">
|
<div class="txt">
|
||||||
<p class="p1">经度</p>
|
<p class="p1">序列号</p>
|
||||||
<p class="p2">${attr.lon}</p>
|
<p class="p2">${attr.deviceSN}</p>
|
||||||
</div>
|
|
||||||
<div class="txt">
|
|
||||||
<p class="p1">IP</p>
|
|
||||||
<p class="p2">${attr.ip}</p>
|
|
||||||
</div>
|
|
||||||
<div class="txt">
|
|
||||||
<p class="p1">纬度</p>
|
|
||||||
<p class="p2">${attr.lat}</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="txt">
|
<div class="txt">
|
||||||
<p class="p1">状态</p>
|
<p class="p1">状态</p>
|
||||||
<p class="p2">${attr.isOnline ? "在线" : "离线"}</p>
|
<p class="p2">${attr.isOnline ? "在线" : "离线"}</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="txt">
|
||||||
|
<p class="p1">位置</p>
|
||||||
|
<p class="p2">${attr.lon}</p>
|
||||||
|
</div>
|
||||||
|
<div class="txt">
|
||||||
|
<p class="p1">纬度</p>
|
||||||
|
<p class="p2">${attr.lat}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,26 @@ export default {
|
||||||
this.timeInterval = setInterval(() => {
|
this.timeInterval = setInterval(() => {
|
||||||
this.initHomeData();
|
this.initHomeData();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
// setInterval(() => {
|
||||||
|
// this.signaData = [
|
||||||
|
// {
|
||||||
|
// serial_number: "123456",
|
||||||
|
// times: "2023-01-01 00:00:00",
|
||||||
|
// DeviceName: "无人机1",
|
||||||
|
// freq: "24GHz",
|
||||||
|
// device_type: "无人机",
|
||||||
|
// drone_lat: 39.9042,
|
||||||
|
// drone_lon: 116.4074,
|
||||||
|
// height: 100,
|
||||||
|
// speed: 10,
|
||||||
|
// heading: 90,
|
||||||
|
// battery: 80,
|
||||||
|
// online: true,
|
||||||
|
// BatchId: "123456",
|
||||||
|
// alarmLevel: 1
|
||||||
|
// }
|
||||||
|
// ];
|
||||||
|
// }, 1000);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initHomeData() {
|
initHomeData() {
|
||||||
|
|
|
||||||
|
|
@ -154,21 +154,21 @@ export default {
|
||||||
prop: "duration",
|
prop: "duration",
|
||||||
align: "center"
|
align: "center"
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: "机型",
|
// label: "机型",
|
||||||
prop: "model",
|
// prop: "model",
|
||||||
align: "center"
|
// align: "center"
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: "SN码",
|
label: "SN码",
|
||||||
prop: "sn",
|
prop: "sn",
|
||||||
align: "center"
|
align: "center"
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: "频段",
|
// label: "频段",
|
||||||
prop: "frequency",
|
// prop: "frequency",
|
||||||
align: "center"
|
// align: "center"
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: "开始时间",
|
label: "开始时间",
|
||||||
prop: "startTime",
|
prop: "startTime",
|
||||||
|
|
@ -270,7 +270,7 @@ export default {
|
||||||
}
|
}
|
||||||
console.log(value);
|
console.log(value);
|
||||||
},
|
},
|
||||||
// 停用 编辑 删除
|
// 轨迹回放
|
||||||
handleClick(value, type) {
|
handleClick(value, type) {
|
||||||
let params = { batchid: value.batchId };
|
let params = { batchid: value.batchId };
|
||||||
if (type === "playback") {
|
if (type === "playback") {
|
||||||
|
|
@ -278,51 +278,7 @@ export default {
|
||||||
alarmDetail(params).then((res) => {
|
alarmDetail(params).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
console.log(res.data, "res.data");
|
console.log(res.data, "res.data");
|
||||||
this.historyList = res.data;
|
this.historyList = [value, res.data];
|
||||||
// this.historyList = [
|
|
||||||
// {
|
|
||||||
// lon: 109.056198,
|
|
||||||
// lat: 38.674443,
|
|
||||||
// alt: 0,
|
|
||||||
// createTime: "2025-03-30 03:44:21",
|
|
||||||
// alarmLevel: 0
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// lon: 109.081454,
|
|
||||||
// lat: 38.664766,
|
|
||||||
// alt: 0,
|
|
||||||
// createTime: "2025-03-30 03:44:22",
|
|
||||||
// alarmLevel: 0
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// lon: 109.101687,
|
|
||||||
// lat: 38.632524,
|
|
||||||
// alt: 0,
|
|
||||||
// createTime: "2025-03-30 03:44:25",
|
|
||||||
// alarmLevel: 0
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// lon: 109.063063,
|
|
||||||
// lat: 38.622878,
|
|
||||||
// alt: 0,
|
|
||||||
// createTime: "2025-03-30 03:44:30",
|
|
||||||
// alarmLevel: 0
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// lon: 109.016034,
|
|
||||||
// lat: 38.635138,
|
|
||||||
// alt: 0,
|
|
||||||
// createTime: "2025-03-30 03:44:35",
|
|
||||||
// alarmLevel: 0
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// lon: 108.991419,
|
|
||||||
// lat: 38.659515,
|
|
||||||
// alt: 0,
|
|
||||||
// createTime: "2025-03-30 03:44:38",
|
|
||||||
// alarmLevel: 0
|
|
||||||
// }
|
|
||||||
// ];
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.title = "轨迹回放";
|
this.title = "轨迹回放";
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ export default {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "icon",
|
label: "设备类型",
|
||||||
type: "selectImg",
|
type: "selectImg",
|
||||||
model: "icon",
|
model: "icon",
|
||||||
options: [
|
options: [
|
||||||
|
|
@ -219,11 +219,11 @@ export default {
|
||||||
model: "ip",
|
model: "ip",
|
||||||
rules: [{ required: true, message: "请输入设备名称" }]
|
rules: [{ required: true, message: "请输入设备名称" }]
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
label: "机型",
|
// label: "机型",
|
||||||
type: "input",
|
// type: "input",
|
||||||
model: "model"
|
// model: "model"
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
label: "账号",
|
label: "账号",
|
||||||
type: "input",
|
type: "input",
|
||||||
|
|
@ -270,16 +270,21 @@ export default {
|
||||||
label: "设备SN",
|
label: "设备SN",
|
||||||
prop: "deviceSN"
|
prop: "deviceSN"
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
type: "text",
|
// type: "text",
|
||||||
label: "ip",
|
// label: "ip",
|
||||||
prop: "ip"
|
// prop: "ip"
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
label: "关联防区",
|
label: "关联防区",
|
||||||
prop: "positionName"
|
prop: "positionName"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "设备状态",
|
||||||
|
prop: "online"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
label: "安装地址",
|
label: "安装地址",
|
||||||
|
|
@ -462,7 +467,10 @@ export default {
|
||||||
params.pageSize = this.paginationParam.size;
|
params.pageSize = this.paginationParam.size;
|
||||||
deviceList(params).then((res) => {
|
deviceList(params).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.tableData = res.data.items;
|
this.tableData = res.data.items.map((item) => {
|
||||||
|
item.online = item.online === true ? "在线" : "离线";
|
||||||
|
return item;
|
||||||
|
});
|
||||||
this.paginationParam.total = res.data.total;
|
this.paginationParam.total = res.data.total;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ export default {
|
||||||
model: "address"
|
model: "address"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "防区",
|
label: "* 防区",
|
||||||
type: "marsMapmap",
|
type: "marsMapmap",
|
||||||
model: "polygon"
|
model: "polygon"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,9 @@
|
||||||
删除
|
删除
|
||||||
</el-link>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
|
<template #mark="{ data }">
|
||||||
|
{{ data.mark }}
|
||||||
|
</template>
|
||||||
</my-table>
|
</my-table>
|
||||||
</div>
|
</div>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
|
|
@ -106,18 +109,48 @@ export default {
|
||||||
coloumData: [
|
coloumData: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
label: "sn",
|
label: "型号",
|
||||||
|
prop: "model"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "序列号",
|
||||||
prop: "sn"
|
prop: "sn"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
label: "是否全天",
|
label: "开放防区",
|
||||||
prop: "allDay"
|
prop: "positionName"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slot: "whitTime",
|
type: "text",
|
||||||
label: "白名单生效的起止日期"
|
label: "开始时间",
|
||||||
|
prop: "startTime"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "结束时间",
|
||||||
|
prop: "endTime"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "创建时间",
|
||||||
|
prop: "createTime"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
label: "创建人",
|
||||||
|
prop: "createBy"
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// type: "text",
|
||||||
|
// label: "是否全天",
|
||||||
|
// prop: "allDay"
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// slot: "whitTime",
|
||||||
|
// label: "白名单生效的起止日期"
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
label: "状态",
|
label: "状态",
|
||||||
|
|
@ -125,9 +158,11 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slot: "operate",
|
slot: "operate",
|
||||||
label: "操作",
|
label: "操作"
|
||||||
width: 250,
|
},
|
||||||
fixed: "right"
|
{
|
||||||
|
slot: "mark",
|
||||||
|
label: "备注"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
paginationParam: {
|
paginationParam: {
|
||||||
|
|
@ -149,17 +184,24 @@ export default {
|
||||||
model: "model",
|
model: "model",
|
||||||
rules: [{ required: true, message: "请输入机型" }]
|
rules: [{ required: true, message: "请输入机型" }]
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// label: "是否全天",
|
||||||
|
// type: "select",
|
||||||
|
// model: "allDay",
|
||||||
|
// options: [
|
||||||
|
// { label: "是", key: "0" },
|
||||||
|
// { label: "否", key: "1" }
|
||||||
|
// ],
|
||||||
|
// rules: [
|
||||||
|
// { required: true, message: "请选择是否全天", trigger: "change" }
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
label: "是否全天",
|
label: "时间日期",
|
||||||
type: "select",
|
type: "datetimerange",
|
||||||
model: "allDay",
|
model: "date",
|
||||||
options: [
|
format: "yyyy-MM-dd HH:mm:ss",
|
||||||
{ label: "是", key: "0" },
|
rules: [{ required: true, message: "请选择时间日期" }]
|
||||||
{ label: "否", key: "1" }
|
|
||||||
],
|
|
||||||
rules: [
|
|
||||||
{ required: true, message: "请选择是否全天", trigger: "change" }
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "关联防区",
|
label: "关联防区",
|
||||||
|
|
@ -175,7 +217,8 @@ export default {
|
||||||
{
|
{
|
||||||
label: "所属单位",
|
label: "所属单位",
|
||||||
type: "input",
|
type: "input",
|
||||||
model: "company"
|
model: "company",
|
||||||
|
rules: [{ required: true, message: "请输入所属单位" }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "备注",
|
label: "备注",
|
||||||
|
|
@ -184,12 +227,6 @@ export default {
|
||||||
rowsHeight: 15,
|
rowsHeight: 15,
|
||||||
placeholder: "请输入内容",
|
placeholder: "请输入内容",
|
||||||
model: "mark"
|
model: "mark"
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "时间日期",
|
|
||||||
type: "datetimerange",
|
|
||||||
model: "date",
|
|
||||||
format: "yyyy-MM-dd HH:mm:ss"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
drawer: false,
|
drawer: false,
|
||||||
|
|
@ -251,6 +288,7 @@ export default {
|
||||||
let params = {};
|
let params = {};
|
||||||
if (type === "search") {
|
if (type === "search") {
|
||||||
params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
|
params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
|
||||||
|
this.initPosition();
|
||||||
if (params.dateRange) {
|
if (params.dateRange) {
|
||||||
params.startTime = params.dateRange[0];
|
params.startTime = params.dateRange[0];
|
||||||
params.endTime = params.dateRange[1];
|
params.endTime = params.dateRange[1];
|
||||||
|
|
@ -265,18 +303,43 @@ export default {
|
||||||
whitListList(params).then((res) => {
|
whitListList(params).then((res) => {
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.tableData = res.data.items.map((item) => {
|
this.tableData = res.data.items.map((item) => {
|
||||||
let status = "未启用";
|
let status = "待生效";
|
||||||
|
|
||||||
if (item.allDay) {
|
if (item.allDay) {
|
||||||
status = "启用中";
|
// 全天候直接生效
|
||||||
|
status = "生效中";
|
||||||
} else {
|
} else {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const endTime = new Date(item.endTime);
|
const startTime = item.startTime
|
||||||
status = endTime > now ? "启用中" : "未启用";
|
? new Date(item.startTime)
|
||||||
|
: null;
|
||||||
|
const endTime = item.endTime ? new Date(item.endTime) : null;
|
||||||
|
|
||||||
|
if (startTime && endTime) {
|
||||||
|
if (now < startTime) {
|
||||||
|
status = "待生效";
|
||||||
|
} else if (now >= startTime && now <= endTime) {
|
||||||
|
status = "生效中";
|
||||||
|
} else if (now > endTime) {
|
||||||
|
status = "失效";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 匹配 positionName
|
||||||
|
let matchedNames = [];
|
||||||
|
if (item.positionIds && item.positionIds.length > 0) {
|
||||||
|
matchedNames = this.PositionList.filter((m) =>
|
||||||
|
item.positionIds.includes(m.id)
|
||||||
|
).map((m) => m.name);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
allDay: item.allDay ? "是" : "否",
|
allDay: item.allDay ? "是" : "否",
|
||||||
status
|
status,
|
||||||
|
positionName:
|
||||||
|
matchedNames.length > 0 ? matchedNames.join("、") : ""
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -288,7 +351,7 @@ export default {
|
||||||
this.title = "新增白名单";
|
this.title = "新增白名单";
|
||||||
this.initPosition();
|
this.initPosition();
|
||||||
this.fromItem = {};
|
this.fromItem = {};
|
||||||
this.formDrawerList = this.getDefaultFormDrawerList();
|
// this.formDrawerList = this.getDefaultFormDrawerList();
|
||||||
this.isEditFlag = false;
|
this.isEditFlag = false;
|
||||||
this.drawer = true;
|
this.drawer = true;
|
||||||
}
|
}
|
||||||
|
|
@ -305,20 +368,22 @@ export default {
|
||||||
// params.positionName = position ? position.name : "";
|
// params.positionName = position ? position.name : "";
|
||||||
|
|
||||||
// 处理 allDay 和时间
|
// 处理 allDay 和时间
|
||||||
if (params.allDay === "0") {
|
// if (params.allDay === "0") {
|
||||||
params.allDay = true;
|
// 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.startTime = "";
|
||||||
params.endTime = "";
|
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 = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
|
params.allDay = false;
|
||||||
|
params.createBy = localStorage.getItem("userName");
|
||||||
delete params.date; // 移除 date 字段
|
delete params.date; // 移除 date 字段
|
||||||
const apiCall = this.isType === "add" ? whitListAdd : whitListUpdate;
|
const apiCall = this.isType === "add" ? whitListAdd : whitListUpdate;
|
||||||
apiCall(params)
|
apiCall(params)
|
||||||
|
|
@ -350,9 +415,10 @@ export default {
|
||||||
this.isEditFlag = false;
|
this.isEditFlag = false;
|
||||||
this.fromItem = JSON.parse(JSON.stringify(value));
|
this.fromItem = JSON.parse(JSON.stringify(value));
|
||||||
this.fromItem.positionId = this.fromItem.positionIds;
|
this.fromItem.positionId = this.fromItem.positionIds;
|
||||||
this.formDrawerList = this.getDefaultFormDrawerList();
|
// this.formDrawerList = this.getDefaultFormDrawerList();
|
||||||
this.fromItem.allDay = this.fromItem.allDay ? "0" : "1";
|
// this.fromItem.allDay = this.fromItem.allDay ? "0" : "1";
|
||||||
this.changeSelect(this.fromItem.allDay); // 根据 allDay 调整时间日期字段
|
this.fromItem.date = [this.fromItem.startTime, this.fromItem.endTime];
|
||||||
|
// this.changeSelect(this.fromItem.allDay); // 根据 allDay 调整时间日期字段
|
||||||
this.initPosition();
|
this.initPosition();
|
||||||
this.drawer = true;
|
this.drawer = true;
|
||||||
} else if (type === "delete") {
|
} else if (type === "delete") {
|
||||||
|
|
@ -398,64 +464,6 @@ export default {
|
||||||
},
|
},
|
||||||
handleSelectionChange(value) {
|
handleSelectionChange(value) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
}, // 初始化 formDrawerList 的公共方法
|
|
||||||
getDefaultFormDrawerList() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: "sn",
|
|
||||||
type: "input",
|
|
||||||
model: "sn",
|
|
||||||
rules: [{ required: true, message: "请输入sn" }]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "机型",
|
|
||||||
type: "input",
|
|
||||||
model: "model",
|
|
||||||
rules: [{ required: true, message: "请输入机型" }]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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,
|
|
||||||
multiple: true,
|
|
||||||
rules: [
|
|
||||||
{ required: true, message: "请选择关联防区", trigger: "change" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "所属单位",
|
|
||||||
type: "input",
|
|
||||||
model: "company"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "备注",
|
|
||||||
type: "textarea",
|
|
||||||
maxLenght: 100,
|
|
||||||
rowsHeight: 15,
|
|
||||||
placeholder: "请输入内容",
|
|
||||||
model: "mark"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "时间日期",
|
|
||||||
type: "datetimerange",
|
|
||||||
model: "date",
|
|
||||||
format: "yyyy-MM-dd HH:mm:ss"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue