Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复问卷分组bug #459

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export class SurveyGroupController {
const surveyTotalList = await Promise.all(
groupIdList.map((item) => {
return this.surveyMetaService.countSurveyMetaByGroupId({
userId,
groupId: item,
});
}),
Expand All @@ -95,6 +96,7 @@ export class SurveyGroupController {
return pre;
}, {});
const notTotal = await this.surveyMetaService.countSurveyMetaByGroupId({
userId,
groupId: null,
});
return {
Expand Down
5 changes: 3 additions & 2 deletions server/src/modules/survey/services/surveyMeta.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class SurveyMetaService {
}
if (groupId && groupId !== 'all') {
query.groupId =
groupId === 'nogrouped'
groupId === 'unclassified'
? {
$exists: true,
$eq: null,
Expand Down Expand Up @@ -248,8 +248,9 @@ export class SurveyMetaService {
});
return total;
}
async countSurveyMetaByGroupId({ groupId }) {
async countSurveyMetaByGroupId({ groupId, userId = undefined }) {
const total = await this.surveyRepository.count({
ownerId: userId,
groupId,
$or: [
{ workspaceId: { $exists: false } },
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/pages/list/components/ModifyDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<el-form-item label="备注">
<el-input v-model="current.remark" />
</el-form-item>
<el-form-item prop="groupId" label="问卷分组" v-if="menuType === MenuType.PersonalGroup">
<el-form-item prop="groupId" label="分组" v-if="menuType === MenuType.PersonalGroup">
<el-select
v-model="current.groupId"
placeholder="未分组"
Expand Down
6 changes: 3 additions & 3 deletions web/src/management/pages/list/components/SliderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ const props = withDefaults(

const active = computed({
get: () => {
return props.activeValue
},
set: () => {}
return props.activeValue
},
set: () => {}
})

const emit = defineEmits(['select'])
Expand Down
2 changes: 0 additions & 2 deletions web/src/management/pages/list/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,7 @@ const fetchSurveyList = async (params?: any) => {
}

onMounted(() => {
fetchGroupList()
fetchSpaceList()
fetchSurveyList()
})

const modifyType = ref('add')
Expand Down
2 changes: 1 addition & 1 deletion web/src/management/stores/surveyList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { CODE_MAP } from '@/management/api/base'
import { getSurveyList as getSurveyListReq } from '@/management/api/survey'
import { GroupState } from '@/management/utils/workSpace'

Check warning on line 9 in web/src/management/stores/surveyList.ts

View workflow job for this annotation

GitHub Actions / Lint

'GroupState' is defined but never used
import { useWorkSpaceStore } from './workSpace'

import {
Expand Down Expand Up @@ -151,7 +151,7 @@
filter: filterString,
order: orderString,
workspaceId: workSpaceStore.workSpaceId,
groupId: workSpaceStore.groupId === GroupState.All ? '' : workSpaceStore.groupId
groupId: workSpaceStore.groupId
}

const res: any = await getSurveyListReq(params)
Expand Down
3 changes: 3 additions & 0 deletions web/src/management/styles/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
}
}
}
.el-message-box__status{
font-size: 24px;
}
2 changes: 1 addition & 1 deletion web/src/management/utils/workSpace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export enum UserRole {

export enum GroupState {
All = 'all',
Not = 'nogrouped'
Not = 'unclassified'
}

// 定义角色标签映射对象
Expand Down
Loading