From f33e0a4d96c34fcb7c26342e880bafc4d68c4e07 Mon Sep 17 00:00:00 2001
From: Gary Gu <garygu@Garydebijibendiannao.local>
Date: Thu, 24 Jul 2025 09:14:37 +0800
Subject: [PATCH] feat: 新增智慧工地跳转URL
---
src/components/Header.vue | 47 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/src/components/Header.vue b/src/components/Header.vue
index 3fc3799..507ec69 100644
--- a/src/components/Header.vue
+++ b/src/components/Header.vue
@@ -43,7 +43,7 @@
</div>
<div class="absolute top-0 right-0">
<div class="flex items-center h-[80px] mr-[20px]">
- <el-select v-model="projectSelected" placeholder="请选择" class="mr-[24px]">
+ <el-select v-model="bindSelected" placeholder="请选择" class="mr-[24px]" @change="handleSelect">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<i
@@ -61,6 +61,9 @@
</template>
<script>
+ import { HomeAPI } from "@/api/home";
+ import { mapActions } from "vuex";
+
export default {
name: "AppHeader",
components: {},
@@ -76,21 +79,19 @@
},
data() {
return {
- projectSelected: "",
- options: [
- { value: "project1", label: "项目1" },
- { value: "project2", label: "项目2" },
- { value: "project3", label: "项目3" },
- ],
+ bindSelected: "",
+ options: [],
activeTab: "home",
currentTime: "",
currentDate: "",
timer: null,
backgroundImage: new URL("@/assets/images/backgrounds/logo.png", import.meta.url).href,
+ binds: [],
};
},
mounted() {
this.updateTime();
+ this.getBinds();
this.timer = setInterval(this.updateTime, 1000);
},
beforeDestroy() {
@@ -102,7 +103,9 @@
handleFullscreen() {
if (this.$fullscreen.isFullscreen) {
this.$fullscreen.exit();
+ this.$emit("fullscreenChange", false);
} else {
+ this.$emit("fullscreenChange", true);
this.$fullscreen.request();
}
},
@@ -127,6 +130,34 @@
const weekDay = weekDays[now.getDay()];
this.currentDate = `${year}.${month}.${day} 星期${weekDay}`;
},
+ /**
+ * 获取标段信息
+ */
+ getBinds() {
+ HomeAPI.GetBindSelect().then((res) => {
+ if (res.Ret === 1) {
+ const result = res.Data;
+ if (result.length > 0) {
+ this.binds = result;
+ this.options = result.map((item) => ({
+ value: item.Id,
+ label: item.BindName,
+ }));
+ this.bindSelected = this.options[0].value; // 默认选中第一个项目
+ this.handleSelect(this.bindSelected);
+ } else {
+ this.options = [];
+ }
+ }
+ });
+ },
+ /**
+ * 处理选择变化
+ */
+ handleSelect(val) {
+ const item = this.binds.find((item) => item.Id === val);
+ this.$emit("onSelectChange", val, item.WebUrl);
+ },
},
};
</script>
@@ -137,7 +168,7 @@
::v-deep(.el-select) {
width: 160px;
height: 28px;
- background: rgba(33,72,115,0.9);
+ background: rgba(33, 72, 115, 0.9);
border-radius: 2px;
.el-input {
align-items: center;
--
Gitblit v1.9.3