diff --git a/src/components/myForm.vue b/src/components/myForm.vue
index 44f6b2f..801b88d 100644
--- a/src/components/myForm.vue
+++ b/src/components/myForm.vue
@@ -16,6 +16,15 @@
:rules="detail ? false : item.rules"
v-show="item.show === undefined ? true : item.show"
>
+
+
+
+ *
+ {{ item.label.replace("*", "") }}
+
+ {{ item.label }}
+
+
"use script";
import moment from "moment";
+import { Homeview } from "@/api/home.js";
export default {
name: "myMars",
props: {
@@ -25,7 +26,9 @@ export default {
return {
inputs: "",
checkInterval: null,
- time: null
+ time: null,
+ matchedNames: [],
+ historyData: {}
};
},
components: {},
@@ -33,9 +36,11 @@ export default {
historyList: {
handler(val) {
let value = JSON.parse(JSON.stringify(val));
+ console.log(value, "value");
if (value) {
- this.startCheckTimer(value);
+ this.startCheckTimer(value[1]);
}
+ this.historyData = value;
},
deep: true,
immediate: true
@@ -102,15 +107,14 @@ export default {
let newMapList = (mapList = mapList.filter(
(item) => Number(item.lon) !== 0 && Number(item.lat) !== 0
));
- console.log(newMapList, "newMapList");
- if (newMapList.length === 0) {
- this.clearDraw();
- this.$message({
- message: "暂无数据",
- type: "warning"
- });
- return;
- }
+ // if (newMapList.length === 0) {
+ // this.clearDraw();
+ // this.$message({
+ // message: "暂无数据",
+ // type: "warning"
+ // });
+ // return;
+ // }
// eslint-disable-next-line no-undef
const property = new Cesium.SampledPositionProperty();
// eslint-disable-next-line no-undef
@@ -252,10 +256,85 @@ export default {
});
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() {
- if (this.graphics) {
- this.mapMars.removeLayer(this.graphics);
+ // if (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) {
this.graphicLayer.clear();
diff --git a/src/components/myTable.vue b/src/components/myTable.vue
index a900290..95d52af 100644
--- a/src/components/myTable.vue
+++ b/src/components/myTable.vue
@@ -11,6 +11,8 @@
:border="border"
@selection-change="handleSelectionChange"
>
+
+
diff --git a/src/views/contentData/LeftSidebar/index.vue b/src/views/contentData/LeftSidebar/index.vue
index 52e44e6..1e38aad 100644
--- a/src/views/contentData/LeftSidebar/index.vue
+++ b/src/views/contentData/LeftSidebar/index.vue
@@ -1,5 +1,6 @@
{
if (res.code === 0) {
this.tableData = res.data.items.map((item) => {
- let status = "未启用";
+ let status = "待生效";
+
if (item.allDay) {
- status = "启用中";
+ // 全天候直接生效
+ status = "生效中";
} else {
const now = new Date();
- const endTime = new Date(item.endTime);
- status = endTime > now ? "启用中" : "未启用";
+ const startTime = item.startTime
+ ? 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 {
...item,
allDay: item.allDay ? "是" : "否",
- status
+ status,
+ positionName:
+ matchedNames.length > 0 ? matchedNames.join("、") : ""
};
});
@@ -288,7 +351,7 @@ export default {
this.title = "新增白名单";
this.initPosition();
this.fromItem = {};
- this.formDrawerList = this.getDefaultFormDrawerList();
+ // this.formDrawerList = this.getDefaultFormDrawerList();
this.isEditFlag = false;
this.drawer = true;
}
@@ -305,20 +368,22 @@ export default {
// params.positionName = position ? position.name : "";
// 处理 allDay 和时间
- if (params.allDay === "0") {
- params.allDay = true;
+ // 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 = "";
- } 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 字段
const apiCall = this.isType === "add" ? whitListAdd : whitListUpdate;
apiCall(params)
@@ -350,9 +415,10 @@ export default {
this.isEditFlag = false;
this.fromItem = JSON.parse(JSON.stringify(value));
this.fromItem.positionId = this.fromItem.positionIds;
- this.formDrawerList = this.getDefaultFormDrawerList();
- this.fromItem.allDay = this.fromItem.allDay ? "0" : "1";
- this.changeSelect(this.fromItem.allDay); // 根据 allDay 调整时间日期字段
+ // this.formDrawerList = this.getDefaultFormDrawerList();
+ // this.fromItem.allDay = this.fromItem.allDay ? "0" : "1";
+ this.fromItem.date = [this.fromItem.startTime, this.fromItem.endTime];
+ // this.changeSelect(this.fromItem.allDay); // 根据 allDay 调整时间日期字段
this.initPosition();
this.drawer = true;
} else if (type === "delete") {
@@ -398,64 +464,6 @@ export default {
},
handleSelectionChange(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"
- }
- ];
}
}
};