feat: breadcrumb
This commit is contained in:
parent
37c9ef3087
commit
b656d05036
@ -1,7 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="breadcrumb ml-4 mt-4 mb-12 flex">
|
<div class="breadcrumb ml-4 mt-4 mb-12 flex">
|
||||||
<back-button :to="activeMenu" class="mt-4"></back-button>
|
<back-button :to="activeMenu" class="mt-4"></back-button>
|
||||||
<el-dropdown
|
<div class="flex align-center">
|
||||||
|
<el-avatar
|
||||||
|
v-if="isApplication && isAppIcon(current?.icon)"
|
||||||
|
shape="square"
|
||||||
|
:size="24"
|
||||||
|
style="background: none"
|
||||||
|
class="mr-8"
|
||||||
|
>
|
||||||
|
<img :src="current?.icon" alt="" />
|
||||||
|
</el-avatar>
|
||||||
|
<LogoIcon
|
||||||
|
v-else-if="isApplication"
|
||||||
|
height="28px"
|
||||||
|
style="width: 28px; height: 28px; display: block"
|
||||||
|
class="mr-8"
|
||||||
|
/>
|
||||||
|
<KnowledgeIcon v-else-if="isKnowledge" :type="current?.type" class="mr-8" />
|
||||||
|
|
||||||
|
<div class="ellipsis" :title="current?.name">{{ current?.name }}</div>
|
||||||
|
</div>
|
||||||
|
<!-- <el-dropdown
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@command="changeMenu"
|
@command="changeMenu"
|
||||||
@ -19,13 +39,10 @@
|
|||||||
>
|
>
|
||||||
<img :src="current?.icon" alt="" />
|
<img :src="current?.icon" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<LogoIcon
|
||||||
v-else-if="isApplication"
|
v-else-if="isApplication"
|
||||||
:name="current?.name"
|
height="28px"
|
||||||
pinyinColor
|
style="width: 28px; height: 28px; display: block"
|
||||||
shape="square"
|
|
||||||
class="mr-8"
|
|
||||||
:size="24"
|
|
||||||
/>
|
/>
|
||||||
<KnowledgeIcon v-else-if="isKnowledge" :type="current?.type" />
|
<KnowledgeIcon v-else-if="isKnowledge" :type="current?.type" />
|
||||||
|
|
||||||
@ -91,7 +108,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -120,10 +137,10 @@ const list = ref<any[]>([])
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
const breadcrumbData = computed(() => common.breadcrumb)
|
const breadcrumbData = computed(() => common.breadcrumb)
|
||||||
|
const current = ref<any>(null)
|
||||||
const current = computed(() => {
|
// const current = computed(() => {
|
||||||
return list.value?.filter((v) => v.id === id)?.[0]
|
// return list.value?.filter((v) => v.id === id)?.[0]
|
||||||
})
|
// })
|
||||||
|
|
||||||
const isApplication = computed(() => {
|
const isApplication = computed(() => {
|
||||||
return activeMenu.includes('application')
|
return activeMenu.includes('application')
|
||||||
@ -132,6 +149,32 @@ const isKnowledge = computed(() => {
|
|||||||
return activeMenu.includes('knowledge')
|
return activeMenu.includes('knowledge')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function getKnowledgeDetail() {
|
||||||
|
loading.value = true
|
||||||
|
knowledge
|
||||||
|
.asyncGetKnowledgeDetail(id)
|
||||||
|
.then((res: any) => {
|
||||||
|
current.value = res.data
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function getApplicationDetail() {
|
||||||
|
loading.value = true
|
||||||
|
application
|
||||||
|
.asyncGetApplicationDetail(id)
|
||||||
|
.then((res: any) => {
|
||||||
|
current.value = res.data
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function openCreateDialog() {
|
function openCreateDialog() {
|
||||||
if (isKnowledge.value) {
|
if (isKnowledge.value) {
|
||||||
CreateKnowledgeDialogRef.value.open()
|
CreateKnowledgeDialogRef.value.open()
|
||||||
@ -192,15 +235,20 @@ function refresh() {
|
|||||||
common.saveBreadcrumb(null)
|
common.saveBreadcrumb(null)
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!breadcrumbData.value) {
|
|
||||||
if (isKnowledge.value) {
|
if (isKnowledge.value) {
|
||||||
getKnowledge()
|
getKnowledgeDetail()
|
||||||
} else if (isApplication.value) {
|
} else if (isApplication.value) {
|
||||||
getApplication()
|
getApplicationDetail()
|
||||||
}
|
|
||||||
} else {
|
|
||||||
list.value = breadcrumbData.value
|
|
||||||
}
|
}
|
||||||
|
// if (!breadcrumbData.value) {
|
||||||
|
// if (isKnowledge.value) {
|
||||||
|
// getKnowledge()
|
||||||
|
// } else if (isApplication.value) {
|
||||||
|
// getApplication()
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// list.value = breadcrumbData.value
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="sidebar p-8">
|
<div class="sidebar p-8">
|
||||||
<!-- <div v-if="showBreadcrumb">
|
<div v-if="showBreadcrumb">
|
||||||
<AppBreadcrumb />
|
<AppBreadcrumb />
|
||||||
</div> -->
|
</div>
|
||||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||||
<el-menu :default-active="activeMenu" router>
|
<el-menu :default-active="activeMenu" router>
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
|
|||||||
@ -47,6 +47,18 @@ const useKnowledgeStore = defineStore('knowledge', {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
async asyncGetKnowledgeDetail(knowledge_id: string, loading?: Ref<boolean>) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
knowledgeApi
|
||||||
|
.getKnowledgeDetail(knowledge_id, loading)
|
||||||
|
.then((data) => {
|
||||||
|
resolve(data)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
// async asyncGetTreeRootKnowledge(loading?: Ref<boolean>) {
|
// async asyncGetTreeRootKnowledge(loading?: Ref<boolean>) {
|
||||||
// const folder = useFolderStore()
|
// const folder = useFolderStore()
|
||||||
// return Promise.all([
|
// return Promise.all([
|
||||||
@ -87,18 +99,6 @@ const useKnowledgeStore = defineStore('knowledge', {
|
|||||||
// return Promise.reject(error)
|
// return Promise.reject(error)
|
||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
async asyncGetKnowledgeDetail(knowledge_id: string, loading?: Ref<boolean>) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
knowledgeApi
|
|
||||||
.getKnowledgeDetail(knowledge_id, loading)
|
|
||||||
.then((data) => {
|
|
||||||
resolve(data)
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -11,13 +11,7 @@
|
|||||||
>
|
>
|
||||||
<img :src="applicationDetail?.icon" alt="" />
|
<img :src="applicationDetail?.icon" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<LogoIcon v-else height="28px" style="width: 28px; height: 28px; display: block" />
|
||||||
v-else-if="applicationDetail?.name"
|
|
||||||
:name="applicationDetail?.name"
|
|
||||||
pinyinColor
|
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>{{ applicationDetail?.name }}</h2>
|
<h2>{{ applicationDetail?.name }}</h2>
|
||||||
@ -64,7 +58,7 @@ const applicationDetail = computed({
|
|||||||
get: () => {
|
get: () => {
|
||||||
return props.application_profile
|
return props.application_profile
|
||||||
},
|
},
|
||||||
set: (v) => {}
|
set: (v) => {},
|
||||||
})
|
})
|
||||||
const recordList = ref([])
|
const recordList = ref([])
|
||||||
const currentChatId = ref('')
|
const currentChatId = ref('')
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:style="{
|
:style="{
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1)
|
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="chat-embed__header" :style="customStyle">
|
<div class="chat-embed__header" :style="customStyle">
|
||||||
@ -19,13 +19,7 @@
|
|||||||
>
|
>
|
||||||
<img :src="applicationDetail?.icon" alt="" />
|
<img :src="applicationDetail?.icon" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<LogoIcon v-else height="28px" style="width: 28px; height: 28px; display: block" />
|
||||||
v-else-if="applicationDetail?.name"
|
|
||||||
:name="applicationDetail?.name"
|
|
||||||
pinyinColor
|
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>{{ applicationDetail?.name }}</h4>
|
<h4>{{ applicationDetail?.name }}</h4>
|
||||||
@ -64,7 +58,7 @@
|
|||||||
<AppIcon
|
<AppIcon
|
||||||
iconName="app-history-outlined"
|
iconName="app-history-outlined"
|
||||||
:style="{
|
:style="{
|
||||||
color: applicationDetail?.custom_theme?.header_font_color
|
color: applicationDetail?.custom_theme?.header_font_color,
|
||||||
}"
|
}"
|
||||||
></AppIcon>
|
></AppIcon>
|
||||||
</div>
|
</div>
|
||||||
@ -154,12 +148,12 @@ const applicationDetail = computed({
|
|||||||
get: () => {
|
get: () => {
|
||||||
return props.application_profile
|
return props.application_profile
|
||||||
},
|
},
|
||||||
set: (v) => {}
|
set: (v) => {},
|
||||||
})
|
})
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
total: 0
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentRecordList = ref<any>([])
|
const currentRecordList = ref<any>([])
|
||||||
@ -170,14 +164,14 @@ const mouseId = ref('')
|
|||||||
const customStyle = computed(() => {
|
const customStyle = computed(() => {
|
||||||
return {
|
return {
|
||||||
background: applicationDetail.value?.custom_theme?.theme_color,
|
background: applicationDetail.value?.custom_theme?.theme_color,
|
||||||
color: applicationDetail.value?.custom_theme?.header_font_color
|
color: applicationDetail.value?.custom_theme?.header_font_color,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function editName(val: string, item: any) {
|
function editName(val: string, item: any) {
|
||||||
if (val) {
|
if (val) {
|
||||||
const obj = {
|
const obj = {
|
||||||
abstract: val
|
abstract: val,
|
||||||
}
|
}
|
||||||
chatLog.asyncPutChatClientLog(applicationDetail.value.id, item.id, obj, loading).then(() => {
|
chatLog.asyncPutChatClientLog(applicationDetail.value.id, item.id, obj, loading).then(() => {
|
||||||
const find = chatLogData.value.find((row: any) => row.id === item.id)
|
const find = chatLogData.value.find((row: any) => row.id === item.id)
|
||||||
@ -241,7 +235,7 @@ function newChat() {
|
|||||||
function getChatLog(id: string) {
|
function getChatLog(id: string) {
|
||||||
const page = {
|
const page = {
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20
|
page_size: 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
chatLog.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
|
chatLog.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
|
||||||
@ -263,7 +257,7 @@ function getChatRecord() {
|
|||||||
currentChatId.value,
|
currentChatId.value,
|
||||||
paginationConfig,
|
paginationConfig,
|
||||||
loading,
|
loading,
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
paginationConfig.total = res.data.total
|
paginationConfig.total = res.data.total
|
||||||
@ -273,7 +267,7 @@ function getChatRecord() {
|
|||||||
v['record_id'] = v.id
|
v['record_id'] = v.id
|
||||||
})
|
})
|
||||||
currentRecordList.value = [...list, ...currentRecordList.value].sort((a, b) =>
|
currentRecordList.value = [...list, ...currentRecordList.value].sort((a, b) =>
|
||||||
a.create_time.localeCompare(b.create_time)
|
a.create_time.localeCompare(b.create_time),
|
||||||
)
|
)
|
||||||
if (paginationConfig.current_page === 1) {
|
if (paginationConfig.current_page === 1) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:style="{
|
:style="{
|
||||||
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
'--el-color-primary': applicationDetail?.custom_theme?.theme_color,
|
||||||
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1)
|
'--el-color-primary-light-9': hexToRgba(applicationDetail?.custom_theme?.theme_color, 0.1),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="chat-embed__header" :style="customStyle">
|
<div class="chat-embed__header" :style="customStyle">
|
||||||
@ -18,13 +18,7 @@
|
|||||||
>
|
>
|
||||||
<img :src="applicationDetail?.icon" alt="" />
|
<img :src="applicationDetail?.icon" alt="" />
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<el-avatar
|
<LogoIcon v-else height="28px" style="width: 28px; height: 28px; display: block" />
|
||||||
v-else-if="applicationDetail?.name"
|
|
||||||
:name="applicationDetail?.name"
|
|
||||||
pinyinColor
|
|
||||||
shape="square"
|
|
||||||
:size="32"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>{{ applicationDetail?.name }}</h4>
|
<h4>{{ applicationDetail?.name }}</h4>
|
||||||
@ -63,7 +57,7 @@
|
|||||||
<AppIcon
|
<AppIcon
|
||||||
iconName="app-history-outlined"
|
iconName="app-history-outlined"
|
||||||
:style="{
|
:style="{
|
||||||
color: applicationDetail?.custom_theme?.header_font_color
|
color: applicationDetail?.custom_theme?.header_font_color,
|
||||||
}"
|
}"
|
||||||
></AppIcon>
|
></AppIcon>
|
||||||
</div>
|
</div>
|
||||||
@ -149,12 +143,12 @@ const applicationDetail = computed({
|
|||||||
get: () => {
|
get: () => {
|
||||||
return props.application_profile
|
return props.application_profile
|
||||||
},
|
},
|
||||||
set: (v) => {}
|
set: (v) => {},
|
||||||
})
|
})
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
total: 0
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
const currentRecordList = ref<any>([])
|
const currentRecordList = ref<any>([])
|
||||||
@ -165,14 +159,14 @@ const mouseId = ref('')
|
|||||||
const customStyle = computed(() => {
|
const customStyle = computed(() => {
|
||||||
return {
|
return {
|
||||||
background: applicationDetail.value?.custom_theme?.theme_color,
|
background: applicationDetail.value?.custom_theme?.theme_color,
|
||||||
color: applicationDetail.value?.custom_theme?.header_font_color
|
color: applicationDetail.value?.custom_theme?.header_font_color,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function editName(val: string, item: any) {
|
function editName(val: string, item: any) {
|
||||||
if (val) {
|
if (val) {
|
||||||
const obj = {
|
const obj = {
|
||||||
abstract: val
|
abstract: val,
|
||||||
}
|
}
|
||||||
|
|
||||||
chatLog.asyncPutChatClientLog(applicationDetail.value.id, item.id, obj, loading).then(() => {
|
chatLog.asyncPutChatClientLog(applicationDetail.value.id, item.id, obj, loading).then(() => {
|
||||||
@ -237,7 +231,7 @@ function newChat() {
|
|||||||
function getChatLog(id: string) {
|
function getChatLog(id: string) {
|
||||||
const page = {
|
const page = {
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20
|
page_size: 20,
|
||||||
}
|
}
|
||||||
|
|
||||||
chatLog.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
|
chatLog.asyncGetChatLogClient(id, page, left_loading).then((res: any) => {
|
||||||
@ -259,7 +253,7 @@ function getChatRecord() {
|
|||||||
currentChatId.value,
|
currentChatId.value,
|
||||||
paginationConfig,
|
paginationConfig,
|
||||||
loading,
|
loading,
|
||||||
false
|
false,
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
paginationConfig.total = res.data.total
|
paginationConfig.total = res.data.total
|
||||||
@ -269,7 +263,7 @@ function getChatRecord() {
|
|||||||
v['record_id'] = v.id
|
v['record_id'] = v.id
|
||||||
})
|
})
|
||||||
currentRecordList.value = [...list, ...currentRecordList.value].sort((a, b) =>
|
currentRecordList.value = [...list, ...currentRecordList.value].sort((a, b) =>
|
||||||
a.create_time.localeCompare(b.create_time)
|
a.create_time.localeCompare(b.create_time),
|
||||||
)
|
)
|
||||||
if (paginationConfig.current_page === 1) {
|
if (paginationConfig.current_page === 1) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user