This commit is contained in:
liang.chao 2025-11-29 13:46:07 +08:00
parent 77e2dce7cd
commit 6c17051046
1 changed files with 130 additions and 88 deletions

View File

@ -11,31 +11,32 @@
@node-click="nodeClick" @node-click="nodeClick"
> >
<template #default="{ node, data }"> <template #default="{ node, data }">
<span>{{ data.contentName }}</span> <div class="tree-node-row">
<span class="node-label">{{ data.contentName }}</span>
<el-icon <span class="node-actions">
v-if="data.level != 3" <el-icon
class="el-icon-circle-plus-outline icon-op" v-if="data.level != 3"
@click.stop="openDialog('add',data)" class="el-icon-circle-plus-outline icon-op"
> @click.stop="openDialog('add', data)"
<CirclePlus /> >
</el-icon> <CirclePlus />
</el-icon>
<el-icon <el-icon
v-if="data.level > 0" v-if="data.level > 0"
class="el-icon-edit icon-op" class="el-icon-edit icon-op"
@click.stop="openDialog('edit',data)" @click.stop="openDialog('edit', data)"
> >
<Edit /> <Edit />
</el-icon> </el-icon>
<el-icon
<el-icon v-if="data.level > 0"
v-if="data.level > 0" class="el-icon-delete icon-op"
class="el-icon-delete icon-op" @click.stop="deleteNode(data)"
@click.stop="deleteNode(data)" >
> <Delete />
<Delete /> </el-icon>
</el-icon> </span>
</div>
</template> </template>
</avue-tree> </avue-tree>
</basic-container> </basic-container>
@ -95,7 +96,8 @@
<!-- 名称 --> <!-- 名称 -->
<el-form-item label="分类名称" prop="contentName"> <el-form-item label="分类名称" prop="contentName">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" maxlength="64" v-model="editForm.contentName" placeholder="请输入分类名称" /> <el-input type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" maxlength="64" v-model="editForm.contentName"
placeholder="请输入分类名称" />
</el-form-item> </el-form-item>
<!-- 案卷排序号 --> <!-- 案卷排序号 -->
@ -113,7 +115,7 @@
</template> </template>
<script> <script>
import { ref } from "vue"; import { ref } from 'vue';
import { import {
getArchivalCatalogueTreeApi, getArchivalCatalogueTreeApi,
addArchiveLeftApi, addArchiveLeftApi,
@ -126,7 +128,7 @@ import {
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
// import { add, getDetail, getList, remove, update } from '@/api/data-collect/data-class-manage'; // import { add, getDetail, getList, remove, update } from '@/api/data-collect/data-class-manage';
export default { export default {
name: "ArchCatalogue", name: 'ArchCatalogue',
data() { data() {
return { return {
form: {}, form: {},
@ -137,12 +139,12 @@ export default {
page: { page: {
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
total: 0, total: 0
}, },
selectionList: [], selectionList: [],
option: { option: {
height: "calc(100vh - 280px)", height: 'calc(100vh - 280px)',
tip: false, tip: false,
searchShow: true, searchShow: true,
searchMenuSpan: 6, searchMenuSpan: 6,
@ -159,24 +161,24 @@ export default {
hide: true, hide: true,
type: 'input', // static input type: 'input', // static input
readonly: true, // readonly: true, //
disabled: true, // disabled: true //
}, },
{ {
label: "文件名称", label: '文件名称',
labelWidth: 120, labelWidth: 120,
prop: "contentName", prop: 'contentName',
search: true, search: true,
type: "input", type: 'input',
placeholder: "请输入文件名称", placeholder: '请输入文件名称',
searchLabelWidth: 120, searchLabelWidth: 120,
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入文件名称', message: '请输入文件名称',
trigger: 'blur', trigger: 'blur'
}, }
], ]
}, },
{ {
label: '案卷期限', label: '案卷期限',
@ -186,9 +188,9 @@ export default {
{ {
required: true, required: true,
message: '请输入案卷期限', message: '请输入案卷期限',
trigger: 'blur', trigger: 'blur'
}, }
], ]
}, },
{ {
label: '档案标识代码', label: '档案标识代码',
@ -202,16 +204,16 @@ export default {
}, },
props: { props: {
label: 'dictLabel', label: 'dictLabel',
value: 'dictLabel', value: 'dictLabel'
}, },
slot: true, slot: true,
rules: [ rules: [
{ {
required: true, required: true,
message: '请选择档案标识代码', message: '请选择档案标识代码',
trigger: 'change', trigger: 'change'
}, }
], ]
}, },
{ {
label: '归档责任单位', label: '归档责任单位',
@ -221,9 +223,9 @@ export default {
{ {
required: true, required: true,
message: '请输入归档责任单位', message: '请输入归档责任单位',
trigger: 'blur', trigger: 'blur'
}, }
], ]
}, },
{ {
label: '所属专业', label: '所属专业',
@ -233,9 +235,9 @@ export default {
{ {
required: true, required: true,
message: '请输入所属专业', message: '请输入所属专业',
trigger: 'blur', trigger: 'blur'
}, }
], ]
}, },
{ {
label: '文件分类标记', label: '文件分类标记',
@ -246,30 +248,30 @@ export default {
dicMethod: 'post', // POST dicMethod: 'post', // POST
props: { props: {
label: 'name', label: 'name',
value: 'id', value: 'id'
}, },
slot: true, slot: true,
rules: [ rules: [
{ {
required: true, required: true,
message: '请选择文件分类标记', message: '请选择文件分类标记',
trigger: 'change', trigger: 'change'
}, }
], ]
}, }
] ]
}, },
treeDeptId: "0", treeDeptId: '0',
treeLevel:0, treeLevel: 0,
treeData: [], treeData: [],
treeOption: { treeOption: {
nodeKey: "id", nodeKey: 'id',
menu: false, menu: false,
addBtn: false, addBtn: false,
props: { label: "contentName", children: "children" }, props: { label: 'contentName', children: 'children' },
level: null, level: null,
defaultExpandAll: true, defaultExpandAll: true
}, },
shareDialogVisible: false, shareDialogVisible: false,
@ -278,8 +280,8 @@ export default {
selectedNodeName: '', selectedNodeName: '',
dialogVisible: false, dialogVisible: false,
dialogType: "add", dialogType: 'add',
editForm: { contentName:null,id:null,level:null,parentId:null,sort:null }, editForm: { contentName: null, id: null, level: null, parentId: null, sort: null },
treeOptions: [], // treeOptions: [], //
treeForDialog: [], // treeForDialog: [], //
@ -287,36 +289,36 @@ export default {
menu: false, menu: false,
addBtn: false, addBtn: false,
searchShow: false, searchShow: false,
nodeKey: "id", nodeKey: 'id',
props: { props: {
label: "contentName", label: 'contentName',
children: "children", children: 'children',
value: "id" value: 'id'
}, },
defaultExpandAll: true, defaultExpandAll: true,
multiple: false, multiple: false,
checkStrictly: true, checkStrictly: true,
selectClick: true, selectClick: true
}, },
sortTip: "", sortTip: '',
dialogTitle: '', dialogTitle: '',
treeKey: 0, // treeKey: 0, //
selectedNodePath:'', selectedNodePath: ''
}; };
}, },
computed: { computed: {
...mapGetters(['permission']), ...mapGetters(['permission']),
permissionList() { permissionList() {
let isLevel3 = this.treeLevel ===3; let isLevel3 = this.treeLevel === 3;
return { return {
addBtn: this.validData(this.permission.post_add, false) && isLevel3, addBtn: this.validData(this.permission.post_add, false) && isLevel3,
viewBtn: this.validData(this.permission.post_view, false), viewBtn: this.validData(this.permission.post_view, false),
delBtn: this.validData(this.permission.post_delete, false), delBtn: this.validData(this.permission.post_delete, false),
editBtn: this.validData(this.permission.post_edit, false), editBtn: this.validData(this.permission.post_edit, false)
}; };
}, }
}, },
mounted() { mounted() {
@ -343,7 +345,7 @@ export default {
this.treeData = convert(rows); this.treeData = convert(rows);
this.treeOptions = this.treeData; // treeOptions parentId this.treeOptions = this.treeData; // treeOptions parentId
} catch (err) { } catch (err) {
console.error("加载左树失败", err); console.error('加载左树失败', err);
this.treeData = []; this.treeData = [];
this.treeOptions = []; this.treeOptions = [];
} }
@ -458,7 +460,7 @@ export default {
return; return;
} }
const api = this.dialogType === "add" ? addArchiveLeftApi : editArchiveLeftApi; const api = this.dialogType === 'add' ? addArchiveLeftApi : editArchiveLeftApi;
await api(this.editForm); await api(this.editForm);
this.dialogVisible = false; this.dialogVisible = false;
this.$message({ type: 'success', message: '操作成功!' }); this.$message({ type: 'success', message: '操作成功!' });
@ -508,7 +510,7 @@ export default {
} }
} else { } else {
this.editForm.level = 1; this.editForm.level = 1;
this.sortTip = ""; this.sortTip = '';
} }
}, },
@ -553,14 +555,14 @@ export default {
rowSave(row, done, loading) { rowSave(row, done, loading) {
row.level = 4; row.level = 4;
row.parentId = this.selectedNodeId; row.parentId = this.selectedNodeId;
row.classifyMark= row.classifyMarkId; row.classifyMark = row.classifyMarkId;
addArchiveRightApi(row).then( addArchiveRightApi(row).then(
() => { () => {
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
type: 'success', type: 'success',
message: '操作成功!', message: '操作成功!'
}); });
done(); done();
}, },
@ -573,13 +575,13 @@ export default {
rowUpdate(row, index, done, loading) { rowUpdate(row, index, done, loading) {
row.level = 4; row.level = 4;
row.parentId = this.selectedNodeId; row.parentId = this.selectedNodeId;
row.classifyMark= row.classifyMarkId; row.classifyMark = row.classifyMarkId;
editArchiveRightApi(row).then( editArchiveRightApi(row).then(
() => { () => {
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
type: 'success', type: 'success',
message: '操作成功!', message: '操作成功!'
}); });
done(); done();
}, },
@ -593,7 +595,7 @@ export default {
this.$confirm('确定将选择数据删除?', { this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning'
}) })
.then(() => { .then(() => {
return delArchiveApi(row.id); return delArchiveApi(row.id);
@ -602,7 +604,7 @@ export default {
this.onLoad(this.page); this.onLoad(this.page);
this.$message({ this.$message({
type: 'success', type: 'success',
message: '操作成功!', message: '操作成功!'
}); });
}); });
}, },
@ -610,7 +612,7 @@ export default {
if (type === 'add') { if (type === 'add') {
this.$nextTick(() => { this.$nextTick(() => {
this.form.path = this.selectedNodePath; this.form.path = this.selectedNodePath;
console.log("aaa=",this.form.path) console.log('aaa=', this.form.path);
}); });
} }
done(); done();
@ -628,8 +630,8 @@ export default {
this.loading = true; this.loading = true;
let data = { let data = {
...params, ...params,
pageNum:page.currentPage, pageNum: page.currentPage,
pageSize:page.pageSize, pageSize: page.pageSize,
parentId: this.treeDeptId parentId: this.treeDeptId
}; };
getArchivalCatalogueListApi(data).then(res => { getArchivalCatalogueListApi(data).then(res => {
@ -637,7 +639,7 @@ export default {
this.page.total = data.total; this.page.total = data.total;
this.data = data.rows; this.data = data.rows;
this.loading = false; this.loading = false;
if(data.rows.length){ if (data.rows.length) {
this.selectedNodePath = data.rows[0].path; this.selectedNodePath = data.rows[0].path;
} }
this.selectionClear(); this.selectionClear();
@ -647,7 +649,7 @@ export default {
selectionClear() { selectionClear() {
this.selectionList = []; this.selectionList = [];
this.$refs.crud.toggleSelection(); this.$refs.crud.toggleSelection();
}, }
} }
}; };
</script> </script>
@ -656,31 +658,71 @@ export default {
.full-height { .full-height {
height: 100%; height: 100%;
} }
.box { .box {
height: 800px; height: 800px;
} }
.el-scrollbar { .el-scrollbar {
height: 100%; height: 100%;
} }
.box .el-scrollbar__wrap { .box .el-scrollbar__wrap {
overflow: scroll; overflow: scroll;
} }
.icon-op { .icon-op {
font-size: 16px; font-size: 16px;
margin-left: 6px; margin-left: 6px;
color: #409EFF; color: #409EFF;
cursor: pointer; cursor: pointer;
} }
.icon-op:hover { .icon-op:hover {
color: #66b1ff; color: #66b1ff;
} }
.left-panel { .left-panel {
border-right: 1px solid #e6e6e6; border-right: 1px solid #e6e6e6;
} }
.right-panel { .right-panel {
padding-left: 16px; padding-left: 16px;
} }
.right-basic { .right-basic {
height: 100%; height: 100%;
} }
/* 确保整行可 hover */
.tree-node-row {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 100%;
padding: 4px 8px; /* 根据实际调整 */
box-sizing: border-box;
}
/* 默认隐藏操作图标 */
.tree-node-row .node-actions .icon-op {
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease;
margin-left: 8px;
}
/* 鼠标 hover 整行时显示 */
.tree-node-row:hover .node-actions .icon-op {
opacity: 1;
visibility: visible;
}
/* 可选:让操作区不占用布局空间(始终 reserve 位置) */
.tree-node-row .node-actions {
display: flex;
align-items: center;
white-space: nowrap;
}
</style> </style>