diff --git a/ui/src/locales/lang/en-US/views/document.ts b/ui/src/locales/lang/en-US/views/document.ts index 320ce187a..5638c5f5c 100644 --- a/ui/src/locales/lang/en-US/views/document.ts +++ b/ui/src/locales/lang/en-US/views/document.ts @@ -159,6 +159,11 @@ export default { optimization: 'Model optimization', directly_return: 'Respond directly', }, + movePosition: { + title: 'Move position', + moveUp: 'Move up', + moveDown: 'Move down' + }, generateQuestion: { title: 'Generate Questions', successMessage: 'Successful', diff --git a/ui/src/locales/lang/zh-CN/views/document.ts b/ui/src/locales/lang/zh-CN/views/document.ts index 208d862a5..aaf6c9b30 100644 --- a/ui/src/locales/lang/zh-CN/views/document.ts +++ b/ui/src/locales/lang/zh-CN/views/document.ts @@ -156,6 +156,11 @@ export default { optimization: '模型优化', directly_return: '直接回答', }, + movePosition: { + title: '移动位置', + moveUp: '上移', + moveDown: '下移', + }, generateQuestion: { title: '生成问题', successMessage: '生成问题成功', diff --git a/ui/src/locales/lang/zh-Hant/views/document.ts b/ui/src/locales/lang/zh-Hant/views/document.ts index 08445f131..2e6f27fd0 100644 --- a/ui/src/locales/lang/zh-Hant/views/document.ts +++ b/ui/src/locales/lang/zh-Hant/views/document.ts @@ -156,6 +156,11 @@ export default { optimization: '模型優化', directly_return: '直接回答', }, + movePosition: { + title: '移動位置', + moveUp: '上移', + moveDown: '下移' + }, generateQuestion: { title: '生成問題', successMessage: '生成問題成功', diff --git a/ui/src/views/paragraph/component/ParagraphCard.vue b/ui/src/views/paragraph/component/ParagraphCard.vue index 09f61c0bd..0f92564d0 100644 --- a/ui/src/views/paragraph/component/ParagraphCard.vue +++ b/ui/src/views/paragraph/component/ParagraphCard.vue @@ -42,7 +42,7 @@ - + {{ $t('views.document.generateQuestion.title') }} {{ $t('views.document.setting.migration') }} + + + + + + + {{ $t('views.document.movePosition.title') }} + + + + + + + {{ $t('views.document.movePosition.moveUp') }} + + + {{ $t('views.document.movePosition.moveDown') }} + + + + + {{ $t('common.delete') }} @@ -94,6 +122,8 @@ import { t } from '@/locales' const props = defineProps<{ data: any disabled?: boolean + showMoveUp?: boolean + showMoveDown?: boolean }>() const route = useRoute() @@ -106,7 +136,7 @@ const apiType = computed(() => { return type as 'systemShare' | 'workspace' | 'systemManage' }) -const emit = defineEmits(['changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph']) +const emit = defineEmits(['changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move']) const loading = ref(false) const changeStateloading = ref(false) const show = ref(false) @@ -229,3 +259,11 @@ function refreshMigrateParagraph() { } } + + \ No newline at end of file diff --git a/ui/src/views/paragraph/index.vue b/ui/src/views/paragraph/index.vue index 782f42506..be71cbd93 100644 --- a/ui/src/views/paragraph/index.vue +++ b/ui/src/views/paragraph/index.vue @@ -109,9 +109,12 @@ onEnd(null, {paragraph_id: item.id,new_position: val==='up'?index-1:index+1}, index)" @refresh="refresh" @refreshMigrateParagraph="refreshMigrateParagraph" :disabled="shareDisabled" @@ -328,8 +331,8 @@ function openGenerateDialog(row?: any) { GenerateRelatedDialogRef.value.open(arr, 'paragraph') } -function onEnd(event?: any) { - const obj = { +function onEnd(event?: any, params?: any, index?: number) { + const obj =params ?? { paragraph_id: paragraphDetail.value[event.newIndex].id, // 当前拖动的段落ID new_position: paragraphDetail.value[event.newIndex + 1].position, // 新位置的段落位置 } @@ -339,6 +342,10 @@ function onEnd(event?: any) { obj, loading, ) + if(params) { + const movedItem = paragraphDetail.value.splice(index as number, 1)[0] + paragraphDetail.value.splice(params.new_position, 0, movedItem) + } } onMounted(() => {