fix: bug fix

This commit is contained in:
dataeaseShu
2025-07-25 17:17:29 +08:00
parent 789d21c634
commit 1acf86cfba
5 changed files with 52 additions and 21 deletions
+1
View File
@@ -463,6 +463,7 @@
"duplicate_name": "Duplicate name",
"duplicate_name_": "Duplicate name",
"duplicate_account": "Duplicate account",
"repeating_parameters": "Repeating Parameters",
"duplicate_email": "Duplicate email",
"interface_credentials": "Interface credentials",
"no_credentials_yet": "No credentials yet",
+1
View File
@@ -469,6 +469,7 @@
"duplicate_name_": "重复姓名",
"duplicate_account": "重复账号",
"duplicate_email": "重复邮箱",
"repeating_parameters": "重复参数",
"interface_credentials": "接口凭证",
"no_credentials_yet": "暂无凭证",
"intelligent_customer_service": "SQLBot 智能客服",
+30 -19
View File
@@ -69,6 +69,35 @@ const defaultModelListWithSearch = computed(() => {
})
})
const duplicateName = async (item: any) => {
const res = await modelApi.queryAll()
const names = res.filter((ele: any) => ele.id !== item.id).map((ele: any) => ele.name)
if (names.includes(item.name)) {
ElMessage.error(t('embedded.duplicate_name'))
return
}
if (!item.id) {
modelApi.add(item).then(() => {
beforeClose()
search()
ElMessage({
type: 'success',
message: t('workspace.add_successfully'),
})
})
return
}
modelApi.edit(item).then(() => {
beforeClose()
search()
ElMessage({
type: 'success',
message: t('common.save_success'),
})
})
}
const handleDefaultModelChange = (item: any) => {
const current_default_node = modelList.value.find((ele: Model) => ele.default_model)
if (current_default_node?.id === item.id) {
@@ -185,25 +214,7 @@ const search = () => {
search()
const submit = (item: any) => {
if (!item.id) {
modelApi.add(item).then(() => {
beforeClose()
search()
ElMessage({
type: 'success',
message: t('workspace.add_successfully'),
})
})
return
}
modelApi.edit(item).then(() => {
beforeClose()
search()
ElMessage({
type: 'success',
message: t('common.save_success'),
})
})
duplicateName(item)
}
</script>
+19 -2
View File
@@ -116,9 +116,22 @@ const addParams = () => {
paramsFormRef.value.submit()
}
const submit = (item: any) => {
const duplicateName = async (item: any) => {
const arr = advancedSetting.value.filter((ele: any) => ele.id !== item.id)
const names = arr.map((ele: any) => ele.name)
const keys = arr.map((ele: any) => ele.key)
if (names.includes(item.name)) {
ElMessage.error(t('embedded.duplicate_name'))
return
}
if (keys.includes(item.key)) {
ElMessage.error(t('embedded.repeating_parameters'))
return
}
if (isCreate.value) {
advancedSetting.value.push({ ...item })
advancedSetting.value.push({ ...item, id: +new Date() })
beforeClose()
return
}
@@ -132,6 +145,10 @@ const submit = (item: any) => {
beforeClose()
}
const submit = (item: any) => {
duplicateName(item)
}
const beforeClose = () => {
paramsFormRef.value.close()
paramsFormDrawer.value = false
@@ -205,6 +205,7 @@ const handleCheckAllChange = (val: any) => {
}
}
const handleToggleRowSelection = (check: boolean = true) => {
let i = 0
const ids = multipleSelectionAll.value.map((ele: any) => ele.id)