顶部列表联动中间表格刷新

This commit is contained in:
Teo
2025-03-25 11:12:26 +08:00
parent 9cf18799fc
commit 0fe766cb12
3 changed files with 3 additions and 9 deletions

View File

@ -21,7 +21,7 @@ import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const projects = computed(() => [
{ id: '', name: '全部工程项目' }, // 添加空选项
// { id: '', name: '全部工程项目' }, // 添加空选项
...userStore.projects
]);
@ -37,17 +37,11 @@ watch(
);
const handleSelect = (projectId: string) => {
const oldId = userStore.getSelectedProjectFromStorage()
console.log(projectId,oldId.id);
if (projectId!=oldId.id) {
location.reload()
}
const selectedProject = projects.value.find((p) => p.id === projectId);
if (selectedProject) {
userStore.setSelectedProject(selectedProject);
location.reload()
}
};
</script>

View File

@ -136,7 +136,6 @@ export const useUserStore = defineStore('user', () => {
setAvatar,
setProjects,
setSelectedProject,
getSelectedProjectFromStorage,
projects,
selectedProject
};

View File

@ -172,6 +172,7 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询分包单位列表 */
const getList = async () => {
loading.value = true;
const res = await listContractor(queryParams.value);
contractorList.value = res.rows;
total.value = res.total;