From dffc70c00552734b3d9fcb850ec0c3a9c41db38e Mon Sep 17 00:00:00 2001 From: dayou <853094838@qq.com> Date: Mon, 28 Oct 2024 21:20:56 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20(#445)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复依赖版本 * fix: nanoid version * fix: sass锁定1.79.6的版本 * nanoid reset * fix: modern-compiler --- web/package.json | 4 ++-- web/vite.config.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/package.json b/web/package.json index f9060096..c606e495 100644 --- a/web/package.json +++ b/web/package.json @@ -23,7 +23,7 @@ "clipboard": "^2.0.11", "crypto-js": "^4.2.0", "echarts": "^5.5.0", - "element-plus": "^2.8.3", + "element-plus": "^2.8.5", "lodash-es": "^4.17.21", "moment": "^2.29.4", "nanoid": "^5.0.7", @@ -57,7 +57,7 @@ "husky": "^9.0.11", "npm-run-all2": "^6.1.1", "prettier": "^3.0.3", - "sass": "1.77.6", + "sass": "1.79.6", "typescript": "~5.3.0", "unplugin-auto-import": "^0.17.5", "unplugin-icons": "^0.18.5", diff --git a/web/vite.config.ts b/web/vite.config.ts index ee989105..49bfe3ba 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -114,6 +114,7 @@ export default defineConfig({ css: { preprocessorOptions: { scss: { + api: 'modern-compiler', additionalData: `@use "@/management/styles/element-variables.scss" as *;` } } From 6c9ac33ea5f61143b89fe3f6d287d4d839739dd7 Mon Sep 17 00:00:00 2001 From: dayou <853094838@qq.com> Date: Wed, 30 Oct 2024 17:56:30 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dc=E7=AB=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=8A=A5=E9=94=99=20(#448)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/management/pages/edit/pages/edit/LogicIndex.vue | 1 + web/src/render/stores/question.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/management/pages/edit/pages/edit/LogicIndex.vue b/web/src/management/pages/edit/pages/edit/LogicIndex.vue index 4241506f..b9967eb2 100644 --- a/web/src/management/pages/edit/pages/edit/LogicIndex.vue +++ b/web/src/management/pages/edit/pages/edit/LogicIndex.vue @@ -73,6 +73,7 @@ const handleChange = (name: any) => { :deep(.el-tabs__content) { height: calc(100% - 10px); padding-bottom: 10px; + overflow-y: auto; :deep(el-tab-pane) { height: 100%; overflow: auto; diff --git a/web/src/render/stores/question.js b/web/src/render/stores/question.js index 8e8e9fbf..5e9f750c 100644 --- a/web/src/render/stores/question.js +++ b/web/src/render/stores/question.js @@ -103,7 +103,7 @@ export const useQuestionStore = defineStore('question', () => { const pageIndex = ref(1) // 当前分页的索引 const changeField = ref(null) const changeIndex = computed(() => { - return questionData.value[changeField.value].index + return questionData.value[changeField.value]?.index }) const needHideFields = ref([]) From c93515d2bd6d627900f5fcdbabc3c4bc26aa26ed Mon Sep 17 00:00:00 2001 From: Liang-Yaxin <161290054+Liang-Yaxin@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:58:17 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20=E7=BC=96=E8=BE=91=E6=80=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20(#444)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/management/pages/edit/pages/edit/index.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/src/management/pages/edit/pages/edit/index.vue b/web/src/management/pages/edit/pages/edit/index.vue index d0b0cb7c..60530995 100644 --- a/web/src/management/pages/edit/pages/edit/index.vue +++ b/web/src/management/pages/edit/pages/edit/index.vue @@ -16,7 +16,9 @@ - diff --git a/web/src/management/components/CooperModify/OperationSelect.vue b/web/src/management/components/CooperModify/OperationSelect.vue index 03cde5a5..dbc6dc9c 100644 --- a/web/src/management/components/CooperModify/OperationSelect.vue +++ b/web/src/management/components/CooperModify/OperationSelect.vue @@ -125,6 +125,11 @@ const handleCheckAll = (val: CheckboxValueType) => { :deep(.el-select__wrapper) { border: none; box-shadow: none; + &:hover, + &:focus { + border: none; + box-shadow: none; + } } :deep(.ishovering) { border: none; @@ -134,11 +139,11 @@ const handleCheckAll = (val: CheckboxValueType) => { display: flex; justify-content: flex-end; } - .operation-select { - :deep(.el-select__placeholder) { - text-align: right; - } - } + // .operation-select { + // :deep(.el-select__placeholder) { + // text-align: right; + // } + // } } + \ No newline at end of file diff --git a/web/src/management/pages/list/components/GroupModify.vue b/web/src/management/pages/list/components/GroupModify.vue new file mode 100644 index 00000000..7ccf922c --- /dev/null +++ b/web/src/management/pages/list/components/GroupModify.vue @@ -0,0 +1,119 @@ + + + + + + \ No newline at end of file diff --git a/web/src/management/pages/list/components/ModifyDialog.vue b/web/src/management/pages/list/components/ModifyDialog.vue index 1ac7da58..6940cd80 100644 --- a/web/src/management/pages/list/components/ModifyDialog.vue +++ b/web/src/management/pages/list/components/ModifyDialog.vue @@ -21,6 +21,19 @@ + + + + + @@ -66,10 +89,13 @@ import { storeToRefs } from 'pinia' import { useRouter } from 'vue-router' import BaseList from './components/BaseList.vue' import SpaceList from './components/SpaceList.vue' +import GroupList from './components/GroupList.vue' import SliderBar from './components/SliderBar.vue' import SpaceModify from './components/SpaceModify.vue' +import GroupModify from './components/GroupModify.vue' import TopNav from '@/management/components/TopNav.vue' -import { SpaceType } from '@/management/utils/workSpace' +import { MenuType } from '@/management/utils/workSpace' + import { useWorkSpaceStore } from '@/management/stores/workSpace' import { useSurveyListStore } from '@/management/stores/surveyList' import { type IWorkspace } from '@/management/utils/workSpace' @@ -78,14 +104,39 @@ const workSpaceStore = useWorkSpaceStore() const surveyListStore = useSurveyListStore() const { surveyList, surveyTotal } = storeToRefs(surveyListStore) -const { spaceMenus, workSpaceId, spaceType, workSpaceList, workSpaceListTotal } = +const { spaceMenus, workSpaceId, groupId, menuType, workSpaceList, workSpaceListTotal, groupList, groupListTotal } = storeToRefs(workSpaceStore) const router = useRouter() +const tableTitle = computed(() => { + if(menuType.value === MenuType.PersonalGroup && !groupId.value) { + return '我的空间' + } else if (menuType.value === MenuType.SpaceGroup && !workSpaceId.value) { + return '团队空间' + } else { + return currentTeamSpace.value?.name || '问卷列表'; + } +}) + +const activeValue = computed(() => { + if(workSpaceId.value !== '') { + return workSpaceId.value + } else if(groupId.value !== '') { + return groupId.value + } else if(menuType.value === MenuType.PersonalGroup) { + return MenuType.PersonalGroup + } else if(menuType.value === MenuType.SpaceGroup) { + return MenuType.SpaceGroup + } else { + return '' + } +}) + const loading = ref(false) const spaceListRef = ref(null) const spaceLoading = ref(false) +const groupLoading = ref(false) const fetchSpaceList = async (params?: any) => { spaceLoading.value = true @@ -94,24 +145,39 @@ const fetchSpaceList = async (params?: any) => { spaceLoading.value = false } -const handleSpaceSelect = (id: SpaceType | string) => { - if (id === spaceType.value || id === workSpaceId.value) { +const fetchGroupList = async (params?: any) => { + groupLoading.value = true + workSpaceStore.changeWorkSpace('') + workSpaceStore.getGroupList(params) + groupLoading.value = false +} + +const handleSpaceSelect = (id: MenuType | string) => { + if (groupId.value === id || workSpaceId.value === id) { return void 0 } - + let parentMenu = undefined switch (id) { - case SpaceType.Personal: - workSpaceStore.changeSpaceType(SpaceType.Personal) + case MenuType.PersonalGroup: + workSpaceStore.changeMenuType(MenuType.PersonalGroup) workSpaceStore.changeWorkSpace('') + fetchGroupList() break - case SpaceType.Group: - workSpaceStore.changeSpaceType(SpaceType.Group) + case MenuType.SpaceGroup: + workSpaceStore.changeMenuType(MenuType.SpaceGroup) workSpaceStore.changeWorkSpace('') fetchSpaceList() break default: - workSpaceStore.changeSpaceType(SpaceType.Teamwork) - workSpaceStore.changeWorkSpace(id) + parentMenu = spaceMenus.value.find((parent: any) => parent.children.find((children: any) => children.id.toString() === id)) + if(parentMenu != undefined) { + workSpaceStore.changeMenuType(parentMenu.id) + if(parentMenu.id === MenuType.PersonalGroup) { + workSpaceStore.changeGroup(id) + } else if (parentMenu.id === MenuType.SpaceGroup) { + workSpaceStore.changeWorkSpace(id) + } + } break } fetchSurveyList() @@ -133,6 +199,7 @@ const fetchSurveyList = async (params?: any) => { } onMounted(() => { + fetchGroupList() fetchSpaceList() fetchSurveyList() }) @@ -168,7 +235,7 @@ const onCloseModifyInTeamWork = (data: IWorkspace) => { } } -const onCloseModify = (type: string) => { +const onCloseSpaceModify = (type: string) => { showSpaceModify.value = false if (type === 'update' && spaceListRef.value) { fetchSpaceList() @@ -179,6 +246,20 @@ const onSpaceCreate = () => { modifyType.value = 'add' showSpaceModify.value = true } + +// 分组 + +const showGroupModify = ref(false) + +const onCloseGroupModify = () => { + showGroupModify.value = false + fetchGroupList() +} + +const onGroupCreate = () => { + showGroupModify.value = true +} + const onCreate = () => { router.push('/create') } diff --git a/web/src/management/stores/surveyList.ts b/web/src/management/stores/surveyList.ts index 7d403af6..fcd885ef 100644 --- a/web/src/management/stores/surveyList.ts +++ b/web/src/management/stores/surveyList.ts @@ -6,7 +6,7 @@ import 'element-plus/theme-chalk/src/message.scss' import { CODE_MAP } from '@/management/api/base' import { getSurveyList as getSurveyListReq } from '@/management/api/survey' - +import { GroupState } from '@/management/utils/workSpace' import { useWorkSpaceStore } from './workSpace' import { @@ -150,7 +150,8 @@ export const useSurveyListStore = defineStore('surveyList', () => { pageSize: payload?.pageSize || 10, // 默认一页10条 filter: filterString, order: orderString, - workspaceId: workSpaceStore.workSpaceId + workspaceId: workSpaceStore.workSpaceId, + groupId: workSpaceStore.groupId === GroupState.All ? '' : workSpaceStore.groupId } const res: any = await getSurveyListReq(params) diff --git a/web/src/management/stores/workSpace.ts b/web/src/management/stores/workSpace.ts index 9469bc02..1d3c95c3 100644 --- a/web/src/management/stores/workSpace.ts +++ b/web/src/management/stores/workSpace.ts @@ -10,11 +10,16 @@ import { updateSpace as updateSpaceReq, deleteSpace as deleteSpaceReq, getSpaceList as getSpaceListReq, - getSpaceDetail as getSpaceDetailReq + getSpaceDetail as getSpaceDetailReq, + createGroup, + getGroupList as getGroupListReq, + updateGroup as updateGroupReq, + deleteGroup as deleteGroupReq } from '@/management/api/space' -import { SpaceType } from '@/management/utils/workSpace' -import { type SpaceDetail, type SpaceItem, type IWorkspace } from '@/management/utils/workSpace' +import { GroupState, MenuType } from '@/management/utils/workSpace' +import { type SpaceDetail, type SpaceItem, type IWorkspace, type IGroup, type GroupItem, } from '@/management/utils/workSpace' + import { useSurveyListStore } from './surveyList' @@ -24,16 +29,18 @@ export const useWorkSpaceStore = defineStore('workSpace', () => { { icon: 'icon-wodekongjian', name: '我的空间', - id: SpaceType.Personal + id: MenuType.PersonalGroup, + children: [] }, { icon: 'icon-tuanduikongjian', name: '团队空间', - id: SpaceType.Group, + id: MenuType.SpaceGroup, children: [] } ]) - const spaceType = ref(SpaceType.Personal) + const menuType = ref(MenuType.PersonalGroup) + const groupId = ref('') const workSpaceId = ref('') const spaceDetail = ref(null) const workSpaceList = ref([]) @@ -50,7 +57,8 @@ export const useWorkSpaceStore = defineStore('workSpace', () => { const workSpace = list.map((item: SpaceDetail) => { return { id: item._id, - name: item.name + name: item.name, + total: item.surveyTotal } }) workSpaceList.value = list @@ -78,12 +86,19 @@ export const useWorkSpaceStore = defineStore('workSpace', () => { } } - function changeSpaceType(id: SpaceType) { - spaceType.value = id + function changeMenuType(id: MenuType) { + menuType.value = id } function changeWorkSpace(id: string) { workSpaceId.value = id + groupId.value = '' + surveyListStore.resetSearch() + } + + function changeGroup(id: string) { + groupId.value = id + workSpaceId.value = '' surveyListStore.resetSearch() } @@ -126,21 +141,130 @@ export const useWorkSpaceStore = defineStore('workSpace', () => { function setSpaceDetail(data: null | SpaceDetail) { spaceDetail.value = data } + + // 分组 + const groupList = ref([]) + const groupAllList = ref([]) + const groupListTotal = ref(0) + const groupDetail = ref(null) + async function addGroup(params: IGroup) { + const { name } = params + const res: any = await createGroup({ name }) + + if (res.code === CODE_MAP.SUCCESS) { + ElMessage.success('添加成功') + } else { + ElMessage.error('createGroup code err' + res.errmsg) + } + } + + async function updateGroup(params: Required) { + const { _id, name } = params + const res: any = await updateGroupReq({ _id, name }) + + if (res?.code === CODE_MAP.SUCCESS) { + ElMessage.success('更新成功') + } else { + ElMessage.error(res?.errmsg) + } + } + + async function getGroupList(params = { curPage: 1 }) { + try { + const res: any = await getGroupListReq(params) + if (res.code === CODE_MAP.SUCCESS) { + const { list, allList, total, notTotal } = res.data + let allTotal = notTotal + const group = list.map((item: GroupItem) => { + allTotal += item.surveyTotal + return { + id: item._id, + name: item.name, + total: item.surveyTotal, + } + }) + group.unshift({ + id: GroupState.All, + name: '全部' , + total: allTotal + }, { + id: GroupState.Not, + name: '未分组' , + total: notTotal + }) + allList.unshift({ + _id: '', + name: '未分组' + }) + groupList.value = list + groupListTotal.value = total + spaceMenus.value[0].children = group + groupAllList.value = allList + } else { + ElMessage.error('getGroupList' + res.errmsg) + } + } catch (err) { + ElMessage.error('getGroupList' + err) + } + } + + function getGroupDetail(id: string) { + try { + const data = groupList.value.find((item: GroupItem) => item._id === id) + if(data != undefined) { + groupDetail.value = data + } else { + ElMessage.error('groupDetail 未找到分组') + } + } catch (err) { + ElMessage.error('groupDetail' + err) + } + } + + function setGroupDetail(data: null | GroupItem) { + groupDetail.value = data + } + + async function deleteGroup(id: string) { + try { + const res: any = await deleteGroupReq(id) + + if (res.code === CODE_MAP.SUCCESS) { + ElMessage.success('删除成功') + } else { + ElMessage.error(res.errmsg) + } + } catch (err: any) { + ElMessage.error(err) + } + } return { + menuType, spaceMenus, - spaceType, + groupId, workSpaceId, spaceDetail, workSpaceList, workSpaceListTotal, getSpaceList, getSpaceDetail, - changeSpaceType, + changeMenuType, changeWorkSpace, + changeGroup, addSpace, deleteSpace, updateSpace, - setSpaceDetail + setSpaceDetail, + groupList, + groupAllList, + groupListTotal, + groupDetail, + addGroup, + updateGroup, + getGroupList, + getGroupDetail, + setGroupDetail, + deleteGroup } }) diff --git a/web/src/management/utils/workSpace.ts b/web/src/management/utils/workSpace.ts index 654cfd2a..ac0cc95f 100644 --- a/web/src/management/utils/workSpace.ts +++ b/web/src/management/utils/workSpace.ts @@ -7,9 +7,15 @@ export interface MenuItem { id: string name: string icon?: string + total?: Number children?: MenuItem[] } +export type IGroup = { + _id?: string + name: string +} + export type IWorkspace = { _id?: string name: string @@ -29,6 +35,7 @@ export interface SpaceDetail { name: string currentUserId?: string description: string + surveyTotal: number members: IMember[] } @@ -49,16 +56,30 @@ export interface ICollaborator { permissions: Array } -export enum SpaceType { - Personal = 'personal', - Group = 'group', - Teamwork = 'teamwork' +export type GroupItem = { + _id: string, + name: string, + createdAt: string + updatedAt?: string + ownerId: string + surveyTotal: number } + +export enum MenuType { + PersonalGroup = 'personalGroup', + SpaceGroup = 'spaceGroup', +} + export enum UserRole { Admin = 'admin', Member = 'user' } +export enum GroupState { + All = 'all', + Not = 'nogrouped' +} + // 定义角色标签映射对象 export const roleLabels: Record = { [UserRole.Admin]: '管理员', From f01465aa6cd753e25dd58c014b33238aaba32a4a Mon Sep 17 00:00:00 2001 From: dayou <853094838@qq.com> Date: Thu, 31 Oct 2024 21:40:32 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=20=E8=A7=A3=E5=86=B3=E5=86=B2?= =?UTF-8?q?=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/management/pages/list/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/management/pages/list/index.vue b/web/src/management/pages/list/index.vue index cf349025..6ed71124 100644 --- a/web/src/management/pages/list/index.vue +++ b/web/src/management/pages/list/index.vue @@ -219,7 +219,7 @@ const onSetGroup = async () => { } const onCloseModifyInTeamWork = (data: IWorkspace) => { - if (spaceType.value === SpaceType.Teamwork) { + if (activeValue.value === MenuType.SpaceGroup) { const currentData = workSpaceList.value.find((item) => item._id === data._id) if (currentData) { currentData.name = data.name