From 64a1caf0dddac3c238e519d9ee2ca8bdf18f9d92 Mon Sep 17 00:00:00 2001 From: sudoooooo Date: Tue, 9 Jul 2024 11:36:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20list=E6=A8=A1=E5=9D=97=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/create/components/CreateForm.vue | 8 +- .../pages/list/components/BaseList.vue | 8 +- .../pages/list/components/MemberList.vue | 6 +- .../pages/list/components/SpaceList.vue | 16 +-- .../pages/list/components/SpaceModify.vue | 40 ++++-- web/src/management/pages/list/index.vue | 26 ++-- web/src/management/store/list/index.js | 28 ++-- web/src/management/stores/surveyList.ts | 136 +++++++++--------- .../stores/{teamSpace.ts => workSpace.ts} | 30 ++-- 9 files changed, 162 insertions(+), 136 deletions(-) rename web/src/management/stores/{teamSpace.ts => workSpace.ts} (88%) diff --git a/web/src/management/pages/create/components/CreateForm.vue b/web/src/management/pages/create/components/CreateForm.vue index 614a122d..43b0c628 100644 --- a/web/src/management/pages/create/components/CreateForm.vue +++ b/web/src/management/pages/create/components/CreateForm.vue @@ -42,7 +42,7 @@ import { ElMessage } from 'element-plus' import 'element-plus/theme-chalk/src/message.scss' import { createSurvey } from '@/management/api/survey' import { SURVEY_TYPE_LIST } from '../types' -import { useTeamSpaceStore } from '@/management/stores/teamSpace' +import { useWorkSpaceStore } from '@/management/stores/workSpace' interface Props { selectType?: string @@ -52,7 +52,7 @@ const props = withDefaults(defineProps(), { selectType: 'normal' }) -const teamSpaceStore = useTeamSpaceStore() +const workSpaceStore = useWorkSpaceStore() const ruleForm = ref(null) const state = reactive({ @@ -92,8 +92,8 @@ const submit = () => { surveyType: selectType, ...state.form } - if (teamSpaceStore.workSpaceId) { - payload.workspaceId = teamSpaceStore.workSpaceId + if (workSpaceStore.workSpaceId) { + payload.workspaceId = workSpaceStore.workSpaceId } const res: any = await createSurvey(payload) if (res?.code === 200 && res?.data?.id) { diff --git a/web/src/management/pages/list/components/BaseList.vue b/web/src/management/pages/list/components/BaseList.vue index ecc88eb5..5c96911a 100644 --- a/web/src/management/pages/list/components/BaseList.vue +++ b/web/src/management/pages/list/components/BaseList.vue @@ -123,7 +123,7 @@ import EmptyIndex from '@/management/components/EmptyIndex.vue' import { CODE_MAP } from '@/management/api/base' import { QOP_MAP } from '@/management/utils/constant.ts' import { deleteSurvey } from '@/management/api/survey' -import { useTeamSpaceStore } from '@/management/stores/teamSpace' +import { useWorkSpaceStore } from '@/management/stores/workSpace' import { useSurveyListStore } from '@/management/stores/surveyList' import ModifyDialog from './ModifyDialog.vue' import TagModule from './TagModule.vue' @@ -144,8 +144,8 @@ import { } from '@/management/config/listConfig' const surveyListStore = useSurveyListStore() -const teamSpaceStore = useTeamSpaceStore() -const { workSpaceId } = storeToRefs(teamSpaceStore) +const workSpaceStore = useWorkSpaceStore() +const { workSpaceId } = storeToRefs(workSpaceStore) const router = useRouter() const props = defineProps({ loading: { @@ -433,7 +433,7 @@ const onSelectChange = (selectKey, selectValue) => { onReflush() } const onButtonChange = (effectKey, effectValue) => { - surveyListStore.reserButtonValueMap() + surveyListStore.resetButtonValueMap() surveyListStore.changeButtonValueMap(effectKey, effectValue) onReflush() } diff --git a/web/src/management/pages/list/components/MemberList.vue b/web/src/management/pages/list/components/MemberList.vue index 1832198c..2a5afa3c 100644 --- a/web/src/management/pages/list/components/MemberList.vue +++ b/web/src/management/pages/list/components/MemberList.vue @@ -18,9 +18,9 @@ import { computed } from 'vue' import { type IMember, type ListItem } from '@/management/utils/types/workSpace' import OperationSelect from './OperationSelect.vue' -import { useTeamSpaceStore } from '@/management/stores/teamSpace' +import { useWorkSpaceStore } from '@/management/stores/workSpace' -const teamSpaceStore = useTeamSpaceStore() +const workSpaceStore = useWorkSpaceStore() const props = withDefaults( defineProps<{ members: IMember[] @@ -43,7 +43,7 @@ const list = computed({ } }) const currentUserId = computed(() => { - return teamSpaceStore.spaceDetail?.currentUserId + return workSpaceStore.spaceDetail?.currentUserId }) const handleRemove = (index: number) => { list.value.splice(index, 1) diff --git a/web/src/management/pages/list/components/SpaceList.vue b/web/src/management/pages/list/components/SpaceList.vue index 07d8c987..4765ba0e 100644 --- a/web/src/management/pages/list/components/SpaceList.vue +++ b/web/src/management/pages/list/components/SpaceList.vue @@ -77,11 +77,11 @@ import { get, map } from 'lodash-es' import { spaceListConfig } from '@/management/config/listConfig' import SpaceModify from './SpaceModify.vue' import { UserRole } from '@/management/utils/types/workSpace' -import { useTeamSpaceStore } from '@/management/stores/teamSpace' +import { useWorkSpaceStore } from '@/management/stores/workSpace' const showSpaceModify = ref(false) const modifyType = ref('edit') -const teamSpaceStore = useTeamSpaceStore() +const workSpaceStore = useWorkSpaceStore() const fields = ['name', 'surveyTotal', 'memberTotal', 'owner', 'createDate'] const fieldList = computed(() => { return map(fields, (f) => { @@ -89,17 +89,17 @@ const fieldList = computed(() => { }) }) const dataList = computed(() => { - return teamSpaceStore.teamSpaceList + return workSpaceStore.workSpaceList }) const isAdmin = (id: string) => { return ( - teamSpaceStore.teamSpaceList.find((item: any) => item._id === id)?.currentUserRole === + workSpaceStore.workSpaceList.find((item: any) => item._id === id)?.currentUserRole === UserRole.Admin ) } const handleModify = async (id: string) => { - await teamSpaceStore.getSpaceDetail(id) + await workSpaceStore.getSpaceDetail(id) modifyType.value = 'edit' showSpaceModify.value = true } @@ -115,15 +115,15 @@ const handleDelete = (id: string) => { } ) .then(async () => { - await teamSpaceStore.deleteSpace(id) - await teamSpaceStore.getSpaceList() + await workSpaceStore.deleteSpace(id) + await workSpaceStore.getSpaceList() }) .catch(() => {}) } const onCloseModify = () => { showSpaceModify.value = false - teamSpaceStore.getSpaceList() + workSpaceStore.getSpaceList() } // const handleCurrentChange = (current) => { diff --git a/web/src/management/pages/list/components/SpaceModify.vue b/web/src/management/pages/list/components/SpaceModify.vue index f32465b4..69997646 100644 --- a/web/src/management/pages/list/components/SpaceModify.vue +++ b/web/src/management/pages/list/components/SpaceModify.vue @@ -1,7 +1,21 @@