mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-22 15:24:09 +00:00
perf(CRUD):优化逻辑
This commit is contained in:
parent
b5abc80a9d
commit
9657d95b5f
@ -665,17 +665,21 @@ const showRemoteSelectPre = (index: number, hideDelField = false) => {
|
||||
state.remoteSelectPre.form.controllerFile = state.fields[index].form['remote-controller'].value
|
||||
state.remoteSelectPre.form.modelFile = state.fields[index].form['remote-model'].value
|
||||
state.remoteSelectPre.form.joinField = state.fields[index].form['relation-fields'].value.split(',')
|
||||
getTableFieldList(state.fields[index].form['remote-table'].value).then((res) => {
|
||||
const fieldSelect: anyObj = {}
|
||||
for (const key in res.data.fieldList) {
|
||||
fieldSelect[key] = (key ? key + ' - ' : '') + res.data.fieldList[key]
|
||||
}
|
||||
state.remoteSelectPre.fieldList = fieldSelect
|
||||
})
|
||||
getFileData(state.fields[index].form['remote-table'].value).then((res) => {
|
||||
state.remoteSelectPre.modelFileList = res.data.modelFileList
|
||||
state.remoteSelectPre.controllerFileList = res.data.controllerFileList
|
||||
})
|
||||
if (isEmpty(state.remoteSelectPre.fieldList)) {
|
||||
getTableFieldList(state.fields[index].form['remote-table'].value).then((res) => {
|
||||
const fieldSelect: anyObj = {}
|
||||
for (const key in res.data.fieldList) {
|
||||
fieldSelect[key] = (key ? key + ' - ' : '') + res.data.fieldList[key]
|
||||
}
|
||||
state.remoteSelectPre.fieldList = fieldSelect
|
||||
})
|
||||
}
|
||||
if (isEmpty(state.remoteSelectPre.modelFileList) || isEmpty(state.remoteSelectPre.controllerFileList)) {
|
||||
getFileData(state.fields[index].form['remote-table'].value).then((res) => {
|
||||
state.remoteSelectPre.modelFileList = res.data.modelFileList
|
||||
state.remoteSelectPre.controllerFileList = res.data.controllerFileList
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user