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