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,8 +11,9 @@
@node-click="nodeClick"
>
<template #default="{ node, data }">
<span>{{ data.contentName }}</span>
<div class="tree-node-row">
<span class="node-label">{{ data.contentName }}</span>
<span class="node-actions">
<el-icon
v-if="data.level != 3"
class="el-icon-circle-plus-outline icon-op"
@ -20,7 +21,6 @@
>
<CirclePlus />
</el-icon>
<el-icon
v-if="data.level > 0"
class="el-icon-edit icon-op"
@ -28,7 +28,6 @@
>
<Edit />
</el-icon>
<el-icon
v-if="data.level > 0"
class="el-icon-delete icon-op"
@ -36,6 +35,8 @@
>
<Delete />
</el-icon>
</span>
</div>
</template>
</avue-tree>
</basic-container>
@ -95,7 +96,8 @@
<!-- 名称 -->
<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>
<!-- 案卷排序号 -->
@ -113,7 +115,7 @@
</template>
<script>
import { ref } from "vue";
import { ref } from 'vue';
import {
getArchivalCatalogueTreeApi,
addArchiveLeftApi,
@ -126,7 +128,7 @@ import {
import { mapGetters } from 'vuex';
// import { add, getDetail, getList, remove, update } from '@/api/data-collect/data-class-manage';
export default {
name: "ArchCatalogue",
name: 'ArchCatalogue',
data() {
return {
form: {},
@ -137,12 +139,12 @@ export default {
page: {
pageSize: 10,
currentPage: 1,
total: 0,
total: 0
},
selectionList: [],
option: {
height: "calc(100vh - 280px)",
height: 'calc(100vh - 280px)',
tip: false,
searchShow: true,
searchMenuSpan: 6,
@ -159,24 +161,24 @@ export default {
hide: true,
type: 'input', // static input
readonly: true, //
disabled: true, //
disabled: true //
},
{
label: "文件名称",
label: '文件名称',
labelWidth: 120,
prop: "contentName",
prop: 'contentName',
search: true,
type: "input",
placeholder: "请输入文件名称",
type: 'input',
placeholder: '请输入文件名称',
searchLabelWidth: 120,
rules: [
{
required: true,
message: '请输入文件名称',
trigger: 'blur',
},
],
trigger: 'blur'
}
]
},
{
label: '案卷期限',
@ -186,9 +188,9 @@ export default {
{
required: true,
message: '请输入案卷期限',
trigger: 'blur',
},
],
trigger: 'blur'
}
]
},
{
label: '档案标识代码',
@ -202,16 +204,16 @@ export default {
},
props: {
label: 'dictLabel',
value: 'dictLabel',
value: 'dictLabel'
},
slot: true,
rules: [
{
required: true,
message: '请选择档案标识代码',
trigger: 'change',
},
],
trigger: 'change'
}
]
},
{
label: '归档责任单位',
@ -221,9 +223,9 @@ export default {
{
required: true,
message: '请输入归档责任单位',
trigger: 'blur',
},
],
trigger: 'blur'
}
]
},
{
label: '所属专业',
@ -233,9 +235,9 @@ export default {
{
required: true,
message: '请输入所属专业',
trigger: 'blur',
},
],
trigger: 'blur'
}
]
},
{
label: '文件分类标记',
@ -246,30 +248,30 @@ export default {
dicMethod: 'post', // POST
props: {
label: 'name',
value: 'id',
value: 'id'
},
slot: true,
rules: [
{
required: true,
message: '请选择文件分类标记',
trigger: 'change',
},
],
},
trigger: 'change'
}
]
}
]
},
treeDeptId: "0",
treeDeptId: '0',
treeLevel: 0,
treeData: [],
treeOption: {
nodeKey: "id",
nodeKey: 'id',
menu: false,
addBtn: false,
props: { label: "contentName", children: "children" },
props: { label: 'contentName', children: 'children' },
level: null,
defaultExpandAll: true,
defaultExpandAll: true
},
shareDialogVisible: false,
@ -278,7 +280,7 @@ export default {
selectedNodeName: '',
dialogVisible: false,
dialogType: "add",
dialogType: 'add',
editForm: { contentName: null, id: null, level: null, parentId: null, sort: null },
treeOptions: [], //
@ -287,22 +289,22 @@ export default {
menu: false,
addBtn: false,
searchShow: false,
nodeKey: "id",
nodeKey: 'id',
props: {
label: "contentName",
children: "children",
value: "id"
label: 'contentName',
children: 'children',
value: 'id'
},
defaultExpandAll: true,
multiple: false,
checkStrictly: true,
selectClick: true,
selectClick: true
},
sortTip: "",
sortTip: '',
dialogTitle: '',
treeKey: 0, //
selectedNodePath:'',
selectedNodePath: ''
};
},
@ -314,9 +316,9 @@ export default {
addBtn: this.validData(this.permission.post_add, false) && isLevel3,
viewBtn: this.validData(this.permission.post_view, 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() {
@ -343,7 +345,7 @@ export default {
this.treeData = convert(rows);
this.treeOptions = this.treeData; // treeOptions parentId
} catch (err) {
console.error("加载左树失败", err);
console.error('加载左树失败', err);
this.treeData = [];
this.treeOptions = [];
}
@ -458,7 +460,7 @@ export default {
return;
}
const api = this.dialogType === "add" ? addArchiveLeftApi : editArchiveLeftApi;
const api = this.dialogType === 'add' ? addArchiveLeftApi : editArchiveLeftApi;
await api(this.editForm);
this.dialogVisible = false;
this.$message({ type: 'success', message: '操作成功!' });
@ -508,7 +510,7 @@ export default {
}
} else {
this.editForm.level = 1;
this.sortTip = "";
this.sortTip = '';
}
},
@ -560,7 +562,7 @@ export default {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
message: '操作成功!'
});
done();
},
@ -579,7 +581,7 @@ export default {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
message: '操作成功!'
});
done();
},
@ -593,7 +595,7 @@ export default {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
type: 'warning'
})
.then(() => {
return delArchiveApi(row.id);
@ -602,7 +604,7 @@ export default {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
message: '操作成功!'
});
});
},
@ -610,7 +612,7 @@ export default {
if (type === 'add') {
this.$nextTick(() => {
this.form.path = this.selectedNodePath;
console.log("aaa=",this.form.path)
console.log('aaa=', this.form.path);
});
}
done();
@ -647,7 +649,7 @@ export default {
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
}
}
};
</script>
@ -656,31 +658,71 @@ export default {
.full-height {
height: 100%;
}
.box {
height: 800px;
}
.el-scrollbar {
height: 100%;
}
.box .el-scrollbar__wrap {
overflow: scroll;
}
.icon-op {
font-size: 16px;
margin-left: 6px;
color: #409EFF;
cursor: pointer;
}
.icon-op:hover {
color: #66b1ff;
}
.left-panel {
border-right: 1px solid #e6e6e6;
}
.right-panel {
padding-left: 16px;
}
.right-basic {
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>