diff --git a/web/src/views/backend/crud/design.vue b/web/src/views/backend/crud/design.vue index 9c928e70..b3eb5a1f 100644 --- a/web/src/views/backend/crud/design.vue +++ b/web/src/views/backend/crud/design.vue @@ -421,7 +421,7 @@ v-loading="state.remoteSelectPre.loading" label-position="right" label-width="160px" - v-if="state.remoteSelectPre.index != -1" + v-if="state.remoteSelectPre.index != -1 && state.fields[state.remoteSelectPre.index]" > { const onSaveRemoteSelect = () => { const submitCallback = () => { // 修改字段名 - onFieldBackup(state.fields[state.remoteSelectPre.index], state.remoteSelectPre.index) - const newName = state.remoteSelectPre.form.table + (state.fields[state.remoteSelectPre.index].designType == 'remoteSelect' ? '_id' : '_ids') - state.fields[state.remoteSelectPre.index].name = newName - onFieldNameChange(newName, state.remoteSelectPre.index) + if (state.fields[state.remoteSelectPre.index].name == 'remote_select') { + onFieldBackup(state.fields[state.remoteSelectPre.index], state.remoteSelectPre.index) + const newName = + state.remoteSelectPre.form.table + (state.fields[state.remoteSelectPre.index].designType == 'remoteSelect' ? '_id' : '_ids') + state.fields[state.remoteSelectPre.index].name = newName + onFieldNameChange(newName, state.remoteSelectPre.index) + } state.fields[state.remoteSelectPre.index].form['remote-table'].value = state.remoteSelectPre.form.table state.fields[state.remoteSelectPre.index].form['remote-pk'].value = state.remoteSelectPre.form.pk diff --git a/web/src/views/backend/crud/index.ts b/web/src/views/backend/crud/index.ts index e66a6f38..e8ff6b8b 100644 --- a/web/src/views/backend/crud/index.ts +++ b/web/src/views/backend/crud/index.ts @@ -161,7 +161,7 @@ export const fieldItem: { }, { title: i18n.global.t('crud.state.Remote Select (association table)'), - name: 'user_id', + name: 'remote_select', comment: i18n.global.t('utils.remote select'), designType: 'remoteSelect', tableBuildExclude: true, @@ -412,7 +412,7 @@ export const fieldItem: { }, { title: i18n.global.t('crud.state.Remote Select (Multi)'), - name: 'user_ids', + name: 'remote_select', comment: i18n.global.t('utils.remote select'), designType: 'remoteSelects', tableBuildExclude: true,