提交代码
This commit is contained in:
parent
26de5f5ab1
commit
655de1de86
|
@ -29,10 +29,10 @@ export interface CatalogTextbookVO {
|
|||
*/
|
||||
type: number;
|
||||
|
||||
/**
|
||||
* 子对象
|
||||
*/
|
||||
children: CatalogTextbookVO[];
|
||||
/**
|
||||
* 子对象
|
||||
*/
|
||||
children: CatalogTextbookVO[];
|
||||
}
|
||||
|
||||
export interface CatalogTextbookForm extends BaseEntity {
|
||||
|
@ -95,10 +95,10 @@ export interface CatalogTextbookQuery {
|
|||
*/
|
||||
type?: number;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,10 +66,65 @@ export function delOss(ossId: string | number | Array<string | number>) {
|
|||
});
|
||||
}
|
||||
|
||||
export function pageTextbook(query: any): AxiosPromise<any[]> {
|
||||
return request({
|
||||
url: '/file/textbook/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export function awaitTexbookList(query: any): AxiosPromise<any[]> {
|
||||
return request({
|
||||
url: '/file/textbook/awaitList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export const addTextbook = (data: any) => {
|
||||
return request({
|
||||
url: '/file/textbook',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function pageResource(query: any): AxiosPromise<any[]> {
|
||||
return request({
|
||||
url: '/file/resource/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export const review = (data: any) => {
|
||||
return request({
|
||||
url: '/file/textbook/review',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export const copy = (data: any) => {
|
||||
return request({
|
||||
url: '/file/textbook/copy',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export const move = (data: any) => {
|
||||
return request({
|
||||
url: '/file/textbook/move',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function delTextbook(ossId: string | number | Array<string | number>) {
|
||||
return request({
|
||||
url: '/file/textbook/' + ossId,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
|
@ -15,8 +15,9 @@ export interface OssQuery extends PageQuery {
|
|||
fileSuffix: string;
|
||||
createTime: string;
|
||||
service: string;
|
||||
orderByColumn: string;
|
||||
isAsc: string;
|
||||
orderByColumn?: string;
|
||||
isAsc?: string;
|
||||
catalogId?: string;
|
||||
}
|
||||
export interface OssForm {
|
||||
file: undefined | string;
|
||||
|
|
|
@ -1,28 +1,38 @@
|
|||
<template>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-tabs v-model="activeName" type="border-card" style="padding-left: 20px;margin-top: 10px;"
|
||||
tab-click="handleTabClick">
|
||||
<el-tab-pane label="课件" name="first">课件</el-tab-pane>
|
||||
<el-tab-pane label="精品课堂" name="second">精品课堂</el-tab-pane>
|
||||
<el-tab-pane label="作业" name="third">作业</el-tab-pane>
|
||||
<el-tab-pane label="试卷" name="fourth">试卷</el-tab-pane>
|
||||
</el-tabs>
|
||||
<el-col :span="5">
|
||||
<div class="tree-container">
|
||||
<div class="top">
|
||||
<el-button type="" text="plain">全部专题资源</el-button>
|
||||
<br>
|
||||
<el-button :class="['btn-audit', isAudit && 'active']" type="" text="plain"
|
||||
@click="handleAudit">待审核</el-button>
|
||||
<el-tree ref="treeRef" v-loading="treeLoading" :data="treeData" :props="defaultProps" default-expand-all
|
||||
@node-click="handleNode" />
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<span>资源空间:639.7MB / 1TB</span>
|
||||
<el-progress :percentage="55" />
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="18">
|
||||
<el-col :span="19">
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
||||
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="文件名" prop="fileName">
|
||||
<el-input v-model="queryParams.fileName" placeholder="请输入文件名" clearable @keyup.enter="handleQuery" />
|
||||
<el-form-item label="课件名称" prop="fileName">
|
||||
<el-input v-model="queryParams.fileName" placeholder="请输入课件名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="格式" prop="fileSuffix">
|
||||
<el-input v-model="queryParams.fileSuffix" placeholder="请输入文件后缀" clearable
|
||||
@keyup.enter="handleQuery" />
|
||||
<el-select v-model="queryParams.fileSuffix" placeholder="请选择" style="width: 240px"
|
||||
@keyup.enter="handleQuery">
|
||||
<el-option v-for="item in formatOptions" :key="item.value" :label="item.label"
|
||||
:value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
|
||||
|
@ -36,9 +46,9 @@
|
|||
<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>
|
||||
@click="handleFile">上传课件</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['system:oss:remove']" type="danger" plain icon="Delete" :disabled="multiple"
|
||||
|
@ -53,34 +63,40 @@
|
|||
<el-table v-if="showTable" v-loading="loading" :data="ossList" :header-cell-class-name="handleHeaderClass"
|
||||
@selection-change="handleSelectionChange" @header-click="handleHeaderCLick">
|
||||
<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="fileSuffix" />
|
||||
<el-table-column label="文件大小" align="center" prop="fileSuffix" />
|
||||
<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="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="340">
|
||||
<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 v-hasPermi="['system:oss:download']" link type="primary" icon="View"
|
||||
@click="handlePreview(scope.row)">预览</el-button>
|
||||
<el-button link type="primary" icon="View" @click="handlePreview(scope.row)">预览</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="下载" placement="top">
|
||||
<el-button v-hasPermi="['system:oss:download']" link type="primary" icon="Download"
|
||||
@click="handleDownload(scope.row)">下载</el-button>
|
||||
<el-tooltip v-hasPermi="['system:oss:download']" content="下载" placement="top">
|
||||
<el-button link type="primary" icon="Download" @click="handleDownload(scope.row)">下载</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="移动" placement="top">
|
||||
<el-button v-hasPermi="['system:oss:download']" link type="primary" icon="CopyDocument"
|
||||
@click="handleDownload(scope.row)">移动</el-button>
|
||||
|
||||
<el-tooltip v-if="isTree" content="移动" placement="top">
|
||||
<el-button link type="primary" icon="CopyDocument" @click="handleMove(scope.row)">移动</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="复制" placement="top">
|
||||
<el-button v-hasPermi="['system:oss:download']" link type="primary" icon="DocumentCopy"
|
||||
@click="handleDownload(scope.row)">复制</el-button>
|
||||
<el-tooltip v-if="isTree" content="复制" placement="top">
|
||||
<el-button link type="primary" icon="DocumentCopy" @click="handleCopy(scope.row)">复制</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-tooltip v-if="isTree" content="删除" placement="top">
|
||||
<el-button v-hasPermi="['system:oss:remove']" link type="primary" icon="Delete"
|
||||
@click="handleDelete(scope.row)">删除</el-button>
|
||||
</el-tooltip>
|
||||
|
@ -91,11 +107,12 @@
|
|||
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
:total="total" @pagination="getList" />
|
||||
</el-card>
|
||||
|
||||
<!-- 添加或修改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" />
|
||||
<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>
|
||||
|
@ -108,7 +125,54 @@
|
|||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="previewDialog.visible" :title="previewDialog.title" width="900px" append-to-body>
|
||||
<vue-office-docx :src="docx" />
|
||||
<vue-office-docx v-loading="fileLoading" element-loading-text="加载中..."
|
||||
v-if="currentFile.fileSuffix == '.doc' || currentFile.fileSuffix == '.docx'" :src="file" />
|
||||
|
||||
<vue-office-excel v-loading="fileLoading" element-loading-text="加载中..." :options="options"
|
||||
style="height: 100vh;width: 100vh;"
|
||||
v-if="currentFile.fileSuffix == '.xls' || currentFile.fileSuffix == '.xlsx'" :src="file" />
|
||||
|
||||
<vue-office-pdf v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.pdf'"
|
||||
:src="file" />
|
||||
|
||||
<div v-loading="fileLoading" element-loading-text="加载中..." v-if="currentFile.fileSuffix == '.txt'"
|
||||
style="white-space: pre-wrap;">{{ txt }}
|
||||
</div>
|
||||
|
||||
<ImagePreview v-loading="fileLoading" element-loading-text="加载中..." style="width: 100%; text-align: center;"
|
||||
v-if="imgSuffix.includes(currentFile.fileSuffix)" :src="imgUrl" />
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="treeMoveDialog.visible" :title="treeMoveDialog.title" width="500px" append-to-body>
|
||||
<el-form ref="treeMoveFormRef" :model="treeMoveForm" :rules="treeMoveRules">
|
||||
<el-form-item label="移动至" prop="catalogId">
|
||||
<el-tree-select v-model="treeMoveForm.catalogId" :data="treeData"
|
||||
:props="{ value: 'catalogId', label: 'catalogName', children: 'children' }" value-key="catalogId"
|
||||
placeholder="请选择" check-strictly />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitMoveForm">确 定</el-button>
|
||||
<el-button @click="cancelMove">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="treeCopyDialog.visible" :title="treeCopyDialog.title" width="500px" append-to-body>
|
||||
<el-form ref="treeCopyFormRef" :model="treeCopyForm" :rules="treeCopyRules">
|
||||
<el-form-item label="复制至" prop="catalogId">
|
||||
<el-tree-select v-model="treeCopyForm.catalogId" :data="treeData"
|
||||
:props="{ value: 'catalogId', label: 'catalogName', children: 'children' }" value-key="catalogId"
|
||||
placeholder="请选择" check-strictly />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitCopyForm">确 定</el-button>
|
||||
<el-button @click="cancelCopy">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -116,17 +180,74 @@
|
|||
</template>
|
||||
|
||||
<script setup name="Oss" lang="ts">
|
||||
import { listOss, delOss } from '@/api/system/oss';
|
||||
import { pageResource, preview, previewTxt, delOss, addTextbook } from '@/api/system/oss';
|
||||
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 { CatalogResourceVO } from '@/api/resource/catalogResource/types';
|
||||
|
||||
//引入VueOfficeDocx组件
|
||||
import VueOfficeDocx from '@vue-office/docx'
|
||||
//引入相关样式
|
||||
import '@vue-office/docx/lib/index.css'
|
||||
//引入VueOfficeExcel组件
|
||||
import VueOfficeExcel from '@vue-office/excel'
|
||||
//引入相关样式
|
||||
import '@vue-office/excel/lib/index.css'
|
||||
//引入VueOfficePdf组件
|
||||
import VueOfficePdf from '@vue-office/pdf'
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const activeName = ref('first')
|
||||
const fileSuffix = ['.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf']
|
||||
const imgSuffix = ['.jpg', '.png', '.jpeg', '.gif', '.bmp']
|
||||
|
||||
const formatOptions = [
|
||||
{
|
||||
value: '.doc',
|
||||
label: 'doc',
|
||||
},
|
||||
{
|
||||
value: '.docx',
|
||||
label: 'docx',
|
||||
},
|
||||
{
|
||||
value: '.xls',
|
||||
label: 'xls',
|
||||
},
|
||||
{
|
||||
value: '.xlsx',
|
||||
label: 'xlsx',
|
||||
},
|
||||
{
|
||||
value: '.ppt',
|
||||
label: 'ppt',
|
||||
},
|
||||
{
|
||||
value: '.pptx',
|
||||
label: 'pptx',
|
||||
},
|
||||
{
|
||||
value: '.pdf',
|
||||
label: 'pdf',
|
||||
},
|
||||
{
|
||||
value: '.txt',
|
||||
label: 'txt',
|
||||
}
|
||||
]
|
||||
|
||||
const catalogRadio = ref('1')
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'catalogName',
|
||||
}
|
||||
|
||||
const isUpload = ref(false)
|
||||
const currentNode = ref<any>({})
|
||||
const treeData = ref<CatalogResourceVO[]>([])
|
||||
|
||||
const ossList = ref<OssVO[]>([]);
|
||||
const showTable = ref(true);
|
||||
|
@ -139,21 +260,36 @@ 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,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const docx = ref('http://101.37.69.204:9001/mentalhealth/2024/04/22/24b50eee715048018eec53cad99b9e25.docx')
|
||||
const previewDialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: '文件预览'
|
||||
});
|
||||
|
||||
// 默认排序
|
||||
const defaultSort = ref({ prop: 'createTime', order: 'ascending' });
|
||||
const treeMoveDialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: '移动'
|
||||
});
|
||||
const treeMoveFormRef = ref()
|
||||
const treeMoveForm = ref<any>({ catalogId: '' });
|
||||
const treeMoveRules = ref({
|
||||
catalogId: [{ required: true, message: '请选择', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const treeCopyDialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: '复制'
|
||||
});
|
||||
const treeCopyFormRef = ref()
|
||||
const treeCopyForm = ref<any>({ catalogId: '' });
|
||||
const treeCopyRules = ref({
|
||||
catalogId: [{ required: true, message: '请选择', trigger: 'blur' }]
|
||||
})
|
||||
|
||||
const ossFormRef = ref<ElFormInstance>();
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
|
@ -167,13 +303,12 @@ const data = reactive<PageData<OssForm, OssQuery>>({
|
|||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
ossId: '',
|
||||
fileName: '',
|
||||
originalName: '',
|
||||
fileSuffix: '',
|
||||
createTime: '',
|
||||
service: '',
|
||||
orderByColumn: defaultSort.value.prop,
|
||||
isAsc: defaultSort.value.order
|
||||
},
|
||||
rules: {
|
||||
file: [{ required: true, message: '文件不能为空', trigger: 'blur' }]
|
||||
|
@ -187,12 +322,13 @@ 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 pageResource(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];
|
||||
|
@ -216,10 +352,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();
|
||||
}
|
||||
/** 选择条数 */
|
||||
|
@ -291,15 +424,58 @@ const handleImage = () => {
|
|||
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 addTextbook({ ossId, catalogId, fileName: fileName.value, type: catalogRadio.value })
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
};
|
||||
|
||||
const submitMoveForm = () => {
|
||||
treeMoveFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
treeMoveDialog.visible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const cancelMove = () => {
|
||||
treeMoveDialog.visible = false
|
||||
}
|
||||
|
||||
const submitCopyForm = () => {
|
||||
treeCopyFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
treeCopyDialog.visible = false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const cancelCopy = () => {
|
||||
treeCopyDialog.visible = false
|
||||
}
|
||||
|
||||
/** 下载按钮操作 */
|
||||
const handleDownload = (row: OssVO) => {
|
||||
proxy?.$download.oss(row.ossId);
|
||||
};
|
||||
|
||||
const handleMove = (row: OssVO) => {
|
||||
treeMoveDialog.visible = true
|
||||
}
|
||||
|
||||
const handleCopy = (row: OssVO) => {
|
||||
treeCopyDialog.visible = true
|
||||
}
|
||||
|
||||
/** 用户状态修改 */
|
||||
const handlePreviewListResource = async (preview: boolean) => {
|
||||
let text = preview ? '启用' : '停用';
|
||||
|
@ -322,23 +498,113 @@ const handleDelete = async (row?: OssVO) => {
|
|||
proxy?.$modal.msgSuccess('删除成功');
|
||||
};
|
||||
|
||||
const handleTabClick = () => {
|
||||
|
||||
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
|
||||
isUpload.value = true
|
||||
currentNode.value = node
|
||||
}
|
||||
|
||||
const options = ref({
|
||||
xls: false, //预览xlsx文件设为false;预览xls文件设为true
|
||||
minColLength: 0, // excel最少渲染多少列,如果想实现xlsx文件内容有几列,就渲染几列,可以将此值设置为0.
|
||||
minRowLength: 0, // excel最少渲染多少行,如果想实现根据xlsx实际函数渲染,可以将此值设置为0.
|
||||
widthOffset: 10, //如果渲染出来的结果感觉单元格宽度不够,可以在默认渲染的列表宽度上再加 Npx宽
|
||||
heightOffset: 10, //在默认渲染的列表高度上再加 Npx高
|
||||
beforeTransformData: (workbookData) => { return workbookData }, //底层通过exceljs获取excel文件内容,通过该钩子函数,可以对获取的excel文件内容进行修改,比如某个单元格的数据显示不正确,可以在此自行修改每个单元格的value值。
|
||||
transformData: (workbookData) => { return workbookData }, //将获取到的excel数据进行处理之后且渲染到页面之前,可通过transformData对即将渲染的数据及样式进行修改,此时每个单元格的text值就是即将渲染到页面上的内容
|
||||
})
|
||||
|
||||
const currentFile = ref()
|
||||
const handlePreview = (row: OssVO) => {
|
||||
console.log(row)
|
||||
const file = ref('')
|
||||
const fileLoading = ref(false)
|
||||
const txt = ref('')
|
||||
const imgUrl = ref('')
|
||||
const handlePreview = async (row: OssVO) => {
|
||||
file.value = ''
|
||||
fileLoading.value = true
|
||||
previewDialog.visible = true
|
||||
currentFile.value = row.curl
|
||||
currentFile.value = row
|
||||
|
||||
if (row.fileSuffix == '.txt') {
|
||||
const fileRes = await previewTxt(row.ossId)
|
||||
console.log(fileRes)
|
||||
txt.value = fileRes
|
||||
} else if (imgSuffix.includes(row.fileSuffix)) {
|
||||
const fileRes = await preview(row.ossId)
|
||||
let blob = new Blob([fileRes], { type: `image/${row.fileSuffix.substring(1)}` })
|
||||
imgUrl.value = URL.createObjectURL(blob)
|
||||
} else if (fileSuffix.includes(row.fileSuffix)) {
|
||||
const fileRes = await preview(row.ossId)
|
||||
fileRes.arrayBuffer().then(res => file.value = res)
|
||||
}
|
||||
|
||||
fileLoading.value = false
|
||||
}
|
||||
|
||||
const treeLoading = ref(false)
|
||||
/** 查询目录-同步教材列表 */
|
||||
const getListCatalogTextbook = async () => {
|
||||
treeLoading.value = true;
|
||||
const res = await listCatalogTextbook();
|
||||
const data = proxy?.handleTree<CatalogResourceVO>(res.data, "catalogId", "parentId");
|
||||
if (data) {
|
||||
treeData.value = data;
|
||||
treeLoading.value = false;
|
||||
}
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getListCatalogTextbook()
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<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;
|
||||
|
|
|
@ -68,13 +68,13 @@
|
|||
</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>
|
||||
|
@ -83,11 +83,12 @@
|
|||
<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-button link type="primary" icon="CopyDocument"
|
||||
@click="handleAuditBtn(scope.row, 1)">审核通过</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>
|
||||
@click="handleAuditBtn(scope.row, 0)">审核不通过</el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip content="预览" placement="top">
|
||||
|
@ -187,7 +188,7 @@
|
|||
</template>
|
||||
|
||||
<script setup name="Oss" lang="ts">
|
||||
import { listOss, preview, previewTxt, delOss, addTextbook } from '@/api/system/oss';
|
||||
import { pageTextbook, awaitTexbookList, preview, previewTxt, delTextbook, addTextbook, review, copy, move } from '@/api/system/oss';
|
||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||
import FileMd5Upload from '@/components/FileMd5Upload/index.vue';
|
||||
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
|
||||
|
@ -267,7 +268,6 @@ 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,
|
||||
|
@ -284,7 +284,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' }]
|
||||
})
|
||||
|
@ -294,14 +294,11 @@ 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>();
|
||||
|
||||
|
@ -320,8 +317,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' }]
|
||||
|
@ -335,7 +331,12 @@ 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'));
|
||||
let response
|
||||
if(isAudit.value) {
|
||||
response = await awaitTexbookList(queryParams.value);
|
||||
} else {
|
||||
response = await pageTextbook(queryParams.value);
|
||||
}
|
||||
ossList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
|
@ -365,10 +366,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();
|
||||
}
|
||||
/** 选择条数 */
|
||||
|
@ -459,6 +457,11 @@ const submitMoveForm = () => {
|
|||
treeMoveFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
treeMoveDialog.visible = false;
|
||||
const res = await move(treeMoveForm.value)
|
||||
if (res.code === 200) {
|
||||
proxy?.$modal.msgSuccess("移动成功")
|
||||
await getList()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -471,6 +474,11 @@ const submitCopyForm = () => {
|
|||
treeCopyFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
treeCopyDialog.visible = false
|
||||
const res = await copy(treeCopyForm.value)
|
||||
if (res.code === 200) {
|
||||
proxy?.$modal.msgSuccess("复制成功")
|
||||
await getList()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -479,17 +487,32 @@ const cancelCopy = () => {
|
|||
treeCopyDialog.visible = false
|
||||
}
|
||||
|
||||
// 0审核不通过 1审核通过
|
||||
const handleAuditBtn = async (row: any, status: number) => {
|
||||
const id = row?.id
|
||||
const fileName = row?.fileName
|
||||
const title = status === 1 ? `是否审核通过${fileName}?` : `是否审核不通过${fileName}?`
|
||||
await proxy?.$modal.confirm(title).finally(() => loading.value = false)
|
||||
await review({ id, status })
|
||||
proxy?.$modal.msgSuccess(status === 1 ? "审核通过" : '审核不通过');
|
||||
await getList();
|
||||
}
|
||||
|
||||
/** 下载按钮操作 */
|
||||
const handleDownload = (row: OssVO) => {
|
||||
proxy?.$download.oss(row.ossId);
|
||||
};
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
/** 用户状态修改 */
|
||||
|
@ -509,7 +532,7 @@ const handleDelete = async (row?: OssVO) => {
|
|||
const ossIds = row?.ossId || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除OSS对象存储编号为"' + ossIds + '"的数据项?');
|
||||
loading.value = true;
|
||||
await delOss(ossIds).finally(() => (loading.value = false));
|
||||
await delTextbook(ossIds).finally(() => (loading.value = false));
|
||||
await getList();
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
};
|
||||
|
@ -527,6 +550,9 @@ const handleNode = (node: any) => {
|
|||
isTree.value = true
|
||||
isUpload.value = true
|
||||
currentNode.value = node
|
||||
|
||||
queryParams.value.catalogId = node.catalogId
|
||||
getList()
|
||||
}
|
||||
|
||||
const options = ref({
|
||||
|
|
Loading…
Reference in New Issue