forked from integrated_whb/integrated_whb_vue
init
parent
41a4ee6edd
commit
9b837c85c9
|
@ -188,7 +188,7 @@
|
||||||
--el-checkbox-disabled-border-color: var(--el-border-color);
|
--el-checkbox-disabled-border-color: var(--el-border-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
|
.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner, .el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner {
|
||||||
--el-checkbox-disabled-checked-input-fill: var(--el-checkbox-bg-color);
|
--el-checkbox-disabled-checked-input-fill: var(--el-checkbox-bg-color);
|
||||||
--el-checkbox-disabled-checked-input-border-color: var(--el-color-check);
|
--el-checkbox-disabled-checked-input-border-color: var(--el-color-check);
|
||||||
}
|
}
|
||||||
|
|
|
@ -956,6 +956,22 @@ export default [
|
||||||
},
|
},
|
||||||
component: "online_learn_exam/curriculum/add",
|
component: "online_learn_exam/curriculum/add",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/online_learn_exam/curriculum/edit",
|
||||||
|
meta: {
|
||||||
|
title: "修改",
|
||||||
|
activeMenu: "/online_learn_exam/curriculum",
|
||||||
|
},
|
||||||
|
component: "online_learn_exam/curriculum/add",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/online_learn_exam/curriculum/inherit",
|
||||||
|
meta: {
|
||||||
|
title: "继承",
|
||||||
|
activeMenu: "/online_learn_exam/curriculum",
|
||||||
|
},
|
||||||
|
component: "online_learn_exam/curriculum/add",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { getDataType } from "@/assets/js/utils.js";
|
||||||
* @param options.defaultSearchForm {Object?} searchForm默认值
|
* @param options.defaultSearchForm {Object?} searchForm默认值
|
||||||
* @param options.immediate {Boolean?} 是否立即执行接口函数(默认是)
|
* @param options.immediate {Boolean?} 是否立即执行接口函数(默认是)
|
||||||
* @param options.usePagination {Boolean?} 是否使用分页(默认是)
|
* @param options.usePagination {Boolean?} 是否使用分页(默认是)
|
||||||
|
* @param options.clearSelection {Boolean?} 调用fnResetPagination是是否清空表格选择数据(默认是)
|
||||||
* @param options.key {String?} 返回的存放数组的key(默认varList)
|
* @param options.key {String?} 返回的存放数组的key(默认varList)
|
||||||
* @return {Object} 返回对象包含以下属性:list 表格数据,pagination 分页数据,searchForm 搜索表单数据,tableRef 表格实例,fnGetData 获取数据函数,fnResetPagination 重置分页函数
|
* @return {Object} 返回对象包含以下属性:list 表格数据,pagination 分页数据,searchForm 搜索表单数据,tableRef 表格实例,fnGetData 获取数据函数,fnResetPagination 重置分页函数
|
||||||
*/
|
*/
|
||||||
|
@ -23,17 +24,27 @@ export default function useListData(api, options = {}) {
|
||||||
throw new Error("options.usePagination必须是一个布尔值");
|
throw new Error("options.usePagination必须是一个布尔值");
|
||||||
if (options.key && getDataType(options.key) !== "String")
|
if (options.key && getDataType(options.key) !== "String")
|
||||||
throw new Error("options.key必须是一个字符串");
|
throw new Error("options.key必须是一个字符串");
|
||||||
if (options.callbackFn && getDataType(options.callbackFn) !== "Function")
|
if (
|
||||||
|
options.callbackFn &&
|
||||||
|
getDataType(options.callbackFn) !== "Function" &&
|
||||||
|
getDataType(options.callbackFn) !== "AsyncFunction"
|
||||||
|
)
|
||||||
throw new Error("options.callbackFn必须是一个函数");
|
throw new Error("options.callbackFn必须是一个函数");
|
||||||
if (
|
if (
|
||||||
options.defaultSearchForm &&
|
options.defaultSearchForm &&
|
||||||
getDataType(options.defaultSearchForm) !== "Object"
|
getDataType(options.defaultSearchForm) !== "Object"
|
||||||
)
|
)
|
||||||
throw new Error("options.defaultSearchForm必须是一个对象");
|
throw new Error("options.defaultSearchForm必须是一个对象");
|
||||||
|
if (
|
||||||
|
options.clearSelection &&
|
||||||
|
getDataType(options.clearSelection) !== "Boolean"
|
||||||
|
)
|
||||||
|
throw new Error("options.clearSelection必须是一个布尔值");
|
||||||
const immediate = options.immediate ?? true;
|
const immediate = options.immediate ?? true;
|
||||||
const usePagination = options.usePagination ?? true;
|
const usePagination = options.usePagination ?? true;
|
||||||
const key = options.key ?? "varList";
|
const key = options.key ?? "varList";
|
||||||
const defaultSearchForm = options.defaultSearchForm ?? {};
|
const defaultSearchForm = options.defaultSearchForm ?? {};
|
||||||
|
const clearSelection = options.clearSelection ?? true;
|
||||||
if (
|
if (
|
||||||
immediate &&
|
immediate &&
|
||||||
options.otherParams &&
|
options.otherParams &&
|
||||||
|
@ -74,7 +85,7 @@ export default function useListData(api, options = {}) {
|
||||||
};
|
};
|
||||||
await nextTick();
|
await nextTick();
|
||||||
await fnGetData(otherParams);
|
await fnGetData(otherParams);
|
||||||
tableRef.value && tableRef.value.clearSelection();
|
clearSelection && tableRef.value && tableRef.value.clearSelection();
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
list,
|
list,
|
||||||
|
|
|
@ -143,17 +143,8 @@ const getSelectionRows = () => {
|
||||||
const clearSelection = () => {
|
const clearSelection = () => {
|
||||||
return tableRef.value.clearSelection();
|
return tableRef.value.clearSelection();
|
||||||
};
|
};
|
||||||
const toggleRowSelection = (value, selected) => {
|
const toggleRowSelection = (value, selected = true) => {
|
||||||
if (typeof value === "object") {
|
tableRef.value.toggleRowSelection(value, selected);
|
||||||
tableRef.value.toggleRowSelection(value, selected);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < props.data.length; i++) {
|
|
||||||
if (props.data[i][props.rowKey] === value) {
|
|
||||||
tableRef.value.toggleRowSelection(props.data[i], selected);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
defineExpose({
|
defineExpose({
|
||||||
getSelectionRows,
|
getSelectionRows,
|
||||||
|
|
|
@ -36,3 +36,7 @@ export const getCurriculumList = (params) => post("/curriculum/list", params); /
|
||||||
export const getCurriculumView = (params) => post("/curriculum/goEdit", params); // 课程管理查看
|
export const getCurriculumView = (params) => post("/curriculum/goEdit", params); // 课程管理查看
|
||||||
export const setCurriculumDelete = (params) =>
|
export const setCurriculumDelete = (params) =>
|
||||||
post("/curriculum/delete", params); // 课程管理删除
|
post("/curriculum/delete", params); // 课程管理删除
|
||||||
|
export const setCurriculumAdd = (params) => upload("/curriculum/add", params); // 课程管理添加
|
||||||
|
export const setCurriculumEdit = (params) => upload("/curriculum/edit", params); // 课程管理修改
|
||||||
|
export const setCurriculumInherit = (params) =>
|
||||||
|
upload("/curriculum/inherit", params); // 课程管理继承
|
||||||
|
|
|
@ -397,7 +397,7 @@ const fnTableSelection = async () => {
|
||||||
const selectionData = tableRef.value.getSelectionRows();
|
const selectionData = tableRef.value.getSelectionRows();
|
||||||
await nextTick();
|
await nextTick();
|
||||||
selectionData.forEach((item) => {
|
selectionData.forEach((item) => {
|
||||||
tableRef.value.toggleRowSelection(item, true);
|
tableRef.value.toggleRowSelection(item);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const fnAddRiskSubmit = (item) => {
|
const fnAddRiskSubmit = (item) => {
|
||||||
|
|
|
@ -0,0 +1,375 @@
|
||||||
|
<template>
|
||||||
|
<layout-card>
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="data.form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="120px"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="课程名称" prop="CURRICULUMNAME">
|
||||||
|
<el-input v-model="data.form.CURRICULUMNAME" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="培训板块" prop="trainingSection">
|
||||||
|
<layout-training-section-cascader
|
||||||
|
v-model="data.form.trainingSection"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="培训行业类型" prop="TRAINTYPE">
|
||||||
|
<layout-learning-train-type
|
||||||
|
v-model="data.form.TRAINTYPE"
|
||||||
|
type="industry"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="岗位培训类型" prop="POSTTYPE">
|
||||||
|
<layout-learning-train-type
|
||||||
|
v-model="data.form.POSTTYPE"
|
||||||
|
type="post"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="课程图片" prop="file">
|
||||||
|
<layout-upload
|
||||||
|
v-model:file-list="data.form.file"
|
||||||
|
accept=".jpg,.jpeg,.png"
|
||||||
|
list-type="picture-card"
|
||||||
|
:limit="1"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="课程介绍" prop="CURRICULUMINTRODUCE">
|
||||||
|
<el-input
|
||||||
|
v-model="data.form.CURRICULUMINTRODUCE"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{
|
||||||
|
minRows: 3,
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="章节">
|
||||||
|
<el-button type="primary" @click="fnAddChapter">添加章节</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col
|
||||||
|
:span="24"
|
||||||
|
v-for="(item, index) in data.chapterList"
|
||||||
|
:key="item.id || item.CHAPTER_ID"
|
||||||
|
>
|
||||||
|
<el-form-item label="章节名称">
|
||||||
|
<div style="flex: 1; display: flex">
|
||||||
|
<el-input v-model="item.NAME" />
|
||||||
|
<el-button
|
||||||
|
class="ml-10"
|
||||||
|
type="danger"
|
||||||
|
@click="fnDeleteChapter(index)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
<el-button type="primary" @click="fnBatchAddCourseware(index)">
|
||||||
|
批量添加课件
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
v-if="item.xzVideoList.length > 0 || item.xzDataList.length > 0"
|
||||||
|
label="已经添加课件"
|
||||||
|
>
|
||||||
|
<div style="flex: 1; display: flex">
|
||||||
|
<div class="mr-10" style="flex: 1">
|
||||||
|
<layout-table
|
||||||
|
:data="item.xzVideoList"
|
||||||
|
:summary-method="fnSummaries"
|
||||||
|
show-summary
|
||||||
|
:show-pagination="false"
|
||||||
|
>
|
||||||
|
<el-table-column prop="COURSEWARENAME" label="视频课件名称" />
|
||||||
|
<el-table-column
|
||||||
|
prop="CLASSHOUR"
|
||||||
|
label="学时(分钟)"
|
||||||
|
width="100"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="CLASSHOUR" label="操作" width="60">
|
||||||
|
<template v-slot="{ $index }">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
text
|
||||||
|
link
|
||||||
|
@click="fnDeleteVideoList(index, $index)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</layout-table>
|
||||||
|
</div>
|
||||||
|
<div class="ml-10" style="flex: 1">
|
||||||
|
<layout-table
|
||||||
|
:data="item.xzDataList"
|
||||||
|
:summary-method="fnSummaries"
|
||||||
|
show-summary
|
||||||
|
:show-pagination="false"
|
||||||
|
>
|
||||||
|
<el-table-column prop="COURSEWARENAME" label="资料课件名称" />
|
||||||
|
<el-table-column
|
||||||
|
prop="CLASSHOUR"
|
||||||
|
label="学时(分钟)"
|
||||||
|
width="100"
|
||||||
|
/>
|
||||||
|
<el-table-column prop="CLASSHOUR" label="操作" width="60">
|
||||||
|
<template v-slot="{ $index }">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
text
|
||||||
|
link
|
||||||
|
@click="fnDeleteDataList(index, $index)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</layout-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="课程总学时" prop="CLASSHOUR">
|
||||||
|
<el-input v-model="data.form.CLASSHOUR" disabled />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div class="tc mt-10">
|
||||||
|
<el-button type="primary" @click="fnSubmit">提交</el-button>
|
||||||
|
</div>
|
||||||
|
<batch-add-courseware
|
||||||
|
v-model:visible="data.batchAddCoursewareDialog.visible"
|
||||||
|
@submit="fnBatchAddCoursewareDialogSubmit"
|
||||||
|
:xz-data-list="data.batchAddCoursewareDialog.xzDataList"
|
||||||
|
:xz-video-list="data.batchAddCoursewareDialog.xzVideoList"
|
||||||
|
/>
|
||||||
|
</layout-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { reactive, ref } from "vue";
|
||||||
|
import LayoutLearningTrainType from "@/components/learning_train_type/index.vue";
|
||||||
|
import LayoutTrainingSectionCascader from "@/components/training_section_cascader/index.vue";
|
||||||
|
import { useUserStore } from "@/pinia/user.js";
|
||||||
|
import LayoutUpload from "@/components/upload/index.vue";
|
||||||
|
import { sumBy } from "lodash-es";
|
||||||
|
import BatchAddCourseware from "./components/batch_add_courseware.vue";
|
||||||
|
import { debounce } from "throttle-debounce";
|
||||||
|
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import {
|
||||||
|
getCurriculumView,
|
||||||
|
setCurriculumAdd,
|
||||||
|
setCurriculumEdit,
|
||||||
|
setCurriculumInherit,
|
||||||
|
} from "@/request/online_learn_exam.js";
|
||||||
|
import { getFileName } from "@/assets/js/utils.js";
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { type, CURRICULUM_ID } = route.query;
|
||||||
|
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
|
||||||
|
const rules = {
|
||||||
|
CURRICULUMNAME: [
|
||||||
|
{ required: true, message: "请输入课程名称", trigger: "blur" },
|
||||||
|
],
|
||||||
|
POSTTYPE: [
|
||||||
|
{ required: true, message: "请选择岗位培训类型", trigger: "change" },
|
||||||
|
],
|
||||||
|
file: [{ required: true, message: "请上传课程图片", trigger: "change" }],
|
||||||
|
CURRICULUMINTRODUCE: [
|
||||||
|
{ required: true, message: "请输入课程介绍", trigger: "blur" },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const formRef = ref(null);
|
||||||
|
const data = reactive({
|
||||||
|
form: {
|
||||||
|
CURRICULUMNAME: "",
|
||||||
|
trainingSection: [],
|
||||||
|
TRAINTYPE: "",
|
||||||
|
POSTTYPE: "",
|
||||||
|
file: [],
|
||||||
|
CURRICULUMINTRODUCE: "",
|
||||||
|
CLASSHOUR: 0,
|
||||||
|
},
|
||||||
|
chapterList: [],
|
||||||
|
batchAddCoursewareDialog: {
|
||||||
|
visible: false,
|
||||||
|
index: 0,
|
||||||
|
xzVideoList: [],
|
||||||
|
xzDataList: [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const fnGetData = async () => {
|
||||||
|
if (type === "add")
|
||||||
|
data.form.TRAINTYPE = userStore.getUserInfo.CORP_TRAINTYPE;
|
||||||
|
else {
|
||||||
|
const resData = await getCurriculumView({
|
||||||
|
CURRICULUM_ID,
|
||||||
|
});
|
||||||
|
data.form = resData.pd;
|
||||||
|
data.form.file = [
|
||||||
|
{
|
||||||
|
url: VITE_FILE_URL + resData.pd.CAPTURE,
|
||||||
|
name: getFileName(resData.pd.CAPTURE),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const trainingSection = [];
|
||||||
|
for (let i = 0; i < resData.coursewareAllList.length; i++) {
|
||||||
|
trainingSection.push(
|
||||||
|
resData.coursewareAllList[i].DICTIONARIES_IDS.split(",")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
data.form.trainingSection = trainingSection;
|
||||||
|
data.chapterList = resData.chapterList;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fnGetData();
|
||||||
|
const fnAddChapter = () => {
|
||||||
|
data.chapterList.push({
|
||||||
|
CHAPTER_ID: "",
|
||||||
|
NAME: "",
|
||||||
|
xzVideoList: [],
|
||||||
|
xzDataList: [],
|
||||||
|
id: Math.random(),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const fnBatchAddCourseware = (index) => {
|
||||||
|
data.batchAddCoursewareDialog.index = index;
|
||||||
|
data.batchAddCoursewareDialog.xzVideoList =
|
||||||
|
data.chapterList[index].xzVideoList;
|
||||||
|
data.batchAddCoursewareDialog.xzDataList = data.chapterList[index].xzDataList;
|
||||||
|
data.batchAddCoursewareDialog.visible = true;
|
||||||
|
};
|
||||||
|
const fnBatchAddCoursewareDialogSubmit = ({ videoList, dataList }) => {
|
||||||
|
const index = data.batchAddCoursewareDialog.index;
|
||||||
|
data.chapterList[index].xzVideoList = videoList;
|
||||||
|
data.chapterList[index].xzDataList = dataList;
|
||||||
|
fnCalculateTotalCreditHours();
|
||||||
|
};
|
||||||
|
const fnDeleteChapter = (index) => {
|
||||||
|
data.chapterList.splice(index, 1);
|
||||||
|
fnCalculateTotalCreditHours();
|
||||||
|
};
|
||||||
|
const fnDeleteVideoList = (index, index1) => {
|
||||||
|
data.chapterList[index].xzVideoList.splice(index1, 1);
|
||||||
|
fnCalculateTotalCreditHours();
|
||||||
|
};
|
||||||
|
const fnDeleteDataList = (index, index1) => {
|
||||||
|
data.chapterList[index].xzDataList.splice(index1, 1);
|
||||||
|
fnCalculateTotalCreditHours();
|
||||||
|
};
|
||||||
|
const fnSummaries = ({ columns, data }) => {
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = "合计";
|
||||||
|
} else if (index === 2) {
|
||||||
|
sums[index] = "分钟";
|
||||||
|
} else if (index === 1) {
|
||||||
|
const values = data.map((item) => Number(item[column.property]));
|
||||||
|
if (!values.every((value) => isNaN(value))) {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr);
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return prev + curr;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
} else {
|
||||||
|
sums[index] = "N/A";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
};
|
||||||
|
const fnCalculateTotalCreditHours = () => {
|
||||||
|
data.form.CLASSHOUR = 0;
|
||||||
|
let CLASSHOUR = 0;
|
||||||
|
for (let i = 0; i < data.chapterList.length; i++) {
|
||||||
|
CLASSHOUR += sumBy(
|
||||||
|
data.chapterList[i].xzVideoList,
|
||||||
|
(item) => item.CLASSHOUR
|
||||||
|
);
|
||||||
|
CLASSHOUR += sumBy(
|
||||||
|
data.chapterList[i].xzDataList,
|
||||||
|
(item) => item.CLASSHOUR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
data.form.CLASSHOUR = CLASSHOUR;
|
||||||
|
};
|
||||||
|
const fnSubmit = debounce(
|
||||||
|
1000,
|
||||||
|
async () => {
|
||||||
|
await useFormValidate(formRef);
|
||||||
|
const formData = new FormData();
|
||||||
|
if (data.chapterList.length === 0) {
|
||||||
|
ElMessage.warning("请添加章节");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const chapterList = [];
|
||||||
|
for (let i = 0; i < data.chapterList.length; i++) {
|
||||||
|
if (!data.chapterList[i].NAME) {
|
||||||
|
ElMessage.warning("请输入章节名称");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
data.chapterList[i].xzVideoList.length === 0 &&
|
||||||
|
data.chapterList[i].xzDataList.length === 0
|
||||||
|
) {
|
||||||
|
ElMessage.warning(`【${data.chapterList[i].NAME}】没有选择课件`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chapterList.push({
|
||||||
|
CHAPTER_ID: data.chapterList[i].CHAPTER_ID,
|
||||||
|
NAME: data.chapterList[i].NAME,
|
||||||
|
VIDEOCOURSEWARES: data.chapterList[i].xzVideoList
|
||||||
|
.map((item) => item.VIDEOCOURSEWARE_ID)
|
||||||
|
.join(","),
|
||||||
|
DATACOURSEWARES: data.chapterList[i].xzDataList
|
||||||
|
.map((item) => item.DATACOURSEWARE_ID)
|
||||||
|
.join(","),
|
||||||
|
SORT: i + 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Object.keys(data.form).forEach((key) => {
|
||||||
|
formData.append(key, data.form[key]);
|
||||||
|
});
|
||||||
|
formData.append("chapterList", JSON.stringify(chapterList));
|
||||||
|
if (data.form.trainingSection.length > 0) {
|
||||||
|
formData.delete("trainingSection");
|
||||||
|
formData.append("trainingSection", data.form.trainingSection.join(";"));
|
||||||
|
}
|
||||||
|
formData.delete("screenshotFile");
|
||||||
|
if (data.form.file[0].raw) formData.append("FFILE", data.form.file[0].raw);
|
||||||
|
if (type === "add") await setCurriculumAdd(formData);
|
||||||
|
if (type === "edit") await setCurriculumEdit(formData);
|
||||||
|
if (type === "inherit") await setCurriculumInherit(formData);
|
||||||
|
ElMessage.success("保存成功");
|
||||||
|
router.back();
|
||||||
|
},
|
||||||
|
{ atBegin: true }
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,197 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
v-model="visible"
|
||||||
|
title="选择课件"
|
||||||
|
append-to-body
|
||||||
|
:on-close="fnClose"
|
||||||
|
width="1500px"
|
||||||
|
>
|
||||||
|
<el-tabs v-model="activeName">
|
||||||
|
<el-tab-pane label="视频课件" name="video">
|
||||||
|
<el-form
|
||||||
|
:model="videoSearchForm"
|
||||||
|
label-width="80px"
|
||||||
|
@submit.prevent="fnVideoResetPagination"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="课件名称" prop="KEYWORDS">
|
||||||
|
<el-input v-model="videoSearchForm.KEYWORDS" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="10px">
|
||||||
|
<el-button type="primary" native-type="submit">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button native-type="reset" @click="fnVideoResetPagination">
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<layout-table
|
||||||
|
ref="videoTableRef"
|
||||||
|
row-key="VIDEOCOURSEWARE_ID"
|
||||||
|
:data="videoList"
|
||||||
|
v-model:pagination="videoPagination"
|
||||||
|
@get-data="fnVideoGetData"
|
||||||
|
>
|
||||||
|
<el-table-column reserve-selection type="selection" width="55" />
|
||||||
|
<el-table-column label="序号" width="60">
|
||||||
|
<template #default="{ $index }">
|
||||||
|
{{ serialNumber(videoPagination, $index) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="COURSEWARENAME" label="课件名称" />
|
||||||
|
<el-table-column prop="post_type_name" label="岗位培训类型" />
|
||||||
|
<el-table-column prop="train_type_name" label="培训行业类型" />
|
||||||
|
<el-table-column prop="CLASSHOUR" label="学时(分钟)" />
|
||||||
|
<el-table-column prop="SPEAKER" label="讲师名称" />
|
||||||
|
</layout-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="资料课件" name="data">
|
||||||
|
<el-form
|
||||||
|
:model="dataSearchForm"
|
||||||
|
label-width="80px"
|
||||||
|
@submit.prevent="fnDataResetPagination"
|
||||||
|
>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label="课件名称" prop="KEYWORDS">
|
||||||
|
<el-input v-model="dataSearchForm.KEYWORDS" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-form-item label-width="10px">
|
||||||
|
<el-button type="primary" native-type="submit">
|
||||||
|
搜索
|
||||||
|
</el-button>
|
||||||
|
<el-button native-type="reset" @click="fnDataResetPagination">
|
||||||
|
重置
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<layout-table
|
||||||
|
ref="dataTableRef"
|
||||||
|
row-key="DATACOURSEWARE_ID"
|
||||||
|
:data="dataList"
|
||||||
|
v-model:pagination="dataPagination"
|
||||||
|
@get-data="fnDataGetData"
|
||||||
|
>
|
||||||
|
<el-table-column reserve-selection type="selection" width="55" />
|
||||||
|
<el-table-column label="序号" width="60">
|
||||||
|
<template #default="{ $index }">
|
||||||
|
{{ serialNumber(dataPagination, $index) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="COURSEWARENAME" label="课件名称" />
|
||||||
|
<el-table-column prop="post_type_name" label="岗位培训类型" />
|
||||||
|
<el-table-column prop="train_type_name" label="培训行业类型" />
|
||||||
|
<el-table-column prop="CLASSHOUR" label="学时(分钟)" />
|
||||||
|
<el-table-column prop="SPEAKER" label="讲师名称" />
|
||||||
|
</layout-table>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="fnClose">关闭</el-button>
|
||||||
|
<el-button type="primary" @click="fnSubmit">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { useVModel } from "@vueuse/core";
|
||||||
|
import { nextTick, ref, watch } from "vue";
|
||||||
|
import useListData from "@/assets/js/useListData.js";
|
||||||
|
import {
|
||||||
|
getDataCoursewareList,
|
||||||
|
getVideoCoursewareList,
|
||||||
|
} from "@/request/online_learn_exam.js";
|
||||||
|
import { serialNumber } from "@/assets/js/utils.js";
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
xzVideoList: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
xzDataList: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const emits = defineEmits(["update:visible", "submit"]);
|
||||||
|
const visible = useVModel(props, "visible", emits);
|
||||||
|
const activeName = ref("video");
|
||||||
|
const {
|
||||||
|
list: videoList,
|
||||||
|
pagination: videoPagination,
|
||||||
|
searchForm: videoSearchForm,
|
||||||
|
fnResetPagination: fnVideoResetPagination,
|
||||||
|
fnGetData: fnVideoGetData,
|
||||||
|
tableRef: videoTableRef,
|
||||||
|
} = useListData(getVideoCoursewareList, {
|
||||||
|
otherParams: {
|
||||||
|
STATE: "0",
|
||||||
|
},
|
||||||
|
immediate: false,
|
||||||
|
clearSelection: false,
|
||||||
|
});
|
||||||
|
const {
|
||||||
|
list: dataList,
|
||||||
|
pagination: dataPagination,
|
||||||
|
searchForm: dataSearchForm,
|
||||||
|
fnResetPagination: fnDataResetPagination,
|
||||||
|
fnGetData: fnDataGetData,
|
||||||
|
tableRef: dataTableRef,
|
||||||
|
} = useListData(getDataCoursewareList, {
|
||||||
|
otherParams: {
|
||||||
|
STATE: "0",
|
||||||
|
},
|
||||||
|
immediate: false,
|
||||||
|
clearSelection: false,
|
||||||
|
});
|
||||||
|
const fnClose = () => {
|
||||||
|
videoTableRef.value.clearSelection();
|
||||||
|
dataTableRef.value.clearSelection();
|
||||||
|
visible.value = false;
|
||||||
|
};
|
||||||
|
const fnSubmit = () => {
|
||||||
|
emits("submit", {
|
||||||
|
videoList: videoTableRef.value.getSelectionRows(),
|
||||||
|
dataList: dataTableRef.value.getSelectionRows(),
|
||||||
|
});
|
||||||
|
fnClose();
|
||||||
|
};
|
||||||
|
const fnInit = async () => {
|
||||||
|
await nextTick();
|
||||||
|
props.xzVideoList.forEach((item) => {
|
||||||
|
videoTableRef.value.toggleRowSelection(item);
|
||||||
|
});
|
||||||
|
props.xzDataList.forEach((item) => {
|
||||||
|
dataTableRef.value.toggleRowSelection(item);
|
||||||
|
});
|
||||||
|
fnVideoResetPagination();
|
||||||
|
fnDataResetPagination();
|
||||||
|
};
|
||||||
|
watch(
|
||||||
|
() => props.visible,
|
||||||
|
(value) => {
|
||||||
|
if (value) {
|
||||||
|
fnInit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss"></style>
|
|
@ -40,7 +40,10 @@
|
||||||
:data="list"
|
:data="list"
|
||||||
@get-data="fnGetData"
|
@get-data="fnGetData"
|
||||||
v-model:pagination="pagination"
|
v-model:pagination="pagination"
|
||||||
|
ref="tableRef"
|
||||||
|
row-key="CURRICULUM_ID"
|
||||||
>
|
>
|
||||||
|
<el-table-column reserve-selection type="selection" width="55" />
|
||||||
<el-table-column label="序号" width="60">
|
<el-table-column label="序号" width="60">
|
||||||
<template #default="{ $index }">
|
<template #default="{ $index }">
|
||||||
{{ serialNumber(pagination, $index) }}
|
{{ serialNumber(pagination, $index) }}
|
||||||
|
@ -86,6 +89,12 @@
|
||||||
type="primary"
|
type="primary"
|
||||||
text
|
text
|
||||||
link
|
link
|
||||||
|
@click="
|
||||||
|
router.push({
|
||||||
|
path: '/online_learn_exam/curriculum/edit',
|
||||||
|
query: { CURRICULUM_ID: row.CURRICULUM_ID, type: 'edit' },
|
||||||
|
})
|
||||||
|
"
|
||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -101,10 +110,23 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<template #button>
|
<template #button>
|
||||||
<el-button v-if="buttonJurisdiction.add" type="primary">
|
<el-button
|
||||||
|
v-if="buttonJurisdiction.add"
|
||||||
|
type="primary"
|
||||||
|
@click="
|
||||||
|
router.push({
|
||||||
|
path: '/online_learn_exam/curriculum/add',
|
||||||
|
query: { type: 'add' },
|
||||||
|
})
|
||||||
|
"
|
||||||
|
>
|
||||||
新建课程
|
新建课程
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="buttonJurisdiction.add" type="primary">
|
<el-button
|
||||||
|
v-if="buttonJurisdiction.add"
|
||||||
|
type="primary"
|
||||||
|
@click="fnInherit"
|
||||||
|
>
|
||||||
继承
|
继承
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -127,19 +149,37 @@ import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
|
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
|
||||||
useListData(getCurriculumList);
|
useListData(getCurriculumList);
|
||||||
const buttonJurisdiction = await useButtonJurisdiction("curriculum");
|
const buttonJurisdiction = await useButtonJurisdiction("curriculum");
|
||||||
const fnDelete = debounce(
|
const fnDelete = debounce(
|
||||||
1000,
|
1000,
|
||||||
async (CURRICULUM_ID) => {
|
async (CURRICULUM_ID) => {
|
||||||
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
|
await ElMessageBox.confirm(
|
||||||
|
"删除课程的同时会删除相关的课程习题、课程考试试卷、阶段考试试卷等信息,确定要删除吗?",
|
||||||
|
{ type: "warning" }
|
||||||
|
);
|
||||||
await setCurriculumDelete({ CURRICULUM_ID });
|
await setCurriculumDelete({ CURRICULUM_ID });
|
||||||
ElMessage.success("删除成功");
|
ElMessage.success("删除成功");
|
||||||
fnResetPagination();
|
fnResetPagination();
|
||||||
},
|
},
|
||||||
{ atBegin: true }
|
{ atBegin: true }
|
||||||
);
|
);
|
||||||
|
const fnInherit = () => {
|
||||||
|
const selectionData = tableRef.value.getSelectionRows();
|
||||||
|
if (selectionData.length === 0) {
|
||||||
|
ElMessage.warning("请选中要继承的课程");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (selectionData.length > 1) {
|
||||||
|
ElMessage.warning("继承只能选择一个课程");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
router.push({
|
||||||
|
path: "/online_learn_exam/curriculum/inherit",
|
||||||
|
query: { type: "inherit", CURRICULUM_ID: selectionData[0].CURRICULUM_ID },
|
||||||
|
});
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss"></style>
|
||||||
|
|
Loading…
Reference in New Issue