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'),
duration: 3,
});
// 教师修改学生时改变状态
if (student) {
const item = classState.studentOptionsDef.find(
s => s.value === classState.student
);
if (item) {
item.applyStatus = status;
}
}
} else {
message.error({
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;
/**学生选择搜索 */
@@ -168,15 +185,22 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
if (!Array.isArray(res.data) || res.data.length <= 0) {
return;
}
for (const s of res.data) {
for (const v of res.data) {
classState.studentOptions.push({
value: s.userName,
label: s.userName,
applyId: s.applyId,
applyStatus: s.applyStatus,
value: v.userName,
label: v.userName,
applyId: v.applyId,
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);
}
});
@@ -184,7 +208,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
// 学生状态
const studentStatus = computed(() => {
const item = classState.studentOptions.find(
const item = classState.studentOptionsDef.find(
s => s.value === classState.student
);
if (item) return item.applyStatus;
@@ -199,5 +223,6 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
classState,
studentStatus,
studentSearch,
studentChange,
};
}

View File

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