Skip to content

Commit

Permalink
fix: 修复问卷分组bug (#459)
Browse files Browse the repository at this point in the history
* fix: 修复未分组总数

* fix: 列表接口显示传all

* fix: 修复问卷分组bug
  • Loading branch information
skique authored Dec 9, 2024
1 parent 770f86d commit bbef468
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
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 @@ -151,7 +151,7 @@ export const useSurveyListStore = defineStore('surveyList', () => {
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

0 comments on commit bbef468

Please sign in to comment.