fix: 参数配置教师操作学生应用和退回
This commit is contained in:
@@ -1,12 +1,24 @@
|
|||||||
import { request } from '@/plugins/http-fetch';
|
import { request } from '@/plugins/http-fetch';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班级学生列表 (仅教师操作)
|
||||||
|
* @param params 数据 {userName}
|
||||||
|
* @returns object
|
||||||
|
*/
|
||||||
|
export function getPtClassStudents(params?: Record<string, any>) {
|
||||||
|
return request({
|
||||||
|
url: `/pt/neConfigApply/students`,
|
||||||
|
params,
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网元参数配置应用申请列表
|
* 网元参数配置应用申请列表
|
||||||
* @param params 数据 {neType,paramName}
|
* @param params 数据 {neType,paramName}
|
||||||
* @returns object
|
* @returns object
|
||||||
*/
|
*/
|
||||||
export function getPtNeConfigApply(params: Record<string, any>) {
|
export function getPtNeConfigApplyList(params: Record<string, any>) {
|
||||||
return request({
|
return request({
|
||||||
url: `/pt/neConfigApply/list`,
|
url: `/pt/neConfigApply/list`,
|
||||||
params,
|
params,
|
||||||
@@ -39,5 +51,3 @@ export function updatePtNeConfigApply(data: Record<string, any>) {
|
|||||||
data: data,
|
data: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ export default function useConfigList({
|
|||||||
/**当前页数 */
|
/**当前页数 */
|
||||||
current: 1,
|
current: 1,
|
||||||
/**每页条数 */
|
/**每页条数 */
|
||||||
pageSize: 20,
|
pageSize: 10,
|
||||||
/**默认的每页条数 */
|
/**默认的每页条数 */
|
||||||
defaultPageSize: 20,
|
defaultPageSize: 10,
|
||||||
/**指定每页可以显示多少条 */
|
/**指定每页可以显示多少条 */
|
||||||
pageSizeOptions: ['10', '20', '50', '100'],
|
pageSizeOptions: ['10', '20', '50', '100'],
|
||||||
/**只有一页时是否隐藏分页器 */
|
/**只有一页时是否隐藏分页器 */
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
restLoading: false,
|
restLoading: false,
|
||||||
applyLoading: false,
|
applyLoading: false,
|
||||||
});
|
});
|
||||||
/**保存网元下所有配置为示例配置 */
|
/**(管理员)保存网元下所有配置为示例配置 */
|
||||||
function ptConfigSave(neType: string) {
|
function ptConfigSave(neType: string) {
|
||||||
ptConfigState.saveLoading = true;
|
ptConfigState.saveLoading = true;
|
||||||
ptSaveAsDefault(neType, '001')
|
ptSaveAsDefault(neType, '001')
|
||||||
@@ -39,6 +39,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
ptConfigState.saveLoading = false;
|
ptConfigState.saveLoading = false;
|
||||||
|
fnActiveConfigNode('#');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,13 +67,34 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**配置下方应用(学生)申请撤回和(管理/教师)应用退回 */
|
/**配置下方应用(学生)申请撤回和(管理/教师)应用退回 */
|
||||||
function ptConfigApply(neType: string, status: '0' | '1' |'2'| '3' ) {
|
function ptConfigApply(
|
||||||
|
neType: string,
|
||||||
|
status: '0' | '1' | '2' | '3',
|
||||||
|
student?: string
|
||||||
|
) {
|
||||||
let result: any;
|
let result: any;
|
||||||
if (status === '2') {
|
if (status === '2' || status === '3') {
|
||||||
result = updatePtNeConfigApply({ neType, status: '2' });
|
let from: {
|
||||||
|
neType: string;
|
||||||
|
status: string;
|
||||||
|
student?: string;
|
||||||
|
backInfo?: string;
|
||||||
|
} = {
|
||||||
|
neType,
|
||||||
|
status: '2',
|
||||||
|
};
|
||||||
|
if (student) {
|
||||||
|
if (status === '2') {
|
||||||
|
from = { neType, status, student };
|
||||||
|
}
|
||||||
|
if (status === '3') {
|
||||||
|
from = { neType, status, student, backInfo: '请重新检查配置' };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result = updatePtNeConfigApply(from);
|
||||||
}
|
}
|
||||||
if (status === '0') {
|
if (status === '0' || status === '1') {
|
||||||
result = stuPtNeConfigApply({ neType, status: '0' });
|
result = stuPtNeConfigApply({ neType, status });
|
||||||
}
|
}
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
ptConfigState.applyLoading = true;
|
ptConfigState.applyLoading = true;
|
||||||
@@ -99,8 +121,18 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
/**学生账号 */
|
/**学生账号 */
|
||||||
student: string | undefined;
|
student: string | undefined;
|
||||||
/**学生可选择列表 */
|
/**学生可选择列表 */
|
||||||
studentOptions: { value: string; label: string; status: string }[];
|
studentOptions: {
|
||||||
studentOptionsDef: { value: string; label: string; status: string }[];
|
value: string;
|
||||||
|
label: string;
|
||||||
|
applyId: string;
|
||||||
|
applyStatus: string;
|
||||||
|
}[];
|
||||||
|
studentOptionsDef: {
|
||||||
|
value: string;
|
||||||
|
label: string;
|
||||||
|
applyId: string;
|
||||||
|
applyStatus: string;
|
||||||
|
}[];
|
||||||
}>({
|
}>({
|
||||||
student: undefined,
|
student: undefined,
|
||||||
studentOptions: [],
|
studentOptions: [],
|
||||||
@@ -110,21 +142,7 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
// 仅教师加载
|
// 仅教师加载
|
||||||
if (hasRoles(['teacher'])) {
|
if (hasRoles(['teacher'])) {
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 初始学生列表
|
classStudents(); // 初始学生列表
|
||||||
getPtClassStudents().then(res => {
|
|
||||||
if (!Array.isArray(res.data) || res.data.length <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
classState.studentOptions = [];
|
|
||||||
for (const s of res.data) {
|
|
||||||
classState.studentOptions.push({
|
|
||||||
value: s.userName,
|
|
||||||
label: s.userName,
|
|
||||||
status: s.applyStatus,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Object.assign(classState.studentOptionsDef, classState.studentOptions);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,28 +158,36 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
Object.assign(classState.studentOptions, classState.studentOptionsDef);
|
Object.assign(classState.studentOptions, classState.studentOptionsDef);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
function fake() {
|
timeout = setTimeout(() => classStudents(val), 500);
|
||||||
getPtClassStudents({ userName: val }).then(res => {
|
}
|
||||||
classState.studentOptions = [];
|
|
||||||
for (const s of res.data) {
|
/**班级学生列表 */
|
||||||
classState.studentOptions.push({
|
function classStudents(val?: string) {
|
||||||
value: s.userName,
|
getPtClassStudents({ userName: val }).then(res => {
|
||||||
label: s.userName,
|
classState.studentOptions = [];
|
||||||
status: s.applyStatus,
|
if (!Array.isArray(res.data) || res.data.length <= 0) {
|
||||||
});
|
return;
|
||||||
}
|
}
|
||||||
});
|
for (const s of res.data) {
|
||||||
}
|
classState.studentOptions.push({
|
||||||
timeout = setTimeout(fake, 500);
|
value: s.userName,
|
||||||
|
label: s.userName,
|
||||||
|
applyId: s.applyId,
|
||||||
|
applyStatus: s.applyStatus,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (val) {
|
||||||
|
Object.assign(classState.studentOptionsDef, classState.studentOptions);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 学生状态
|
// 学生状态
|
||||||
const studentStatus = computed(() => {
|
const studentStatus = computed(() => {
|
||||||
const item = classState.studentOptions.find(
|
const item = classState.studentOptions.find(
|
||||||
s => s.value === classState.student
|
s => s.value === classState.student
|
||||||
);
|
);
|
||||||
if (item) return item.status;
|
if (item) return item.applyStatus;
|
||||||
return '';
|
return '';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -172,6 +198,6 @@ export default function usePtOptions({ t, fnActiveConfigNode }: any) {
|
|||||||
ptConfigApply,
|
ptConfigApply,
|
||||||
classState,
|
classState,
|
||||||
studentStatus,
|
studentStatus,
|
||||||
studentSearch,
|
studentSearch,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -440,14 +440,14 @@ onMounted(() => {
|
|||||||
@search="studentSearch"
|
@search="studentSearch"
|
||||||
@change="fnActiveConfigNode('#')"
|
@change="fnActiveConfigNode('#')"
|
||||||
>
|
>
|
||||||
<template #option="{ value, label, status }">
|
<template #option="{ value, label, applyStatus }">
|
||||||
<span>{{ label }} </span>
|
<span>{{ label }} </span>
|
||||||
<a-tag
|
<a-tag
|
||||||
v-if="status === '0'"
|
v-if="applyStatus === '0'"
|
||||||
color="processing"
|
color="processing"
|
||||||
style="position: absolute; right: 0;}"
|
style="position: absolute; right: 0;}"
|
||||||
>
|
>
|
||||||
{{ status && '申请' }}
|
{{ applyStatus && '申请' }}
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
</a-select>
|
</a-select>
|
||||||
@@ -464,13 +464,13 @@ onMounted(() => {
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
<a-button
|
<a-button
|
||||||
@click="ptConfigApply(treeState.neType, '2')"
|
@click="ptConfigApply(treeState.neType, '2', classState.student)"
|
||||||
:loading="ptConfigState.applyLoading"
|
:loading="ptConfigState.applyLoading"
|
||||||
>
|
>
|
||||||
应用
|
应用
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
@click="ptConfigApply(treeState.neType, '3')"
|
@click="ptConfigApply(treeState.neType, '3', classState.student)"
|
||||||
:loading="ptConfigState.applyLoading"
|
:loading="ptConfigState.applyLoading"
|
||||||
>
|
>
|
||||||
退回
|
退回
|
||||||
|
|||||||
Reference in New Issue
Block a user