| | |
| | | <h3>文档管理</h3> |
| | | <el-button icon="Plus" size="small" type="primary" @click="append('')" |
| | | >新增 |
| | | </el-button |
| | | > |
| | | </el-button> |
| | | </div> |
| | | |
| | | <!-- 搜索框 --> |
| | |
| | | @node-click="handleNodeClick" |
| | | > |
| | | <template #default="{ node, data }"> |
| | | <div class="tree-node-content" @dblclick="headerDbClick(node,data)"> |
| | | <div |
| | | class="tree-node-content" |
| | | @dblclick="headerDbClick(node, data)" |
| | | > |
| | | <div class="node-icon"> |
| | | <el-icon |
| | | v-if="!node.isLeaf" |
| | |
| | | placeholder="请输入节点名称" |
| | | size="small" |
| | | @blur="(event) => handleInputBlur(event, data, node)" |
| | | @keyup.enter=" |
| | | (event) => handleInputBlur(event, data, node) |
| | | " |
| | | @keyup.enter="(event) => handleInputBlur(event, data, node)" |
| | | /> |
| | | </div> |
| | | <div v-show="!data.isEdit" class="node-actions"> |
| | |
| | | </div> |
| | | <div class="right"> |
| | | <el-row :gutter="24"> |
| | | <el-col :offset="20" :span="2" |
| | | <el-col :span="10"> |
| | | <div> |
| | | <el-input |
| | | style="float: left; width: 50%" |
| | | v-model="searchText" |
| | | placeholder="请输入关键字查询文件" |
| | | clearable |
| | | @input="handleSearch" |
| | | @clear="handleSearch" |
| | | > |
| | | <el-button :icon="Delete" type="danger" @click="delHandler">删除</el-button> |
| | | </el-col |
| | | <template #prefix> |
| | | <el-icon> |
| | | <Search /> |
| | | </el-icon> |
| | | </template> |
| | | <template #suffix> |
| | | <el-button @click="handleSearch" link style="border: none"> |
| | | <span>搜索</span> |
| | | </el-button> |
| | | </template> |
| | | </el-input> |
| | | </div> |
| | | </el-col> |
| | | <el-col :offset="10" :span="2"> |
| | | <el-button :icon="Delete" type="danger" @click="delHandler" |
| | | >删除</el-button |
| | | > |
| | | <el-col :span="2" |
| | | > |
| | | </el-col> |
| | | <el-col :span="2"> |
| | | <el-button |
| | | :disabled="!tableSwitch" |
| | | :icon="Plus" |
| | | type="primary" |
| | | @click="add" |
| | | >新增 |
| | | </el-button |
| | | > |
| | | </el-col |
| | | > |
| | | </el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <ETable |
| | | :border="true" |
| | |
| | | :row="row" |
| | | @centerDialogVisible="centerDialogVisible" |
| | | @submitForm="submitForm" |
| | | |
| | | > |
| | | </archiveDialog> |
| | | </el-card> |
| | |
| | | <script setup> |
| | | import {nextTick, onMounted, reactive, ref} from "vue"; |
| | | import ETable from "@/components/Table/ETable.vue"; |
| | | import {ElButton, ElIcon, ElInput, ElMessage, ElMessageBox} from "element-plus"; |
| | | import { |
| | | ElButton, |
| | | ElIcon, |
| | | ElInput, |
| | | ElMessage, |
| | | ElMessageBox, |
| | | } from "element-plus"; |
| | | import archiveDialog from "./mould/archiveDialog.vue"; |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import {Delete, Document, Folder, Plus, Search,} from "@element-plus/icons-vue"; |
| | | import {addOrEditTree, delArchive, delTree, getArchiveList, getTree,} from "@/api/archiveManagement"; |
| | | import { |
| | | Delete, |
| | | Document, |
| | | Folder, |
| | | Plus, |
| | | Search, |
| | | } from "@element-plus/icons-vue"; |
| | | import { |
| | | addOrEditTree, |
| | | delArchive, |
| | | delTree, |
| | | getArchiveList, |
| | | getTree, |
| | | } from "@/api/archiveManagement"; |
| | | |
| | | // ===== 响应式状态管理 ===== |
| | | const searchText = ref(""); |
| | | const dialogVisible = ref(false); |
| | | const loading = ref(false); |
| | | const tableData = ref([]); |
| | |
| | | ElMessage.success(msg); |
| | | }; |
| | | |
| | | // 搜索查询函数 |
| | | const handleSearch = () => { |
| | | queryParams.searchAll = searchText.value; |
| | | queryParams.current = 1; // 重置到第一页 |
| | | getArchiveListData(); |
| | | }; |
| | | |
| | | const showConfirm = (message, title = "确认操作") => { |
| | | return ElMessageBox.confirm(message, title, { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }); |
| | | }; |
| | | |
| | |
| | | const getList = async () => { |
| | | try { |
| | | const res = await getTree(); |
| | | treeData.value = res.code === 200 ? (res.data?.records || res.data || []) : []; |
| | | treeData.value = |
| | | res.code === 200 ? res.data?.records || res.data || [] : []; |
| | | } catch (error) { |
| | | handleError(error, "获取树结构数据失败"); |
| | | treeData.value = []; |
| | |
| | | |
| | | nextTick(() => { |
| | | if (archiveDialogs.value) { |
| | | const method = isEdit ? 'editForm' : 'initForm'; |
| | | if (typeof archiveDialogs.value[method] === 'function') { |
| | | const method = isEdit ? "editForm" : "initForm"; |
| | | if (typeof archiveDialogs.value[method] === "function") { |
| | | archiveDialogs.value[method](isEdit ? rowData : rowClickData.value); |
| | | } |
| | | } |
| | | }); |
| | | } catch (error) { |
| | | handleError(error, `打开${isEdit ? '编辑' : '新增'}界面失败`); |
| | | handleError(error, `打开${isEdit ? "编辑" : "新增"}界面失败`); |
| | | } |
| | | }; |
| | | |
| | |
| | | } |
| | | |
| | | try { |
| | | await showConfirm(`确定要删除选中的 ${selectedRows.length} 条记录吗?`, '删除确认'); |
| | | await showConfirm( |
| | | `确定要删除选中的 ${selectedRows.length} 条记录吗?`, |
| | | "删除确认" |
| | | ); |
| | | |
| | | const ids = selectedRows.map((row) => row.id); |
| | | const { code, msg } = await delArchive(ids); |
| | |
| | | showSuccess("删除成功"); |
| | | await getArchiveListData(); |
| | | selectedRows.splice(0, selectedRows.length); |
| | | |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | if (error !== "cancel") { |
| | | handleError(error, "删除操作失败"); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | try { |
| | | await showConfirm(`确定要删除节点 "${data.name}" 吗?`, '删除确认'); |
| | | await showConfirm(`确定要删除节点 "${data.name}" 吗?`, "删除确认"); |
| | | |
| | | const { code, msg } = await delTree([data.id]); |
| | | |
| | |
| | | |
| | | showSuccess("删除成功"); |
| | | await getList(); |
| | | |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | if (error !== "cancel") { |
| | | handleError(error, "删除节点失败"); |
| | | } |
| | | } |
| | |
| | | |
| | | const handleInputBlur = async (event, comeTreeData, node) => { |
| | | try { |
| | | if (!comeTreeData.isEdit || (event.relatedTarget?.tagName === "BUTTON")) return; |
| | | if (!comeTreeData.isEdit || event.relatedTarget?.tagName === "BUTTON") |
| | | return; |
| | | |
| | | comeTreeData.isEdit = false; |
| | | const newValue = newName.value.trim(); |
| | |
| | | comeTreeData.name = comeTreeData.name || "新节点"; |
| | | ElMessage.error("保存失败: " + (result.msg || "未知错误")); |
| | | } |
| | | |
| | | } catch (error) { |
| | | handleError(error, "保存节点失败"); |
| | | comeTreeData.name = comeTreeData.name || "新节点"; |