mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
Merge branch 'main' of github.com:maxkb-dev/maxkb
This commit is contained in:
commit
928ea66b9d
|
|
@ -0,0 +1,37 @@
|
|||
<template>
|
||||
<el-tooltip
|
||||
v-bind="$attrs"
|
||||
:disabled="!(containerWeight > contentWeight)"
|
||||
effect="dark"
|
||||
placement="bottom"
|
||||
>
|
||||
<div ref="tagLabel" class="auto-tooltip">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, nextTick } from 'vue'
|
||||
defineOptions({ name: 'AutoTooltip' })
|
||||
const tagLabel = ref()
|
||||
const containerWeight = ref(0)
|
||||
const contentWeight = ref(0)
|
||||
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
containerWeight.value = tagLabel.value?.scrollWidth
|
||||
contentWeight.value = tagLabel.value?.clientWidth
|
||||
})
|
||||
window.addEventListener('resize', function () {
|
||||
containerWeight.value = tagLabel.value?.scrollWidth
|
||||
contentWeight.value = tagLabel.value?.clientWidth
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.auto-tooltip {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -17,6 +17,7 @@ import dynamicsForm from './dynamics-form'
|
|||
import CardCheckbox from './card-checkbox/index.vue'
|
||||
import AiChat from './ai-chat/index.vue'
|
||||
import InfiniteScroll from './infinite-scroll/index.vue'
|
||||
import AutoTooltip from './auto-tooltip/index.vue'
|
||||
|
||||
export default {
|
||||
install(app: App) {
|
||||
|
|
@ -38,5 +39,6 @@ export default {
|
|||
app.component(CardCheckbox.name, CardCheckbox)
|
||||
app.component(AiChat.name, AiChat)
|
||||
app.component(InfiniteScroll.name, InfiniteScroll)
|
||||
app.component(AutoTooltip.name, AutoTooltip)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@
|
|||
<div class="cursor">
|
||||
<slot name="read">
|
||||
<div class="flex align-center" v-if="!isEdit">
|
||||
<span>{{ data }}</span>
|
||||
<auto-tooltip :content="data">
|
||||
{{ data }}
|
||||
</auto-tooltip>
|
||||
|
||||
<el-button @click.stop="editNameHandle" text v-if="showEditIcon">
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,8 @@
|
|||
<template>
|
||||
<el-tag class="tag-ellipsis flex-between mb-8" effect="plain" v-bind="$attrs">
|
||||
<el-tooltip
|
||||
:disabled="!isShowTooltip"
|
||||
effect="dark"
|
||||
:content="tooltipContent"
|
||||
placement="bottom"
|
||||
>
|
||||
<div ref="tagLabel">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</el-tooltip>
|
||||
<AutoTooltip :content="tooltipContent">
|
||||
<slot></slot>
|
||||
</AutoTooltip>
|
||||
</el-tag>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
|
@ -17,18 +10,6 @@ import { ref, computed, useSlots } from 'vue'
|
|||
defineOptions({ name: 'TagEllipsis' })
|
||||
const slots = useSlots()
|
||||
const tooltipContent = slots.default?.()?.[0].children || ''
|
||||
const tagLabel = ref()
|
||||
const isShowTooltip = computed(() => {
|
||||
const containerWeight = tagLabel.value?.scrollWidth
|
||||
const contentWeight = tagLabel.value?.clientWidth
|
||||
if (containerWeight > contentWeight) {
|
||||
/* 实际宽度 > 可视宽度 */
|
||||
return true
|
||||
} else {
|
||||
/* 否则为不溢出 */
|
||||
return false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
/* tag超出省略号 */
|
||||
|
|
@ -46,10 +27,10 @@ const isShowTooltip = computed(() => {
|
|||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
:deep(.el-tooltip__trigger) {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
// :deep(.el-tooltip__trigger) {
|
||||
// overflow: hidden;
|
||||
// white-space: nowrap;
|
||||
// text-overflow: ellipsis;
|
||||
// }
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -13,11 +13,12 @@
|
|||
<el-button v-if="datasetDetail.type === '1'" type="primary" @click="importDoc"
|
||||
>导入文档</el-button
|
||||
>
|
||||
<el-button @click="syncDataset" v-if="datasetDetail.type === '1'">同步知识库</el-button>
|
||||
<el-button
|
||||
@click="syncMulDocument"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
v-if="datasetDetail.type === '1'"
|
||||
>批量同步</el-button
|
||||
>同步文档</el-button
|
||||
>
|
||||
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0"
|
||||
>批量删除</el-button
|
||||
|
|
@ -149,6 +150,7 @@
|
|||
</app-table>
|
||||
</div>
|
||||
<ImportDocumentDialog ref="ImportDocumentDialogRef" :title="title" @refresh="refresh" />
|
||||
<SyncWebDialog ref="SyncWebDialogRef" @refresh="refresh" />
|
||||
</div>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
|
|
@ -158,6 +160,7 @@ import { useRouter, useRoute } from 'vue-router'
|
|||
import { ElTable } from 'element-plus'
|
||||
import documentApi from '@/api/document'
|
||||
import ImportDocumentDialog from './component/ImportDocumentDialog.vue'
|
||||
import SyncWebDialog from '@/views/dataset/component/SyncWebDialog.vue'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
|
|
@ -169,6 +172,8 @@ const {
|
|||
} = route as any
|
||||
|
||||
const { dataset } = useStore()
|
||||
|
||||
const SyncWebDialogRef = ref()
|
||||
const loading = ref(false)
|
||||
let interval: any
|
||||
const filterText = ref('')
|
||||
|
|
@ -187,6 +192,10 @@ const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
|||
const multipleSelection = ref<any[]>([])
|
||||
const title = ref('')
|
||||
|
||||
function syncDataset() {
|
||||
SyncWebDialogRef.value.open(id)
|
||||
}
|
||||
|
||||
function importDoc() {
|
||||
title.value = '导入文档'
|
||||
ImportDocumentDialogRef.value.open()
|
||||
|
|
@ -271,7 +280,7 @@ function syncMulDocument() {
|
|||
}
|
||||
})
|
||||
documentApi.delMulSyncDocument(id, arr, loading).then(() => {
|
||||
MsgSuccess('批量同步成功')
|
||||
MsgSuccess('同步文档成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ const props = withDefaults(
|
|||
{}
|
||||
)
|
||||
|
||||
const emit = defineEmits(['update:chartId', 'update:currentAbstract'])
|
||||
const emit = defineEmits(['update:chartId', 'update:currentAbstract', 'refresh'])
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
|
|
@ -106,6 +106,7 @@ watch(visible, (bool) => {
|
|||
if (!bool) {
|
||||
emit('update:chartId', '')
|
||||
emit('update:currentAbstract', '')
|
||||
emit('refresh')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@
|
|||
:application="detail"
|
||||
:pre_disable="pre_disable"
|
||||
:next_disable="next_disable"
|
||||
@refresh="refresh"
|
||||
/>
|
||||
</LayoutContainer>
|
||||
</template>
|
||||
|
|
@ -248,6 +249,10 @@ function getDetail() {
|
|||
})
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
getList()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
getDetail()
|
||||
|
|
|
|||
Loading…
Reference in New Issue