fix: 班级学生列表搜索时刷新合并申请状态,可直接应用和退回操作

This commit is contained in:
TsMask
2024-07-22 11:45:15 +08:00
parent f977b6ea53
commit b2510c0eb3
2 changed files with 55 additions and 16 deletions

View File

@@ -105,6 +105,15 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
content: t('common.operateOk'), content: t('common.operateOk'),
duration: 3, duration: 3,
}); });
// 教师修改学生时改变状态
if (student) {
const item = classState.studentOptionsDef.find(
s => s.value === classState.student
);
if (item) {
item.applyStatus = status;
}
}
} else { } else {
message.error({ message.error({
content: `${res.msg}`, content: `${res.msg}`,
@@ -146,6 +155,14 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
}); });
} }
/**学生选择搜索 */
function studentChange(v: any) {
if (!v) {
Object.assign(classState.studentOptions, classState.studentOptionsDef);
}
fnActiveConfigNode('#');
}
let timeout: any; let timeout: any;
/**学生选择搜索 */ /**学生选择搜索 */
@@ -168,15 +185,22 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
if (!Array.isArray(res.data) || res.data.length <= 0) { if (!Array.isArray(res.data) || res.data.length <= 0) {
return; return;
} }
for (const s of res.data) { for (const v of res.data) {
classState.studentOptions.push({ classState.studentOptions.push({
value: s.userName, value: v.userName,
label: s.userName, label: v.userName,
applyId: s.applyId, applyId: v.applyId,
applyStatus: s.applyStatus, applyStatus: v.applyStatus,
}); });
// 设为最新状态
const item = classState.studentOptionsDef.find(
s => s.value === v.userName
);
if (item) {
item.applyStatus = v.applyStatus;
}
} }
if (val) { if (!val) {
Object.assign(classState.studentOptionsDef, classState.studentOptions); Object.assign(classState.studentOptionsDef, classState.studentOptions);
} }
}); });
@@ -184,7 +208,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
// 学生状态 // 学生状态
const studentStatus = computed(() => { const studentStatus = computed(() => {
const item = classState.studentOptions.find( const item = classState.studentOptionsDef.find(
s => s.value === classState.student s => s.value === classState.student
); );
if (item) return item.applyStatus; if (item) return item.applyStatus;
@@ -199,5 +223,6 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
classState, classState,
studentStatus, studentStatus,
studentSearch, studentSearch,
studentChange,
}; };
} }

View File

@@ -21,7 +21,7 @@ import useConfigArray from './hooks/useConfigArray';
import useConfigArrayChild from './hooks/useConfigArrayChild'; import useConfigArrayChild from './hooks/useConfigArrayChild';
import { getAllNeConfig } from '@/api/ne/neConfig'; import { getAllNeConfig } from '@/api/ne/neConfig';
import { getPtNeConfigData } from '@/api/pt/neConfig'; import { getPtNeConfigData } from '@/api/pt/neConfig';
import { hasRoles } from '@/plugins/auth-user'; import { isSystemAdmin, hasRoles } from '@/plugins/auth-user';
const neInfoStore = useNeInfoStore(); const neInfoStore = useNeInfoStore();
const { t } = useI18n(); const { t } = useI18n();
const { ruleVerification, getConfigSMFByUPFIds, SMFByUPFIdOptions } = const { ruleVerification, getConfigSMFByUPFIds, SMFByUPFIdOptions } =
@@ -343,6 +343,7 @@ const {
classState, classState,
studentStatus, studentStatus,
studentSearch, studentSearch,
studentChange,
} = usePtOptions({ t, fnActiveConfigNode }); } = usePtOptions({ t, fnActiveConfigNode });
const { tablePagination, listState, listEdit, listEditClose, listEditOk } = const { tablePagination, listState, listEdit, listEditClose, listEditOk } =
@@ -438,6 +439,7 @@ onMounted(() => {
<template> <template>
<PageContainer> <PageContainer>
<a-card <a-card
v-if="!isSystemAdmin()"
:bordered="false" :bordered="false"
:body-style="{ marginBottom: '24px', paddingBottom: 0 }" :body-style="{ marginBottom: '24px', paddingBottom: 0 }"
> >
@@ -455,7 +457,7 @@ onMounted(() => {
:not-found-content="null" :not-found-content="null"
:options="classState.studentOptions" :options="classState.studentOptions"
@search="studentSearch" @search="studentSearch"
@change="fnActiveConfigNode('#')" @change="studentChange"
> >
<template #option="{ value, label, applyStatus }"> <template #option="{ value, label, applyStatus }">
<span>{{ label }} </span> <span>{{ label }} </span>
@@ -681,7 +683,12 @@ onMounted(() => {
v-model:value="listState.editRecord['value']" v-model:value="listState.editRecord['value']"
:disabled="listState.confirmLoading" :disabled="listState.confirmLoading"
></a-input> ></a-input>
<a-space :size="16" align="center" direction="horizontal"> <a-space
:size="8"
align="center"
direction="horizontal"
style="margin-left: 18px"
>
<a-tooltip placement="bottomRight"> <a-tooltip placement="bottomRight">
<template #title> {{ t('common.ok') }} </template> <template #title> {{ t('common.ok') }} </template>
<a-popconfirm <a-popconfirm
@@ -700,26 +707,32 @@ onMounted(() => {
class="editable-cell__icon-edit" class="editable-cell__icon-edit"
:disabled="listState.confirmLoading" :disabled="listState.confirmLoading"
> >
<template #icon><CheckOutlined /></template> <template #icon>
<CheckOutlined style="color: #52c41a" />
</template>
</a-button> </a-button>
</a-popconfirm> </a-popconfirm>
</a-tooltip> </a-tooltip>
<a-tooltip placement="bottomRight"> <a-tooltip placement="bottomRight">
<template #title> <template #title> {{ t('common.cancel') }} </template>
{{ t('common.cancel') }}
</template>
<a-button <a-button
type="text" type="text"
class="editable-cell__icon-edit" class="editable-cell__icon-edit"
:disabled="listState.confirmLoading" :disabled="listState.confirmLoading"
@click.prevent="listEditClose()" @click.prevent="listEditClose()"
> >
<template #icon><CloseOutlined /></template> <template #icon>
<CloseOutlined style="color: #eb2f96" />
</template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
</a-space> </a-space>
</div> </div>
<div v-else class="editable-cell__text-wrapper"> <div
v-else
class="editable-cell__text-wrapper"
@dblclick="listEdit(record)"
>
<template v-if="record['type'] === 'enum'"> <template v-if="record['type'] === 'enum'">
{{ JSON.parse(record['filter'])[text] }} {{ JSON.parse(record['filter'])[text] }}
</template> </template>
@@ -727,6 +740,7 @@ onMounted(() => {
<EditOutlined <EditOutlined
class="editable-cell__icon" class="editable-cell__icon"
@click="listEdit(record)" @click="listEdit(record)"
style="margin-left: 18px"
v-if=" v-if="
!['read-only', 'read', 'ro'].includes( !['read-only', 'read', 'ro'].includes(
record.access record.access