diff --git a/.env.development b/.env.development index b2ecbc7..a03e777 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台 VITE_APP_ENV = 'development' # 开发环境 -VITE_APP_BASE_API = 'http://192.168.110.119:8899' +VITE_APP_BASE_API = 'http://192.168.110.159:8899' # 无人机接口地址 diff --git a/.env.production b/.env.production index 62b1323..e1eaa1a 100644 --- a/.env.production +++ b/.env.production @@ -14,7 +14,7 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications' VITE_APP_SNAILJOB_ADMIN = '/snail-job' # 生产环境 -VITE_APP_BASE_API = 'http://192.168.110.2:8899' +VITE_APP_BASE_API = 'http://58.17.134.85:8899' # 是否在打包时开启压缩,支持 gzip 和 brotli VITE_BUILD_COMPRESS = gzip diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index e2dab04..e048c98 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -27,6 +27,7 @@ const getSelectedProjectFromStorage = () => { const getProjectTeamListFromStorage = () => { const stored = $cache.local.getJSON('ProjectTeamList'); + console.log('获取缓存的项目班组列表:', stored); return stored ? stored : null; }; diff --git a/src/views/project/attendance/index.vue b/src/views/project/attendance/index.vue index 030dbec..0ec9ca8 100644 --- a/src/views/project/attendance/index.vue +++ b/src/views/project/attendance/index.vue @@ -212,7 +212,8 @@ import type { CalendarDateType, CalendarInstance } from 'element-plus'; const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); + const attendanceList = ref([]); const attendanceTwoWeekList = ref([]); const buttonLoading = ref(false); diff --git a/src/views/project/attendanceRecords/index.vue b/src/views/project/attendanceRecords/index.vue index d00411a..e202e68 100644 --- a/src/views/project/attendanceRecords/index.vue +++ b/src/views/project/attendanceRecords/index.vue @@ -96,7 +96,8 @@ const dialog = reactive({ const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); + const initFormData: AttendanceForm = { id: undefined, userId: undefined, diff --git a/src/views/project/constructionUser/index.vue b/src/views/project/constructionUser/index.vue index 9c6ff63..c6813df 100644 --- a/src/views/project/constructionUser/index.vue +++ b/src/views/project/constructionUser/index.vue @@ -524,7 +524,8 @@ const { type_of_work, user_sex_type, user_clock_type, user_file_type, user_statu const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); + const constructionUserList = ref([]); const buttonLoading = ref(false); const loading = ref(true); @@ -829,10 +830,10 @@ const updateProjectFile = async () => { await getList(); }; -const getTeamName = (teamId: string | number) => { - const team = ProjectTeam.value.find((item: any) => item.value === teamId); +const getTeamName = computed(() => (teamId: string | number) => { + const team = Array.isArray(ProjectTeam.value) ? ProjectTeam.value.find((item: any) => item.value === teamId) : null; return team ? team.label : teamId; -}; +}); /** 取消按钮 */ const cancel = () => { diff --git a/src/views/project/leave/index.vue b/src/views/project/leave/index.vue index 9c6607c..917527a 100644 --- a/src/views/project/leave/index.vue +++ b/src/views/project/leave/index.vue @@ -246,7 +246,8 @@ const dialog = reactive({ const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); + const initFormData: LeaveForm = { id: undefined, userId: undefined, diff --git a/src/views/project/projectUser/index.vue b/src/views/project/projectUser/index.vue index 398ef6d..4130b26 100644 --- a/src/views/project/projectUser/index.vue +++ b/src/views/project/projectUser/index.vue @@ -101,7 +101,7 @@ - + @@ -521,7 +521,7 @@ const { type_of_work, user_sex_type, user_clock_type, user_file_type, user_statu const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); const constructionUserList = ref([]); const buttonLoading = ref(false); const loading = ref(true); @@ -825,10 +825,10 @@ const updateProjectFile = async () => { await getList(); }; -const getTeamName = (teamId: string | number) => { - const team = ProjectTeam.value.find((item: any) => item.value === teamId); +const getTeamName = computed(() => (teamId: string | number) => { + const team = Array.isArray(ProjectTeam.value) ? ProjectTeam.value.find((item: any) => item.value === teamId) : null; return team ? team.label : teamId; -}; +}); /** 取消按钮 */ const cancel = () => { diff --git a/src/views/project/reissueCard/index.vue b/src/views/project/reissueCard/index.vue index 4af89a6..1a5488c 100644 --- a/src/views/project/reissueCard/index.vue +++ b/src/views/project/reissueCard/index.vue @@ -222,7 +222,8 @@ const dialog = reactive({ const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); + const initFormData: ReissueCardForm = { id: undefined, userId: undefined, diff --git a/src/views/project/workerDailyReport/index.vue b/src/views/project/workerDailyReport/index.vue index 4bab129..1c0e10b 100644 --- a/src/views/project/workerDailyReport/index.vue +++ b/src/views/project/workerDailyReport/index.vue @@ -117,7 +117,8 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance; const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); + const workerDailyReportList = ref([]); const buttonLoading = ref(false); const loading = ref(true); diff --git a/src/views/safety/questionUserAnswer/index.vue b/src/views/safety/questionUserAnswer/index.vue index 135ae07..e95520d 100644 --- a/src/views/safety/questionUserAnswer/index.vue +++ b/src/views/safety/questionUserAnswer/index.vue @@ -104,7 +104,7 @@ const { user_exam_type } = toRefs(proxy?.useDict('user_exam_type')); const userStore = useUserStoreHook(); // 从 store 中获取项目列表和当前选中的项目 const currentProject = computed(() => userStore.selectedProject); -const ProjectTeam = computed(() => userStore.ProjectTeamList); +const ProjectTeam = computed(() => proxy?.$cache.local.getJSON('ProjectTeamList') || []); const questionUserAnswerList = ref([]); const buttonLoading = ref(false);