修改开场白和推荐问题,修复菜单栏布局问题
This commit is contained in:
parent
c44b4d2728
commit
8abc3e1883
|
@ -2,14 +2,14 @@
|
|||
# 此文件修改后需要重启项目
|
||||
NODE_ENV=development
|
||||
#VUE_APP_BASE_URL='/vab-mock-server'
|
||||
# VUE_APP_BASE_URL='http://localhost:10001'
|
||||
# VUE_APP_API_BASE_URL='http://localhost:8080'
|
||||
VUE_APP_BASE_URL='http://localhost:10001'
|
||||
VUE_APP_API_BASE_URL='http://localhost:8080'
|
||||
#北京服务器配置
|
||||
# VUE_APP_BASE_URL='http://192.168.1.211:80/brichat'
|
||||
# VUE_APP_API_BASE_URL='http://192.168.1.211:80/brichat'
|
||||
# #武汉公司服务器
|
||||
VUE_APP_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
VUE_APP_API_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
# VUE_APP_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
# VUE_APP_API_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
#总部服务器配置
|
||||
# VUE_APP_BASE_URL='http://192.168.0.33:80/brichat'
|
||||
# VUE_APP_API_BASE_URL='http://192.168.0.33:80/brichat'
|
||||
|
|
|
@ -8,8 +8,8 @@ VUE_APP_API_BASE_URL='http://localhost:10001'
|
|||
# VUE_APP_BASE_URL='http://192.168.1.211:80/brichat'
|
||||
# VUE_APP_API_BASE_URL='http://192.168.1.211:80/brichat'
|
||||
#武汉公司服务器
|
||||
VUE_APP_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
VUE_APP_API_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
# VUE_APP_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
# VUE_APP_API_BASE_URL='http://192.168.8.253:80/brichat'
|
||||
# 总部服务器
|
||||
# VUE_APP_BASE_URL='http://192.168.0.33:80/brichat'
|
||||
# VUE_APP_API_BASE_URL='http://192.168.0.33:80/brichat'
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
import { handleActivePath, handleTabs } from '@/utils/routes'
|
||||
import { translate } from '@/i18n'
|
||||
import { VabRoute, VabRouteRecord } from '/#/router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
defineProps({
|
||||
layout: {
|
||||
type: String,
|
||||
|
@ -24,14 +26,7 @@
|
|||
const { getRoutes: routes } = storeToRefs(routesStore)
|
||||
const tabsStore = useTabsStore()
|
||||
const { getVisitedRoutes: visitedRoutes } = storeToRefs(tabsStore)
|
||||
const {
|
||||
addVisitedRoute,
|
||||
delVisitedRoute,
|
||||
delOthersVisitedRoutes,
|
||||
delLeftVisitedRoutes,
|
||||
delRightVisitedRoutes,
|
||||
delAllVisitedRoutes,
|
||||
} = tabsStore
|
||||
const { addVisitedRoute, delVisitedRoute, delOthersVisitedRoutes, delLeftVisitedRoutes, delRightVisitedRoutes, delAllVisitedRoutes } = tabsStore
|
||||
|
||||
const tabActive = ref('')
|
||||
const active = ref(false)
|
||||
|
@ -148,9 +143,7 @@
|
|||
* 跳转最后一个标签页
|
||||
*/
|
||||
const toLastTab = async () => {
|
||||
const latestView = visitedRoutes.value
|
||||
.filter((_: any) => _.path !== handleActivePath(route, true))
|
||||
.slice(-1)[0]
|
||||
const latestView = visitedRoutes.value.filter((_: any) => _.path !== handleActivePath(route, true)).slice(-1)[0]
|
||||
if (latestView) await router.push(latestView)
|
||||
else await router.push('/')
|
||||
}
|
||||
|
@ -196,20 +189,11 @@
|
|||
@tab-click="handleTabClick"
|
||||
@tab-remove="handleTabRemove"
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="item in visitedRoutes"
|
||||
:key="item.path"
|
||||
:closable="!isNoCLosable(item)"
|
||||
:name="item.path"
|
||||
>
|
||||
<el-tab-pane v-for="item in visitedRoutes" :key="item.path" :closable="!isNoCLosable(item)" :name="item.path">
|
||||
<template #label>
|
||||
<span style="display: inline-block" @contextmenu.prevent="openMenu">
|
||||
<template v-if="theme.showTabsIcon">
|
||||
<vab-icon
|
||||
v-if="item.meta && item.meta.icon"
|
||||
:icon="item.meta.icon"
|
||||
:is-custom-svg="item.meta.isCustomSvg"
|
||||
/>
|
||||
<vab-icon v-if="item.meta && item.meta.icon" :icon="item.meta.icon" :is-custom-svg="item.meta.isCustomSvg" />
|
||||
<!-- 如果没有图标那么取第二级的图标 -->
|
||||
<vab-icon v-else :icon="item.parentIcon" />
|
||||
</template>
|
||||
|
@ -221,12 +205,7 @@
|
|||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
||||
<el-dropdown
|
||||
placement="bottom-end"
|
||||
popper-class="vab-tabs-more-dropdown"
|
||||
@command="handleCommand"
|
||||
@visible-change="handleVisibleChange"
|
||||
>
|
||||
<el-dropdown placement="bottom-end" popper-class="vab-tabs-more-dropdown" @command="handleCommand" @visible-change="handleVisibleChange">
|
||||
<span class="vab-tabs-more" :class="{ 'vab-tabs-more-active': active }">
|
||||
<span class="vab-tabs-more-icon">
|
||||
<i class="box box-t"></i>
|
||||
|
@ -238,75 +217,62 @@
|
|||
<el-dropdown-item command="refreshThisTab">
|
||||
<vab-icon icon="refresh-line" />
|
||||
<span>
|
||||
{{ translate('刷新') }}
|
||||
{{ t('vabI18n.vabtabs.refresh') }}
|
||||
</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="closeOthersTabs">
|
||||
<vab-icon icon="close-line" />
|
||||
<span>
|
||||
{{ translate('关闭其他') }}
|
||||
{{ t('vabI18n.vabtabs.closeOthers') }}
|
||||
</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="closeLeftTabs">
|
||||
<vab-icon icon="arrow-left-line" />
|
||||
<span>
|
||||
{{ translate('关闭左侧') }}
|
||||
{{ t('vabI18n.vabtabs.closeLeft') }}
|
||||
</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="closeRightTabs">
|
||||
<vab-icon icon="arrow-right-line" />
|
||||
<span>
|
||||
{{ translate('关闭右侧') }}
|
||||
{{ t('vabI18n.vabtabs.closeRight') }}
|
||||
</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="closeAllTabs">
|
||||
<vab-icon icon="close-line" />
|
||||
<span>
|
||||
{{ translate('关闭全部') }}
|
||||
{{ t('vabI18n.vabtabs.closeAll') }}
|
||||
</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<ul
|
||||
v-if="visible"
|
||||
class="contextmenu el-dropdown-menu"
|
||||
:style="{ left: left + 'px', top: top + 'px' }"
|
||||
>
|
||||
<ul v-if="visible" class="contextmenu el-dropdown-menu" :style="{ left: left + 'px', top: top + 'px' }">
|
||||
<li class="el-dropdown-menu__item" @click="refreshThisTab">
|
||||
<vab-icon icon="refresh-line" />
|
||||
<span>{{ translate('刷新') }}</span>
|
||||
<span>{{ t('vabI18n.vabtabs.refresh') }}</span>
|
||||
</li>
|
||||
<li
|
||||
class="el-dropdown-menu__item"
|
||||
:class="{ 'is-disabled': visitedRoutes.length === 1 }"
|
||||
@click="closeOthersTabs"
|
||||
>
|
||||
<li class="el-dropdown-menu__item" :class="{ 'is-disabled': visitedRoutes.length === 1 }" @click="closeOthersTabs">
|
||||
<vab-icon icon="close-line" />
|
||||
<span>{{ translate('关闭其他') }}</span>
|
||||
<span>{{ t('vabI18n.vabtabs.closeOthers') }}</span>
|
||||
</li>
|
||||
<li
|
||||
class="el-dropdown-menu__item"
|
||||
:class="{ 'is-disabled': !visitedRoutes.indexOf(hoverRoute) }"
|
||||
@click="closeLeftTabs"
|
||||
>
|
||||
<li class="el-dropdown-menu__item" :class="{ 'is-disabled': !visitedRoutes.indexOf(hoverRoute) }" @click="closeLeftTabs">
|
||||
<vab-icon icon="arrow-left-line" />
|
||||
<span>{{ translate('关闭左侧') }}</span>
|
||||
<span>{{ t('vabI18n.vabtabs.closeLeft') }}</span>
|
||||
</li>
|
||||
<li
|
||||
class="el-dropdown-menu__item"
|
||||
:class="{
|
||||
'is-disabled':
|
||||
visitedRoutes.indexOf(hoverRoute) === visitedRoutes.length - 1,
|
||||
'is-disabled': visitedRoutes.indexOf(hoverRoute) === visitedRoutes.length - 1,
|
||||
}"
|
||||
@click="closeRightTabs"
|
||||
>
|
||||
<vab-icon icon="arrow-right-line" />
|
||||
<span>{{ translate('关闭右侧') }}</span>
|
||||
<span>{{ t('vabI18n.vabtabs.closeRight') }}</span>
|
||||
</li>
|
||||
<li class="el-dropdown-menu__item" @click="closeAllTabs">
|
||||
<vab-icon icon="close-line" />
|
||||
<span>{{ translate('关闭全部') }}</span>
|
||||
<span>{{ t('vabI18n.vabtabs.closeAll') }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -337,9 +303,9 @@
|
|||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.vab-icon {
|
||||
vertical-align: -3px;
|
||||
}
|
||||
// .vab-icon {
|
||||
// vertical-align: -3px;
|
||||
// }
|
||||
}
|
||||
|
||||
&-content {
|
||||
|
@ -466,10 +432,7 @@
|
|||
.el-tabs__item {
|
||||
height: $base-tag-item-height + 4;
|
||||
padding: 0 30px 0 30px;
|
||||
margin-top: #{math.div(
|
||||
$base-tabs-height - $base-tag-item-height - 4.1,
|
||||
2
|
||||
)};
|
||||
margin-top: #{math.div($base-tabs-height - $base-tag-item-height - 4.1, 2)};
|
||||
margin-right: -18px;
|
||||
line-height: $base-tag-item-height + 4;
|
||||
text-align: center;
|
||||
|
@ -598,4 +561,20 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-tabs__nav-wrap.is-top) {
|
||||
padding-top: 0 !important;
|
||||
margin-top: 0 !important;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: $base-tabs-height;
|
||||
}
|
||||
|
||||
:deep(.el-tabs__header.is-top) {
|
||||
padding-top: 0 !important;
|
||||
margin-top: 0 !important;
|
||||
height: $base-tabs-height;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -26,7 +26,7 @@ export function getRecommendations(chatType: string) {
|
|||
}
|
||||
|
||||
// 编辑推荐问题
|
||||
export function eidtRecommendation(data: any) {
|
||||
export function editRecommendation(data: any) {
|
||||
return request({
|
||||
url: '/brichat-service/prologue/eidtRecommendation',
|
||||
method: 'post',
|
||||
|
@ -41,4 +41,13 @@ export function deleteRecommendation(id: string) {
|
|||
method: 'delete',
|
||||
params: { id },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 新增推荐问题
|
||||
export function addRecommendation(data: any) {
|
||||
return request({
|
||||
url: '/brichat-service/prologue/addRecommendation',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -515,35 +515,70 @@ export default {
|
|||
Tip: 'Tip',
|
||||
selectDeleteData: 'Please select the data to be deleted',
|
||||
confirmDeleteApiKeys: 'This operation will permanently delete selected ',
|
||||
confirmDeleteApiKeysEnd:' API key, are you sure?',
|
||||
confirmDeleteApiKeysEndPlural:' API keys, are you sure?',
|
||||
confirmDeleteApiKeysEnd: ' API key, are you sure?',
|
||||
confirmDeleteApiKeysEndPlural: ' API keys, are you sure?',
|
||||
confirmRefreshCache: 'This operation will refresh Redis cache, reloading all API keys, are you sure?',
|
||||
updateSuccess: 'Update Successfully',
|
||||
updateFail: 'Update Failed',
|
||||
addSuccess: 'Add Successfully',
|
||||
addFail:'Add Failed'
|
||||
addFail: 'Add Failed',
|
||||
},
|
||||
prologue:{
|
||||
prologue: {
|
||||
title: 'Opening Statement Management',
|
||||
query: 'Query',
|
||||
save: 'Save',
|
||||
chatType: 'Chat Type',
|
||||
selectChatType: 'Select Chat Type',
|
||||
prologueContent: 'Prologue Content',
|
||||
addRecommend: 'Add Recommendation',
|
||||
recommendQuestion: 'Recommended Question',
|
||||
actions: 'Actions',
|
||||
chatTypes: {
|
||||
'1': 'Fault Diagnosis',
|
||||
'2': 'Intelligent Q&A',
|
||||
'3': 'Chart Report',
|
||||
'4': 'Emergency Assistant Q&A',
|
||||
'5': 'Diagnostic Code Lookup',
|
||||
},
|
||||
openingContent: 'Opening Statement Content',
|
||||
addRecommend: 'Add Recommended Question',
|
||||
recommendation: 'Recommended Question',
|
||||
action: 'Action',
|
||||
edit: 'Edit',
|
||||
delete: 'Delete',
|
||||
confirmDelete: 'Are you sure you want to delete this recommendation?',
|
||||
confirmSave: 'Are you sure you want to save the changes?',
|
||||
deleteSuccess: 'Deleted successfully',
|
||||
deleteFailure: 'Failed to delete, please try again later',
|
||||
saveSuccess: 'Saved successfully',
|
||||
saveFailure: 'Failed to save, please try again later',
|
||||
loadSuccess: 'Loaded successfully',
|
||||
loadFailure: 'Failed to load, please try again later',
|
||||
noContent: 'No content found',
|
||||
loading: 'Loading...',
|
||||
updateRecommendation: 'Update Recommendation',
|
||||
addRecommendation: 'Add Recommendation',
|
||||
}
|
||||
dialog: {
|
||||
addTitle: 'Add Recommended Question',
|
||||
editTitle: 'Edit Recommended Question',
|
||||
questionContent: 'Recommended Question',
|
||||
cancel: 'Cancel',
|
||||
confirm: 'Confirm',
|
||||
save: 'Save',
|
||||
},
|
||||
message: {
|
||||
loadSuccess: 'Loaded successfully',
|
||||
loadFailed: 'Load failed, please try again later',
|
||||
loadFailedMess: 'Failed to load recommended questions',
|
||||
notFound: 'Opening statement not found',
|
||||
saveSuccess: 'Saved successfully',
|
||||
saveFailed: 'Save failed, please try again later',
|
||||
addSuccess: 'Recommended question added successfully',
|
||||
addFailed: 'Failed to add recommended question',
|
||||
editSuccess: 'Recommended question edited successfully',
|
||||
editFailed: 'Failed to edit recommended question, please try again later',
|
||||
deleteSuccess: 'Deleted successfully',
|
||||
deleteFailed: 'Deletion failed',
|
||||
},
|
||||
confirm: {
|
||||
save: 'Are you sure you want to save the changes?',
|
||||
tips: 'Tips',
|
||||
delete: 'Are you sure you want to delete this recommended question?',
|
||||
deleteConfirm: 'Delete Confirmation',
|
||||
},
|
||||
placeholder: {
|
||||
selectType: 'Select chat type',
|
||||
},
|
||||
},
|
||||
vabtabs: {
|
||||
refresh: 'Refresh',
|
||||
closeOthers: 'Close Others',
|
||||
closeLeft: 'Close Left',
|
||||
closeRight: 'Close Right',
|
||||
closeAll: 'Close All',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -472,14 +472,14 @@ export default {
|
|||
enterApiValue: '請輸入密鑰值',
|
||||
createBy: '創建人',
|
||||
placeCreateby: '請輸入創建人',
|
||||
search:'查詢',
|
||||
search: '查詢',
|
||||
index: '序號',
|
||||
createTime: '創建時間',
|
||||
updateBy: '更新人',
|
||||
updateTime: '更新時間',
|
||||
edit: '編輯',
|
||||
delete: '刪除',
|
||||
|
||||
|
||||
add: '新增',
|
||||
batchDelete: '批量刪除',
|
||||
refreshCache: '刷新快取',
|
||||
|
@ -495,8 +495,8 @@ export default {
|
|||
batchDeleteFail: '批量刪除失敗',
|
||||
dictionaryKey: '密鑰名稱',
|
||||
dictionaryValue: '密鑰值',
|
||||
show:'顯示',
|
||||
hide:'隱藏',
|
||||
show: '顯示',
|
||||
hide: '隱藏',
|
||||
operation: '操作',
|
||||
remark: '備註',
|
||||
enterRemark: '請輸入備註信息',
|
||||
|
@ -507,43 +507,78 @@ export default {
|
|||
refreshCacheFail: '快取刷新失敗',
|
||||
copySuccess: '複製成功',
|
||||
copyFail: '複製失敗',
|
||||
copy:'複製',
|
||||
copy: '複製',
|
||||
dictionaryKeyLength: '密鑰名稱長度在 1 到 255 個字符',
|
||||
dictionaryValueLength: '密鑰值長度在 1 到 255 個字符',
|
||||
getApiKeysFail: '获取API密鑰列表失败',
|
||||
confirmDeleteApiKey: '此操作将永久删除该API密鑰,是否继续?',
|
||||
confirmDeleteApiKey: '此操作将永久删除该API密鑰,是否继续?',
|
||||
Tip: '提示',
|
||||
selectDeleteData: '請選擇要刪除的數據',
|
||||
confirmDeleteApiKeys: '此操作將永久删除选中的 ',
|
||||
confirmDeleteApiKeysEnd:' 條API密鑰,是否繼續?',
|
||||
confirmDeleteApiKeysEndPlural:' 條API密鑰,是否繼續?',
|
||||
confirmDeleteApiKeysEnd: ' 條API密鑰,是否繼續?',
|
||||
confirmDeleteApiKeysEndPlural: ' 條API密鑰,是否繼續?',
|
||||
confirmRefreshCache: '此操作將刷新Redis缓存,重新加载所有API密鑰,是否繼續?',
|
||||
updateSuccess: '更新成功',
|
||||
updateFail:'更新失敗',
|
||||
addSuccess:'新增成功',
|
||||
addFail:'新增失敗',
|
||||
updateFail: '更新失敗',
|
||||
addSuccess: '新增成功',
|
||||
addFail: '新增失敗',
|
||||
},
|
||||
prologue:{
|
||||
prologue: {
|
||||
title: '開場白管理',
|
||||
query: '查詢',
|
||||
save: '儲存',
|
||||
chatType: '聊天類型',
|
||||
selectChatType: '選擇聊天類型',
|
||||
prologueContent: '開場白內容',
|
||||
chatTypes: {
|
||||
'1': '故障診斷',
|
||||
'2': '智慧問答',
|
||||
'3': '圖表報告',
|
||||
'4': '應急助手問答',
|
||||
'5': '診斷代碼查詢',
|
||||
},
|
||||
openingContent: '開場白內容',
|
||||
addRecommend: '新增推薦問題',
|
||||
recommendQuestion: '推薦問題',
|
||||
actions: '操作',
|
||||
recommendation: '推薦問題',
|
||||
action: '操作',
|
||||
edit: '編輯',
|
||||
delete: '刪除',
|
||||
confirmDelete: '確定要刪除該推薦問題嗎?',
|
||||
confirmSave: '是否確認保存修改?',
|
||||
deleteSuccess: '刪除成功',
|
||||
deleteFailure: '刪除失敗,請稍後重試',
|
||||
saveSuccess: '保存成功',
|
||||
saveFailure: '保存失敗,請稍後重試',
|
||||
loadSuccess: '加載成功',
|
||||
loadFailure: '加載失敗,請稍後重試',
|
||||
noContent: '未找到內容',
|
||||
loading: '加載中...',
|
||||
updateRecommendation: '更新推薦問題',
|
||||
addRecommendation: '新增推薦問題',
|
||||
}
|
||||
dialog: {
|
||||
addTitle: '新增推薦問題',
|
||||
editTitle: '編輯推薦問題',
|
||||
questionContent: '推薦問題',
|
||||
cancel: '取消',
|
||||
confirm: '確認',
|
||||
save: '儲存',
|
||||
},
|
||||
message: {
|
||||
loadSuccess: '加載成功',
|
||||
loadFailed: '加載失敗,請稍後重試',
|
||||
loadFailedMess: '加載推薦問題失敗',
|
||||
notFound: '未找到開場白內容',
|
||||
saveSuccess: '儲存成功',
|
||||
saveFailed: '儲存失敗,請稍後重試',
|
||||
addSuccess: '推薦問題新增成功',
|
||||
addFailed: '新增推薦問題失敗',
|
||||
editSuccess: '推薦問題編輯成功',
|
||||
editFailed: '編輯推薦問題失敗,請稍後重試',
|
||||
deleteSuccess: '刪除成功',
|
||||
deleteFailed: '刪除失敗',
|
||||
},
|
||||
confirm: {
|
||||
save: '是否確認儲存修改?',
|
||||
tips: '提示',
|
||||
delete: '確定要刪除該推薦問題嗎?',
|
||||
deleteConfirm: '刪除確認',
|
||||
},
|
||||
placeholder: {
|
||||
selectType: '選擇聊天類型',
|
||||
},
|
||||
},
|
||||
vabtabs: {
|
||||
refresh: '刷新',
|
||||
closeOthers: '關閉其他',
|
||||
closeLeft: '關閉左側',
|
||||
closeRight: '關閉右側',
|
||||
closeAll: '關閉全部',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ export default {
|
|||
enterApiValue: '请输入密钥值',
|
||||
createBy: '创建人',
|
||||
placeCreateby: '请输入创建人',
|
||||
search:'查询',
|
||||
search: '查询',
|
||||
index: '序号',
|
||||
createTime: '创建时间',
|
||||
updateBy: '更新人',
|
||||
|
@ -503,8 +503,8 @@ export default {
|
|||
batchDeleteFail: '批量删除失败',
|
||||
dictionaryKey: '密钥名称',
|
||||
dictionaryValue: '密钥值',
|
||||
show:'显示',
|
||||
hide:'隐藏',
|
||||
show: '显示',
|
||||
hide: '隐藏',
|
||||
operation: '操作',
|
||||
remark: '备注',
|
||||
enterRemark: '请输入备注信息',
|
||||
|
@ -513,45 +513,80 @@ export default {
|
|||
cancel: '取消',
|
||||
refreshCacheSuccess: '缓存刷新成功',
|
||||
refreshCacheFail: '缓存刷新失败',
|
||||
copy:'复制',
|
||||
copy: '复制',
|
||||
copySuccess: '复制成功',
|
||||
copyFail: '复制失败',
|
||||
dictionaryKeyLength: '密钥名称长度在 1 到 255 个字符',
|
||||
dictionaryValueLength: '密钥值长度在 1 到 255 个字符',
|
||||
getApiKeysFail: '获取API密钥列表失败',
|
||||
confirmDeleteApiKey: '此操作将永久删除该API密钥,是否继续?',
|
||||
confirmDeleteApiKey: '此操作将永久删除该API密钥,是否继续?',
|
||||
Tip: '提示',
|
||||
selectDeleteData: '请选择要删除的数据',
|
||||
confirmDeleteApiKeys: '此操作将永久删除选中的 ',
|
||||
confirmDeleteApiKeysEnd:' 条API密钥,是否继续?',
|
||||
confirmDeleteApiKeysEndPlural:' 条API密钥,是否继续?',
|
||||
confirmDeleteApiKeysEnd: ' 条API密钥,是否继续?',
|
||||
confirmDeleteApiKeysEndPlural: ' 条API密钥,是否继续?',
|
||||
confirmRefreshCache: '此操作将刷新Redis缓存,重新加载所有API密钥,是否继续?',
|
||||
updateSuccess: '更新成功',
|
||||
updateFail: '更新失败',
|
||||
addSuccess: '新增成功',
|
||||
addFail: '新增失败',
|
||||
},
|
||||
prologue:{
|
||||
prologue: {
|
||||
title: '开场白管理',
|
||||
query: '查询',
|
||||
save: '保存',
|
||||
chatType: '聊天类型',
|
||||
selectChatType: '选择聊天类型',
|
||||
prologueContent: '开场白内容',
|
||||
chatTypes: {
|
||||
'1': '故障诊断',
|
||||
'2': '智能问答',
|
||||
'3': '图表报告',
|
||||
'4': '应急助手问答',
|
||||
'5': '诊断代码查询',
|
||||
},
|
||||
openingContent: '开场白内容',
|
||||
addRecommend: '新增推荐问题',
|
||||
recommendQuestion: '推荐问题',
|
||||
actions: '操作',
|
||||
recommendation: '推荐问题',
|
||||
action: '操作',
|
||||
edit: '编辑',
|
||||
delete: '删除',
|
||||
confirmDelete: '确定要删除该推荐问题吗?',
|
||||
confirmSave: '是否确认保存修改?',
|
||||
deleteSuccess: '删除成功',
|
||||
deleteFailure: '删除失败,请稍后重试',
|
||||
saveSuccess: '保存成功',
|
||||
saveFailure: '保存失败,请稍后重试',
|
||||
loadSuccess: '加载成功',
|
||||
loadFailure: '加载失败,请稍后重试',
|
||||
noContent: '未找到内容',
|
||||
loading: '加载中...',
|
||||
updateRecommendation: '更新推荐问题',
|
||||
addRecommendation: '新增推荐问题',
|
||||
dialog: {
|
||||
addTitle: '新增推荐问题',
|
||||
editTitle: '编辑推荐问题',
|
||||
questionContent: '推荐问题',
|
||||
cancel: '取消',
|
||||
confirm: '确认',
|
||||
save: '保存',
|
||||
},
|
||||
message: {
|
||||
loadSuccess: '加载成功',
|
||||
loadFailed: '加载失败,请稍后重试',
|
||||
loadFailedMess: '加载推荐问题失败',
|
||||
notFound: '未找到开场白内容',
|
||||
saveSuccess: '保存成功',
|
||||
saveFailed: '保存失败,请稍后重试',
|
||||
addSuccess: '推荐问题新增成功',
|
||||
addFailed: '新增推荐问题失败',
|
||||
editSuccess: '推荐问题编辑成功',
|
||||
editFailed: '编辑推荐问题失败,请稍后重试',
|
||||
deleteSuccess: '删除成功',
|
||||
deleteFailed: '删除失败',
|
||||
},
|
||||
confirm: {
|
||||
save: '是否确认保存修改?',
|
||||
tips: '提示',
|
||||
delete: '确定要删除该推荐问题吗?',
|
||||
deleteConfirm:'删除确认'
|
||||
},
|
||||
placeholder: {
|
||||
selectType: '选择聊天类型',
|
||||
},
|
||||
},
|
||||
vabtabs:{
|
||||
refresh:'刷新',
|
||||
closeOthers:'关闭其他',
|
||||
closeLeft:'关闭左侧',
|
||||
closeRight:'关闭右侧',
|
||||
closeAll:'关闭全部'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -340,9 +340,13 @@ const renameForm = reactive({
|
|||
|
||||
const getFileTypeIcon = (fileType: string) => {
|
||||
// 使用动态导入获取图标路径
|
||||
// const getIconUrl = (iconName: string) => {
|
||||
// return new URL(require(`@/assets/img/filetype-icon/${iconName}.png`), import.meta.url).href
|
||||
// }
|
||||
const getIconUrl = (iconName: string) => {
|
||||
return new URL(require(`@/assets/img/filetype-icon/${iconName}.png`), import.meta.url).href
|
||||
}
|
||||
return new URL(`/src/assets/img/filetype-icon/${iconName}.png`, import.meta.url).href
|
||||
}
|
||||
|
||||
|
||||
const iconMap: Record<string, string> = {
|
||||
'pdf': getIconUrl('pdf'),
|
||||
|
|
|
@ -2,46 +2,73 @@
|
|||
<el-card>
|
||||
<el-form :model="form" label-width="120px">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="load">查询</el-button>
|
||||
<el-button type="success" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="load">{{t('vabI18n.prologue.query')}}</el-button>
|
||||
<el-button type="success" @click="save">{{t('vabI18n.prologue.save')}}</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item :label="聊天类型">
|
||||
<el-select v-model="form.chatType" placeholder="选择聊天类型">
|
||||
<el-option label="故障诊断" value="1" />
|
||||
<el-option label="智能问答" value="2" />
|
||||
<el-option label="图表报告" value="3" />
|
||||
<el-option label="应急助手问答" value="4" />
|
||||
<el-option label="诊断代码查询" value="5" />
|
||||
<el-form-item :label="t('vabI18n.prologue.chatType')">
|
||||
<el-select v-model="form.chatType" :placeholder="t('vabI18n.prologue.placeholder.selectType')">
|
||||
<el-option :label="t('vabI18n.prologue.chatTypes.1')" value="1" />
|
||||
<el-option :label="t('vabI18n.prologue.chatTypes.2')" value="2" />
|
||||
<el-option :label="t('vabI18n.prologue.chatTypes.3')" value="3" />
|
||||
<el-option :label="t('vabI18n.prologue.chatTypes.4')" value="4" />
|
||||
<el-option :label="t('vabI18n.prologue.chatTypes.5')" value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开场白内容">
|
||||
<el-form-item :label="t('vabI18n.prologue.openingContent')">
|
||||
<el-input type="textarea" v-model="form.content" rows="8"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 新增推荐问题 -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="addRecommend">新增推荐问题</el-button>
|
||||
<el-button type="primary" @click="addRecommend">{{t('vabI18n.prologue.addRecommend')}}</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 推荐问题列表 -->
|
||||
<el-table :data="recommendations" style="width: 100%" border>
|
||||
<el-table-column label="推荐问题" prop="questionContent" />
|
||||
<el-table-column label="操作" width="180">
|
||||
<el-table-column :label="t('vabI18n.prologue.recommendation')" prop="questionContent" />
|
||||
<el-table-column :label="t('vabI18n.prologue.action')" width="180">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" @click="editRecommend(scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteRecommend(scope.row)">删除</el-button>
|
||||
<el-button size="mini" @click="editRecommend(scope.row)">{{t('vabI18n.prologue.edit')}}</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteRecommend(scope.row)">{{t('vabI18n.prologue.delete')}}</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 新增推荐问题弹窗 -->
|
||||
<el-dialog v-model="dialogVisible" :title="t('vabI18n.prologue.dialog.addTitle')">
|
||||
<el-form :model="newRecommendForm" label-width="120px">
|
||||
<el-form-item :label="t('vabI18n.prologue.dialog.questionContent')">
|
||||
<el-input v-model="newRecommendForm.questionContent" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">{{t('vabI18n.prologue.dialog.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="saveNewRecommend">{{t('vabI18n.prologue.dialog.save')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 编辑推荐问题弹窗 -->
|
||||
<el-dialog v-model="editdialogVisible" :title="t('vabI18n.prologue.dialog.editTitle')">
|
||||
<el-form :model="currentRecommendation" label-width="120px">
|
||||
<el-form-item label="t('vabI18n.prologue.dialog.questionContent')">
|
||||
<el-input v-model="currentRecommendation.questionContent" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="editdialogVisible = false">{{t('vabI18n.prologue.dialog.cancel')}}</el-button>
|
||||
<el-button type="primary" @click="saveEditRecommend">{{t('vabI18n.prologue.dialog.save')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getRemark, saveRemark, getRecommendations, editRecommendation, deleteRecommendation } from '@/api/prologue'
|
||||
import { getRemark, saveRemark, getRecommendations, editRecommendation, deleteRecommendation, addRecommendation } from '@/api/prologue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
|
@ -57,6 +84,12 @@
|
|||
|
||||
const recommendations = ref([]) // 推荐问题列表
|
||||
const currentRecommendation = ref({ questionContent: '' }) // 当前正在编辑的推荐问题
|
||||
const dialogVisible = ref(false) // 控制新增推荐问题弹窗显示
|
||||
const editdialogVisible = ref(false) // 控制编辑推荐问题弹窗显示
|
||||
const newRecommendForm = ref({ //新增推荐问题的表单
|
||||
questionContent: '',
|
||||
chatType: form.value.chatType,
|
||||
})
|
||||
|
||||
// 查询开场白内容
|
||||
const load = async () => {
|
||||
|
@ -64,14 +97,14 @@
|
|||
const res = await getRemark(form.value.chatType) // 根据 chatType 获取开场白
|
||||
if (res.data) {
|
||||
form.value.content = res.data.content
|
||||
ElMessage.success('加载成功')
|
||||
ElMessage.success(t('vabI18n.prologue.message.loadSuccess'))
|
||||
await loadRecommendations() // 获取推荐问题列表
|
||||
} else {
|
||||
form.value.content = ''
|
||||
ElMessage.error('未找到开场白内容')
|
||||
ElMessage.error(t('vabI18n.prologue.message.notFound'))
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('加载失败,请稍后重试')
|
||||
ElMessage.error(t('vabI18n.prologue.message.loadFail'))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,7 +117,7 @@
|
|||
recommendations.value = res.data // 确保 res.data 是推荐问题列表
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('加载推荐问题失败')
|
||||
ElMessage.error(t('vabI18n.prologue.message.loadFailedMess'))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,46 +131,71 @@
|
|||
|
||||
// 保存修改后的内容
|
||||
const save = () => {
|
||||
ElMessageBox.confirm('是否确认保存修改?', '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
ElMessageBox.confirm(t('vabI18n.prologue.confirm.save'), t('vabI18n.prologue.confirm.tips'), {
|
||||
confirmButtonText: t('vabI18n.prologue.dialog.confirm'),
|
||||
cancelButtonText: t('vabI18n.prologue.dialog.cancel'),
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
try {
|
||||
await saveRemark(form.value)
|
||||
ElMessage.success('保存成功')
|
||||
ElMessage.success(t('vabI18n.prologue.message.saveSuccess'))
|
||||
} catch (error) {
|
||||
ElMessage.error('保存失败,请稍后重试')
|
||||
ElMessage.error(t('vabI18n.prologue.message.saveFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 新增推荐问题
|
||||
const addRecommend = () => {
|
||||
// currentRecommendation.value = { questionContent: '' } // 清空编辑框
|
||||
// dialogVisible.value = true // 显示编辑对话框
|
||||
newRecommendForm.value = { questionContent: '', chatType: form.value.chatType } // 清空表单并绑定当前 chatType
|
||||
dialogVisible.value = true // 显示新增推荐问题的弹窗
|
||||
}
|
||||
|
||||
// 保存新增的推荐问题
|
||||
const saveNewRecommend = async () => {
|
||||
try {
|
||||
// 保存推荐问题时,将 chatType 一起提交
|
||||
await addRecommendation(newRecommendForm.value) // 调用 API 保存推荐问题
|
||||
ElMessage.success(t('vabI18n.prologue.message.addSuccess'))
|
||||
dialogVisible.value = false // 关闭弹窗
|
||||
await loadRecommendations() // 重新加载推荐问题列表
|
||||
} catch (error) {
|
||||
ElMessage.error(t('vabI18n.prologue.message.addFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑推荐问题
|
||||
const editRecommend = (row: any) => {
|
||||
// currentRecommendation.value = { ...row } // 填充编辑框
|
||||
// dialogVisible.value = true // 显示编辑对话框
|
||||
currentRecommendation.value = { ...row } // 填充编辑框
|
||||
editdialogVisible.value = true
|
||||
}
|
||||
|
||||
// 保存编辑的推荐问题
|
||||
const saveEditRecommend = async () => {
|
||||
try {
|
||||
// 保存推荐问题时,将 chatType 一起提交
|
||||
await editRecommendation(currentRecommendation.value) // 调用 API 保存推荐问题
|
||||
ElMessage.success(t('vabI18n.prologue.message.editSuccess'))
|
||||
editdialogVisible.value = false // 关闭弹窗
|
||||
await loadRecommendations() // 重新加载推荐问题列表
|
||||
} catch (error) {
|
||||
ElMessage.error(t('vabI18n.prologue.message.editFailed'))
|
||||
}
|
||||
}
|
||||
|
||||
// 删除推荐问题
|
||||
const deleteRecommend = (row: any) => {
|
||||
ElMessageBox.confirm('确定要删除该推荐问题吗?', '删除确认', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
ElMessageBox.confirm(t('vabI18n.prologue.confirm.delete'), t('vabI18n.prologue.confirm.tips'), {
|
||||
confirmButtonText: t('vabI18n.prologue.dialog.confirm'),
|
||||
cancelButtonText: t('vabI18n.prologue.dialog.cancel'),
|
||||
type: 'warning',
|
||||
}).then(async () => {
|
||||
try {
|
||||
await deleteRecommendation(row.id) // 根据 id 删除推荐问题
|
||||
console.log('待删除的row.id',row.id)
|
||||
ElMessage.success('删除成功')
|
||||
ElMessage.success(t('vabI18n.prologue.message.deleteSuccess'))
|
||||
await loadRecommendations() // 重新加载推荐问题列表
|
||||
} catch (error) {
|
||||
ElMessage.error('删除失败')
|
||||
ElMessage.error(t('vabI18n.prologue.message.deleteFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -48,4 +48,24 @@ public class PrologueController {
|
|||
return ResultUtils.success(prologueService.deleteRecommendQuestionById(id));
|
||||
}
|
||||
|
||||
@PostMapping("/addRecommendation")
|
||||
public ResultUtils post(@RequestBody PrologueQuestion prologueQuestion) {
|
||||
try {
|
||||
prologueService.addRecommendation(prologueQuestion);
|
||||
return ResultUtils.success("推荐问题新增成功");
|
||||
} catch (Exception e) {
|
||||
return ResultUtils.error("新增推荐问题失败: ");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/eidtRecommendation")
|
||||
public ResultUtils eidtRecommendation(@RequestBody PrologueQuestion prologueQuestion) {
|
||||
try {
|
||||
prologueService.editRecommendation(prologueQuestion);
|
||||
return ResultUtils.success("推荐问题修改成功");
|
||||
}catch (Exception e) {
|
||||
return ResultUtils.error("推荐问题修改失败: ");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,4 +16,8 @@ public interface PrologueMapper {
|
|||
List<PrologueQuestion> getQuestionsbyChatType(String chatType);
|
||||
|
||||
Boolean deleteQuesById(Integer id);
|
||||
|
||||
Boolean addQues(PrologueQuestion ques);
|
||||
|
||||
Boolean editQues(PrologueQuestion ques);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.bjtds.brichat.service;
|
|||
|
||||
import com.bjtds.brichat.entity.sys.PrologueQuestion;
|
||||
import com.bjtds.brichat.entity.sys.SystemRemark;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -15,4 +16,8 @@ public interface PrologueService {
|
|||
List<PrologueQuestion> getRecommendations(String chatType);
|
||||
|
||||
Boolean deleteRecommendQuestionById(Integer id);
|
||||
|
||||
Boolean addRecommendation(PrologueQuestion prologueQuestion);
|
||||
|
||||
Boolean editRecommendation(PrologueQuestion prologueQuestion);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.bjtds.brichat.entity.sys.SystemRemark;
|
|||
import com.bjtds.brichat.mapper.opengauss.PrologueMapper;
|
||||
import com.bjtds.brichat.service.PrologueService;
|
||||
import com.netflix.discovery.converters.Auto;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -42,4 +43,23 @@ public class PrologueServiceImpl implements PrologueService {
|
|||
public Boolean deleteRecommendQuestionById(Integer id) {
|
||||
return prologueMapper.deleteQuesById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addRecommendation(PrologueQuestion prologueQuestion) {
|
||||
PrologueQuestion ques=new PrologueQuestion();
|
||||
ques.setChatType(prologueQuestion.getChatType());
|
||||
ques.setQuestionContent(prologueQuestion.getQuestionContent());
|
||||
ques.setUpdatedAt(LocalDateTime.now());
|
||||
return prologueMapper.addQues(ques);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean editRecommendation(PrologueQuestion prologueQuestion) {
|
||||
PrologueQuestion ques=new PrologueQuestion();
|
||||
ques.setId(prologueQuestion.getId());
|
||||
ques.setChatType(prologueQuestion.getChatType());
|
||||
ques.setQuestionContent(prologueQuestion.getQuestionContent());
|
||||
ques.setUpdatedAt(LocalDateTime.now());
|
||||
return prologueMapper.editQues(ques);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,22 @@
|
|||
<result column="question_content" property="questionContent" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
<insert id="addQues" >
|
||||
INSERT INTO bripg.t_chat_recommendations (chat_type, question_content, updated_at)
|
||||
VALUES (#{chatType}, #{questionContent}, #{updatedAt})
|
||||
</insert>
|
||||
|
||||
<update id="updateRemark">
|
||||
update bripg.t_chat_prologue
|
||||
set content= #{content} , updated_at =#{updatedAt}
|
||||
where chat_type = #{chatType}
|
||||
</update>
|
||||
<update id="editQues">
|
||||
update bripg.t_chat_recommendations
|
||||
set question_content=#{questionContent}
|
||||
where id =#{id}
|
||||
|
||||
</update>
|
||||
<delete id="deleteQuesById">
|
||||
DELETE FROM bripg.t_chat_recommendations
|
||||
WHERE id = #{id}
|
||||
|
|
Loading…
Reference in New Issue