mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-19 22:09:03 +08:00
fix: More button operations rename using drawer processing parameters (#10933)
#10591
This commit is contained in:
parent
5b0fccd19a
commit
a7342d6ef2
1 changed files with 35 additions and 14 deletions
|
|
@ -468,7 +468,7 @@
|
||||||
@cell-mouse-enter="showFavorite"
|
@cell-mouse-enter="showFavorite"
|
||||||
@cell-mouse-leave="hideFavorite"
|
@cell-mouse-leave="hideFavorite"
|
||||||
:heightDiff="heightDiff"
|
:heightDiff="heightDiff"
|
||||||
:right-buttons="buttons"
|
:right-buttons="rightButtons"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="30" />
|
<el-table-column type="selection" width="30" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
|
@ -590,7 +590,7 @@
|
||||||
></el-table-column>
|
></el-table-column>
|
||||||
<fu-table-operations
|
<fu-table-operations
|
||||||
:ellipsis="mobile ? 0 : 2"
|
:ellipsis="mobile ? 0 : 2"
|
||||||
:buttons="buttons"
|
:buttons="tableMoreButtons"
|
||||||
:label="$t('commons.table.operate')"
|
:label="$t('commons.table.operate')"
|
||||||
:min-width="mobile ? 'auto' : 200"
|
:min-width="mobile ? 'auto' : 200"
|
||||||
:fixed="mobile ? false : 'right'"
|
:fixed="mobile ? false : 'right'"
|
||||||
|
|
@ -1360,15 +1360,19 @@ const getWgetProcess = async () => {
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const openRename = (item: File.File) => {
|
const openRename = (item: File.File, source: String) => {
|
||||||
fileRename.path = req.path;
|
fileRename.path = req.path;
|
||||||
fileRename.oldName = item.name;
|
fileRename.oldName = item.name;
|
||||||
fileRename.newName = item.name;
|
if (source === 'right') {
|
||||||
isEdit.value = true;
|
fileRename.newName = item.name;
|
||||||
nextTick(() => {
|
isEdit.value = true;
|
||||||
getCurrentRename().focus();
|
nextTick(() => {
|
||||||
});
|
getCurrentRename().focus();
|
||||||
hideRightMenu();
|
});
|
||||||
|
hideRightMenu();
|
||||||
|
} else {
|
||||||
|
renameRef.value.acceptParams(fileRename);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onRenameBlur = (e: FocusEvent, row: File.File) => {
|
const onRenameBlur = (e: FocusEvent, row: File.File) => {
|
||||||
|
|
@ -1549,7 +1553,7 @@ const openWithVSCode = (row: File.File) => {
|
||||||
dialogVscodeOpenRef.value.acceptParams({ path: row.path + (row.isDir ? '' : ':1:1') });
|
dialogVscodeOpenRef.value.acceptParams({ path: row.path + (row.isDir ? '' : ':1:1') });
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttons = [
|
const beforeButtons = [
|
||||||
{
|
{
|
||||||
label: i18n.global.t('commons.button.open'),
|
label: i18n.global.t('commons.button.open'),
|
||||||
click: open,
|
click: open,
|
||||||
|
|
@ -1597,10 +1601,8 @@ const buttons = [
|
||||||
openBatchRole([row]);
|
openBatchRole([row]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
];
|
||||||
label: i18n.global.t('file.rename'),
|
const afterButtons = [
|
||||||
click: openRename,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: i18n.global.t('commons.button.delete'),
|
label: i18n.global.t('commons.button.delete'),
|
||||||
disabled: (row: File.File) => {
|
disabled: (row: File.File) => {
|
||||||
|
|
@ -1643,6 +1645,25 @@ const buttons = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const rightBtnRename = [
|
||||||
|
{
|
||||||
|
label: i18n.global.t('file.rename'),
|
||||||
|
click: (row: File.File) => {
|
||||||
|
openRename(row, 'right');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const moreBtnRename = [
|
||||||
|
{
|
||||||
|
label: i18n.global.t('file.rename'),
|
||||||
|
click: (row: File.File) => {
|
||||||
|
openRename(row, 'more');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const rightButtons = [...beforeButtons, ...rightBtnRename, ...afterButtons];
|
||||||
|
const tableMoreButtons = [...beforeButtons, ...moreBtnRename, ...afterButtons];
|
||||||
const openConvert = (item: File.File) => {
|
const openConvert = (item: File.File) => {
|
||||||
if (!ffmpegExist.value) {
|
if (!ffmpegExist.value) {
|
||||||
ElMessageBox.confirm(i18n.global.t('cronjob.library.noSuchApp', ['FFmpeg']), i18n.global.t('file.convert'), {
|
ElMessageBox.confirm(i18n.global.t('cronjob.library.noSuchApp', ['FFmpeg']), i18n.global.t('file.convert'), {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue