diff --git a/src/assets/css/element.scss b/src/assets/css/element.scss index 6321c2b..fe9346d 100644 --- a/src/assets/css/element.scss +++ b/src/assets/css/element.scss @@ -188,7 +188,7 @@ --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-border-color: var(--el-color-check); } diff --git a/src/assets/js/asyncRouter.js b/src/assets/js/asyncRouter.js index 8cf23af..3657628 100644 --- a/src/assets/js/asyncRouter.js +++ b/src/assets/js/asyncRouter.js @@ -956,6 +956,22 @@ export default [ }, 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", + }, ], }, ], diff --git a/src/assets/js/useListData.js b/src/assets/js/useListData.js index 4e71d13..eb5343c 100644 --- a/src/assets/js/useListData.js +++ b/src/assets/js/useListData.js @@ -9,6 +9,7 @@ import { getDataType } from "@/assets/js/utils.js"; * @param options.defaultSearchForm {Object?} searchForm默认值 * @param options.immediate {Boolean?} 是否立即执行接口函数(默认是) * @param options.usePagination {Boolean?} 是否使用分页(默认是) + * @param options.clearSelection {Boolean?} 调用fnResetPagination是是否清空表格选择数据(默认是) * @param options.key {String?} 返回的存放数组的key(默认varList) * @return {Object} 返回对象包含以下属性:list 表格数据,pagination 分页数据,searchForm 搜索表单数据,tableRef 表格实例,fnGetData 获取数据函数,fnResetPagination 重置分页函数 */ @@ -23,17 +24,27 @@ export default function useListData(api, options = {}) { throw new Error("options.usePagination必须是一个布尔值"); if (options.key && getDataType(options.key) !== "String") 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必须是一个函数"); if ( options.defaultSearchForm && getDataType(options.defaultSearchForm) !== "Object" ) throw new Error("options.defaultSearchForm必须是一个对象"); + if ( + options.clearSelection && + getDataType(options.clearSelection) !== "Boolean" + ) + throw new Error("options.clearSelection必须是一个布尔值"); const immediate = options.immediate ?? true; const usePagination = options.usePagination ?? true; const key = options.key ?? "varList"; const defaultSearchForm = options.defaultSearchForm ?? {}; + const clearSelection = options.clearSelection ?? true; if ( immediate && options.otherParams && @@ -74,7 +85,7 @@ export default function useListData(api, options = {}) { }; await nextTick(); await fnGetData(otherParams); - tableRef.value && tableRef.value.clearSelection(); + clearSelection && tableRef.value && tableRef.value.clearSelection(); }; return { list, diff --git a/src/components/table/index.vue b/src/components/table/index.vue index b55247c..8b6cbcc 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -143,17 +143,8 @@ const getSelectionRows = () => { const clearSelection = () => { return tableRef.value.clearSelection(); }; -const toggleRowSelection = (value, selected) => { - if (typeof value === "object") { - 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; - } - } +const toggleRowSelection = (value, selected = true) => { + tableRef.value.toggleRowSelection(value, selected); }; defineExpose({ getSelectionRows, diff --git a/src/request/online_learn_exam.js b/src/request/online_learn_exam.js index d386e79..2d617c2 100644 --- a/src/request/online_learn_exam.js +++ b/src/request/online_learn_exam.js @@ -36,3 +36,7 @@ export const getCurriculumList = (params) => post("/curriculum/list", params); / export const getCurriculumView = (params) => post("/curriculum/goEdit", params); // 课程管理查看 export const setCurriculumDelete = (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); // 课程管理继承 diff --git a/src/views/hazard_investigation/inventory_management/add.vue b/src/views/hazard_investigation/inventory_management/add.vue index 95bcd9e..ee85a3c 100644 --- a/src/views/hazard_investigation/inventory_management/add.vue +++ b/src/views/hazard_investigation/inventory_management/add.vue @@ -397,7 +397,7 @@ const fnTableSelection = async () => { const selectionData = tableRef.value.getSelectionRows(); await nextTick(); selectionData.forEach((item) => { - tableRef.value.toggleRowSelection(item, true); + tableRef.value.toggleRowSelection(item); }); }; const fnAddRiskSubmit = (item) => { diff --git a/src/views/online_learn_exam/curriculum/add.vue b/src/views/online_learn_exam/curriculum/add.vue new file mode 100644 index 0000000..fc6fffb --- /dev/null +++ b/src/views/online_learn_exam/curriculum/add.vue @@ -0,0 +1,375 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 添加章节 + + + + + + + + 删除 + + + 批量添加课件 + + + + + + + + + + + + + 删除 + + + + + + + + + + + + + 删除 + + + + + + + + + + + + + + + + + 提交 + + + + + + + + diff --git a/src/views/online_learn_exam/curriculum/components/batch_add_courseware.vue b/src/views/online_learn_exam/curriculum/components/batch_add_courseware.vue new file mode 100644 index 0000000..d7f8d9c --- /dev/null +++ b/src/views/online_learn_exam/curriculum/components/batch_add_courseware.vue @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + 搜索 + + + 重置 + + + + + + + + + + {{ serialNumber(videoPagination, $index) }} + + + + + + + + + + + + + + + + + + + + + 搜索 + + + 重置 + + + + + + + + + + {{ serialNumber(dataPagination, $index) }} + + + + + + + + + + + + 关闭 + 确定 + + + + + + + diff --git a/src/views/online_learn_exam/curriculum/index.vue b/src/views/online_learn_exam/curriculum/index.vue index e13e52b..aed555a 100644 --- a/src/views/online_learn_exam/curriculum/index.vue +++ b/src/views/online_learn_exam/curriculum/index.vue @@ -40,7 +40,10 @@ :data="list" @get-data="fnGetData" v-model:pagination="pagination" + ref="tableRef" + row-key="CURRICULUM_ID" > + {{ serialNumber(pagination, $index) }} @@ -86,6 +89,12 @@ type="primary" text link + @click=" + router.push({ + path: '/online_learn_exam/curriculum/edit', + query: { CURRICULUM_ID: row.CURRICULUM_ID, type: 'edit' }, + }) + " > 编辑 @@ -101,10 +110,23 @@ - + 新建课程 - + 继承 @@ -127,19 +149,37 @@ import { ElMessage, ElMessageBox } from "element-plus"; import { useRouter } from "vue-router"; const router = useRouter(); -const { list, pagination, searchForm, fnGetData, fnResetPagination } = +const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } = useListData(getCurriculumList); const buttonJurisdiction = await useButtonJurisdiction("curriculum"); const fnDelete = debounce( 1000, async (CURRICULUM_ID) => { - await ElMessageBox.confirm("确定要删除吗?", { type: "warning" }); + await ElMessageBox.confirm( + "删除课程的同时会删除相关的课程习题、课程考试试卷、阶段考试试卷等信息,确定要删除吗?", + { type: "warning" } + ); await setCurriculumDelete({ CURRICULUM_ID }); ElMessage.success("删除成功"); fnResetPagination(); }, { 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 }, + }); +};