| | |
| | | </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 |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { HomeAPI } from "@/api/home"; |
| | | import { mapActions } from "vuex"; |
| | | |
| | | export default { |
| | | name: "AppHeader", |
| | | components: {}, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | projectSelected: "", |
| | | options: [ |
| | | { value: "project1", label: "项目1" }, |
| | | { value: "project2", label: "项目2" }, |
| | | { value: "project3", label: "项目3" }, |
| | | ], |
| | | bindSelected: "", |
| | | options: [], |
| | | activeTab: "home", |
| | | currentTime: "", |
| | | currentDate: "", |
| | |
| | | }, |
| | | mounted() { |
| | | this.updateTime(); |
| | | this.getBinds(); |
| | | this.timer = setInterval(this.updateTime, 1000); |
| | | }, |
| | | beforeDestroy() { |
| | |
| | | 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.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) { |
| | | this.$emit("onSelectChange", val); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | ::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; |