项目列表完整功能

This commit is contained in:
zhuer
2025-03-06 11:50:32 +08:00
parent 86bfb30545
commit c3c6859025
42 changed files with 1861 additions and 3530 deletions

View File

@ -0,0 +1,103 @@
<template>
<div class="select-container">
<label for="projectSelect" class="select-label">项目列表:</label>
<el-select
id="projectSelect"
v-model="selectedProjectId"
placeholder="选择工程"
clearable
filterable
@change="handleSelect"
style="width: 120px;margin-right: 20px;"
>
<el-option
v-for="project in projects"
:key="project.id"
:label="project.name"
:value="project.id"
/>
</el-select>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, watch } from 'vue';
import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const projects = computed(() => userStore.projects);
const selectedProjectId = ref(userStore.selectedProject?.id || '');
// 监听 userStore.selectedProject 变化,更新 selectedProjectId
watch(() => userStore.selectedProject, (newProject) => {
selectedProjectId.value = newProject?.id || '';
}, { deep: true });
const handleSelect = (projectId: string) => {
const selectedProject = projects.value.find(p => p.id === projectId);
if (selectedProject) {
userStore.setSelectedProject(selectedProject);
}
};
</script>
<style lang="scss" scoped>
.select-container {
display: flex;
align-items: center; // 上下居中对齐
gap: 10px; // label 和 select 之间的间距
}
.select-label {
font-weight: bold;
color: #333;
white-space: nowrap; // 防止 label 换行
font-size: 14px; // 设置字体大小
}
#projectSelect {
.el-select {
width: 400px; // 保持宽度
.el-input__inner {
height: 38px;
border-radius: 4px;
border: 1px solid #dcdfe6;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
&:hover {
border-color: #409eff;
}
&:focus {
border-color: #409eff;
box-shadow: 0 0 5px rgba(64, 158, 255, 0.3);
}
}
.el-input__icon {
line-height: 38px;
}
}
&.is-focus .el-input__inner {
border-color: #409eff;
}
}
// 响应式设计(可选)
@media (max-width: 768px) {
.select-container {
flex-direction: column; // 栈式布局
align-items: flex-start; // 左对齐
.select-label {
margin-bottom: 5px; // label 和 select 之间的垂直间距
}
#projectSelect .el-select {
width: 100%; // 在小屏幕上占满宽度
}
}
}
</style>

View File

@ -1,13 +0,0 @@
<template>
<div>
<svg-icon icon-class="question" @click="goto" />
</div>
</template>
<script setup>
const url = ref('https://plus-doc.dromara.org/');
function goto() {
window.open(url.value);
}
</script>

View File

@ -1,13 +0,0 @@
<template>
<div>
<svg-icon icon-class="github" @click="goto" />
</div>
</template>
<script setup>
const url = ref('https://gitee.com/dromara/RuoYi-Vue-Plus');
function goto() {
window.open(url.value);
}
</script>