-- 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_TEMPLATE_DETAIL_MODIFY = '/admin/project/template/editStageAndTask post';
export const PROJECT_RELEASE = '/admin/project/realease';
export const ASYNC_STUDENT_STATUS = '/admin/cache/getStudentAsyncStatus';

View File

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

View File

@@ -35,6 +35,7 @@
class="cus-btn"
style="background: #4ea6ff; color: #fff; width: 100px"
@click="search"
:loading="stuAsyncLoading"
>
<template #icon
><img
@@ -131,7 +132,6 @@
<script setup>
import {
computed,
// createVNode,
defineProps,
defineExpose,
ref,
@@ -140,8 +140,7 @@ import {
import { usePage } from "@/api/request";
import { STUDENT_LIST } from "@/api/apis";
import { delStudentList } from "@/api/index1";
// import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
// import { Modal } from "ant-design-vue";
import {useAsyncStu} from "@/utils/useCommon";
const props = defineProps({
type: Number,
@@ -231,6 +230,9 @@ const {
loading,
} = usePage(STUDENT_LIST, searchParams);
const { loading: stuAsyncLoading } = useAsyncStu(props.id, props.types.join(","), searchStu);
const stuPagination = computed(() => ({
total: total.value,
showSizeChanger: false,
@@ -250,6 +252,7 @@ const changePagination = (page) => {
function search() {
searchParams.value.studentName = searchName.value;
searchParams.value.pageNo = 1;
searchStu()
}
const deleteModalVisible = ref(false);
@@ -257,20 +260,6 @@ const deleteId = ref(null);
function del(id) {
deleteModalVisible.value = true;
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() {
searchParams.value = initParams;
searchName.value = "";
searchParams.value.pageNo = 1;
searchStu()
}
watch(visiable, () => {

View File

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