提交 c2b5eab4 authored 作者: lhh's avatar lhh

update

上级 c0bc635c
......@@ -123,3 +123,10 @@ export function viewTagCourse(params: { tag_id: string; course_id: string }) {
export function viewTagBook(params: { tag_id: string; course_id: string }) {
return httpRequest.get('/api/resource/v1/course/course/tag-book', { params })
}
// 导入
export function importTag(data: { course_id: string; file: any }) {
return httpRequest.post('/api/resource/v1/course/course/tag-import', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
\ No newline at end of file
<script setup lang="ts">
import { getTagList, addTag, updateTag, deleteTag } from '../api'
import { getTagList, addTag, updateTag, deleteTag, importTag } from '../api'
import ViewGraphCourse from '../components/ViewGraphCourse.vue'
import ViewGraphBook from '../components/ViewGraphBook.vue'
import { ElMessage } from 'element-plus'
......@@ -120,6 +120,21 @@ const handleBookView = function (scope: any) {
const formInline = reactive({
user: ''
})
// 导出
const handleTagDownload = () => {
// tagDownload({ course_id: route.query.cid as string }).then()
window.open(`/api/resource/v1/course/course/tag-download?course_id=${route.query.cid}`)
}
const fetchFileUpload = (option: any) => {
return new Promise(() => {
importTag({ course_id: route.query.cid as string, file: option.file }).then(() => {
updateTagList()
ElMessage.success('导入数据成功')
})
})
}
</script>
<template>
<AppCard title="知识图库">
......@@ -135,9 +150,15 @@ const formInline = reactive({
</el-form-item>
</el-form>
</div> -->
<el-button type="primary" @click="handleAddTagSame">添加知识点</el-button>
<el-button type="primary">批量导入</el-button>
<el-button type="primary">导出</el-button>
<div style="display: flex">
<el-button type="primary" @click="handleAddTagSame">添加知识点</el-button>
<el-upload :show-file-list="false" ref="upload" action="#" :limit="1" :http-request="fetchFileUpload">
<el-button type="primary" style="margin: 0 15px">批量导入</el-button>
<!-- <el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">将文件拖至此处,点击上传</div> -->
</el-upload>
<el-button type="primary" @click="handleTagDownload">导出</el-button>
</div>
<el-table
:data="tableData"
style="width: 100%; margin: 20px 0"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论