mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
fix: bug fix
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -469,6 +469,7 @@
|
||||
"duplicate_name_": "重复姓名",
|
||||
"duplicate_account": "重复账号",
|
||||
"duplicate_email": "重复邮箱",
|
||||
"repeating_parameters": "重复参数",
|
||||
"interface_credentials": "接口凭证",
|
||||
"no_credentials_yet": "暂无凭证",
|
||||
"intelligent_customer_service": "SQLBot 智能客服",
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user