-- fix bug

This commit is contained in:
yuping
2023-03-04 02:53:02 +08:00
parent ff6bd4907f
commit 77aac9cdcf
5 changed files with 147 additions and 98 deletions

View File

@@ -6,3 +6,4 @@ export const ROUTER_DETAIL_MODIFY = '/admin/router/routerInfoTemp post';
export const PROJECT_DETAIL_MODIFY = '/admin/project/projectInfoTemp post'; export const PROJECT_DETAIL_MODIFY = '/admin/project/projectInfoTemp post';
export const PROJECT_TEMPLATE_DETAIL_MODIFY = '/admin/project/template/editStageAndTask post'; export const PROJECT_TEMPLATE_DETAIL_MODIFY = '/admin/project/template/editStageAndTask post';
export const PROJECT_RELEASE = '/admin/project/realease'; export const PROJECT_RELEASE = '/admin/project/realease';
export const ASYNC_STUDENT_STATUS = '/admin/cache/getStudentAsyncStatus';

View File

@@ -1,13 +1,13 @@
<template> <template>
<a-modal <a-modal
:visible="true" :visible="true"
:footer="null" :footer="null"
:title="null" :title="null"
:centere="true" :centere="true"
:closable="false" :closable="false"
style="margin-top: 400px" style="margin-top: 400px"
:zIndex="9999" :zIndex="9999"
@cancel="close" @cancel="close"
> >
<div class="delete"> <div class="delete">
<div class="del_header"></div> <div class="del_header"></div>
@@ -22,7 +22,7 @@
<div><span>{{ content }}</span></div> <div><span>{{ content }}</span></div>
</div> </div>
<div class="del_btnbox"> <div class="del_btnbox">
<div class="del_btn btn2" @click="close"> <div class="del_btn btn2" @click="close" v-if="cancel">
<div class="btnText">取消</div> <div class="btnText">取消</div>
</div> </div>
<div class="del_btn btn2" @click="handleConfirm"> <div class="del_btn btn2" @click="handleConfirm">
@@ -34,9 +34,9 @@
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import notide from '@/assets/images/coursewareManage/notice.png' import notide from "@/assets/images/coursewareManage/notice.png";
import infoPng from '@/assets/images/coursewareManage/QR.png' import infoPng from "@/assets/images/coursewareManage/QR.png";
import {defineProps, ref} from "vue"; import {defineProps, onMounted, ref} from "vue";
const props = defineProps({ const props = defineProps({
close: { close: {
@@ -50,22 +50,34 @@ const props = defineProps({
content: String, content: String,
title: { title: {
type: String, type: String,
default: '提示' default: "提示"
},
cancel: {
type: Boolean,
default: true
},
duration: {
type: Number,
default: 0
}, },
type: { type: {
type: Number, type: Number,
default: 1 default: 1
} }
}) });
const types = { const types = {
1: infoPng, 1: infoPng,
2: notide 2: notide
} };
const type = ref(1) const type = ref(1);
onMounted(() => {
props.duration && setTimeout(() => props.close(), props.duration)
});
function handleConfirm() { function handleConfirm() {
props.ok() props.ok();
props.close() props.close();
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -84,8 +96,8 @@ function handleConfirm() {
width: calc(100%); width: calc(100%);
height: 40px; height: 40px;
background: linear-gradient( background: linear-gradient(
rgba(78, 166, 255, 0.2) 0%, rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100% rgba(78, 166, 255, 0) 100%
); );
} }

View File

@@ -35,6 +35,7 @@
class="cus-btn" class="cus-btn"
style="background: #4ea6ff; color: #fff; width: 100px" style="background: #4ea6ff; color: #fff; width: 100px"
@click="search" @click="search"
:loading="stuAsyncLoading"
> >
<template #icon <template #icon
><img ><img
@@ -131,7 +132,6 @@
<script setup> <script setup>
import { import {
computed, computed,
// createVNode,
defineProps, defineProps,
defineExpose, defineExpose,
ref, ref,
@@ -140,8 +140,7 @@ import {
import { usePage } from "@/api/request"; import { usePage } from "@/api/request";
import { STUDENT_LIST } from "@/api/apis"; import { STUDENT_LIST } from "@/api/apis";
import { delStudentList } from "@/api/index1"; import { delStudentList } from "@/api/index1";
// import { ExclamationCircleOutlined } from "@ant-design/icons-vue"; import {useAsyncStu} from "@/utils/useCommon";
// import { Modal } from "ant-design-vue";
const props = defineProps({ const props = defineProps({
type: Number, type: Number,
@@ -231,6 +230,9 @@ const {
loading, loading,
} = usePage(STUDENT_LIST, searchParams); } = usePage(STUDENT_LIST, searchParams);
const { loading: stuAsyncLoading } = useAsyncStu(props.id, props.types.join(","), searchStu);
const stuPagination = computed(() => ({ const stuPagination = computed(() => ({
total: total.value, total: total.value,
showSizeChanger: false, showSizeChanger: false,
@@ -250,6 +252,7 @@ const changePagination = (page) => {
function search() { function search() {
searchParams.value.studentName = searchName.value; searchParams.value.studentName = searchName.value;
searchParams.value.pageNo = 1; searchParams.value.pageNo = 1;
searchStu()
} }
const deleteModalVisible = ref(false); const deleteModalVisible = ref(false);
@@ -257,20 +260,6 @@ const deleteId = ref(null);
function del(id) { function del(id) {
deleteModalVisible.value = true; deleteModalVisible.value = true;
deleteId.value = id; deleteId.value = id;
// Modal.confirm({
// title: () => "确定删除?",
// icon: () => createVNode(ExclamationCircleOutlined),
// content: () => "数据删除后不可恢复!",
// okText: () => "确定",
// okType: "danger",
// cancelText: () => "取消",
// onOk() {
// if (id) {
// loading.value = true;
// delStudentList({ ids: [id] }).then(() => searchStu());
// }
// },
// });
} }
//确定删除 //确定删除
@@ -294,6 +283,8 @@ const closeDrawer = () => {
function reset() { function reset() {
searchParams.value = initParams; searchParams.value = initParams;
searchName.value = ""; searchName.value = "";
searchParams.value.pageNo = 1;
searchStu()
} }
watch(visiable, () => { watch(visiable, () => {

View File

@@ -42,9 +42,7 @@
style="width: 260px; height: 40px" style="width: 260px; height: 40px"
placeholder="是否为优秀学员" placeholder="是否为优秀学员"
:options="topFlagList" :options="topFlagList"
@change="selectProjectName"
allowClear allowClear
showSearch
></a-select> ></a-select>
</div> </div>
</a-form-item> </a-form-item>
@@ -54,12 +52,13 @@
class="cus-btn" class="cus-btn"
style="background: #4ea6ff; color: #fff; width: 100px" style="background: #4ea6ff; color: #fff; width: 100px"
@click="getStuList" @click="getStuList"
:loading="stuAsyncLoading"
> >
<template #icon> <template #icon>
<img <img
style="margin-right: 10px" style="margin-right: 10px"
src="../../assets/images/courseManage/search0.png" src="../../assets/images/courseManage/search0.png"
/></template> /></template>
搜索 搜索
</a-button> </a-button>
</a-col> </a-col>
@@ -69,7 +68,7 @@
<img <img
style="margin-right: 10px" style="margin-right: 10px"
src="../../assets/images/courseManage/reset0.png" src="../../assets/images/courseManage/reset0.png"
/></template> /></template>
重置 重置
</a-button> </a-button>
</a-col> </a-col>
@@ -90,9 +89,9 @@
> >
<a-button class="cus-btn" style="background: #4ea6ff; color: #fff"> <a-button class="cus-btn" style="background: #4ea6ff; color: #fff">
<template #icon <template #icon
><img ><img
style="margin-right: 10px" style="margin-right: 10px"
src="../../assets/images/courseManage/add0.png" src="../../assets/images/courseManage/add0.png"
/></template> /></template>
添加学员 添加学员
</a-button> </a-button>
@@ -102,9 +101,9 @@
<a-col :span="1.5" v-if="type === 1 || type === 2"> <a-col :span="1.5" v-if="type === 1 || type === 2">
<a-button class="cus-btn white" @click="showImpStu"> <a-button class="cus-btn white" @click="showImpStu">
<template #icon <template #icon
><img ><img
style="margin-right: 10px" style="margin-right: 10px"
src="../../assets/images/basicinfo/in.png" src="../../assets/images/basicinfo/in.png"
/></template> /></template>
导入学员 导入学员
</a-button> </a-button>
@@ -129,9 +128,9 @@
<a-col :span="1.5"> <a-col :span="1.5">
<a-button class="cus-btn white" @click="bathDel"> <a-button class="cus-btn white" @click="bathDel">
<template #icon <template #icon
><img ><img
style="margin-right: 10px" style="margin-right: 10px"
src="../../assets/images/projectadd/delete1.png" src="../../assets/images/projectadd/delete1.png"
/></template> /></template>
批量删除 批量删除
</a-button> </a-button>
@@ -223,13 +222,15 @@
v-if="type === 3 && record.status !== 0 && checkPer(permissions)" v-if="type === 3 && record.status !== 0 && checkPer(permissions)"
@click="updateStatus(0, record.id)" @click="updateStatus(0, record.id)"
type="link" type="link"
>通过</a-button >通过
</a-button
> >
<a-button <a-button
v-if="type === 3 && record.status !== 0 && checkPer(permissions)" v-if="type === 3 && record.status !== 0 && checkPer(permissions)"
@click="updateStatus(2, record.id)" @click="updateStatus(2, record.id)"
type="link" type="link"
>拒绝</a-button >拒绝
</a-button
> >
<a-button <a-button
v-if="checkPer(permissions)" v-if="checkPer(permissions)"
@@ -237,7 +238,8 @@
@click="del(record.id, record)" @click="del(record.id, record)"
type="link" type="link"
danger danger
>删除</a-button >删除
</a-button
> >
</a-space> </a-space>
</template> </template>
@@ -387,21 +389,20 @@
</a-modal> </a-modal>
</template> </template>
<script setup> <script setup>
import { computed, defineProps, onMounted, ref, watch } from "vue"; import {computed, defineProps, onMounted, ref, watch} from "vue";
import { delStudentList, getStuPage, batchUpdateStatus } from "@/api/index1"; import {delStudentList, getStuPage, batchUpdateStatus} from "@/api/index1";
import ChangeGroupModal from "@/components/student/ChangeGroupModal.vue"; import ChangeGroupModal from "@/components/student/ChangeGroupModal.vue";
import CommonStudent from "@/components/student/CommonStudent"; import CommonStudent from "@/components/student/CommonStudent";
import ChangeLevelModal from "./ChangeLevelModal.vue"; import ChangeLevelModal from "./ChangeLevelModal.vue";
import { message } from "ant-design-vue"; import {message} from "ant-design-vue";
// import { topStudent } from "../../api/indexProjStu";
import SeeStu from "../../components/drawers/SeeStu"; import SeeStu from "../../components/drawers/SeeStu";
import EScore from "../drawers/ExportScore.vue"; import EScore from "../drawers/ExportScore.vue";
import OrgClass from "@/components/project/OrgClass"; import OrgClass from "@/components/project/OrgClass";
import ExportHomeWork from "../Modals/ExportHomeWork.vue"; import ExportHomeWork from "../Modals/ExportHomeWork.vue";
import * as api from "../../api/index1"; import * as api from "../../api/index1";
import ImpStu from "../drawers/AddLevelImportStu"; import ImpStu from "../drawers/AddLevelImportStu";
// import { ExclamationCircleOutlined } from "@ant-design/icons-vue"; import {checkPer} from "@/utils/utils";
import { checkPer } from "@/utils/utils"; import {useAsyncStu} from "@/utils/useCommon";
const props = defineProps({ const props = defineProps({
type: Number, type: Number,
@@ -435,6 +436,9 @@ const props = defineProps({
default: () => [], default: () => [],
}, },
}); });
const { loading: stuAsyncLoading, start } = useAsyncStu(props.id, props.type, getStuList);
const topFlagList = ref([ const topFlagList = ref([
{ {
id: 0, id: 0,
@@ -541,8 +545,8 @@ function allDepartShow(a, b) {
a == "" || a == null || a == undefined a == "" || a == null || a == undefined
? (a = "") ? (a = "")
: a.slice(0, 1) == "/" : a.slice(0, 1) == "/"
? a.slice(1, a.length) ? a.slice(1, a.length)
: a; : a;
let depart = b == "" || b == null || b == undefined ? (b = "") : b; let depart = b == "" || b == null || b == undefined ? (b = "") : b;
let allname = org == "" && depart == "" ? "-" : org + depart; let allname = org == "" && depart == "" ? "-" : org + depart;
return allname; return allname;
@@ -680,11 +684,12 @@ function bathDel() {
); );
} }
tableData.value.loading = true; tableData.value.loading = true;
delStudentList({ ids: stuSelectKeys.value,type:props.type,targetId:props.id }).then(() => getStuList()); delStudentList({ ids: stuSelectKeys.value, type: props.type, targetId: props.id }).then(() => getStuList());
} }
const deleteModalVisible = ref(false); const deleteModalVisible = ref(false);
const deleteId = ref(null); const deleteId = ref(null);
function del(id, row) { function del(id, row) {
if (row.isLeader === "1") { if (row.isLeader === "1") {
return message.warning("" + row.name + "是小组长,请勿删除!"); return message.warning("" + row.name + "是小组长,请勿删除!");
@@ -707,6 +712,7 @@ function del(id, row) {
// }, // },
// }); // });
} }
//确定删除 //确定删除
const sureSameModal = () => { const sureSameModal = () => {
if (deleteId.value) { if (deleteId.value) {
@@ -724,6 +730,7 @@ const closeSameModal = () => {
function submitCall(flag) { function submitCall(flag) {
tableData.value.loading = true; tableData.value.loading = true;
flag && getStuList(); flag && getStuList();
flag && start();
} }
// 调整关卡; // 调整关卡;
@@ -885,9 +892,11 @@ const AddImpStuvisibleClose = (isget) => {
getStuList(); getStuList();
} }
}; };
function startLoading() { function startLoading() {
tableData.value.loading = true; tableData.value.loading = true;
} }
defineExpose({ getStuList, startLoading }); defineExpose({ getStuList, startLoading });
</script> </script>
<style lang="scss"> <style lang="scss">
@@ -967,8 +976,8 @@ defineExpose({ getStuList, startLoading });
width: calc(100%); width: calc(100%);
height: 40px; height: 40px;
background: linear-gradient( background: linear-gradient(
rgba(78, 166, 255, 0.2) 0%, rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100% rgba(78, 166, 255, 0) 100%
); );
} }
@@ -1101,8 +1110,8 @@ defineExpose({ getStuList, startLoading });
width: calc(100%); width: calc(100%);
height: 68px; height: 68px;
background: linear-gradient( background: linear-gradient(
rgba(78, 166, 255, 0.2) 0%, rgba(78, 166, 255, 0.2) 0%,
rgba(78, 166, 255, 0) 100% rgba(78, 166, 255, 0) 100%
); );
} }
@@ -1194,11 +1203,13 @@ defineExpose({ getStuList, startLoading });
} }
} }
} }
.ant-modal-close-x { .ant-modal-close-x {
display: none; display: none;
} }
} }
} }
/*.delete { /*.delete {
z-index: 9999; z-index: 9999;
width: 424px; width: 424px;

View File

@@ -1,45 +1,79 @@
import {ref} from "vue"; import {onMounted, ref, watch} from "vue";
import {message} from "ant-design-vue"; import {message} from "ant-design-vue";
import {ASYNC_STUDENT_STATUS} from "@/api/apis";
import {request} from "@/api/request";
import dialog from "@/utils/dialog";
export function useInterval(fun, time) { export function useInterval(fun, time) {
const timer = ref(); const timer = ref();
function start(d) { function start(d) {
clearInterval(timer.value) clearInterval(timer.value);
timer.value = setInterval(async () => { timer.value = setInterval(async () => {
if (await fun(d)) { if (await fun(d)) {
clearInterval(timer.value) clearInterval(timer.value);
} }
}, time); }, time);
} }
return {start} return { start };
} }
export function useTimeout(asyncFun, time) { export function useTimeout(asyncFun, time) {
const timer = ref(); const timer = ref();
const maxCount = ref(0); const maxCount = ref(0);
function start(d) { function start(d) {
clearTimeout(timer.value) clearTimeout(timer.value);
maxCount.value = 0 maxCount.value = 0;
execute(d) execute(d);
}
async function execute(d) {
if (maxCount.value > 300) {
message.error("等待超时,请联系管理员!");
throw Error("等待超时 查询任务结束");
} }
try {
async function execute(d) { await asyncFun(d);
if (maxCount.value > 300) { maxCount.value = maxCount.value + 1;
message.error("等待超时,请联系管理员!") timer.value = setTimeout(() => execute(d), time);
throw Error("等待超时 查询任务结束") } catch (e) {
} clearTimeout(timer.value);
try { console.log(e);
await asyncFun(d)
maxCount.value = maxCount.value + 1
timer.value = setTimeout(() => execute(d), time);
} catch (e) {
clearTimeout(timer.value)
console.log(e)
}
} }
}
return {start} return { start };
} }
export function useAsyncStu(id, type, func) {
const loading = ref(false);
const { start } = useTimeout(async () => {
const { data } = await request(ASYNC_STUDENT_STATUS, { id, type });
if (!data) {
loading.value = false;
throw Error("查询任务结束");
}
loading.value = true;
}, 10000);
watch(loading, () => {
loading.value && dialog({
duration: 3500,
cancel: false,
content: "您选择的学员正在添加中,请耐心等待,进行其他操作不影响此次添加"
});
loading.value || (func && func());
});
onMounted(() => {
console.log(22222222);
console.log(id);
console.log(type);
id && type && start();
});
return { loading, start };
}