提交拖动代码
This commit is contained in:
parent
cb790f86d0
commit
985ec3d51a
|
@ -69,3 +69,12 @@ export const delCatalogTextbook = (catalogId: string | number | Array<string | n
|
|||
method: 'delete'
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
export const dragTextbook = (data: any) => {
|
||||
return request({
|
||||
url: '/catalog/textbook/drag',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
|
@ -122,6 +122,10 @@ export interface TeacherForm extends BaseEntity {
|
|||
*/
|
||||
birthday?: string;
|
||||
|
||||
postCode?: string;
|
||||
|
||||
postIds?: []
|
||||
|
||||
}
|
||||
|
||||
export interface TeacherQuery extends PageQuery {
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<el-form-item label="年级/班级" prop="deptId">
|
||||
<el-tree-select v-model="form.deptId" :data="deptOptions" clearable
|
||||
:props="{ value: 'id', label: 'label', children: 'children' }" value-key="id" placeholder="请选择年级/班级"
|
||||
check-strictly />
|
||||
check-strictly @change="handleDeptChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -172,6 +172,15 @@
|
|||
<el-input v-model="form.email" placeholder="请输入电子邮箱" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="岗位">
|
||||
<el-select v-model="form.postIds" multiple placeholder="请选择">
|
||||
<el-option v-for="item in postOptions" :key="item.postId" :label="item.postName" :value="item.postId"
|
||||
:disabled="item.status == '1'"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -217,7 +226,9 @@ import { pageTeacher, getTeacher, delTeacher, addTeacher, updateTeacher } from '
|
|||
import { TeacherVO, TeacherQuery, TeacherForm } from '@/api/teacher/types';
|
||||
|
||||
import { deptTreeSelect } from '@/api/system/user';
|
||||
import { optionselect } from '@/api/system/post';
|
||||
import { DeptVO } from '@/api/system/dept/types';
|
||||
import { PostVO } from '@/api/system/post/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
|
@ -310,6 +321,13 @@ const data = reactive<PageData<TeacherForm, TeacherQuery>>({
|
|||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
const postOptions = ref<PostVO[]>([]);
|
||||
async function handleDeptChange(value: number | string) {
|
||||
const response = await optionselect(value);
|
||||
postOptions.value = response.data;
|
||||
form.value.postIds = [];
|
||||
}
|
||||
|
||||
/** 查询部门下拉树结构 */
|
||||
const getTreeSelect = async () => {
|
||||
const res = await deptTreeSelect();
|
||||
|
|
|
@ -17,41 +17,29 @@
|
|||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :search="false"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<div class="tree-container-scroll">
|
||||
<el-scrollbar>
|
||||
<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="left" prop="catalogName">
|
||||
<template #default="scope">
|
||||
<el-popover placement="top-start" title="分类名称" :width="200" trigger="hover"
|
||||
:content="scope.row.catalogName">
|
||||
<template #reference>
|
||||
<span class="text-ellipsis">{{ scope.row.catalogName }}</span>
|
||||
|
||||
<el-tree ref="treeRef" draggable v-loading="loading" :data="catalogPersonList" :props="defaultProps"
|
||||
default-expand-all :expand-on-click-node="false" node-key="catalogId" @node-click="handleNodeClick"
|
||||
@node-drop="handleDrop">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<div class="text-ellipsis">{{ node.label }} </div>
|
||||
|
||||
<div>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(data)" />
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(data)" />
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(data)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="新增" placement="top">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tree>
|
||||
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</el-card>
|
||||
|
@ -103,6 +91,11 @@ type CatalogPersonOption = {
|
|||
children?: CatalogPersonOption[];
|
||||
}
|
||||
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'catalogName',
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const { volume } = useVolume(2);
|
||||
|
@ -290,10 +283,18 @@ onMounted(() => {
|
|||
});
|
||||
|
||||
const fileListRef = ref()
|
||||
const handleRowClick = (row: any) => {
|
||||
const handleNodeClick = (row: any) => {
|
||||
fileListRef.value.handleNode(row)
|
||||
}
|
||||
|
||||
const handleDrop = (draggingNode, dropNode, dropType) => {
|
||||
// 处理拖拽后的逻辑,比如更新节点顺序等
|
||||
console.log('draggingNode:', draggingNode, 'dropNode:', dropNode, 'dropType:', dropType)
|
||||
const oldData = draggingNode.data
|
||||
const newData = dropNode.data
|
||||
}
|
||||
|
||||
|
||||
const handleChange = () => {
|
||||
fileListRef.value.handleTypeChange(queryParams.value.type)
|
||||
}
|
||||
|
@ -338,6 +339,15 @@ const handleChange = () => {
|
|||
.active {
|
||||
background-color: #F5F7FA;
|
||||
}
|
||||
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.docx-wrapper) {
|
||||
|
|
|
@ -1,22 +1,5 @@
|
|||
<template>
|
||||
<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="catalogName">
|
||||
<el-input v-model="queryParams.catalogName" placeholder="请输入专题名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-card shadow="never">
|
||||
|
@ -26,42 +9,32 @@
|
|||
<el-button type="primary" plain icon="Plus" @click="handleAdd()"
|
||||
v-hasPermi="['catalog:resource:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :search="false"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table ref="catalogResourceTableRef" @row-click="handleNodeClick" v-loading="loading"
|
||||
:data="catalogResourceList" row-key="catalogId" :default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column label="专题名称" align="left" prop="catalogName">
|
||||
<template #default="scope">
|
||||
<el-popover placement="top-start" title="专题名称" :width="200" trigger="hover"
|
||||
:content="scope.row.catalogName">
|
||||
<template #reference>
|
||||
<span class="text-ellipsis">{{ scope.row.catalogName }}</span>
|
||||
</template>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
|
||||
<el-scrollbar>
|
||||
<el-tree ref="treeRef" draggable v-loading="loading" :data="catalogResourceList" :props="defaultProps"
|
||||
default-expand-all :expand-on-click-node="false" node-key="catalogId" @node-click="handleNodeClick"
|
||||
@node-drop="handleDrop">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<div class="text-ellipsis">{{ node.label }} </div>
|
||||
|
||||
<div>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(data)"
|
||||
v-hasPermi="['catalog:resource:edit']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="新增" placement="top">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)"
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(data)"
|
||||
v-hasPermi="['catalog:resource:add']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(data)"
|
||||
v-hasPermi="['catalog:resource:remove']" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
|
@ -125,6 +98,11 @@ type CatalogResourceOption = {
|
|||
children?: CatalogResourceOption[];
|
||||
}
|
||||
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'catalogName',
|
||||
}
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;;
|
||||
|
||||
|
||||
|
@ -316,12 +294,31 @@ const getTable = async () => {
|
|||
loadingTable.value = false;
|
||||
}
|
||||
|
||||
const handleNodeClick = (row: any) => {
|
||||
queryTableParams.value.catalogId = row.catalogId
|
||||
const handleNodeClick = (data: any) => {
|
||||
queryTableParams.value.catalogId = data.catalogId
|
||||
getTable()
|
||||
}
|
||||
|
||||
const handleDrop = (draggingNode, dropNode, dropType) => {
|
||||
// 处理拖拽后的逻辑,比如更新节点顺序等
|
||||
console.log('draggingNode:', draggingNode, 'dropNode:', dropNode, 'dropType:', dropType)
|
||||
|
||||
const oldData = draggingNode.data
|
||||
const newData = dropNode.data
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,22 +1,5 @@
|
|||
<template>
|
||||
<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="catalogName">
|
||||
<el-input v-model="queryParams.catalogName" placeholder="请输入教材名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="14">
|
||||
<el-card shadow="never">
|
||||
|
@ -26,53 +9,40 @@
|
|||
<el-button type="primary" plain icon="Plus" @click="handleAdd()"
|
||||
v-hasPermi="['catalog:textbook:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" :search="false"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-table ref="catalogTextbookTableRef" @row-click="handleNodeClick" v-loading="loading"
|
||||
:data="catalogTextbookList" row-key="catalogId" :default-expand-all="isExpandAll"
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column label="教材名称" align="left" prop="catalogName">
|
||||
<template #default="scope">
|
||||
<el-popover placement="top-start" title="教材名称" :width="200" trigger="hover"
|
||||
:content="scope.row.catalogName">
|
||||
<template #reference>
|
||||
<span class="text-ellipsis">{{ scope.row.catalogName }}</span>
|
||||
</template>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="目录类型" align="center" prop="type" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.type === 1" type="success">主目录</el-tag>
|
||||
<el-tag v-if="scope.row.type === 2" type="success">学段</el-tag>
|
||||
<el-tag v-if="scope.row.type === 3" type="success">年级</el-tag>
|
||||
<el-tag v-if="scope.row.type === 4" type="success">学科</el-tag>
|
||||
<el-tag v-if="scope.row.type === 5" type="success">版本</el-tag>
|
||||
<el-tag v-if="scope.row.type === 6" type="success">教材</el-tag>
|
||||
<el-tag v-if="scope.row.type === 7" type="success">目录</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
|
||||
<el-scrollbar>
|
||||
<el-tree ref="treeRef" draggable v-loading="loading" :data="catalogTextbookList" :props="defaultProps"
|
||||
default-expand-all :expand-on-click-node="false" node-key="catalogId" @node-click="handleNodeClick"
|
||||
@node-drop="handleDrop">
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node">
|
||||
<div class="text-ellipsis">{{ node.label }} </div>
|
||||
|
||||
<div>
|
||||
<span style="margin-right:20px;">
|
||||
<el-tag v-if="data.type === 1" type="success">主目录</el-tag>
|
||||
<el-tag v-if="data.type === 2" type="success">学段</el-tag>
|
||||
<el-tag v-if="data.type === 3" type="success">年级</el-tag>
|
||||
<el-tag v-if="data.type === 4" type="success">学科</el-tag>
|
||||
<el-tag v-if="data.type === 5" type="success">版本</el-tag>
|
||||
<el-tag v-if="data.type === 6" type="success">教材</el-tag>
|
||||
<el-tag v-if="data.type === 7" type="success">目录</el-tag>
|
||||
</span>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(data)"
|
||||
v-hasPermi="['catalog:textbook:edit']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="新增" placement="top">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)"
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(data)"
|
||||
v-hasPermi="['catalog:textbook:add']" />
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(data)"
|
||||
v-hasPermi="['catalog:textbook:remove']" />
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-tree>
|
||||
</el-scrollbar>
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
|
@ -140,7 +110,7 @@
|
|||
</template>
|
||||
|
||||
<script setup name="CatalogTextbook" lang="ts">
|
||||
import { listCatalogTextbook, pageCatalogTextbook, getCatalogTextbook, delCatalogTextbook, addCatalogTextbook, updateCatalogTextbook } from "@/api/resource/catalogTextbook";
|
||||
import { listCatalogTextbook, pageCatalogTextbook, getCatalogTextbook, delCatalogTextbook, addCatalogTextbook, updateCatalogTextbook, dragTextbook } from "@/api/resource/catalogTextbook";
|
||||
import { CatalogTextbookVO, CatalogTextbookQuery, CatalogTextbookForm } from '@/api/resource/catalogTextbook/types';
|
||||
|
||||
type CatalogTextbookOption = {
|
||||
|
@ -162,6 +132,11 @@ const queryFormRef = ref<ElFormInstance>();
|
|||
const catalogTextbookFormRef = ref<ElFormInstance>();
|
||||
const catalogTextbookTableRef = ref<ElTableInstance>()
|
||||
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'catalogName',
|
||||
}
|
||||
|
||||
const typeOptions = [
|
||||
{
|
||||
value: 2,
|
||||
|
@ -290,20 +265,6 @@ const handleAdd = (row?: CatalogTextbookVO) => {
|
|||
dialog.title = "添加目录-同步教材";
|
||||
}
|
||||
|
||||
/** 展开/折叠操作 */
|
||||
const handleToggleExpandAll = () => {
|
||||
isExpandAll.value = !isExpandAll.value;
|
||||
toggleExpandAll(catalogTextbookList.value, isExpandAll.value)
|
||||
}
|
||||
|
||||
/** 展开/折叠操作 */
|
||||
const toggleExpandAll = (data: CatalogTextbookVO[], status: boolean) => {
|
||||
data.forEach((item) => {
|
||||
catalogTextbookTableRef.value?.toggleRowExpansion(item, status)
|
||||
if (item.children && item.children.length > 0) toggleExpandAll(item.children, status)
|
||||
})
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row: CatalogTextbookVO) => {
|
||||
reset();
|
||||
|
@ -369,12 +330,43 @@ const getTable = async () => {
|
|||
loadingTable.value = false;
|
||||
}
|
||||
|
||||
const handleNodeClick = (row: any) => {
|
||||
queryTableParams.value.catalogId = row.catalogId
|
||||
const handleNodeClick = (node: any) => {
|
||||
console.log(node);
|
||||
queryTableParams.value.catalogId = node.catalogId
|
||||
getTable()
|
||||
}
|
||||
|
||||
const handleDrop = async (draggingNode, dropNode, dropType) => {
|
||||
loading.value= true
|
||||
// 处理拖拽后的逻辑,比如更新节点顺序等
|
||||
const oldData = draggingNode.data
|
||||
const newData = dropNode.data
|
||||
|
||||
try {
|
||||
const res = await dragTextbook({
|
||||
oldCatalog: oldData.catalogId,
|
||||
newCatalog: newData.catalogId,
|
||||
position: dropType
|
||||
})
|
||||
proxy?.$modal.msgSuccess(res.msg);
|
||||
} finally {
|
||||
getList()
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -183,11 +183,11 @@
|
|||
<script setup name="Oss" lang="ts">
|
||||
import { pageResource, awaitResourceList, awaitResourceCount, previewResource, delResource, addResource, reviewResource, copyResource, moveResource } from '@/api/system/oss';
|
||||
import FileMd5Upload from '@/components/FileMd5Upload/index.vue';
|
||||
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
|
||||
import { listCatalogResource } from "@/api/resource/catalogResource";
|
||||
import { CatalogTextbookVO } from '@/api/resource/catalogTextbook/types';
|
||||
import { Base64 } from 'js-base64'
|
||||
import { useVolume } from "@/composables/useVolume";
|
||||
import auth from '@/plugins/auth';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { volume } = useVolume(1);
|
||||
|
@ -236,7 +236,7 @@ const isUpload = ref(false)
|
|||
const currentNode = ref<any>({})
|
||||
const treeData = ref<CatalogTextbookVO[]>([])
|
||||
|
||||
const ossList = ref<OssVO[]>([]);
|
||||
const ossList = ref<any[]>([]);
|
||||
const showTable = ref(true);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
|
@ -283,7 +283,7 @@ const queryFormRef = ref<ElFormInstance>();
|
|||
const initFormData = {
|
||||
file: undefined
|
||||
};
|
||||
const data = reactive<PageData<OssForm, OssQuery>>({
|
||||
const data = reactive<PageData<any, any>>({
|
||||
form: { ...initFormData },
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
|
@ -333,7 +333,9 @@ function reset() {
|
|||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
if (auth.hasPermi('file:resource:review')) {
|
||||
awaitResourceCountData()
|
||||
}
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
|
@ -342,7 +344,7 @@ function resetQuery() {
|
|||
handleQuery();
|
||||
}
|
||||
/** 选择条数 */
|
||||
function handleSelectionChange(selection: OssVO[]) {
|
||||
function handleSelectionChange(selection: any[]) {
|
||||
ids.value = selection.map((item) => item.ossId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
|
@ -374,7 +376,9 @@ const handleOrderChange = (prop: string, order: string) => {
|
|||
queryParams.value.orderByColumn = orderByArr.join(',');
|
||||
queryParams.value.isAsc = isAscArr.join(',');
|
||||
getList();
|
||||
if (auth.hasPermi('file:resource:review')) {
|
||||
awaitResourceCountData()
|
||||
}
|
||||
};
|
||||
|
||||
/** 文件按钮操作 */
|
||||
|
@ -397,7 +401,9 @@ const submitForm = async () => {
|
|||
await addResource({ ossId, catalogId, fileName: fileName.value })
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
if (auth.hasPermi('file:resource:review')) {
|
||||
awaitResourceCountData()
|
||||
}
|
||||
};
|
||||
|
||||
const submitMoveForm = () => {
|
||||
|
@ -479,7 +485,9 @@ const handleAudit = () => {
|
|||
isTree.value = false
|
||||
|
||||
getList()
|
||||
if (auth.hasPermi('file:resource:review')) {
|
||||
awaitResourceCountData()
|
||||
}
|
||||
}
|
||||
|
||||
const handleNode = (node: any) => {
|
||||
|
@ -491,7 +499,9 @@ const handleNode = (node: any) => {
|
|||
|
||||
queryParams.value.catalogId = node.catalogId
|
||||
getList()
|
||||
if (auth.hasPermi('file:resource:review')) {
|
||||
awaitResourceCountData()
|
||||
}
|
||||
}
|
||||
|
||||
const preViewUrl = import.meta.env.VITE_APP_PREVIEW
|
||||
|
@ -512,16 +522,23 @@ const getlistCatalogResource = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
const auditNum = ref(0)
|
||||
const awaitResourceCountData = async () => {
|
||||
const res = await awaitResourceCount(queryParams.value)
|
||||
auditNum.value = res.data
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getlistCatalogResource()
|
||||
getList();
|
||||
|
||||
|
||||
if (auth.hasPermi('file:resource:review')) {
|
||||
awaitResourceCountData()
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<el-button type="" text="plain">全部文件</el-button>
|
||||
<br>
|
||||
|
||||
|
||||
<el-badge v-if="auditNum > 0" :value="auditNum" style="margin-left:10px;margin-top: 10px;">
|
||||
<el-button v-hasPermi="['file:textbook:awaitList']" :class="['btn-audit', isAudit && 'active']" type=""
|
||||
text="plain" @click="handleAudit">待审核</el-button>
|
||||
|
@ -24,7 +23,7 @@
|
|||
<div class="tree-container-scroll">
|
||||
<el-scrollbar>
|
||||
<el-tree ref="treeRef" v-loading="treeLoading" :data="treeData" :props="defaultProps" default-expand-all
|
||||
@node-click="handleNode" />
|
||||
:expand-on-click-node="false" node-key="catalogId" @node-click="handleNode" />
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -191,11 +190,11 @@
|
|||
<script setup name="Oss" lang="ts">
|
||||
import { pageTextbook, awaitTexbookList, previewTextbook, awaitTextbookCount, delTextbook, addTextbook, reviewTextbook, copyTextbook, moveTextbook } from '@/api/system/oss';
|
||||
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 { Base64 } from 'js-base64'
|
||||
import { useVolume } from "@/composables/useVolume";
|
||||
import auth from '@/plugins/auth';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { volume } = useVolume(1);
|
||||
|
@ -244,7 +243,7 @@ const isUpload = ref(false)
|
|||
const currentNode = ref<any>({})
|
||||
const treeData = ref<CatalogTextbookVO[]>([])
|
||||
|
||||
const ossList = ref<OssVO[]>([]);
|
||||
const ossList = ref<any[]>([]);
|
||||
const showTable = ref(true);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
|
@ -291,7 +290,7 @@ const queryFormRef = ref<ElFormInstance>();
|
|||
const initFormData = {
|
||||
file: undefined
|
||||
};
|
||||
const data = reactive<PageData<OssForm, OssQuery>>({
|
||||
const data = reactive<PageData<any, any>>({
|
||||
form: { ...initFormData },
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
|
@ -315,7 +314,9 @@ const { queryParams, form, rules } = toRefs(data);
|
|||
|
||||
const handleTypeChange = () => {
|
||||
getList()
|
||||
if (auth.hasPermi('file:textbook:review')) {
|
||||
awaitTextbookCountData()
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询OSS对象存储列表 */
|
||||
|
@ -347,7 +348,9 @@ function reset() {
|
|||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
if (auth.hasPermi('file:textbook:review')) {
|
||||
awaitTextbookCountData()
|
||||
}
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
|
@ -356,7 +359,7 @@ function resetQuery() {
|
|||
handleQuery();
|
||||
}
|
||||
/** 选择条数 */
|
||||
function handleSelectionChange(selection: OssVO[]) {
|
||||
function handleSelectionChange(selection: any[]) {
|
||||
ids.value = selection.map((item) => item.ossId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
|
@ -393,7 +396,9 @@ const submitForm = async () => {
|
|||
await addTextbook({ ossId, catalogId, fileName: fileName.value, type: queryParams.value.type })
|
||||
dialog.visible = false;
|
||||
getList();
|
||||
if (auth.hasPermi('file:textbook:review')) {
|
||||
awaitTextbookCountData()
|
||||
}
|
||||
};
|
||||
|
||||
const submitMoveForm = () => {
|
||||
|
@ -475,7 +480,9 @@ const handleAudit = () => {
|
|||
isTree.value = false
|
||||
|
||||
getList()
|
||||
if (auth.hasPermi('file:textbook:review')) {
|
||||
awaitTextbookCountData()
|
||||
}
|
||||
}
|
||||
|
||||
const handleNode = (node: any) => {
|
||||
|
@ -487,7 +494,9 @@ const handleNode = (node: any) => {
|
|||
|
||||
queryParams.value.catalogId = node.catalogId
|
||||
getList()
|
||||
if (auth.hasPermi('file:textbook:review')) {
|
||||
awaitTextbookCountData()
|
||||
}
|
||||
}
|
||||
|
||||
const preViewUrl = import.meta.env.VITE_APP_PREVIEW
|
||||
|
@ -517,7 +526,11 @@ const awaitTextbookCountData = async () => {
|
|||
onMounted(() => {
|
||||
getListCatalogTextbook()
|
||||
getList();
|
||||
|
||||
if (auth.hasPermi('file:textbook:review')) {
|
||||
awaitTextbookCountData()
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue