在线学习与考试-课件管理-视频/资料课件维护-新增/修改未做

pull/1/head
duhang 2024-01-11 14:57:20 +08:00
parent 20a8d64ea1
commit 461d5e31e7
19 changed files with 1242 additions and 13 deletions

View File

@ -347,6 +347,62 @@ export default [
},
],
},
{
path: "/online_learn_exam",
redirect: "/online_learn_exam/courseware",
meta: { title: "在线学习与考试", model: MODEL["2"] },
component: "children",
children: [
{
path: "/online_learn_exam/courseware",
redirect: "/online_learn_exam/courseware/video",
meta: { title: "课件管理" },
component: "children",
children: [
{
path: "/online_learn_exam/courseware/video",
meta: { title: "视频课件维护", isSubMenu: false },
component: "children",
children: [
{
path: "",
component: "online_learn_exam/courseware/video/index",
},
{
path: "/online_learn_exam/courseware/video/question_list",
meta: {
title: "课件习题",
activeMenu: "/online_learn_exam/courseware/video",
},
component:
"online_learn_exam/courseware/question/question_list",
},
],
},
{
path: "/online_learn_exam/courseware/data",
meta: { title: "资料课件维护", isSubMenu: false },
component: "children",
children: [
{
path: "",
component: "online_learn_exam/courseware/data/index",
},
{
path: "/online_learn_exam/courseware/data/question_list",
meta: {
title: "课件习题",
activeMenu: "/online_learn_exam/courseware/data",
},
component:
"online_learn_exam/courseware/question/question_list",
},
],
},
],
},
],
},
{
path: "/archives",
redirect: "/archives/user",

View File

@ -0,0 +1,33 @@
import { post, upload } from "@/request/axios.js";
export const getVideoCoursewareList = (params) =>
post("/videocourseware/list", params); // 视频课件维护-获取课件列表
export const editVideoCoursewareState = (params) =>
post("/videocourseware/editState", params); // 视频课件维护-启用/禁用
export const deleteVideoCourseware = (params) =>
post("/videocourseware/delete", params); // 视频课件维护-删除
export const getDataCoursewareList = (params) =>
post("/datacourseware/list", params); // 视频课件维护-获取课件列表
export const editDataCoursewareState = (params) =>
post("/datacourseware/editState", params); // 视频课件维护-启用/禁用
export const deleteDataCourseware = (params) =>
post("/datacourseware/delete", params); // 视频课件维护-删除
export const getQuestionListByCoursewareIdAndType = (params) =>
post("/question/list", params); // 课件管理-视频/资料课件维护-获取课件习题列表
export const deleteQuestion = (params) => post("/question/delete", params); // 课件管理-视频/资料课件维护-删除课件习题
export const deleteQuestionBatch = (params) =>
post("/question/deleteAll", params); // 课件管理-视频/资料课件维护-批量删除课件习题
export const importQuestion = (params) => upload("/question/readExcel", params); // 课件管理-视频/资料课件维护-导入课件习题
export const addQuestion = (params) => upload("/question/add", params); // 课件管理-视频/资料课件维护-新增课件习题
export const editQuestion = (params) => upload("/question/edit", params); // 课件管理-视频/资料课件维护-修改课件习题

View File

@ -104,7 +104,7 @@ const data = reactive({
currentFile: "",
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClear = () => {
data.currentFile = "";

View File

@ -193,7 +193,7 @@ const data = reactive({
formVisible: false,
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -162,7 +162,7 @@ const data = reactive({
formVisible: false,
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -165,7 +165,7 @@ const data = reactive({
formVisible: false,
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -142,7 +142,7 @@ const data = reactive({
formVisible: false,
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -157,7 +157,7 @@ const data = reactive({
formVisible: false,
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -96,7 +96,7 @@ const data = reactive({
currentFile: "",
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClear = () => {
data.currentFile = "";

View File

@ -79,7 +79,7 @@ const data = reactive({
coursewareList: [],
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -158,7 +158,7 @@ const data = reactive({
},
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -140,7 +140,7 @@ const join_student_list = computed(() => {
return result;
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -246,7 +246,7 @@ const unpass_student_list = computed(() => {
return result;
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -150,7 +150,7 @@ const coursewares = computed(() => {
return result.length > 0 ? result.join(",") : "";
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -173,7 +173,7 @@ const data = reactive({
formVisible: false,
});
const emits = defineEmits(["update:visible"]);
const emits = defineEmits(["update:visible", "update:current"]);
const fnClose = () => {
emits("update:current", undefined);

View File

@ -0,0 +1,293 @@
<template>
<el-card>
<el-form
:model="searchForm"
label-width="130px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="6">
<el-form-item label="课程名称" prop="KEYWORDS">
<el-input
v-model="searchForm.KEYWORDS"
placeholder="请输入课程名称"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="教师名称" prop="SPEAKER">
<el-input
v-model="searchForm.SPEAKER"
placeholder="请输入教师名称"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="培训板块类型" prop="trainingSectionKey">
<layout-learning-train-type
v-model="searchForm.trainingSectionKey"
type="post"
placeholder="请选择培训板块类型"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="培训行业类型" prop="TRAINTYPE">
<layout-learning-train-type
v-model="searchForm.TRAINTYPE"
type="post"
placeholder="请选择培训行业类型"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="岗位培训类型" prop="POSTTYPE">
<layout-learning-train-type
v-model="searchForm.POSTTYPE"
type="post"
placeholder="请选择岗位培训类型"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="课件状态" prop="STATE">
<el-select v-model="searchForm.STATE" placeholder="请选择状态">
<el-option
v-for="item in data.courseStates"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
<el-button
v-if="!data.searchFromUnfolded"
type="text"
@click="data.searchFromUnfolded = true"
>
展开<el-icon><arrow-down /></el-icon>
</el-button>
<el-button
v-else
type="text"
@click="data.searchFromUnfolded = false"
>
合并<el-icon><arrow-up /></el-icon>
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
:data="list"
@get-data="fnGetData"
v-model:pagination="pagination"
>
<el-table-column label="序号" width="50">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="COURSEWARENAME"
label="课件名称"
/>
<el-table-column
show-overflow-tooltip
prop="post_type_name"
label="岗位培训类型"
/>
<el-table-column
show-overflow-tooltip
prop="train_type_name"
label="培训行业类型"
/>
<el-table-column prop="SPEAKER" label="讲师名称" />
<el-table-column prop="CLASSHOUR" label="课件学时(分钟)" />
<el-table-column
show-overflow-tooltip
prop="trainingSectionName"
label="培训板块"
/>
<el-table-column prop="CREATTIME" label="上传时间" />
<el-table-column prop="STATE" label="课件状态">
<template v-slot="{ row }">
<template v-if="row.STATE === 0">
<div>启用</div>
</template>
<template v-else-if="row.STATE === 1">
<div>禁用</div>
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="300">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
v-if="interceptTheSuffix(row.COURSEWAREFILES, '.pdf')"
@click="fnPreviewPdf(row.COURSEWAREFILES)"
>
预览
</el-button>
<el-button
type="primary"
text
link
v-if="buttonJurisdiction.edit && row.STATE === 1"
@click="fnEditState(row.DATACOURSEWARE_ID, 0)"
>
启用
</el-button>
<el-button
type="primary"
text
link
v-if="buttonJurisdiction.edit && row.STATE === 0"
@click="fnEditState(row.DATACOURSEWARE_ID, 1)"
>
禁用
</el-button>
<el-button
type="primary"
text
link
v-if="
buttonJurisdiction.edit &&
row.CURRICULUMCOUNT === 0 &&
row.STAGECOUNT === 0 &&
row.ISPLATFORM === '0'
"
>
修改<!-- todo -->
</el-button>
<el-button
type="primary"
text
link
v-if="
buttonJurisdiction.del &&
row.CURRICULUMCOUNT === 0 &&
row.STAGECOUNT === 0 &&
row.ISPLATFORM === '0'
"
@click="fnDelete(row.DATACOURSEWARE_ID)"
>
删除
</el-button>
<el-button
type="primary"
text
link
@click="
router.push({
path: '/online_learn_exam/courseware/data/question_list',
query: {
COURSE_ID: row.DATACOURSEWARE_ID, // ID
COURSE_TYPE: '2', // (1:2:)
},
})
"
>
课件习题
</el-button>
</template>
</el-table-column>
<template #button>
<el-button v-if="buttonJurisdiction.add" type="primary">
新增<!-- todo -->
</el-button>
</template>
</layout-table>
</layout-card>
<layout-pdf
:src="data.pdfDialog.src"
v-model:visible="data.pdfDialog.visible"
/>
</template>
<script setup>
import LayoutCard from "@/components/card/index.vue";
import LayoutLearningTrainType from "@/components/learning_train_type/index.vue";
import {
getDataCoursewareList,
editDataCoursewareState,
deleteDataCourseware,
} from "@/request/online_learn_exam.js";
import useListData from "@/assets/js/useListData.js";
import { reactive } from "vue";
import { interceptTheSuffix, serialNumber } from "@/assets/js/utils.js";
import LayoutTable from "@/components/table/index.vue";
import { ArrowDown, ArrowUp } from "@element-plus/icons-vue";
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
import LayoutPdf from "@/components/pdf/index.vue";
import { debounce } from "throttle-debounce";
const router = useRouter();
const buttonJurisdiction = await useButtonJurisdiction("courseware");
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getDataCoursewareList);
const data = reactive({
courseStates: [
{ value: "0", label: "启用" },
{ value: "1", label: "禁用" },
],
searchFromUnfolded: false,
pdfDialog: {
src: "",
visible: false,
},
});
const fnPreviewPdf = (FILEPATH) => {
data.pdfDialog.visible = true;
data.pdfDialog.src = FILEPATH;
};
const fnEditState = debounce(
1000,
async (DATACOURSEWARE_ID, STATE) => {
const respData = await editDataCoursewareState({
DATACOURSEWARE_ID,
STATE,
});
if (respData && respData.result === "success") {
ElMessage.success("设置成功");
await fnGetData();
}
},
{ atBegin: true }
);
const fnDelete = debounce(
1000,
async (DATACOURSEWARE_ID) => {
if (DATACOURSEWARE_ID) {
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
const respData = await deleteDataCourseware({ DATACOURSEWARE_ID });
if (respData && respData.result === "success") {
ElMessage.success("删除成功");
await fnGetData();
}
}
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,235 @@
<template>
<el-dialog
v-model="visible"
:title="type === 'edit' ? '修改' : '新增'"
:before-close="fnClose"
>
<el-form ref="formRef" :rules="rules" :model="form" label-width="150px">
<el-row>
<el-col :span="24">
<el-form-item label="试题类型" prop="QUESTIONTYPE">
<el-select
v-model="form.QUESTIONTYPE"
placeholder="请选择"
style="width: 100%"
@change="changeQuestionType"
>
<el-option
v-for="item in data.questionTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="题干" prop="QUESTIONDRY">
<el-input
type="textarea"
autosize
maxlength="255"
v-model="form.QUESTIONDRY"
placeholder="这里输入题干"
/>
</el-form-item>
</el-col>
<el-col v-if="form.QUESTIONTYPE !== '3'" :span="24">
<el-form-item label="选项A" prop="OPTIONA">
<el-input
maxlength="255"
v-model="form.OPTIONA"
placeholder="这里输入选项A"
/>
</el-form-item>
</el-col>
<el-col v-if="form.QUESTIONTYPE !== '3'" :span="24">
<el-form-item label="选项B" prop="OPTIONB">
<el-input
maxlength="255"
v-model="form.OPTIONB"
placeholder="这里输入选项B"
/>
</el-form-item>
</el-col>
<el-col v-if="form.QUESTIONTYPE !== '3'" :span="24">
<el-form-item label="选项C" prop="OPTIONC">
<el-input
maxlength="255"
v-model="form.OPTIONC"
placeholder="这里输入选项C"
/>
</el-form-item>
</el-col>
<el-col v-if="form.QUESTIONTYPE !== '3'" :span="24">
<el-form-item label="选项D" prop="OPTIOND">
<el-input
maxlength="255"
v-model="form.OPTIOND"
placeholder="这里输入选项D"
/>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="答案" prop="ANSWER">
<el-select v-model="form.ANSWER" placeholder="请选择">
<el-option
v-for="item in data.answerList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import { reactive, ref, watchEffect } from "vue";
import { addQuestion, editQuestion } from "@/request/online_learn_exam.js";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
type: {
type: String,
required: true,
default: "",
},
form: {
type: Object,
required: true,
default: () => ({}),
},
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, type, form } = useVModels(props, emits);
const data = reactive({
questionTypeList: [
{
value: "1",
label: "单选题",
},
{
value: "2",
label: "多选题",
},
{
value: "3",
label: "判断题",
},
],
answerList: [],
});
const rules = {
QUESTIONTYPE: [
{
required: true,
message: "试题类型(单选题、多选题、判断题)不能为空",
trigger: "blur",
},
],
QUESTIONDRY: [{ required: true, message: "题干不能为空", trigger: "blur" }],
OPTIONA: [{ required: true, message: "选项A不能为空", trigger: "blur" }],
OPTIONB: [{ required: true, message: "选项B不能为空", trigger: "blur" }],
OPTIONC: [{ required: true, message: "选项C不能为空", trigger: "blur" }],
OPTIOND: [{ required: true, message: "选项D不能为空", trigger: "blur" }],
ANSWER: [{ required: true, message: "答案不能为空", trigger: "blur" }],
COURSEWARETYPE: [
{
required: true,
message: "课件类型(1:视频课件、2:资料课件)不能为空",
trigger: "blur",
},
],
COURSEWAREID: [
{ required: true, message: "课件ID不能为空", trigger: "blur" },
],
};
const formRef = ref(null);
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const respData =
type.value === "add"
? await addQuestion({ ...form.value })
: await editQuestion({ ...form.value });
if (respData.result === "success") {
fnClose();
ElMessage.success("保存成功");
emits("get-data");
}
},
{ atBegin: true }
);
const changeAnswerList = () => {
data.answerList = [];
if (form.value.QUESTIONTYPE === "1") {
data.answerList = [
{ value: "A", label: "A" },
{ value: "B", label: "B" },
{ value: "C", label: "C" },
{ value: "D", label: "D" },
];
} else if (form.value.QUESTIONTYPE === "2") {
data.answerList = [
{ value: "AB", label: "AB" },
{ value: "AC", label: "AC" },
{ value: "AD", label: "AD" },
{ value: "BC", label: "BC" },
{ value: "BD", label: "BD" },
{ value: "CD", label: "CD" },
{ value: "ABC", label: "ABC" },
{ value: "ABD", label: "ABD" },
{ value: "ACD", label: "ACD" },
{ value: "BCD", label: "BCD" },
{ value: "ABCD", label: "ABCD" },
];
} else if (form.value.QUESTIONTYPE === "3") {
data.answerList = [
{ value: "A", label: "正确" },
{ value: "B", label: "错误" },
];
}
};
const changeQuestionType = () => {
form.value.ANSWER = "";
changeAnswerList();
};
watchEffect(() => {
if (form.value.QUESTIONTYPE) {
changeAnswerList();
}
});
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,272 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="130px"
@submit.prevent="fnResetPaginationTransfer"
>
<el-row>
<el-col :span="6">
<el-form-item label="题干" prop="KEYWORDS">
<el-input
v-model="searchForm.KEYWORDS"
placeholder="请输入题干"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
</el-form-item>
</el-col>
<el-col :span="6"></el-col>
<el-col :span="6">
<el-form-item label-width="10px" class="end">
<el-button @click="fnImportDialogChangeShow"></el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
row-key="QUESTION_ID"
:data="list"
@get-data="fnGetDataTransfer"
v-model:pagination="pagination"
>
<el-table-column reserve-selection type="selection" width="55" />
<el-table-column prop="QUESTIONNUMBER" label="题号" width="60" />
<el-table-column
prop="QUESTIONTYPE"
label="试题类型"
show-overflow-tooltip
width="80"
>
<template v-slot="{ row }">
{{ fnFormatterQuestionType(row) }}
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="QUESTIONDRY"
label="题干"
align="left"
/>
<el-table-column
show-overflow-tooltip
prop="ANSWER"
label="答案"
width="55"
>
<template v-slot="{ row }">
<template v-if="row.QUESTIONTYPE === '3'">
<div v-if="row.ANSWER === 'A'"></div>
<div v-if="row.ANSWER === 'B'"></div>
</template>
<template v-else>
<div>{{ row.ANSWER }}</div>
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
v-if="
buttonJurisdiction.edit &&
row.STUDYCOUNT === 0 &&
row.COURSEEXAMRECORDCOUNT === 0 &&
row.STAGEEXAMRECORDCOUNT === 0 &&
row.COURSEEXAMCOUNT === 0 &&
row.STAGEEXAMCOUNT === 0
"
@click="fnAddOrEdit(row)"
>
修改
</el-button>
<el-button
type="primary"
text
link
v-if="
buttonJurisdiction.del &&
row.STUDYCOUNT === 0 &&
row.COURSEEXAMRECORDCOUNT === 0 &&
row.STAGEEXAMRECORDCOUNT === 0 &&
row.COURSEEXAMCOUNT === 0 &&
row.STAGEEXAMCOUNT === 0
"
@click="fnDelete(row.QUESTION_ID)"
>
删除
</el-button>
</template>
</el-table-column>
<template #button>
<el-button
v-if="buttonJurisdiction.add"
type="primary"
@click="fnAddOrEdit(null)"
>
新增
</el-button>
<el-button
v-if="buttonJurisdiction.del"
type="danger"
@click="fnBatchDelete"
>
删除
</el-button>
</template>
</layout-table>
</layout-card>
<layout-import-file
v-model:visible="data.importDialogVisible"
template-url="/template/questionExcelTemplate.xls"
@submit="fnSubmitImport"
/>
<add
v-model:visible="data.addOrEditDialog.visible"
v-model:form="data.addOrEditDialog.form"
:type="data.addOrEditDialog.type"
@get-data="fnResetPaginationTransfer"
/>
</div>
</template>
<script setup>
import LayoutTable from "@/components/table/index.vue";
import LayoutCard from "@/components/card/index.vue";
import {
importQuestion,
deleteQuestion,
deleteQuestionBatch,
getQuestionListByCoursewareIdAndType,
} from "@/request/online_learn_exam.js";
import useListData from "@/assets/js/useListData.js";
import { reactive } from "vue";
import { useRoute } from "vue-router";
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import LayoutImportFile from "@/components/import_file/index.vue";
import Add from "./components/add.vue";
const route = useRoute();
const { COURSE_ID, COURSE_TYPE } = route.query;
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
useListData(getQuestionListByCoursewareIdAndType, {
otherParams: { COURSEWAREID: COURSE_ID, COURSEWARETYPE: COURSE_TYPE },
});
const buttonJurisdiction = await useButtonJurisdiction("courseware");
const data = reactive({
importDialogVisible: false,
questionTypeOptions: [
{
value: "1",
label: "单选题",
},
{
value: "2",
label: "多选题",
},
{
value: "3",
label: "判断题",
},
],
addOrEditDialog: {
visible: false,
form: {},
type: "add",
},
});
const fnGetDataTransfer = async () => {
await fnGetData({
COURSEWAREID: COURSE_ID,
COURSEWARETYPE: COURSE_TYPE,
});
};
const fnResetPaginationTransfer = async () => {
await fnResetPagination({
COURSEWAREID: COURSE_ID,
COURSEWARETYPE: COURSE_TYPE,
});
};
const fnFormatterQuestionType = (row) => {
let label = "";
data.questionTypeOptions.forEach((option) => {
if (option.value === row.QUESTIONTYPE) {
label = option.label;
}
});
return label;
};
const fnDelete = debounce(
1000,
async (QUESTION_ID) => {
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
await deleteQuestion({ QUESTION_ID });
ElMessage.success("删除成功");
fnGetDataTransfer();
},
{ atBegin: true }
);
const fnBatchDelete = debounce(
1000,
async () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要删除的项");
return;
}
await ElMessageBox.confirm("确定要删除选中的数据吗?", { type: "warning" });
const DATA_IDS = selectionData.map((item) => item.RISKUNIT_ID).join(",");
await deleteQuestionBatch({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPaginationTransfer();
},
{ atBegin: true }
);
const fnImportDialogChangeShow = () => {
data.importDialogVisible = !data.importDialogVisible;
};
const fnSubmitImport = async (formData) => {
formData.append("COURSEWARETYPE", COURSE_TYPE);
formData.append("COURSEWAREID", COURSE_ID);
const respData = await importQuestion(formData);
ElMessage.success(respData.msg);
fnImportDialogChangeShow();
fnResetPaginationTransfer();
};
const fnAddOrEdit = (row) => {
data.addOrEditDialog.form = {};
if (row) {
data.addOrEditDialog.form = JSON.parse(JSON.stringify(row));
data.addOrEditDialog.type = "edit";
} else {
data.addOrEditDialog.form.COURSEWAREID = COURSE_ID;
data.addOrEditDialog.form.COURSEWARETYPE = COURSE_TYPE;
data.addOrEditDialog.type = "add";
}
data.addOrEditDialog.visible = true;
};
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,340 @@
<template>
<el-card>
<el-form
:model="searchForm"
label-width="130px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="6">
<el-form-item label="课程名称" prop="KEYWORDS">
<el-input
v-model="searchForm.KEYWORDS"
placeholder="请输入课程名称"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="教师名称" prop="SPEAKER">
<el-input
v-model="searchForm.SPEAKER"
placeholder="请输入教师名称"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="培训板块类型" prop="trainingSectionKey">
<layout-learning-train-type
v-model="searchForm.trainingSectionKey"
type="post"
placeholder="请选择培训板块类型"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="培训行业类型" prop="TRAINTYPE">
<layout-learning-train-type
v-model="searchForm.TRAINTYPE"
type="post"
placeholder="请选择培训行业类型"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="岗位培训类型" prop="POSTTYPE">
<layout-learning-train-type
v-model="searchForm.POSTTYPE"
type="post"
placeholder="请选择岗位培训类型"
/>
</el-form-item>
</el-col>
<el-col v-show="data.searchFromUnfolded" :span="6">
<el-form-item label="课件状态" prop="STATE">
<el-select v-model="searchForm.STATE" placeholder="请选择状态">
<el-option
v-for="item in data.courseStates"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
<el-button
v-if="!data.searchFromUnfolded"
type="text"
@click="data.searchFromUnfolded = true"
>
展开<el-icon><arrow-down /></el-icon>
</el-button>
<el-button
v-else
type="text"
@click="data.searchFromUnfolded = false"
>
合并<el-icon><arrow-up /></el-icon>
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
:data="list"
@get-data="fnGetData"
v-model:pagination="pagination"
>
<el-table-column label="序号" width="50">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="COURSEWARENAME"
label="课件名称"
/>
<el-table-column
show-overflow-tooltip
prop="post_type_name"
label="岗位培训类型"
/>
<el-table-column
show-overflow-tooltip
prop="train_type_name"
label="培训行业类型"
/>
<el-table-column prop="SPEAKER" label="讲师名称" />
<el-table-column prop="CLASSHOUR" label="课件学时(分钟)" />
<el-table-column
show-overflow-tooltip
prop="trainingSectionName"
label="培训板块"
/>
<el-table-column prop="CREATTIME" label="上传时间" />
<el-table-column prop="STATE" label="课件状态">
<template v-slot="{ row }">
<template v-if="row.STATE === 0">
<div>启用</div>
</template>
<template v-else-if="row.STATE === 1">
<div>禁用</div>
</template>
</template>
</el-table-column>
<el-table-column prop="CURRICULUM_ID_REMOTE" label="课件来源">
<template v-slot="{ row }">
<template v-if="row.CURRICULUM_ID_REMOTE">
<div>商城</div>
</template>
<template v-else>
<div>自传</div>
</template>
</template>
</el-table-column>
<el-table-column prop="NUMEXAMPLE" label="习题数" />
<el-table-column label="操作" width="300">
<template v-slot="{ row }">
<el-button
type="primary"
text
link
v-if="
(row.VIDEOCOURSEWARE_ID_REMOTE &&
row.VIDEOCOURSEWARE_ID_REMOTE.length > 0) ||
(row.VIDEOFILES && row.VIDEOFILES.length > 0)
"
@click="fnPreviewVideo(row)"
>
预览
</el-button>
<el-button
type="primary"
text
link
v-if="buttonJurisdiction.edit && row.STATE === 1"
@click="fnEditState(row.VIDEOCOURSEWARE_ID, 0)"
>
启用
</el-button>
<el-button
type="primary"
text
link
v-if="buttonJurisdiction.edit && row.STATE === 0"
@click="fnEditState(row.VIDEOCOURSEWARE_ID, 1)"
>
禁用
</el-button>
<el-button
type="primary"
text
link
v-if="
buttonJurisdiction.edit &&
row.CURRICULUMCOUNT === 0 &&
row.STAGECOUNT === 0 &&
row.ISPLATFORM === 0
"
>
修改<!-- todo -->
</el-button>
<el-button
type="primary"
text
link
v-if="
buttonJurisdiction.del &&
row.CURRICULUMCOUNT === 0 &&
row.STAGECOUNT === 0 &&
row.ISPLATFORM === 0
"
@click="fnDelete(row.VIDEOCOURSEWARE_ID)"
>
删除
</el-button>
<el-button
type="primary"
text
link
@click="
router.push({
path: '/online_learn_exam/courseware/video/question_list',
query: {
COURSE_ID: row.VIDEOCOURSEWARE_ID, // ID
COURSE_TYPE: '1', // (1:2:)
},
})
"
>
课件习题
</el-button>
</template>
</el-table-column>
<template #button>
<el-button v-if="buttonJurisdiction.add" type="primary">
新增<!-- todo -->
</el-button>
</template>
</layout-table>
</layout-card>
<layout-video
:src="data.videoDialog.src"
:vid="data.videoDialog.vid"
:play-auth="data.videoDialog.playAuth"
v-model:visible="data.videoDialog.visible"
/>
</template>
<script setup>
import LayoutCard from "@/components/card/index.vue";
import LayoutLearningTrainType from "@/components/learning_train_type/index.vue";
import {
getVideoCoursewareList,
editVideoCoursewareState,
deleteVideoCourseware,
} from "@/request/online_learn_exam.js";
import useListData from "@/assets/js/useListData.js";
import { reactive } from "vue";
import { serialNumber } from "@/assets/js/utils.js";
import LayoutTable from "@/components/table/index.vue";
import LayoutVideo from "@/components/video/index.vue";
import { getVideoAuth, getVideoSource } from "@/request/api.js";
import { ArrowDown, ArrowUp } from "@element-plus/icons-vue";
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import { ElMessage, ElMessageBox } from "element-plus";
import { useRouter } from "vue-router";
import { debounce } from "throttle-debounce";
const router = useRouter();
const buttonJurisdiction = await useButtonJurisdiction("courseware");
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getVideoCoursewareList);
const data = reactive({
courseStates: [
{ value: "0", label: "启用" },
{ value: "1", label: "禁用" },
],
searchFromUnfolded: false,
videoDialog: {
src: "",
vid: "",
playAuth: "",
visible: false,
},
});
const fnPreviewVideo = async (row) => {
data.videoDialog.src = "";
data.videoDialog.vid = "";
data.videoDialog.playAuth = "";
if (
row.VIDEOCOURSEWARE_ID_REMOTE &&
row.VIDEOCOURSEWARE_ID_REMOTE.length > 0
) {
const respData = await getVideoSource({
VIDEOCOURSEWARE_ID: row.VIDEOCOURSEWARE_ID_REMOTE,
CURRICULUM_ID: row.CURRICULUM_ID_REMOTE,
});
if (respData && respData.type === "success") {
const video = {};
respData.videoList.forEach((item) => {
video[item.definition] = item.playURL;
});
data.videoDialog.src = JSON.stringify(video);
data.videoDialog.visible = true;
}
} else if (row.VIDEOFILES && row.VIDEOFILES.length > 0) {
const respData = await getVideoAuth({
videoId: row.VIDEOFILES,
});
if (respData && respData.type === "success") {
data.videoDialog.playAuth = respData.playAuth;
data.videoDialog.vid = row.VIDEOFILES;
data.videoDialog.visible = true;
}
}
};
const fnEditState = debounce(
1000,
async (VIDEOCOURSEWARE_ID, STATE) => {
const respData = await editVideoCoursewareState({
VIDEOCOURSEWARE_ID,
STATE,
});
if (respData && respData.result === "success") {
ElMessage.success("设置成功");
await fnGetData();
}
},
{ atBegin: true }
);
const fnDelete = debounce(
1000,
async (VIDEOCOURSEWARE_ID) => {
if (VIDEOCOURSEWARE_ID) {
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
const respData = await deleteVideoCourseware({ VIDEOCOURSEWARE_ID });
if (respData && respData.result === "success") {
ElMessage.success("删除成功");
await fnGetData();
}
}
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>