权限更改
This commit is contained in:
		
							parent
							
								
									1ee3fe56e2
								
							
						
					
					
						commit
						16cc80d4ce
					
				| 
						 | 
					@ -1,3 +1,3 @@
 | 
				
			||||||
NODE_ENV = 'development'
 | 
					NODE_ENV = 'development'
 | 
				
			||||||
VUE_APP_API_URL = 'http://114.66.57.139:8088'
 | 
					VUE_APP_API_URL = 'http://114.66.57.139:5002'
 | 
				
			||||||
VUE_APP_MESSAGE_SDK_DEBUG = true
 | 
					VUE_APP_MESSAGE_SDK_DEBUG = true
 | 
				
			||||||
| 
						 | 
					@ -126,64 +126,70 @@ export default {
 | 
				
			||||||
    signaData: {
 | 
					    signaData: {
 | 
				
			||||||
      handler(newVal) {
 | 
					      handler(newVal) {
 | 
				
			||||||
        if (newVal) {
 | 
					        if (newVal) {
 | 
				
			||||||
          newVal.forEach((newItem) => {
 | 
					          let positionID = localStorage.getItem("positionID");
 | 
				
			||||||
            // 如果已经存在相同BatchId的数据,重置计时器
 | 
					          const match = newVal.some((item) =>
 | 
				
			||||||
            if (newItem.BatchId) {
 | 
					            positionID.includes(item.positionId)
 | 
				
			||||||
              const existingTimer = this.droneTimers.get(newItem.BatchId);
 | 
					          );
 | 
				
			||||||
              if (existingTimer) {
 | 
					          if (match) {
 | 
				
			||||||
                clearInterval(existingTimer); // 清除旧计时器
 | 
					            newVal.forEach((newItem) => {
 | 
				
			||||||
              }
 | 
					              // 如果已经存在相同BatchId的数据,重置计时器
 | 
				
			||||||
 | 
					              if (newItem.BatchId) {
 | 
				
			||||||
 | 
					                const existingTimer = this.droneTimers.get(newItem.BatchId);
 | 
				
			||||||
 | 
					                if (existingTimer) {
 | 
				
			||||||
 | 
					                  clearInterval(existingTimer); // 清除旧计时器
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              // 设置15秒初始时间
 | 
					                // 设置15秒初始时间
 | 
				
			||||||
              newItem.currTime = window.mapConfig.currTime;
 | 
					                newItem.currTime = window.mapConfig.currTime;
 | 
				
			||||||
              // 创建新计时器
 | 
					                // 创建新计时器
 | 
				
			||||||
              const timer = this.startTimer(newItem);
 | 
					                const timer = this.startTimer(newItem);
 | 
				
			||||||
              this.droneTimers.set(newItem.BatchId, timer);
 | 
					                this.droneTimers.set(newItem.BatchId, timer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
              // 更新无人机列表
 | 
					                // 更新无人机列表
 | 
				
			||||||
              const existingIndex = this.drones.findIndex(
 | 
					                const existingIndex = this.drones.findIndex(
 | 
				
			||||||
                (d) => d.BatchId === newItem.BatchId
 | 
					                  (d) => d.BatchId === newItem.BatchId
 | 
				
			||||||
              );
 | 
					                );
 | 
				
			||||||
              newItem.times = moment(newItem.CreateTime).format("HH:mm:ss");
 | 
					                newItem.times = moment(newItem.CreateTime).format("HH:mm:ss");
 | 
				
			||||||
              if (existingIndex !== -1) {
 | 
					                if (existingIndex !== -1) {
 | 
				
			||||||
                this.$set(this.drones, existingIndex, { ...newItem });
 | 
					                  this.$set(this.drones, existingIndex, { ...newItem });
 | 
				
			||||||
              } else {
 | 
					                } else {
 | 
				
			||||||
                this.drones.push({ ...newItem });
 | 
					                  this.drones.push({ ...newItem });
 | 
				
			||||||
              }
 | 
					                }
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
          if (newVal.length === 0) {
 | 
					 | 
				
			||||||
            this.iswarning = false;
 | 
					 | 
				
			||||||
            this.showAudioPrompt = false; // 没有数据 不显示提示框
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          if (this.drones) {
 | 
					 | 
				
			||||||
            mapUavFiex(this.drones);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          let alarm = this.drones.find((d) => d.alarmLevel === 1);
 | 
					 | 
				
			||||||
          const media = this.$refs.uavAudio; // 修正 ref 名称为 "uavAudio"
 | 
					 | 
				
			||||||
          if (alarm) {
 | 
					 | 
				
			||||||
            this.iswarning = true;
 | 
					 | 
				
			||||||
            this.$nextTick(() => {
 | 
					 | 
				
			||||||
              if (media) {
 | 
					 | 
				
			||||||
                media.muted = true; // 初始静音
 | 
					 | 
				
			||||||
                media
 | 
					 | 
				
			||||||
                  .play()
 | 
					 | 
				
			||||||
                  .then(() => {
 | 
					 | 
				
			||||||
                    console.log("播放成功,取消静音");
 | 
					 | 
				
			||||||
                    media.muted = false; // 播放成功后取消静音
 | 
					 | 
				
			||||||
                  })
 | 
					 | 
				
			||||||
                  .catch((error) => {
 | 
					 | 
				
			||||||
                    console.log("播放失败:", error);
 | 
					 | 
				
			||||||
                    this.showAudioPrompt = true; // 播放失败时显示提示框
 | 
					 | 
				
			||||||
                  });
 | 
					 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
          } else {
 | 
					            if (newVal.length === 0) {
 | 
				
			||||||
            this.iswarning = false;
 | 
					              this.iswarning = false;
 | 
				
			||||||
            if (media) {
 | 
					              this.showAudioPrompt = false; // 没有数据 不显示提示框
 | 
				
			||||||
              media.pause(); // 无告警时停止播放
 | 
					            }
 | 
				
			||||||
              media.currentTime = 0; // 重置到开始
 | 
					
 | 
				
			||||||
 | 
					            if (this.drones) {
 | 
				
			||||||
 | 
					              mapUavFiex(this.drones);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            let alarm = this.drones.find((d) => d.alarmLevel === 1);
 | 
				
			||||||
 | 
					            const media = this.$refs.uavAudio; // 修正 ref 名称为 "uavAudio"
 | 
				
			||||||
 | 
					            if (alarm) {
 | 
				
			||||||
 | 
					              this.iswarning = true;
 | 
				
			||||||
 | 
					              this.$nextTick(() => {
 | 
				
			||||||
 | 
					                if (media) {
 | 
				
			||||||
 | 
					                  media.muted = true; // 初始静音
 | 
				
			||||||
 | 
					                  media
 | 
				
			||||||
 | 
					                    .play()
 | 
				
			||||||
 | 
					                    .then(() => {
 | 
				
			||||||
 | 
					                      console.log("播放成功,取消静音");
 | 
				
			||||||
 | 
					                      media.muted = false; // 播放成功后取消静音
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					                    .catch((error) => {
 | 
				
			||||||
 | 
					                      console.log("播放失败:", error);
 | 
				
			||||||
 | 
					                      this.showAudioPrompt = true; // 播放失败时显示提示框
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					              this.iswarning = false;
 | 
				
			||||||
 | 
					              if (media) {
 | 
				
			||||||
 | 
					                media.pause(); // 无告警时停止播放
 | 
				
			||||||
 | 
					                media.currentTime = 0; // 重置到开始
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -276,6 +282,7 @@ export default {
 | 
				
			||||||
      this.isContracted = !this.isContracted; // 切换状态
 | 
					      this.isContracted = !this.isContracted; // 切换状态
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    handleDroneClick(value) {
 | 
					    handleDroneClick(value) {
 | 
				
			||||||
 | 
					      console.log(value, "value");
 | 
				
			||||||
      if (value.drone_lon == 0 || value.drone_lat == 0) {
 | 
					      if (value.drone_lon == 0 || value.drone_lat == 0) {
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        window.marsMap.setCameraView({
 | 
					        window.marsMap.setCameraView({
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ export default {
 | 
				
			||||||
            ? localhostPath
 | 
					            ? localhostPath
 | 
				
			||||||
            : process.env.VUE_APP_API_URL;
 | 
					            : process.env.VUE_APP_API_URL;
 | 
				
			||||||
        connection = new signalR.HubConnectionBuilder()
 | 
					        connection = new signalR.HubConnectionBuilder()
 | 
				
			||||||
          .withUrl(uploadUrl + "/websocket", {
 | 
					          .withUrl("ws://114.66.57.139:5001" + "/websocket", {
 | 
				
			||||||
            skipNegotiation: true,
 | 
					            skipNegotiation: true,
 | 
				
			||||||
            transport: signalR.HttpTransportType.WebSockets
 | 
					            transport: signalR.HttpTransportType.WebSockets
 | 
				
			||||||
          })
 | 
					          })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,6 +85,7 @@ export default {
 | 
				
			||||||
            localStorage.setItem("expires", res.data.expires); // 登录到期时间
 | 
					            localStorage.setItem("expires", res.data.expires); // 登录到期时间
 | 
				
			||||||
            localStorage.setItem("userId", res.data.userid); // 登录id
 | 
					            localStorage.setItem("userId", res.data.userid); // 登录id
 | 
				
			||||||
            localStorage.setItem("isAdmin", res.data.isAdmin); // 权限
 | 
					            localStorage.setItem("isAdmin", res.data.isAdmin); // 权限
 | 
				
			||||||
 | 
					            localStorage.setItem("positionID", res.data.positionIds); // 权限
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 注意:Vue 2 中 Pinia 的用法需要调整
 | 
					            // 注意:Vue 2 中 Pinia 的用法需要调整
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,6 +82,7 @@
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
"use script";
 | 
					"use script";
 | 
				
			||||||
import { userList, userAdd, userUpdate, userDelete } from "@/api/user.js";
 | 
					import { userList, userAdd, userUpdate, userDelete } from "@/api/user.js";
 | 
				
			||||||
 | 
					import { devPositionList } from "@/api/position.js";
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
  name: "webDevice",
 | 
					  name: "webDevice",
 | 
				
			||||||
  data() {
 | 
					  data() {
 | 
				
			||||||
| 
						 | 
					@ -126,6 +127,14 @@ export default {
 | 
				
			||||||
              key: false
 | 
					              key: false
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          ]
 | 
					          ]
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          label: "防区",
 | 
				
			||||||
 | 
					          type: "select",
 | 
				
			||||||
 | 
					          model: "positionId",
 | 
				
			||||||
 | 
					          options: [],
 | 
				
			||||||
 | 
					          multiple: true,
 | 
				
			||||||
 | 
					          rules: [{ required: true, message: "请选择防区", trigger: "change" }]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      tableData: [],
 | 
					      tableData: [],
 | 
				
			||||||
| 
						 | 
					@ -165,6 +174,22 @@ export default {
 | 
				
			||||||
    this.headdenForm({}, "search");
 | 
					    this.headdenForm({}, "search");
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
 | 
					    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;
 | 
				
			||||||
 | 
					              });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    getStatusStyle(value) {
 | 
					    getStatusStyle(value) {
 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
        color: value == 0 ? "green" : "red"
 | 
					        color: value == 0 ? "green" : "red"
 | 
				
			||||||
| 
						 | 
					@ -188,6 +213,7 @@ export default {
 | 
				
			||||||
        this.formDrawerList[0].disabled = false;
 | 
					        this.formDrawerList[0].disabled = false;
 | 
				
			||||||
        this.formDrawerList[1].disabled = false;
 | 
					        this.formDrawerList[1].disabled = false;
 | 
				
			||||||
        this.formDrawerList[1].show = true;
 | 
					        this.formDrawerList[1].show = true;
 | 
				
			||||||
 | 
					        this.initPosition();
 | 
				
			||||||
        this.drawer = true;
 | 
					        this.drawer = true;
 | 
				
			||||||
      } else if (type === "search") {
 | 
					      } else if (type === "search") {
 | 
				
			||||||
        params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
 | 
					        params = JSON.parse(JSON.stringify(this.$refs.myForm.ruleForm));
 | 
				
			||||||
| 
						 | 
					@ -214,6 +240,11 @@ export default {
 | 
				
			||||||
        this.isType = "edit";
 | 
					        this.isType = "edit";
 | 
				
			||||||
        this.title = "编辑人员";
 | 
					        this.title = "编辑人员";
 | 
				
			||||||
        this.fromItem = value;
 | 
					        this.fromItem = value;
 | 
				
			||||||
 | 
					        console.log(value, "value.positionId");
 | 
				
			||||||
 | 
					        this.fromItem.positionId = value.positionId.map((item) => {
 | 
				
			||||||
 | 
					          return String(item);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        this.initPosition();
 | 
				
			||||||
        this.formDrawerList[0].disabled = true;
 | 
					        this.formDrawerList[0].disabled = true;
 | 
				
			||||||
        this.formDrawerList[1].disabled = true;
 | 
					        this.formDrawerList[1].disabled = true;
 | 
				
			||||||
        this.formDrawerList[1].show = false;
 | 
					        this.formDrawerList[1].show = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue