1046 lines
39 KiB
JavaScript
1046 lines
39 KiB
JavaScript
import { x as ElFormItem, y as ElInput, h as ElButton, w as ElForm, U as ElRow, V as ElCol, aC as ElCheckbox, aS as ElButtonGroup, i as ElIcon, aT as list_default, aU as grid_default, l as ElTooltip, al as ElTable, am as ElTableColumn, aV as folder_default, aW as document_default, u as ElEmpty, ao as vLoading, a9 as question_filled_default, j as ElBreadcrumb, k as ElBreadcrumbItem, T as ElCard, a1 as ElUpload, aX as upload_filled_default, v as ElDialog, E as ElMessage, D as ElMessageBox } from "./element-plus.CkEW9frc.js";
|
||
import { _ as __unplugin_components_19 } from "./index.fgd49PES.js";
|
||
import { J as defineComponent, t as onMounted, aP as resolveDirective, S as openBlock, _ as createElementBlock, a1 as createBaseVNode, $ as createVNode, a0 as withCtx, a_ as withKeys, a6 as withDirectives, T as createBlock, a9 as createTextVNode, aw as withModifiers, o as unref, aa as toDisplayString, a3 as normalizeClass, a8 as createCommentVNode, H as Fragment, ay as renderList, r as ref, ak as reactive, j as computed } from "./.pnpm.BW3P1y8f.js";
|
||
import { l as httpRequest } from "./index.CMd5bD1r.js";
|
||
import { _ as _export_sfc } from "./_plugin-vue_export-helper.1tPrXgE0.js";
|
||
import "./codemirror.CvJAcn2d.js";
|
||
const API_PATH = "/monitor/resource";
|
||
const ResourceAPI = {
|
||
/**
|
||
* 获取目录列表
|
||
* @param query 查询参数
|
||
*/
|
||
listResource(query) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/list`,
|
||
method: "get",
|
||
params: query
|
||
});
|
||
},
|
||
/**
|
||
* 上传文件
|
||
* @param formData 文件数据
|
||
*/
|
||
uploadFile(formData) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/upload`,
|
||
method: "post",
|
||
data: formData,
|
||
headers: { "Content-Type": "multipart/form-data" }
|
||
});
|
||
},
|
||
/**
|
||
* 下载文件
|
||
* @param path 文件路径
|
||
*/
|
||
downloadFile(path) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/download`,
|
||
method: "get",
|
||
params: { path },
|
||
responseType: "blob"
|
||
});
|
||
},
|
||
/**
|
||
* 删除文件或目录
|
||
* @param body 文件路径数组
|
||
*/
|
||
deleteResource(body) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/delete`,
|
||
method: "delete",
|
||
data: body
|
||
});
|
||
},
|
||
/**
|
||
* 移动文件或目录
|
||
* @param body 移动参数
|
||
*/
|
||
moveResource(body) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/move`,
|
||
method: "post",
|
||
data: body
|
||
});
|
||
},
|
||
/**
|
||
* 复制文件或目录
|
||
* @param body 复制参数
|
||
*/
|
||
copyResource(body) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/copy`,
|
||
method: "post",
|
||
data: body
|
||
});
|
||
},
|
||
/**
|
||
* 重命名文件或目录
|
||
* @param body 重命名参数
|
||
*/
|
||
renameResource(body) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/rename`,
|
||
method: "post",
|
||
data: body
|
||
});
|
||
},
|
||
/**
|
||
* 创建目录
|
||
* @param body 创建目录参数
|
||
*/
|
||
createDirectory(body) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/create-dir`,
|
||
method: "post",
|
||
data: body
|
||
});
|
||
},
|
||
/**
|
||
* 导出资源列表
|
||
* @param body 导出条件
|
||
*/
|
||
exportResource(body) {
|
||
return httpRequest({
|
||
url: `${API_PATH}/export`,
|
||
method: "post",
|
||
data: body,
|
||
responseType: "blob"
|
||
});
|
||
}
|
||
};
|
||
const _hoisted_1 = { class: "app-container" };
|
||
const _hoisted_2 = { class: "search-container" };
|
||
const _hoisted_3 = { class: "card-header" };
|
||
const _hoisted_4 = { class: "breadcrumb-container" };
|
||
const _hoisted_5 = { class: "data-table__toolbar" };
|
||
const _hoisted_6 = { class: "data-table__toolbar--left" };
|
||
const _hoisted_7 = { class: "data-table__toolbar--right" };
|
||
const _hoisted_8 = { class: "file-name" };
|
||
const _hoisted_9 = ["onClick"];
|
||
const _hoisted_10 = { key: 0 };
|
||
const _hoisted_11 = {
|
||
key: 1,
|
||
class: "grid-view"
|
||
};
|
||
const _hoisted_12 = ["onClick"];
|
||
const _hoisted_13 = { class: "item-icon" };
|
||
const _hoisted_14 = { class: "item-name" };
|
||
const _hoisted_15 = {
|
||
key: 0,
|
||
class: "item-size"
|
||
};
|
||
const _sfc_main = /* @__PURE__ */ defineComponent({
|
||
...{
|
||
name: "ResourceMonitor",
|
||
inheritAttrs: false
|
||
},
|
||
__name: "index",
|
||
setup(__props) {
|
||
const fileList = ref([]);
|
||
const loading = ref(false);
|
||
const selectedItems = ref([]);
|
||
const breadcrumbList = ref([{ name: "资源根目录", path: "/" }]);
|
||
const showHiddenFiles = ref(false);
|
||
const viewMode = ref("list");
|
||
const total = ref(0);
|
||
const isSearchMode = ref(false);
|
||
const queryFormRef = ref();
|
||
const currentPath = ref("/");
|
||
const pagination = reactive({
|
||
page_no: 1,
|
||
page_size: 10
|
||
});
|
||
const queryFormData = reactive({
|
||
name: void 0,
|
||
page_no: 1,
|
||
page_size: 10
|
||
});
|
||
const uploadDialogVisible = ref(false);
|
||
const createDirDialogVisible = ref(false);
|
||
const renameDialogVisible = ref(false);
|
||
const uploading = ref(false);
|
||
const uploadRef = ref();
|
||
const uploadFileList = ref([]);
|
||
const createDirForm = reactive({
|
||
dir_name: ""
|
||
});
|
||
const renameForm = reactive({
|
||
new_name: "",
|
||
old_path: ""
|
||
});
|
||
const currentQuery = computed(() => {
|
||
const query = {
|
||
include_hidden: showHiddenFiles.value,
|
||
page_no: pagination.page_no,
|
||
page_size: pagination.page_size
|
||
};
|
||
if (currentPath.value && currentPath.value !== "/") {
|
||
query.path = currentPath.value;
|
||
}
|
||
if (queryFormData.name) {
|
||
query.name = queryFormData.name;
|
||
}
|
||
return query;
|
||
});
|
||
async function loadFileList() {
|
||
var _a;
|
||
loading.value = true;
|
||
try {
|
||
const response = await ResourceAPI.listResource(currentQuery.value);
|
||
const pageResult = (_a = response.data) == null ? void 0 : _a.data;
|
||
if (pageResult && Array.isArray(pageResult.items)) {
|
||
fileList.value = pageResult.items;
|
||
total.value = pageResult.total;
|
||
if (pageResult.page_no !== void 0) {
|
||
pagination.page_no = pageResult.page_no;
|
||
}
|
||
if (pageResult.page_size !== void 0) {
|
||
pagination.page_size = pageResult.page_size;
|
||
}
|
||
} else {
|
||
fileList.value = [];
|
||
total.value = 0;
|
||
}
|
||
} catch (error) {
|
||
console.error("Load file list error:", error);
|
||
fileList.value = [];
|
||
total.value = 0;
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
function handleBreadcrumbClick(item) {
|
||
currentPath.value = item.path;
|
||
updateBreadcrumb();
|
||
loadFileList();
|
||
}
|
||
function updateBreadcrumb() {
|
||
if (currentPath.value === "/") {
|
||
breadcrumbList.value = [{ name: "资源根目录", path: "/" }];
|
||
return;
|
||
}
|
||
const parts = currentPath.value.split("/").filter((part) => part !== "");
|
||
breadcrumbList.value = [
|
||
{ name: "资源根目录", path: "/" },
|
||
...parts.map((part, index2) => ({
|
||
name: part,
|
||
path: parts.slice(0, index2 + 1).join("/")
|
||
}))
|
||
];
|
||
}
|
||
function handleFileNameClick(row) {
|
||
if (row.is_dir) {
|
||
if (currentPath.value === "/") {
|
||
currentPath.value = row.name;
|
||
} else {
|
||
currentPath.value = currentPath.value + "/" + row.name;
|
||
}
|
||
updateBreadcrumb();
|
||
loadFileList();
|
||
} else {
|
||
handleFilePreview(row);
|
||
}
|
||
}
|
||
function handleItemClick(item) {
|
||
if (item.is_dir) {
|
||
if (currentPath.value === "/") {
|
||
currentPath.value = item.name;
|
||
} else {
|
||
currentPath.value = currentPath.value + "/" + item.name;
|
||
}
|
||
updateBreadcrumb();
|
||
loadFileList();
|
||
} else {
|
||
handleFilePreview(item);
|
||
}
|
||
}
|
||
function handleFilePreview(file) {
|
||
let previewUrl = file.file_url;
|
||
if (previewUrl && !previewUrl.startsWith("http")) {
|
||
previewUrl = `${window.location.origin}${previewUrl}`;
|
||
}
|
||
window.open(previewUrl, "_blank");
|
||
}
|
||
function handleSelectionChange(selection) {
|
||
selectedItems.value = selection;
|
||
}
|
||
function handleUpload() {
|
||
uploadDialogVisible.value = true;
|
||
uploadFileList.value = [];
|
||
}
|
||
function handleUploadChange(file, fileList2) {
|
||
uploadFileList.value = fileList2;
|
||
}
|
||
async function handleUploadConfirm() {
|
||
if (uploadFileList.value.length === 0) {
|
||
ElMessage.warning("请选择要上传的文件");
|
||
return;
|
||
}
|
||
try {
|
||
uploading.value = true;
|
||
const formData = new FormData();
|
||
uploadFileList.value.forEach((file) => {
|
||
formData.append("file", file.raw);
|
||
});
|
||
const targetPath = currentPath.value === "/" ? "" : currentPath.value;
|
||
formData.append("target_path", targetPath);
|
||
await ResourceAPI.uploadFile(formData);
|
||
uploadDialogVisible.value = false;
|
||
loadFileList();
|
||
} catch (error) {
|
||
console.error("Upload error:", error);
|
||
} finally {
|
||
uploading.value = false;
|
||
}
|
||
}
|
||
function handleUploadClose() {
|
||
uploadDialogVisible.value = false;
|
||
uploadFileList.value = [];
|
||
}
|
||
function handleCreateDir() {
|
||
createDirForm.dir_name = "";
|
||
createDirDialogVisible.value = true;
|
||
}
|
||
async function handleCreateDirConfirm() {
|
||
if (!createDirForm.dir_name.trim()) {
|
||
ElMessage.warning("请输入文件夹名称");
|
||
return;
|
||
}
|
||
try {
|
||
const parentPath = currentPath.value === "/" ? "" : currentPath.value;
|
||
await ResourceAPI.createDirectory({
|
||
parent_path: parentPath,
|
||
dir_name: createDirForm.dir_name.trim()
|
||
});
|
||
createDirDialogVisible.value = false;
|
||
loadFileList();
|
||
} catch (error) {
|
||
console.error("Create directory error:", error);
|
||
}
|
||
}
|
||
async function handleRefresh() {
|
||
await loadFileList();
|
||
}
|
||
async function handleQuery() {
|
||
queryFormData.page_no = 1;
|
||
await loadFileList();
|
||
}
|
||
async function handleResetQuery() {
|
||
queryFormRef.value.resetFields();
|
||
queryFormData.page_no = 1;
|
||
isSearchMode.value = false;
|
||
await loadFileList();
|
||
}
|
||
function handleShowHiddenChange() {
|
||
loadFileList();
|
||
}
|
||
async function handleDownload(item) {
|
||
try {
|
||
const response = await ResourceAPI.downloadFile(item.file_url);
|
||
const blob = response.data;
|
||
const url = window.URL.createObjectURL(blob);
|
||
const a = document.createElement("a");
|
||
a.href = url;
|
||
a.download = item.name;
|
||
document.body.appendChild(a);
|
||
a.click();
|
||
document.body.removeChild(a);
|
||
window.URL.revokeObjectURL(url);
|
||
} catch (error) {
|
||
console.error("Download error:", error);
|
||
}
|
||
}
|
||
function handleRename(item) {
|
||
renameForm.old_path = item.file_url;
|
||
renameForm.new_name = item.name;
|
||
renameDialogVisible.value = true;
|
||
}
|
||
async function handleRenameConfirm() {
|
||
if (!renameForm.new_name.trim()) {
|
||
ElMessage.warning("请输入新名称");
|
||
return;
|
||
}
|
||
try {
|
||
await ResourceAPI.renameResource({
|
||
old_path: renameForm.old_path,
|
||
new_name: renameForm.new_name.trim()
|
||
});
|
||
renameDialogVisible.value = false;
|
||
loadFileList();
|
||
} catch (error) {
|
||
console.error("Rename error:", error);
|
||
}
|
||
}
|
||
async function handleDelete(item) {
|
||
try {
|
||
await ElMessageBox.confirm(`确定要删除 ${item.name} 吗?`, "确认删除", {
|
||
confirmButtonText: "确定",
|
||
cancelButtonText: "取消",
|
||
type: "warning"
|
||
});
|
||
await ResourceAPI.deleteResource([item.file_url]);
|
||
loadFileList();
|
||
} catch (error) {
|
||
if (error !== "cancel") {
|
||
console.error("Delete error:", error);
|
||
}
|
||
}
|
||
}
|
||
function handlePagination(params) {
|
||
pagination.page_no = params.page;
|
||
pagination.page_size = params.limit;
|
||
loadFileList();
|
||
}
|
||
async function handleBatchDelete() {
|
||
if (selectedItems.value.length === 0) {
|
||
ElMessage.warning("请选择要删除的文件");
|
||
return;
|
||
}
|
||
try {
|
||
await ElMessageBox.confirm(
|
||
`确定要删除选中的 ${selectedItems.value.length} 个文件吗?`,
|
||
"确认删除",
|
||
{
|
||
confirmButtonText: "确定",
|
||
cancelButtonText: "取消",
|
||
type: "warning"
|
||
}
|
||
);
|
||
const paths = selectedItems.value.map((item) => item.file_url);
|
||
await ResourceAPI.deleteResource(paths);
|
||
loadFileList();
|
||
} catch (error) {
|
||
if (error !== "cancel") {
|
||
console.error("Batch delete error:", error);
|
||
}
|
||
}
|
||
}
|
||
function formatFileSize(size) {
|
||
if (!size || size === null) return "-";
|
||
const units = ["B", "KB", "MB", "GB", "TB"];
|
||
let unitIndex = 0;
|
||
let fileSize = size;
|
||
while (fileSize >= 1024 && unitIndex < units.length - 1) {
|
||
fileSize /= 1024;
|
||
unitIndex++;
|
||
}
|
||
return `${fileSize.toFixed(1)} ${units[unitIndex]}`;
|
||
}
|
||
onMounted(() => {
|
||
loadFileList();
|
||
});
|
||
return (_ctx, _cache) => {
|
||
const _component_el_input = ElInput;
|
||
const _component_el_form_item = ElFormItem;
|
||
const _component_el_button = ElButton;
|
||
const _component_el_form = ElForm;
|
||
const _component_el_tooltip = ElTooltip;
|
||
const _component_el_breadcrumb_item = ElBreadcrumbItem;
|
||
const _component_el_breadcrumb = ElBreadcrumb;
|
||
const _component_el_col = ElCol;
|
||
const _component_el_row = ElRow;
|
||
const _component_el_checkbox = ElCheckbox;
|
||
const _component_el_icon = ElIcon;
|
||
const _component_el_button_group = ElButtonGroup;
|
||
const _component_el_empty = ElEmpty;
|
||
const _component_el_table_column = ElTableColumn;
|
||
const _component_el_table = ElTable;
|
||
const _component_Pagination = __unplugin_components_19;
|
||
const _component_el_card = ElCard;
|
||
const _component_el_upload = ElUpload;
|
||
const _component_el_dialog = ElDialog;
|
||
const _directive_hasPerm = resolveDirective("hasPerm");
|
||
const _directive_loading = vLoading;
|
||
return openBlock(), createElementBlock("div", _hoisted_1, [
|
||
createBaseVNode("div", _hoisted_2, [
|
||
createVNode(_component_el_form, {
|
||
ref_key: "queryFormRef",
|
||
ref: queryFormRef,
|
||
model: queryFormData,
|
||
inline: true,
|
||
"label-suffix": ":",
|
||
onSubmit: withModifiers(handleQuery, ["prevent"])
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_form_item, {
|
||
prop: "name",
|
||
label: "关键词"
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_input, {
|
||
modelValue: queryFormData.name,
|
||
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => queryFormData.name = $event),
|
||
placeholder: "请输入文件名或目录名",
|
||
clearable: "",
|
||
style: { "width": "200px" },
|
||
onKeyup: withKeys(handleQuery, ["enter"])
|
||
}, null, 8, ["modelValue"])
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_form_item, { class: "search-buttons" }, {
|
||
default: withCtx(() => [
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "primary",
|
||
icon: "search",
|
||
"native-type": "submit"
|
||
}, {
|
||
default: withCtx(() => [..._cache[15] || (_cache[15] = [
|
||
createTextVNode(" 查询 ", -1)
|
||
])]),
|
||
_: 1
|
||
})), [
|
||
[_directive_hasPerm, ["module_monitor:resource:query"]]
|
||
]),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
icon: "refresh",
|
||
onClick: handleResetQuery
|
||
}, {
|
||
default: withCtx(() => [..._cache[16] || (_cache[16] = [
|
||
createTextVNode(" 重置 ", -1)
|
||
])]),
|
||
_: 1
|
||
})), [
|
||
[_directive_hasPerm, ["module_monitor:resource:query"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}, 8, ["model"])
|
||
]),
|
||
createVNode(_component_el_card, { class: "data-table" }, {
|
||
header: withCtx(() => [
|
||
createBaseVNode("div", _hoisted_3, [
|
||
createBaseVNode("span", null, [
|
||
createVNode(_component_el_tooltip, { content: "资源文件管理系统: 点击路径可以快速返回上级目录" }, {
|
||
default: withCtx(() => [
|
||
createVNode(unref(question_filled_default), { class: "w-4 h-4 mx-1" })
|
||
]),
|
||
_: 1
|
||
}),
|
||
_cache[17] || (_cache[17] = createTextVNode(" 文件列表(当前路径): ", -1))
|
||
]),
|
||
createBaseVNode("div", _hoisted_4, [
|
||
_cache[18] || (_cache[18] = createBaseVNode("span", { class: "breadcrumb-label" }, null, -1)),
|
||
createVNode(_component_el_breadcrumb, { separator: "/" }, {
|
||
default: withCtx(() => [
|
||
(openBlock(true), createElementBlock(Fragment, null, renderList(breadcrumbList.value, (item, index2) => {
|
||
return openBlock(), createBlock(_component_el_breadcrumb_item, {
|
||
key: index2,
|
||
class: normalizeClass({ "is-link": index2 < breadcrumbList.value.length - 1 }),
|
||
onClick: ($event) => handleBreadcrumbClick(item)
|
||
}, {
|
||
default: withCtx(() => [
|
||
createTextVNode(toDisplayString(item.name), 1)
|
||
]),
|
||
_: 2
|
||
}, 1032, ["class", "onClick"]);
|
||
}), 128))
|
||
]),
|
||
_: 1
|
||
})
|
||
])
|
||
])
|
||
]),
|
||
footer: withCtx(() => [
|
||
createVNode(_component_Pagination, {
|
||
total: total.value,
|
||
"onUpdate:total": _cache[4] || (_cache[4] = ($event) => total.value = $event),
|
||
page: pagination.page_no,
|
||
"onUpdate:page": _cache[5] || (_cache[5] = ($event) => pagination.page_no = $event),
|
||
limit: pagination.page_size,
|
||
"onUpdate:limit": _cache[6] || (_cache[6] = ($event) => pagination.page_size = $event),
|
||
onPagination: handlePagination
|
||
}, null, 8, ["total", "page", "limit"])
|
||
]),
|
||
default: withCtx(() => [
|
||
createBaseVNode("div", _hoisted_5, [
|
||
createBaseVNode("div", _hoisted_6, [
|
||
createVNode(_component_el_row, { gutter: 10 }, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_col, { span: 1.5 }, {
|
||
default: withCtx(() => [
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "success",
|
||
icon: "plus",
|
||
onClick: handleUpload
|
||
}, {
|
||
default: withCtx(() => [..._cache[19] || (_cache[19] = [
|
||
createTextVNode(" 上传文件 ", -1)
|
||
])]),
|
||
_: 1
|
||
})), [
|
||
[_directive_hasPerm, ["module_monitor:resource:upload"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_col, { span: 1.5 }, {
|
||
default: withCtx(() => [
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "primary",
|
||
icon: "folder-add",
|
||
onClick: handleCreateDir
|
||
}, {
|
||
default: withCtx(() => [..._cache[20] || (_cache[20] = [
|
||
createTextVNode(" 新建文件夹 ", -1)
|
||
])]),
|
||
_: 1
|
||
})), [
|
||
[_directive_hasPerm, ["module_monitor:resource:create_dir"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_col, { span: 1.5 }, {
|
||
default: withCtx(() => [
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "danger",
|
||
icon: "delete",
|
||
disabled: selectedItems.value.length === 0,
|
||
onClick: handleBatchDelete
|
||
}, {
|
||
default: withCtx(() => [..._cache[21] || (_cache[21] = [
|
||
createTextVNode(" 批量删除 ", -1)
|
||
])]),
|
||
_: 1
|
||
}, 8, ["disabled"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:delete"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
createBaseVNode("div", _hoisted_7, [
|
||
createVNode(_component_el_row, { gutter: 10 }, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_col, { span: 1.5 }, {
|
||
default: withCtx(() => [
|
||
withDirectives((openBlock(), createBlock(_component_el_checkbox, {
|
||
modelValue: showHiddenFiles.value,
|
||
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => showHiddenFiles.value = $event),
|
||
onChange: handleShowHiddenChange
|
||
}, {
|
||
default: withCtx(() => [..._cache[22] || (_cache[22] = [
|
||
createTextVNode(" 显示隐藏文件 ", -1)
|
||
])]),
|
||
_: 1
|
||
}, 8, ["modelValue"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:query"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_col, { span: 1.5 }, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_button_group, null, {
|
||
default: withCtx(() => [
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: viewMode.value === "list" ? "primary" : "",
|
||
onClick: _cache[2] || (_cache[2] = ($event) => viewMode.value = "list")
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_icon, null, {
|
||
default: withCtx(() => [
|
||
createVNode(unref(list_default))
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}, 8, ["type"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:query"]]
|
||
]),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: viewMode.value === "grid" ? "primary" : "",
|
||
onClick: _cache[3] || (_cache[3] = ($event) => viewMode.value = "grid")
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_icon, null, {
|
||
default: withCtx(() => [
|
||
createVNode(unref(grid_default))
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}, 8, ["type"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:query"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_col, { span: 1.5 }, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_tooltip, { content: "刷新" }, {
|
||
default: withCtx(() => [
|
||
withDirectives(createVNode(_component_el_button, {
|
||
type: "primary",
|
||
icon: "refresh",
|
||
circle: "",
|
||
onClick: handleRefresh
|
||
}, null, 512), [
|
||
[_directive_hasPerm, ["module_monitor:resource:query"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
})
|
||
])
|
||
]),
|
||
viewMode.value === "list" ? withDirectives((openBlock(), createBlock(_component_el_table, {
|
||
key: 0,
|
||
ref: "dataTableRef",
|
||
data: fileList.value,
|
||
"row-key": "file_url",
|
||
class: "data-table__content",
|
||
height: "500",
|
||
"max-height": "500",
|
||
border: "",
|
||
stripe: "",
|
||
onSelectionChange: handleSelectionChange
|
||
}, {
|
||
empty: withCtx(() => [
|
||
createVNode(_component_el_empty, {
|
||
"image-size": 80,
|
||
description: "暂无数据"
|
||
})
|
||
]),
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_table_column, {
|
||
type: "selection",
|
||
"min-width": "40",
|
||
align: "center"
|
||
}),
|
||
createVNode(_component_el_table_column, {
|
||
type: "index",
|
||
fixed: "",
|
||
label: "序号",
|
||
"min-width": "50"
|
||
}, {
|
||
default: withCtx((scope) => [
|
||
createTextVNode(toDisplayString((queryFormData.page_no - 1) * queryFormData.page_size + scope.$index + 1), 1)
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_table_column, {
|
||
label: "名称",
|
||
prop: "name",
|
||
"min-width": "200"
|
||
}, {
|
||
default: withCtx(({ row }) => [
|
||
createBaseVNode("div", _hoisted_8, [
|
||
createVNode(_component_el_icon, { class: "file-icon" }, {
|
||
default: withCtx(() => [
|
||
row.is_dir ? (openBlock(), createBlock(unref(folder_default), { key: 0 })) : (openBlock(), createBlock(unref(document_default), { key: 1 }))
|
||
]),
|
||
_: 2
|
||
}, 1024),
|
||
createBaseVNode("span", {
|
||
class: normalizeClass({ "file-name-clickable": true }),
|
||
onClick: ($event) => handleFileNameClick(row)
|
||
}, toDisplayString(row.name), 9, _hoisted_9)
|
||
])
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_table_column, {
|
||
label: "大小",
|
||
prop: "size",
|
||
"min-width": "120",
|
||
align: "center"
|
||
}, {
|
||
default: withCtx(({ row }) => [
|
||
!row.is_dir ? (openBlock(), createElementBlock("span", _hoisted_10, toDisplayString(formatFileSize(row.size)), 1)) : createCommentVNode("", true)
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_table_column, {
|
||
label: "修改时间",
|
||
prop: "modified_time",
|
||
"min-width": "180",
|
||
sortable: ""
|
||
}),
|
||
createVNode(_component_el_table_column, {
|
||
fixed: "right",
|
||
label: "操作",
|
||
align: "center",
|
||
"min-width": "200",
|
||
class: "search-buttons"
|
||
}, {
|
||
default: withCtx(({ row }) => [
|
||
!row.is_dir ? withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
key: 0,
|
||
type: "success",
|
||
size: "small",
|
||
link: "",
|
||
icon: "download",
|
||
onClick: ($event) => handleDownload(row)
|
||
}, {
|
||
default: withCtx(() => [..._cache[23] || (_cache[23] = [
|
||
createTextVNode(" 下载 ", -1)
|
||
])]),
|
||
_: 1
|
||
}, 8, ["onClick"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:download"]]
|
||
]) : createCommentVNode("", true),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "primary",
|
||
size: "small",
|
||
link: "",
|
||
icon: "edit",
|
||
onClick: ($event) => handleRename(row)
|
||
}, {
|
||
default: withCtx(() => [..._cache[24] || (_cache[24] = [
|
||
createTextVNode(" 重命名 ", -1)
|
||
])]),
|
||
_: 1
|
||
}, 8, ["onClick"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:rename"]]
|
||
]),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "danger",
|
||
size: "small",
|
||
link: "",
|
||
icon: "delete",
|
||
onClick: ($event) => handleDelete(row)
|
||
}, {
|
||
default: withCtx(() => [..._cache[25] || (_cache[25] = [
|
||
createTextVNode(" 删除 ", -1)
|
||
])]),
|
||
_: 1
|
||
}, 8, ["onClick"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:delete"]]
|
||
])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}, 8, ["data"])), [
|
||
[_directive_loading, loading.value]
|
||
]) : (openBlock(), createElementBlock("div", _hoisted_11, [
|
||
(openBlock(true), createElementBlock(Fragment, null, renderList(fileList.value, (item) => {
|
||
return openBlock(), createElementBlock("div", {
|
||
key: item.file_url,
|
||
class: "grid-item",
|
||
onClick: ($event) => handleItemClick(item)
|
||
}, [
|
||
createBaseVNode("div", _hoisted_13, [
|
||
item.is_dir ? (openBlock(), createBlock(_component_el_icon, {
|
||
key: 0,
|
||
size: "48"
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(unref(folder_default))
|
||
]),
|
||
_: 1
|
||
})) : (openBlock(), createBlock(_component_el_icon, {
|
||
key: 1,
|
||
size: "48"
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(unref(document_default))
|
||
]),
|
||
_: 1
|
||
}))
|
||
]),
|
||
createBaseVNode("div", _hoisted_14, toDisplayString(item.name), 1),
|
||
!item.is_dir ? (openBlock(), createElementBlock("div", _hoisted_15, toDisplayString(formatFileSize(item.size)), 1)) : createCommentVNode("", true)
|
||
], 8, _hoisted_12);
|
||
}), 128))
|
||
]))
|
||
]),
|
||
_: 1
|
||
}),
|
||
createVNode(_component_el_dialog, {
|
||
modelValue: uploadDialogVisible.value,
|
||
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => uploadDialogVisible.value = $event),
|
||
title: "上传文件",
|
||
width: "500px",
|
||
"before-close": handleUploadClose
|
||
}, {
|
||
footer: withCtx(() => [
|
||
createVNode(_component_el_button, {
|
||
onClick: _cache[7] || (_cache[7] = ($event) => uploadDialogVisible.value = false)
|
||
}, {
|
||
default: withCtx(() => [..._cache[28] || (_cache[28] = [
|
||
createTextVNode("取消", -1)
|
||
])]),
|
||
_: 1
|
||
}),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "primary",
|
||
loading: uploading.value,
|
||
onClick: handleUploadConfirm
|
||
}, {
|
||
default: withCtx(() => [..._cache[29] || (_cache[29] = [
|
||
createTextVNode(" 确定上传 ", -1)
|
||
])]),
|
||
_: 1
|
||
}, 8, ["loading"])), [
|
||
[_directive_hasPerm, ["module_monitor:resource:upload"]]
|
||
])
|
||
]),
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_upload, {
|
||
ref_key: "uploadRef",
|
||
ref: uploadRef,
|
||
"auto-upload": false,
|
||
multiple: true,
|
||
"file-list": uploadFileList.value,
|
||
drag: "",
|
||
onChange: handleUploadChange
|
||
}, {
|
||
tip: withCtx(() => [..._cache[26] || (_cache[26] = [
|
||
createBaseVNode("div", {
|
||
class: "el-upload__tip",
|
||
style: { "color": "red" }
|
||
}, " 不支持多文件上传,单个文件不超过100MB,多文件上传,取最后一个文件上传 ", -1)
|
||
])]),
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_icon, { class: "el-icon--upload" }, {
|
||
default: withCtx(() => [
|
||
createVNode(unref(upload_filled_default))
|
||
]),
|
||
_: 1
|
||
}),
|
||
_cache[27] || (_cache[27] = createBaseVNode("div", { class: "el-upload__text" }, [
|
||
createTextVNode(" 将文件拖到此处,或 "),
|
||
createBaseVNode("em", null, "点击上传")
|
||
], -1))
|
||
]),
|
||
_: 1
|
||
}, 8, ["file-list"])
|
||
]),
|
||
_: 1
|
||
}, 8, ["modelValue"]),
|
||
createVNode(_component_el_dialog, {
|
||
modelValue: createDirDialogVisible.value,
|
||
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => createDirDialogVisible.value = $event),
|
||
title: "新建文件夹",
|
||
width: "400px"
|
||
}, {
|
||
footer: withCtx(() => [
|
||
createVNode(_component_el_button, {
|
||
onClick: _cache[10] || (_cache[10] = ($event) => createDirDialogVisible.value = false)
|
||
}, {
|
||
default: withCtx(() => [..._cache[30] || (_cache[30] = [
|
||
createTextVNode("取消", -1)
|
||
])]),
|
||
_: 1
|
||
}),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "primary",
|
||
onClick: handleCreateDirConfirm
|
||
}, {
|
||
default: withCtx(() => [..._cache[31] || (_cache[31] = [
|
||
createTextVNode(" 确定 ", -1)
|
||
])]),
|
||
_: 1
|
||
})), [
|
||
[_directive_hasPerm, ["module_monitor:resource:create_dir"]]
|
||
])
|
||
]),
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_form, {
|
||
model: createDirForm,
|
||
"label-width": "80px"
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_form_item, {
|
||
label: "文件夹名",
|
||
required: ""
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_input, {
|
||
modelValue: createDirForm.dir_name,
|
||
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => createDirForm.dir_name = $event),
|
||
placeholder: "请输入文件夹名称",
|
||
onKeyup: withKeys(handleCreateDirConfirm, ["enter"])
|
||
}, null, 8, ["modelValue"])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}, 8, ["model"])
|
||
]),
|
||
_: 1
|
||
}, 8, ["modelValue"]),
|
||
createVNode(_component_el_dialog, {
|
||
modelValue: renameDialogVisible.value,
|
||
"onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => renameDialogVisible.value = $event),
|
||
title: "重命名",
|
||
width: "400px"
|
||
}, {
|
||
footer: withCtx(() => [
|
||
createVNode(_component_el_button, {
|
||
onClick: _cache[13] || (_cache[13] = ($event) => renameDialogVisible.value = false)
|
||
}, {
|
||
default: withCtx(() => [..._cache[32] || (_cache[32] = [
|
||
createTextVNode("取消", -1)
|
||
])]),
|
||
_: 1
|
||
}),
|
||
withDirectives((openBlock(), createBlock(_component_el_button, {
|
||
type: "primary",
|
||
onClick: handleRenameConfirm
|
||
}, {
|
||
default: withCtx(() => [..._cache[33] || (_cache[33] = [
|
||
createTextVNode(" 确定 ", -1)
|
||
])]),
|
||
_: 1
|
||
})), [
|
||
[_directive_hasPerm, ["module_monitor:resource:rename"]]
|
||
])
|
||
]),
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_form, {
|
||
model: renameForm,
|
||
"label-width": "80px"
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_form_item, {
|
||
label: "新名称",
|
||
required: ""
|
||
}, {
|
||
default: withCtx(() => [
|
||
createVNode(_component_el_input, {
|
||
modelValue: renameForm.new_name,
|
||
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => renameForm.new_name = $event),
|
||
placeholder: "请输入新名称",
|
||
onKeyup: withKeys(handleRenameConfirm, ["enter"])
|
||
}, null, 8, ["modelValue"])
|
||
]),
|
||
_: 1
|
||
})
|
||
]),
|
||
_: 1
|
||
}, 8, ["model"])
|
||
]),
|
||
_: 1
|
||
}, 8, ["modelValue"])
|
||
]);
|
||
};
|
||
}
|
||
});
|
||
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3f5db10f"]]);
|
||
export {
|
||
index as default
|
||
};
|