Skip to content

fix: 解决组面和群面的选择相同问题 #81

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
22 changes: 15 additions & 7 deletions src/views/interview/management/allowcate-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import dayjs from 'dayjs';
import { Group } from '@/constants/team';
import { Application } from '@/constants/httpMsg/application/getApplicationMsg';
import { isOverlappingWithAny, timeRangesType } from '@/utils/isOverlapping';
import { Interview } from '@/constants/httpMsg/interview/getInterviewMsg';

const { t } = useI18n();
const { widthType } = useWindowResize();
Expand Down Expand Up @@ -94,6 +95,15 @@ const props = defineProps({
default: () => [],
required: true,
},
filteredInterviews: {
type: Array as PropType<Interview[]>,
default: () => [],
required: true,
},
interviewIdSet: {
type: Set,
required: true,
},
});

const showAllowcate = defineModel<boolean>('showAllowcate', {
Expand All @@ -107,20 +117,14 @@ const form = ref<{
}>({ selectInterviewId: '' });
const recStore = useRecruitmentStore();

const filteredInterviews = computed(() =>
props.interviewType === 'group'
? recStore.curInterviews.filter((item) => item.name === props.currentGroup)
: recStore.curInterviews.filter((item) => item.name === 'unique'),
);

const optionsData = computed(() => {
// 面试分类 date->period->time
// eslint-disable-next-line @typescript-eslint/no-shadow
const optionsData = {} as {
[key: string]: { [key: string]: { time: string; interviewId: string }[] };
};

filteredInterviews.value.forEach((interview) => {
props.filteredInterviews.forEach((interview) => {
if (interview.start && interview.period) {
const date = dayjs(interview.start).format('YYYY-MM-DD');
const time = `${dayjs(interview.start).format('HH:mm')}
Expand Down Expand Up @@ -179,6 +183,10 @@ const selectedTime = computed(() => {
);
return (
nowApplication?.interview_selections
// 过滤不是当前的面试,主要由于组面和群面的 interviewSelections 是同一个
?.filter((interview_selection) =>
props.interviewIdSet.has(interview_selection.uid),
)
?.map((interview) => ({
formatedTime: `${dayjs(interview.start).format('YYYY-MM-DD')} ${dayjs(
interview.start,
Expand Down
30 changes: 27 additions & 3 deletions src/views/interview/management/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@
:current-group="currentGroup"
:filtered-apps="filteredAndSortedApps"
:merged-time-ranges="mergedTimeRanges"
:filtered-interviews="filteredInterviews"
:interview-id-set="interviewIdSet"
/>
<!-- 分配选手面试时间弹窗 -->
</template>
Expand Down Expand Up @@ -277,6 +279,22 @@ const filteredAndSortedApps = computed(() =>
}),
);

// 当前组下所有可选的面试
const filteredInterviews = computed(() =>
interviewType.value === InterviewType.Group
? recStore.curInterviews.filter((item) => item.name === currentGroup.value)
: recStore.curInterviews.filter((item) => item.name === 'unique'),
);

// 所有可选面试的 Id
const interviewIdSet = computed(() => {
const m = new Set<string>();
filteredInterviews.value.forEach((inte) => {
m.add(inte.uid);
});
return m;
});

const mergedTimeRanges = computed(() => {
const raw: timeRangesType[] = [];
filteredAndSortedApps.value.forEach((app) => {
Expand Down Expand Up @@ -315,10 +333,16 @@ const data = computed(() =>
};
if (
ret.interviewTime === t('common.status.waitForDistribution') &&
app.interview_selections &&
app.interview_selections.length !== 0
app.interview_selections
) {
ret.name = `💡${ret.name}`;
const isNew =
app.interview_selections?.some((se) =>
interviewIdSet.value.has(se.uid),
) ?? false;

if (isNew) {
ret.name = `💡${ret.name}`;
}
}

return ret;
Expand Down