This commit is contained in:
Pengxiansen
2025-02-13 17:33:57 +08:00
parent c5467438b7
commit 4ca65ea584
25 changed files with 3877 additions and 618 deletions

View File

@@ -449,7 +449,7 @@
</div>
<div class="items_btn">
<div class="cstm_btn btn6" @click="handleCancelStu">
<div class="cstm_btn btn6" @click="closeDrawer">
<div class="btnText">取消</div>
</div>
<a-button
@@ -485,13 +485,6 @@
</CommonTest>
</template>
</div>
<!--新建开课页面 -->
<a-modal
v-model:visible="offCourseNewVisiable"
style="margin-top: 400px"
@cancel="handleCancelStu"
>
</a-modal>
</a-drawer>
</template>
<script setup lang="jsx">
@@ -534,6 +527,7 @@ import moment from "moment";
import * as api from "../../api/indexTaskadd";
import { useRoute } from "vue-router";
import { DeleteOutlined } from "@ant-design/icons-vue";
import { ElLoading } from "element-plus";
// 步骤数
const step = ref(1);
@@ -549,6 +543,8 @@ const title = computed(() => {
return "配置作业";
} else if (step.value == 5) {
return "配置考试";
} else if (step.value == 7) {
return "新增考试";
}
});
// 选择评估确认
@@ -569,7 +565,6 @@ const props = defineProps({
type: Number,
});
const openCourseVisible = ref(false);
const offCourseNewVisiable = ref(false);
const tableRef = ref();
const toggleCheckboxes = (checkedName) => {
if (checkedName === "projectSignFlag") {
@@ -659,17 +654,9 @@ const columns = ref([
const params = ref({
type: props.type,
offcourseId: "",
draftTaskId: "",
taskId: "",
createBeginTime: "",
createEndTime: "",
offteachers: [
{
teacherId: "",
teacherName: "",
weight: "",
},
],
});
const validated = ref(0);
const dateTime = ref([]);
@@ -690,7 +677,24 @@ const formData = useResetRef({
assessmentId: "",
duration: "",
workInfo: {},
examInfo: {},
examInfo: {
examinationName: "",
examinationPaperId: "",
examinationStartTime: "",
examinationEndTime: "",
examinationDuration: null,
passLine: "",
examType: 1,
source: "",
showAnswers: "2",
showAnalysis: "2",
scoringModel: "2",
questionArrangement: "4",
externalExplain: "",
examinationExplain: "",
type: 14,
targetId: props.growId,
},
attach: "",
type: props.type,
offcourseId: "",
@@ -745,11 +749,11 @@ const formDataRule = {
],
};
const { validate } = Form.useForm(formData, formDataRule);
const durationText = computed(() =>
dateTime.value?.length
const durationText = computed(() => {
return dateTime.value[0] && dateTime.value[1]
? dayjs(dateTime.value[1]).diff(dayjs(dateTime.value[0]), "minute")
: "请输入持续时间"
);
: "请输入持续时间";
});
const nums = ref(0);
watch(durationText, (val) => {
nums.value++;
@@ -865,7 +869,6 @@ function reset() {
tableRef.value.reset({
type: props.type,
offcourseId: params.value.offcourseId,
draftTaskId: params.value.draftTaskId,
});
resetTime.value.resetTime();
}
@@ -881,9 +884,9 @@ const closeDrawer = () => {
// 主弹框不退步,配置考试组件内退一步
CommonTestRef.value.setStep(1);
commonTestStep.value = 1;
} else if (step.value == 2 && commonTestStep.value == 7) {
} else if (step.value > 2 && commonTestStep.value == 7) {
// commonTestStep = 7说明在配置考试组件内展示页面为新增试卷
// 主弹框不退步,配置考试组件内退一步
// 主弹框不退步,配置考试组件内退一步
CommonTestRef.value.setStep(2);
commonTestStep.value = 6;
} else if (step.value == 2) {
@@ -893,35 +896,12 @@ const closeDrawer = () => {
tableRef.value.reset({
type: props.type,
offcourseId: params.value.offcourseId,
draftTaskId: params.value.draftTaskId,
});
}
};
const route = useRoute();
const projectInfo = ref({});
const emit = defineEmits(["call-parent-method"]);
const confirm = async () => {
closeDrawer();
if (route.query.projectId) {
await api.getDraftTask({ projectId: route.query.projectId }).then((res) => {
projectInfo.value = res.data.data;
});
request(PROJECT_DETAIL_MODIFY, { ...projectInfo.value });
if (projectInfo.value.projectInfo.status == 3) {
request(PROJECT_RELEASE, { projectId: route.query.projectId });
}
emit("call-parent-method");
}
if (route.query.routerId) {
await GetRouterDraftDetail(route.query.routerId).then((res) => {
projectInfo.value = res.data.data;
});
request(ROUTER_DETAIL_MODIFY, { ...projectInfo.value });
if (projectInfo.value.routerInfo.status == 1) {
await releaseRouter(route.query.routerId);
}
emit("call-parent-method");
}
};
const createNewCourse = () => {
@@ -930,7 +910,7 @@ const createNewCourse = () => {
formData.reset({
type: props.type,
offcourseId: params.value.offcourseId,
draftTaskId: params.value.draftTaskId,
taskId: params.value.taskId,
name: courseName.value,
});
dateTime.value = [moment().format("YYYY-MM-DD HH:mm"), ""];
@@ -946,10 +926,6 @@ const createNewCourse = () => {
// 第二步新增课程
step.value = 2;
};
const handleCancelStu = () => {
changeName.value = false;
offCourseNewVisiable.value = false;
};
const expenseStatus = {
A10: true,
@@ -970,7 +946,8 @@ const del = (id, record) => {
},
});
};
// 全局Loading
let loadingInstance = null;
async function coursePlanConfirm() {
if (!dateTime.value[0]) {
message.info("开始时间未填写");
@@ -1036,7 +1013,6 @@ async function coursePlanConfirm() {
message.warning("开课名称重复,请重新填写");
return;
}
offCourseNewVisiable.value = false;
tableRef.value.toLoading();
// TODO 当点击选择了是否评估按钮 点击保存的时候没有选择评估 则是否需要评估重置为 0 不需要
formData.value.evalFlag = formData.value.assessmentName ? 1 : 0;
@@ -1047,30 +1023,13 @@ async function coursePlanConfirm() {
formData.value.projectSignFlag = formData.value.projectSignFlag ? 1 : 0;
formData.value.beginTime = dateTime.value[0];
formData.value.endTime = dateTime.value[1];
// 开启loading
loadingInstance = ElLoading.service({ fullscreen: true });
await request(COURSE_PLAN_EDIT, { ...formData.value });
if (route.query.projectId) {
await api.getDraftTask({ projectId: route.query.projectId }).then((res) => {
projectInfo.value = res.data.data;
});
request(PROJECT_DETAIL_MODIFY, { ...projectInfo.value });
if (projectInfo.value.projectInfo.status == 3) {
request(PROJECT_RELEASE, { projectId: route.query.projectId });
}
emit("call-parent-method");
}
if (route.query.routerId) {
await GetRouterDraftDetail(route.query.routerId).then((res) => {
projectInfo.value = res.data.data;
});
console.log(projectInfo.value, "ite2545m");
request(ROUTER_DETAIL_MODIFY, { ...projectInfo.value });
if (projectInfo.value.routerInfo.status == 1) {
await releaseRouter(route.query.routerId);
}
emit("call-parent-method");
}
handleCancelStu();
tableRef.value.fetch();
// 关闭loading
loadingInstance.close();
closeDrawer();
}
const editBeginClass = ref(false);
@@ -1079,30 +1038,31 @@ function planEdit(record) {
editBeginClass.value = false;
if (record.expenseStatus && !expenseStatus[record.expenseStatus]) {
editBeginClass.value = true;
console.log(editBeginClass.value);
}
onceName.value = record.name;
formData.value = { ...record };
// formData.value.duration = ''
console.log({ ...record }, "{ ...record }");
validated.value = 0;
formData.value.homeWorkId &&
request(WORK_DETAIL(formData.value.homeWorkId), {}).then(
(res) => (formData.value.workInfo = res.data)
);
formData.value.testId &&
request(EXAM_DETAIL(formData.value.testId), {}).then(
(res) => (formData.value.examInfo = res.data)
);
formData.value.homeWorkId
? request(WORK_DETAIL(formData.value.homeWorkId), {}).then((res) => {
formData.value.workInfo = res.data;
})
: (formData.value.workInfo = {});
formData.value.testId
? request(EXAM_DETAIL(formData.value.testId), {}).then(
(res) => (formData.value.examInfo = res.data)
)
: (formData.value.examInfo = { examType: 1 });
dateTime.value = [formData.value.beginTime, formData.value.endTime];
offCourseNewVisiable.value = true;
step.value = 2;
}
function openDrawer(row) {
openCourseVisible.value = true;
params.value.offcourseId = row.taskId;
params.value.draftTaskId = row.id;
params.value.taskId = row.id;
formData.value.offcourseId = row.taskId;
formData.value.draftTaskId = row.id;
formData.value.taskId = row.id;
courseName.value = row.taskName;
setTimeout(() => {
nextTick(tableRef?.value.fetch);