mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 11:32:57 +08:00
fix: 【数据源】-编辑API数据源,添加接口参数失败
This commit is contained in:
parent
2d63cfd889
commit
7079965a50
@ -261,7 +261,7 @@ export default {
|
||||
customize: 'Customize',
|
||||
that_day: 'That day',
|
||||
value: 'Value',
|
||||
name_use_parameters: 'You can use ${parameter name}, use parameters',
|
||||
name_use_parameters: 'You can use \$\{parameter name\}, use parameters',
|
||||
add_parameters: 'Add parameters',
|
||||
data_source_name: 'Datasource name',
|
||||
data_source_name_de: 'Please enter the Datasource name',
|
||||
|
@ -253,7 +253,7 @@ export default {
|
||||
customize: '自訂',
|
||||
that_day: '當天',
|
||||
value: '值',
|
||||
name_use_parameters: '可用${參數名稱},使用參數',
|
||||
name_use_parameters: '可用\$\{參數名稱\},使用參數',
|
||||
add_parameters: '新增參數',
|
||||
data_source_name: '資料來源名稱',
|
||||
data_source_name_de: '請輸入資料來源名稱',
|
||||
|
@ -254,7 +254,7 @@ export default {
|
||||
customize: '自定义',
|
||||
that_day: '当天',
|
||||
value: '值',
|
||||
name_use_parameters: '可用${参数名},使用参数',
|
||||
name_use_parameters: '可用\$\{参数名\},使用参数',
|
||||
add_parameters: '添加参数',
|
||||
data_source_name: '数据源名称',
|
||||
data_source_name_de: '请输入数据源名称',
|
||||
|
@ -245,6 +245,51 @@ const saveItem = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (editItem.value) {
|
||||
let msg = ''
|
||||
for (let i = 0; i < apiItem.fields.length; i++) {
|
||||
if (apiItem.fields[i].primaryKey) {
|
||||
let find = false
|
||||
for (let j = 0; j < fields.length; j++) {
|
||||
if (fields[j].name === apiItem.fields[i].name && fields[j].primaryKey) {
|
||||
find = true
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
msg = msg + ' ' + apiItem.fields[i].name
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
if (fields[i].primaryKey) {
|
||||
let find = false
|
||||
for (let j = 0; j < apiItem.fields.length; j++) {
|
||||
if (fields[i].name === apiItem.fields[j].name && apiItem.fields[j].primaryKey) {
|
||||
find = true
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
msg = msg + ' ' + fields[i].name
|
||||
}
|
||||
}
|
||||
}
|
||||
if (msg !== '') {
|
||||
ElMessage.error(t('datasource.primary_key_change') + msg)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < apiItem.fields.length; i++) {
|
||||
if (
|
||||
apiItem.fields[i].primaryKey &&
|
||||
!apiItem.fields[i].length &&
|
||||
apiItem.fields[i].deExtractType === 0
|
||||
) {
|
||||
ElMessage.error(t('datasource.primary_key_length') + apiItem.fields[i].name)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < apiItem.fields.length - 1; i++) {
|
||||
@ -255,50 +300,7 @@ const saveItem = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (editItem.value) {
|
||||
let msg = ''
|
||||
for (let i = 0; i < apiItem.fields.length; i++) {
|
||||
if (apiItem.fields[i].primaryKey) {
|
||||
let find = false
|
||||
for (let j = 0; j < fields.length; j++) {
|
||||
if (fields[j].name === apiItem.fields[i].name && fields[j].primaryKey) {
|
||||
find = true
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
msg = msg + ' ' + apiItem.fields[i].name
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
if (fields[i].primaryKey) {
|
||||
let find = false
|
||||
for (let j = 0; j < apiItem.fields.length; j++) {
|
||||
if (fields[i].name === apiItem.fields[j].name && apiItem.fields[j].primaryKey) {
|
||||
find = true
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
msg = msg + ' ' + fields[i].name
|
||||
}
|
||||
}
|
||||
}
|
||||
if (msg !== '') {
|
||||
ElMessage.error(t('datasource.primary_key_change') + msg)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < apiItem.fields.length; i++) {
|
||||
if (
|
||||
apiItem.fields[i].primaryKey &&
|
||||
!apiItem.fields[i].length &&
|
||||
apiItem.fields[i].deExtractType === 0
|
||||
) {
|
||||
ElMessage.error(t('datasource.primary_key_length') + apiItem.fields[i].name)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnAPIItem('returnItem', cloneDeep(apiItem))
|
||||
edit_api_item.value = false
|
||||
}
|
||||
|
@ -451,14 +451,18 @@ const returnItem = apiItem => {
|
||||
form.value.apiConfiguration.push(apiItem)
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < form.value.paramsConfiguration.length; i++) {
|
||||
if (form.value.paramsConfiguration[i].serialNumber === apiItem.serialNumber) {
|
||||
find = true
|
||||
form.value.paramsConfiguration[i] = apiItem
|
||||
if (apiItem.serialNumber === activeParamsID.value) {
|
||||
setActiveName(apiItem)
|
||||
if (form.value.paramsConfiguration) {
|
||||
for (let i = 0; i < form.value.paramsConfiguration.length; i++) {
|
||||
if (form.value.paramsConfiguration[i].serialNumber === apiItem.serialNumber) {
|
||||
find = true
|
||||
form.value.paramsConfiguration[i] = apiItem
|
||||
if (apiItem.serialNumber === activeParamsID.value) {
|
||||
setActiveName(apiItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
form.value.paramsConfiguration = []
|
||||
}
|
||||
if (!find) {
|
||||
state.itemRef = []
|
||||
|
Loading…
Reference in New Issue
Block a user