提交代码

This commit is contained in:
jiangzhe 2024-06-19 14:55:38 +08:00
parent 6254ac4df7
commit 3bc06d57ae
10 changed files with 404 additions and 253 deletions

50
src/api/index.ts Normal file
View File

@ -0,0 +1,50 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
export const getGradeNum = (query?: any): AxiosPromise<any> => {
return request({
url: '/statistic/grade/num',
method: 'get',
params: query
});
};
export const getClassNum = (query?: any): AxiosPromise<any> => {
return request({
url: '/statistic/class/num',
method: 'get',
params: query
});
};
export const getTeacherNum = (query?: any): AxiosPromise<any> => {
return request({
url: '/statistic/teacher/num',
method: 'get',
params: query
});
};
export const getOssNum = (query?: any): AxiosPromise<any> => {
return request({
url: '/statistic/oss/num',
method: 'get',
params: query
});
};
export const getOssUseRank = (query?: any): AxiosPromise<any[]> => {
return request({
url: '/statistic/oss/use/rank',
method: 'get',
params: query
});
};
export const getOssType = (query?: any): AxiosPromise<any[]> => {
return request({
url: '/statistic/oss/type',
method: 'get',
params: query
});
};

View File

@ -29,10 +29,10 @@ export interface CatalogPersonVO {
*/
orderNum: number;
/**
*
*/
children: CatalogPersonVO[];
/**
*
*/
children: CatalogPersonVO[];
}
export interface CatalogPersonForm extends BaseEntity {
@ -95,10 +95,12 @@ export interface CatalogPersonQuery {
*/
orderNum?: number;
/**
*
*/
params?: any;
/**
*
*/
params?: any;
type?: number
}

View File

@ -74,6 +74,22 @@ export function pageTextbook(query: any): AxiosPromise<any[]> {
});
}
export function pageResource(query: any): AxiosPromise<any[]> {
return request({
url: '/file/resource/pageList',
method: 'get',
params: query
});
}
export function pagePerson(query: any): AxiosPromise<any[]> {
return request({
url: '/oss/person/pageList',
method: 'get',
params: query
});
}
export function awaitTexbookList(query: any): AxiosPromise<any[]> {
return request({
url: '/file/textbook/await/pageList',
@ -106,11 +122,11 @@ export const addResource = (data: any) => {
});
}
export function pageResource(query: any): AxiosPromise<any[]> {
export const addPerson = (data: any) => {
return request({
url: '/file/resource/pageList',
method: 'get',
params: query
url: '/oss/person',
method: 'post',
data: data
});
}
@ -146,6 +162,14 @@ export const copyResource = (data: any) => {
});
}
export const copyPerson = (data: any) => {
return request({
url: '/oss/person/copy',
method: 'put',
data: data
});
}
export const moveTextbook = (data: any) => {
return request({
url: '/file/textbook/move',
@ -162,6 +186,14 @@ export const moveResource = (data: any) => {
});
}
export const movePerson = (data: any) => {
return request({
url: '/oss/person/move',
method: 'put',
data: data
});
}
export function delTextbook(id: string | number | Array<string | number>) {
return request({
url: '/file/textbook/' + id,
@ -174,4 +206,11 @@ export function delResource(id: string | number | Array<string | number>) {
url: '/file/resource/' + id,
method: 'delete'
});
}
export function delPerson(id: string | number | Array<string | number>) {
return request({
url: '/oss/person/' + id,
method: 'delete'
});
}

View File

@ -9,6 +9,7 @@ export interface OssVO extends BaseEntity {
}
export interface OssQuery extends PageQuery {
type: number;
ossId: string | number;
fileName: string;
originalName: string;

View File

@ -9,7 +9,7 @@
</el-icon>
</el-col>
<el-col :span="12" class="right">
<el-statistic :value="userNum" :value-style="{ color: '#000', fontSize: '30px' }">
<el-statistic :value="gradeNum" :value-style="{ color: '#000', fontSize: '30px' }">
<template #title>
<div class="stats-title">
年级数
@ -28,7 +28,7 @@
</el-icon>
</el-col>
<el-col :span="12" class="right">
<el-statistic :value="evaluationNum" :value-style="{ color: '#000', fontSize: '30px' }">
<el-statistic :value="classNum" :value-style="{ color: '#000', fontSize: '30px' }">
<template #title>
<div class="stats-title">
班级数
@ -47,7 +47,7 @@
</el-icon>
</el-col>
<el-col :span="12" class="right">
<el-statistic :value="warnNum" :value-style="{ color: '#000', fontSize: '30px' }">
<el-statistic :value="teacherNum" :value-style="{ color: '#000', fontSize: '30px' }">
<template #title>
<div class="stats-title">
教职工总数
@ -66,7 +66,7 @@
</el-icon>
</el-col>
<el-col :span="12" class="right">
<el-statistic :value="interveneNum" :value-style="{ color: '#000', fontSize: '30px' }">
<el-statistic :value="studentNum" :value-style="{ color: '#000', fontSize: '30px' }">
<template #title>
<div class="stats-title">
学生总数
@ -85,7 +85,7 @@
</el-icon>
</el-col>
<el-col :span="12" class="right">
<el-statistic :value="interveneNum" :value-style="{ color: '#000', fontSize: '30px' }">
<el-statistic :value="ossNum" :value-style="{ color: '#000', fontSize: '30px' }">
<template #title>
<div class="stats-title">
资源总数
@ -105,34 +105,34 @@
</template>
<div class="quick-action">
<el-card>
<el-card @click="gotoTeacher">
<div class="item">
<img src="@/assets/icons/student.png" alt="">
<p>添加学生</p>
<p>添加老师</p>
</div>
</el-card>
<el-card>
<div class="item">
<img src="@/assets/icons/resource.png" alt="">
<p>资源目录</p>
</div>
</el-card>
<el-card>
<div class="item">
<img src="@/assets/icons/video.png" alt="">
<p>上传视频</p>
</div>
</el-card>
<el-card>
<div class="item">
<img src="@/assets/icons/image.png" alt="">
<p>上传图片</p>
</div>
</el-card>
<el-card>
<el-card @click="gotoDept">
<div class="item">
<img src="@/assets/icons/course.png" alt="">
<p>上传课件</p>
<p>部门管理</p>
</div>
</el-card>
<el-card @click="gotoMy">
<div class="item">
<img src="@/assets/icons/resource.png" alt="">
<p>我的空间</p>
</div>
</el-card>
<el-card @click="gotoCatalog">
<div class="item">
<img src="@/assets/icons/video.png" alt="">
<p>同步教材</p>
</div>
</el-card>
<el-card @click="gotoSubject">
<div class="item">
<img src="@/assets/icons/image.png" alt="">
<p>专题资源</p>
</div>
</el-card>
</div>
@ -148,26 +148,15 @@
</template>
<ul>
<li>
<span class="num num1">1</span><span>小学劳动课本一年级下册配材料包</span>
</li>
<li>
<span class="num">2</span><span>小学数学课本一年级上册</span>
</li>
<li>
<span class="num">3</span><span>资源名称资源名称资源名称资源名称</span>
</li>
<li>
<span class="num">4</span><span>资源名称资源名称资源名称资源名称</span>
</li>
<li>
<span class="num">5</span><span>资源名称资源名称资源名称资源名称</span>
</li>
<li>
<span class="num">6</span><span>资源名称资源名称资源名称资源名称</span>
</li>
<li>
<span class="num">7</span><span>资源名称资源名称资源名称资源名称</span>
<li v-for="(item, index) in rankList">
<div class="content">
<div class="left">
<span class="num">{{ index + 1 }}</span><span>{{ item.name }}</span>
</div>
<div class="right">
{{ item.value }}
</div>
</div>
</li>
</ul>
</el-card>
@ -194,6 +183,10 @@ import { PieChart } from "echarts/charts";
import { TitleComponent, TooltipComponent, LegendComponent, ToolboxComponent, GridComponent, VisualMapComponent } from "echarts/components";
import VChart from 'vue-echarts'
import { getGradeNum, getClassNum, getTeacherNum, getOssNum, getOssUseRank, getOssType } from '@/api/index'
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
use([
CanvasRenderer,
PieChart,
@ -209,6 +202,80 @@ const goTarget = (url: string) => {
window.open(url, '__blank');
};
const gotoTeacher = () => {
proxy?.$tab.openPage('/basic/teacher')
}
const gotoDept = () => {
proxy?.$tab.openPage('/basic/dept')
}
const gotoMy = () => {
proxy?.$tab.openPage('/catalogPerson')
}
const gotoCatalog = () => {
proxy?.$tab.openPage('/resourceMgt/catalogTextbookMgt')
}
const gotoSubject = () => {
proxy?.$tab.openPage('/resourceMgt/catalogResourceMgt')
}
const gradeNum = ref(0)
const getGradeNumData = async () => {
const res = await getGradeNum()
gradeNum.value = res.data
}
const classNum = ref(0)
const getClassNumData = async () => {
const res = await getClassNum()
classNum.value = res.data
}
const teacherNum = ref(0)
const getTeacherNumData = async () => {
const res = await getTeacherNum()
teacherNum.value = res.data
}
const studentNum = ref(0)
const ossNum = ref(0)
const getOssNumData = async () => {
const res = await getOssNum()
ossNum.value = res.data
}
const initNum = () => {
getGradeNumData()
getClassNumData()
getTeacherNumData()
getOssNumData()
}
const rankList = ref<any[]>([])
const getOssUseRankData = async () => {
const res = await getOssUseRank()
rankList.value = res.data
}
const getOssTypeData = async () => {
const res = await getOssType()
const data = []
res.data.forEach(item => {
data.push({ name: item.name, value: item.value })
})
pieOption.value.series[0].data = data
}
onMounted(() => {
initNum()
getOssUseRankData()
getOssTypeData()
})
const pieOption = ref({
title: {
text: '资源总数',
@ -248,9 +315,9 @@ const pieOption = ref({
center: ['50%', '50%'],
color: ['#ACEE62', '#8FAFFF', '#B2EFD5'],
data: [
{ name: '图片数', value: '214' },
{ name: '视频数', value: '519' },
{ name: '课件数', value: '198' }
// { name: '', value: '214' },
// { name: '', value: '519' },
// { name: '', value: '198' }
],
roseType: 'radius',
label: {
@ -293,26 +360,37 @@ const pieOption = ref({
padding: 9px 0;
margin-bottom: 7px;
.num {
display: inline-block;
border-radius: 50%;
background-color: #D7D7D7;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
color: #fff;
.content {
display: flex;
justify-content: space-between;
.num {
display: inline-block;
border-radius: 50%;
background-color: #D7D7D7;
width: 30px;
height: 30px;
line-height: 30px;
text-align: center;
color: #fff;
}
.right {
margin-right: 20px;
}
}
&:nth-child(1)>span:nth-child(1) {
&:nth-child(1) .left>span:nth-child(1) {
background-color: #F59A23;
}
&:nth-child(2)>span:nth-child(1) {
&:nth-child(2) .left>span:nth-child(1) {
background-color: #CFD6F5;
}
&:nth-child(3)>span:nth-child(1) {
&:nth-child(3) .left>span:nth-child(1) {
background-color: #E9C3A6;
}

View File

@ -26,7 +26,7 @@
<el-card shadow="hover">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-col v-if="isUpload" :span="1.5">
<el-button v-hasPermi="['system:oss:upload']" type="primary" plain icon="Upload"
@click="handleFile">上传课件</el-button>
</el-col>
@ -41,27 +41,19 @@
</template>
<el-table v-if="showTable" v-loading="loading" :data="ossList" :header-cell-class-name="handleHeaderClass"
@selection-change="handleSelectionChange" @header-click="handleHeaderCLick">
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="课件名" align="center" prop="originalName" width="240" />
<el-table-column label="课件名" align="center" prop="fileName" width="240" />
<el-table-column label="课件格式" align="center" prop="fileSuffix" />
<el-table-column label="课件大小" align="center" prop="fileSuffix" />
<el-table-column label="创建人" align="center" prop="createByName" />
<el-table-column label="创建时间" align="center" prop="createTime" sortable="custom">
<el-table-column label="课件大小" align="center" prop="volume" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="350">
<template #default="scope">
<el-tooltip v-if="isAudit" content="审核通过" placement="top">
<el-button link type="primary" icon="CopyDocument" @click="handleDownload(scope.row)">审核通过</el-button>
</el-tooltip>
<el-tooltip v-if="isAudit" content="审核不通过" placement="top">
<el-button link type="primary" icon="DocumentCopy" @click="handleDownload(scope.row)">审核不通过</el-button>
</el-tooltip>
<el-tooltip content="预览" placement="top">
<el-button link type="primary" icon="View" @click="handlePreview(scope.row)">预览</el-button>
</el-tooltip>
@ -90,9 +82,8 @@
<!-- 添加或修改OSS对象存储对话框 -->
<el-dialog v-model="dialog.visible" :title="dialog.title" width="700px" append-to-body>
<el-form ref="ossFormRef" :model="form" :rules="rules">
<el-form-item label="">
<!-- <fileUpload v-if="type === 0" v-model="form.file" /> -->
<FileMd5Upload v-if="type === 0" v-model="form.file" />
<el-form-item prop="file">
<FileMd5Upload v-if="type === 0" v-model="form.file" @onFileName="handleFileName" />
<imageUpload v-if="type === 1" v-model="form.file" />
</el-form-item>
</el-form>
@ -158,12 +149,12 @@
</template>
<script setup name="Oss" lang="ts">
import { listOss, preview, previewTxt, delOss } from '@/api/system/oss';
import { pagePerson, preview, previewTxt, delPerson, addPerson, copyPerson, movePerson } from '@/api/system/oss';
import { listCatalogPerson } from "@/api/resource/catalogPerson";
import { CatalogPersonVO } from '@/api/resource/catalogPerson/types';
import ImagePreview from '@/components/ImagePreview/index.vue';
import FileMd5Upload from '@/components/FileMd5Upload/index.vue';
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
import { listCatalogTextbook } from "@/api/resource/catalogTextbook";
import { CatalogTextbookVO } from '@/api/resource/catalogTextbook/types';
import { OssVO } from '@/api/system/oss/types';
//VueOfficeDocx
import VueOfficeDocx from '@vue-office/docx'
@ -176,7 +167,6 @@ import '@vue-office/excel/lib/index.css'
//VueOfficePdf
import VueOfficePdf from '@vue-office/pdf'
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const fileSuffix = ['.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf']
@ -217,13 +207,9 @@ const formatOptions = [
}
]
const catalogRadio = ref('course')
const defaultProps = {
children: 'children',
label: 'catalogName',
}
const treeData = ref<CatalogTextbookVO[]>([])
const isUpload = ref(false)
const currentNode = ref<any>({})
const treeData = ref<any[]>([])
const ossList = ref<OssVO[]>([]);
const showTable = ref(true);
@ -235,8 +221,6 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const type = ref(0);
const previewListResource = ref(true);
const dateRangeCreateTime = ref<[DateModelType, DateModelType]>(['', '']);
const dialog = reactive<DialogOption>({
visible: false,
@ -253,7 +237,7 @@ const treeMoveDialog = reactive<DialogOption>({
title: '移动'
});
const treeMoveFormRef = ref()
const treeMoveForm = ref<any>({ catalogId: '' });
const treeMoveForm = ref<any>({ id: '', catalogId: '' });
const treeMoveRules = ref({
catalogId: [{ required: true, message: '请选择', trigger: 'blur' }]
})
@ -263,24 +247,22 @@ const treeCopyDialog = reactive<DialogOption>({
title: '复制'
});
const treeCopyFormRef = ref()
const treeCopyForm = ref<any>({ catalogId: '' });
const treeCopyForm = ref<any>({ id: '', catalogId: '' });
const treeCopyRules = ref({
catalogId: [{ required: true, message: '请选择', trigger: 'blur' }]
})
//
const defaultSort = ref({ prop: 'createTime', order: 'ascending' });
const ossFormRef = ref<ElFormInstance>();
const queryFormRef = ref<ElFormInstance>();
const initFormData = {
file: undefined
};
const data = reactive<PageData<OssForm, OssQuery>>({
const data = reactive<PageData<any, any>>({
form: { ...initFormData },
//
queryParams: {
type: 1,
pageNum: 1,
pageSize: 10,
ossId: '',
@ -289,8 +271,7 @@ const data = reactive<PageData<OssForm, OssQuery>>({
fileSuffix: '',
createTime: '',
service: '',
orderByColumn: defaultSort.value.prop,
isAsc: defaultSort.value.order
catalogId: '',
},
rules: {
file: [{ required: true, message: '文件不能为空', trigger: 'blur' }]
@ -302,19 +283,13 @@ const { queryParams, form, rules } = toRefs(data);
/** 查询OSS对象存储列表 */
const getList = async () => {
loading.value = true;
const res = await proxy?.getConfigKey('sys.oss.previewListResource');
previewListResource.value = res?.data === undefined ? true : res.data === 'true';
const response = await listOss(proxy?.addDateRange(queryParams.value, dateRangeCreateTime.value, 'CreateTime'));
const response = await pagePerson(queryParams.value);
ossList.value = response.rows;
total.value = response.total;
loading.value = false;
showTable.value = true;
};
function checkFileSuffix(fileSuffix: string | string[]) {
const arr = [".png", ".jpg", ".jpeg"];
const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix];
return suffixArray.some(suffix => arr.includes(suffix.toLowerCase()));
}
/** 取消按钮 */
function cancel() {
dialog.visible = false;
@ -333,10 +308,7 @@ function handleQuery() {
/** 重置按钮操作 */
function resetQuery() {
showTable.value = false;
dateRangeCreateTime.value = ['', ''];
queryFormRef.value?.resetFields();
queryParams.value.orderByColumn = defaultSort.value.prop;
queryParams.value.isAsc = defaultSort.value.order;
handleQuery();
}
/** 选择条数 */
@ -349,51 +321,8 @@ function handleSelectionChange(selection: OssVO[]) {
const handleHeaderClass = ({ column }: any): any => {
column.order = column.multiOrder;
};
/** 点击表头进行排序 */
const handleHeaderCLick = (column: any) => {
if (column.sortable !== 'custom') {
return;
}
switch (column.multiOrder) {
case 'descending':
column.multiOrder = 'ascending';
break;
case 'ascending':
column.multiOrder = '';
break;
default:
column.multiOrder = 'descending';
break;
}
handleOrderChange(column.property, column.multiOrder);
};
const handleOrderChange = (prop: string, order: string) => {
let orderByArr = queryParams.value.orderByColumn ? queryParams.value.orderByColumn.split(',') : [];
let isAscArr = queryParams.value.isAsc ? queryParams.value.isAsc.split(',') : [];
let propIndex = orderByArr.indexOf(prop);
if (propIndex !== -1) {
if (order) {
//
isAscArr[propIndex] = order;
} else {
//ordernull
isAscArr.splice(propIndex, 1); //
orderByArr.splice(propIndex, 1); //
}
} else {
//
orderByArr.push(prop);
isAscArr.push(order);
}
//
queryParams.value.orderByColumn = orderByArr.join(',');
queryParams.value.isAsc = isAscArr.join(',');
getList();
};
/** 任务日志列表查询 */
const handleOssConfig = () => {
router.push('/system/oss-config/index');
};
/** 文件按钮操作 */
const handleFile = () => {
reset();
@ -401,15 +330,17 @@ const handleFile = () => {
dialog.visible = true;
dialog.title = '上传文件';
};
/** 图片按钮操作 */
const handleImage = () => {
reset();
type.value = 1;
dialog.visible = true;
dialog.title = '上传图片';
};
const fileName = ref('')
const handleFileName = (val) => {
fileName.value = val
}
/** 提交按钮 */
const submitForm = () => {
const submitForm = async () => {
const ossId = form.value.file
const catalogId = currentNode.value.catalogId
await addPerson({ ossId, catalogId, fileName: fileName.value })
dialog.visible = false;
getList();
};
@ -418,6 +349,11 @@ const submitMoveForm = () => {
treeMoveFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
treeMoveDialog.visible = false;
const res = await movePerson(treeMoveForm.value)
if (res.code === 200) {
proxy?.$modal.msgSuccess("移动成功")
await getList()
}
}
});
}
@ -430,6 +366,11 @@ const submitCopyForm = () => {
treeCopyFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
treeCopyDialog.visible = false
const res = await copyPerson(treeCopyForm.value)
if (res.code === 200) {
proxy?.$modal.msgSuccess("复制成功")
await getList()
}
}
});
}
@ -439,51 +380,30 @@ const cancelCopy = () => {
}
/** 下载按钮操作 */
const handleDownload = (row: OssVO) => {
proxy?.$download.oss(row.ossId);
const handleDownload = (row: any) => {
proxy?.download(`/oss/person/download/${row.id}`, {}, `${row.fileName}`);
};
const handleMove = (row: OssVO) => {
const handleMove = async (row: any) => {
treeMoveDialog.visible = true
treeMoveForm.value.id = row.id
treeMoveForm.value.catalogId = currentNode.value.catalogId
}
const handleCopy = (row: OssVO) => {
const handleCopy = (row: any) => {
treeCopyDialog.visible = true
treeCopyForm.value.id = row.id
treeCopyForm.value.catalogId = currentNode.value.catalogId
}
/** 用户状态修改 */
const handlePreviewListResource = async (preview: boolean) => {
let text = preview ? '启用' : '停用';
try {
await proxy?.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?');
await proxy?.updateConfigByKey('sys.oss.previewListResource', preview);
await getList();
proxy?.$modal.msgSuccess(text + '成功');
} catch {
return;
}
};
/** 删除按钮操作 */
const handleDelete = async (row?: OssVO) => {
const ossIds = row?.ossId || ids.value;
await proxy?.$modal.confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?');
const handleDelete = async (row?: any) => {
const delIds = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除OSS对象存储编号为"' + delIds + '"的数据项?');
loading.value = true;
await delOss(ossIds).finally(() => (loading.value = false));
await delPerson(delIds).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('删除成功');
};
const isAudit = ref(false)
const isTree = ref(false)
const handleAudit = () => {
isAudit.value = true
isTree.value = false
}
const handleNode = (node: any) => {
console.log(node)
isAudit.value = false
isTree.value = true
}
const options = ref({
@ -523,23 +443,76 @@ const handlePreview = async (row: OssVO) => {
fileLoading.value = false
}
const treeLoading = ref(false)
/** 查询目录-同步教材列表 */
const getListCatalogTextbook = async () => {
treeLoading.value = true;
const res = await listCatalogTextbook();
const data = proxy?.handleTree<CatalogTextbookVO>(res.data, "catalogId", "parentId");
const getlistCatalogPerson = async () => {
const res = await listCatalogPerson();
const data = proxy?.handleTree<CatalogPersonVO>(res.data, "catalogId", "parentId");
if (data) {
treeData.value = data;
treeLoading.value = false;
}
console.log(data);
}
onMounted(() => {
getListCatalogTextbook()
getList();
getlistCatalogPerson()
getList()
});
const handleNode = (node: any) => {
currentNode.value = node
queryParams.value.catalogId = node.catalogId
isUpload.value = true
getList()
getlistCatalogPerson()
}
const handleTypeChange = (type: any) => {
queryParams.value.type = type
getList()
}
defineExpose({ handleNode, getlistCatalogPerson, handleTypeChange })
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.tree-container {
margin-top: 10px;
padding-top: 10px;
height: calc(100vh - 120px);
display: flex;
flex-direction: column;
justify-content: space-between;
border: 1px solid #ccc;
.top {
margin: 0 20px;
}
.bottom {
text-align: center;
padding-left: 20px;
padding-right: 20px;
padding-bottom: 30px;
font-size: 18px;
}
.line {
border: 1px solid #ccc;
margin: 10px 0;
}
.btn-audit {
text-indent: 1em;
}
.active {
background-color: #F5F7FA;
}
}
:deep(.docx-wrapper) {
background-color: #fff;
padding: 0;
}
</style>

View File

@ -4,11 +4,11 @@
<el-col :span="6">
<div class="tree-container">
<div class="top">
<el-radio-group v-model="catalogRadio" size="middle">
<el-radio-button label="课件" value="course" />
<el-radio-button label="精品课堂" value="room" />
<el-radio-button label="作业" value="job" />
<el-radio-button label="试卷" value="exam" />
<el-radio-group v-model="queryParams.type" @change="handleChange">
<el-radio-button label="课件" :value="1" />
<el-radio-button label="精品课堂" :value="2" />
<el-radio-button label="作业" :value="3" />
<el-radio-button label="试卷" :value="4" />
</el-radio-group>
<div class="line"></div>
<el-card shadow="never">
@ -24,8 +24,9 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table ref="catalogPersonTableRef" v-loading="loading" :data="catalogPersonList" row-key="catalogId"
:default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table ref="catalogPersonTableRef" @row-click="handleRowClick" v-loading="loading"
:data="catalogPersonList" row-key="catalogId" :default-expand-all="isExpandAll"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column label="分类名称" align="center" prop="catalogName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
@ -54,7 +55,7 @@
</el-col>
<el-col :span="18">
<file-list></file-list>
<file-list ref="fileListRef"></file-list>
</el-col>
</el-row>
@ -96,7 +97,6 @@ type CatalogPersonOption = {
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const userStore = useUserStore();
const catalogRadio = ref('course')
const catalogPersonList = ref<CatalogPersonVO[]>([]);
const catalogPersonOptions = ref<CatalogPersonOption[]>([]);
const buttonLoading = ref(false);
@ -113,7 +113,6 @@ const dialog = reactive<DialogOption>({
title: ''
});
const initFormData: CatalogPersonForm = {
catalogId: undefined,
userId: userStore.userId,
@ -126,6 +125,7 @@ const initFormData: CatalogPersonForm = {
const data = reactive<PageData<CatalogPersonForm, CatalogPersonQuery>>({
form: { ...initFormData },
queryParams: {
type: 1,
userId: undefined,
parentId: undefined,
ancestors: undefined,
@ -254,6 +254,7 @@ const submitForm = () => {
proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false;
getList();
fileListRef.value.getlistCatalogPerson()
}
});
}
@ -270,6 +271,16 @@ const handleDelete = async (row: CatalogPersonVO) => {
onMounted(() => {
getList();
});
const fileListRef = ref()
const handleRowClick = (row: any) => {
fileListRef.value.handleNode(row)
}
const handleChange = () => {
fileListRef.value.handleTypeChange(queryParams.value.type)
}
</script>
<style lang="scss" scoped>

View File

@ -111,14 +111,14 @@
<el-form-item label="分类名称" prop="catalogName">
<el-input v-model="form.catalogName" placeholder="请输入分类名称" />
</el-form-item>
<el-form-item label="目录类型" prop="type">
<!-- <el-form-item label="目录类型" prop="type">
<el-select v-model="form.type" placeholder="请选择类型">
<el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="封面" prop="cover">
<image-upload v-model="form.cover" :limit="1" />
</el-form-item>
</el-form-item> -->
</el-form>
<template #footer>
<div class="dialog-footer">
@ -217,9 +217,9 @@ const data = reactive<PageData<CatalogTextbookForm, CatalogTextbookQuery>>({
catalogName: [
{ required: true, message: "教材名称不能为空", trigger: "blur" }
],
type: [
{ required: true, message: "类型不能为空", trigger: "change" }
],
// type: [
// { required: true, message: "", trigger: "change" }
// ],
}
});

View File

@ -199,7 +199,6 @@ import '@vue-office/excel/lib/index.css'
//VueOfficePdf
import VueOfficePdf from '@vue-office/pdf'
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const fileSuffix = ['.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf']
@ -476,8 +475,8 @@ const handleAuditBtn = async (row: any, status: number) => {
}
/** 下载按钮操作 */
const handleDownload = (row: OssVO) => {
proxy?.$download.oss(row.ossId);
const handleDownload = (row: any) => {
proxy?.download(`/file/resource/download/${row.id}`, {}, `${row.fileName}`);
};
const handleMove = async (row: any) => {
@ -569,7 +568,6 @@ const getlistCatalogResource = async () => {
treeData.value = data;
treeLoading.value = false;
}
console.log(data);
}
onMounted(() => {

View File

@ -3,11 +3,11 @@
<el-col :span="5">
<div class="tree-container">
<div class="top">
<el-radio-group v-model="catalogRadio" size="middle">
<el-radio-button label="课件" value="1" />
<el-radio-button label="精品课堂" value="2" />
<el-radio-button label="作业" value="3" />
<el-radio-button label="试卷" value="4" />
<el-radio-group v-model="queryParams.type" @change="handleTypeChange">
<el-radio-button label="课件" :value="1" />
<el-radio-button label="精品课堂" :value="2" />
<el-radio-button label="作业" :value="3" />
<el-radio-button label="试卷" :value="4" />
</el-radio-group>
<div class="line"></div>
<el-button type="" text="plain">全部课件</el-button>
@ -206,7 +206,6 @@ import '@vue-office/excel/lib/index.css'
//VueOfficePdf
import VueOfficePdf from '@vue-office/pdf'
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const fileSuffix = ['.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf']
@ -247,7 +246,6 @@ const formatOptions = [
}
]
const catalogRadio = ref('1')
const defaultProps = {
children: 'children',
label: 'catalogName',
@ -267,7 +265,6 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const type = ref(0);
const previewListResource = ref(true);
const dialog = reactive<DialogOption>({
visible: false,
@ -311,6 +308,7 @@ const data = reactive<PageData<OssForm, OssQuery>>({
queryParams: {
pageNum: 1,
pageSize: 10,
type: 1,
ossId: '',
fileName: '',
originalName: '',
@ -326,11 +324,13 @@ const data = reactive<PageData<OssForm, OssQuery>>({
const { queryParams, form, rules } = toRefs(data);
const handleTypeChange = () => {
getList()
}
/** 查询OSS对象存储列表 */
const getList = async () => {
loading.value = true;
const res = await proxy?.getConfigKey('sys.oss.previewListResource');
previewListResource.value = res?.data === undefined ? true : res.data === 'true';
let response
if (isAudit.value) {
response = await awaitTexbookList(queryParams.value);
@ -479,8 +479,8 @@ const handleAuditBtn = async (row: any, status: number) => {
}
/** 下载按钮操作 */
const handleDownload = (row: OssVO) => {
proxy?.$download.oss(row.ossId);
const handleDownload = (row: any) => {
proxy?.download(`/file/textbook/download/${row.id}`, {}, `${row.fileName}`);
};
const handleMove = async (row: any) => {
@ -572,7 +572,6 @@ const getListCatalogTextbook = async () => {
treeData.value = data;
treeLoading.value = false;
}
console.log(data);
}
onMounted(() => {