|
@@ -1,38 +1,68 @@
|
|
<template>
|
|
<template>
|
|
- <el-dialog
|
|
|
|
- class="select-dimension-dialog"
|
|
|
|
- :visible.sync="modalIsShow"
|
|
|
|
- title="选择知识点"
|
|
|
|
- top="10vh"
|
|
|
|
- width="600px"
|
|
|
|
- :close-on-click-modal="false"
|
|
|
|
- :close-on-press-escape="false"
|
|
|
|
- append-to-body
|
|
|
|
- @opened="visibleChange"
|
|
|
|
- >
|
|
|
|
- <el-tree
|
|
|
|
- ref="treeRef"
|
|
|
|
- :data="treeData"
|
|
|
|
- show-checkbox
|
|
|
|
- check-on-click-node
|
|
|
|
- check-strictly
|
|
|
|
- node-key="id"
|
|
|
|
- :props="defaultProps"
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <el-dialog
|
|
|
|
+ class="select-dimension-dialog page-dialog"
|
|
|
|
+ :visible.sync="modalIsShow"
|
|
|
|
+ title="选择知识点"
|
|
|
|
+ top="10px"
|
|
|
|
+ width="600px"
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
+ :close-on-press-escape="false"
|
|
|
|
+ append-to-body
|
|
|
|
+ @opened="visibleChange"
|
|
>
|
|
>
|
|
- </el-tree>
|
|
|
|
|
|
+ <div class="box-justify mb-2">
|
|
|
|
+ <div></div>
|
|
|
|
+ <el-button type="success" @click="toImport">导入课程知识点</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="part-box part-box-pad mb-0">
|
|
|
|
+ <el-tree
|
|
|
|
+ ref="treeRef"
|
|
|
|
+ :data="treeData"
|
|
|
|
+ show-checkbox
|
|
|
|
+ check-on-click-node
|
|
|
|
+ check-strictly
|
|
|
|
+ :expand-on-click-node="false"
|
|
|
|
+ node-key="id"
|
|
|
|
+ default-expand-all
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ >
|
|
|
|
+ </el-tree>
|
|
|
|
+ </div>
|
|
|
|
|
|
- <div slot="footer">
|
|
|
|
- <el-button type="primary" @click="submit">确认</el-button>
|
|
|
|
- <el-button @click="cancel">取消</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
+ <div slot="footer">
|
|
|
|
+ <el-button type="primary" @click="submit">确认</el-button>
|
|
|
|
+ <el-button @click="cancel">取消</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <!-- ImportFile -->
|
|
|
|
+ <import-file
|
|
|
|
+ ref="ImportFile"
|
|
|
|
+ title="导入课程知识点"
|
|
|
|
+ :upload-url="uploadUrl"
|
|
|
|
+ :upload-data="{
|
|
|
|
+ courseCode: course.courseCode,
|
|
|
|
+ examId: course.examId,
|
|
|
|
+ }"
|
|
|
|
+ :format="['xls', 'xlsx']"
|
|
|
|
+ :download-handle="() => downloadTemplate('courseProperty')"
|
|
|
|
+ :download-filename="dfilename"
|
|
|
|
+ :auto-upload="false"
|
|
|
|
+ @upload-success="dimensionUploaded"
|
|
|
|
+ ></import-file>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { courseDimensionTree } from "../../api";
|
|
import { courseDimensionTree } from "../../api";
|
|
|
|
+import ImportFile from "@/components/ImportFile.vue";
|
|
|
|
+import templateDownload from "@/mixins/templateDownload";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "select-dimension-dialog",
|
|
name: "select-dimension-dialog",
|
|
|
|
+ components: { ImportFile },
|
|
|
|
+ mixins: [templateDownload],
|
|
props: {
|
|
props: {
|
|
selectedData: {
|
|
selectedData: {
|
|
type: Array,
|
|
type: Array,
|
|
@@ -64,6 +94,9 @@ export default {
|
|
children: "children",
|
|
children: "children",
|
|
label: "name",
|
|
label: "name",
|
|
},
|
|
},
|
|
|
|
+ // import
|
|
|
|
+ uploadUrl: "/api/admin/teach/course_target/dimension_import",
|
|
|
|
+ dfilename: "课程知识点导入模板.xlsx",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -71,12 +104,40 @@ export default {
|
|
immediate: true,
|
|
immediate: true,
|
|
handler(val, oldVal) {
|
|
handler(val, oldVal) {
|
|
if (!val) return;
|
|
if (!val) return;
|
|
- if (val !== oldVal) this.getTree();
|
|
|
|
|
|
+ if (
|
|
|
|
+ val.examId &&
|
|
|
|
+ val.courseCode &&
|
|
|
|
+ (!oldVal ||
|
|
|
|
+ oldVal.examId !== val.examId ||
|
|
|
|
+ oldVal.courseCode !== val.courseCode)
|
|
|
|
+ ) {
|
|
|
|
+ this.getTree();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ async dimensionUploaded() {
|
|
|
|
+ const data = await courseDimensionTree({
|
|
|
|
+ examId: this.course.examId,
|
|
|
|
+ courseCode: this.course.courseCode,
|
|
|
|
+ });
|
|
|
|
+ this.treeData = data || [];
|
|
|
|
+
|
|
|
|
+ // 已存在课程目标的情况,强制关闭弹窗
|
|
|
|
+ if (this.disabledData.length) {
|
|
|
|
+ this.modalIsShow = false;
|
|
|
|
+ this.$emit("enforce-close");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.treeRef.setCheckedKeys([]);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
async getTree() {
|
|
async getTree() {
|
|
|
|
+ if (!this.course.examId || !this.course.courseCode) return;
|
|
|
|
+
|
|
const data = await courseDimensionTree({
|
|
const data = await courseDimensionTree({
|
|
examId: this.course.examId,
|
|
examId: this.course.examId,
|
|
courseCode: this.course.courseCode,
|
|
courseCode: this.course.courseCode,
|
|
@@ -93,6 +154,9 @@ export default {
|
|
};
|
|
};
|
|
mdTree(this.treeData);
|
|
mdTree(this.treeData);
|
|
},
|
|
},
|
|
|
|
+ toImport() {
|
|
|
|
+ this.$refs.ImportFile.open();
|
|
|
|
+ },
|
|
visibleChange() {
|
|
visibleChange() {
|
|
this.updateDisableNode();
|
|
this.updateDisableNode();
|
|
this.$refs.treeRef.setCheckedKeys(this.selectedData);
|
|
this.$refs.treeRef.setCheckedKeys(this.selectedData);
|
|
@@ -104,7 +168,8 @@ export default {
|
|
this.modalIsShow = true;
|
|
this.modalIsShow = true;
|
|
},
|
|
},
|
|
submit() {
|
|
submit() {
|
|
- const selectedNodes = this.$refs.treeRef.setCheckedNodes();
|
|
|
|
|
|
+ const selectedNodes = this.$refs.treeRef.getCheckedNodes();
|
|
|
|
+ console.log(selectedNodes);
|
|
|
|
|
|
if (!selectedNodes.length) {
|
|
if (!selectedNodes.length) {
|
|
this.$message.error("请选择知识点");
|
|
this.$message.error("请选择知识点");
|