From 438989cf43893adc9b84d4d96b8ed288c8578db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=99=E7=A0=81=E7=94=9F=E8=8A=B1?= <18523774412@qq.com> Date: Sun, 9 Jul 2023 01:06:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor(CRUD):=E8=BF=9C=E7=A8=8B=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E5=AD=97=E6=AE=B5=E5=90=8D=E8=A7=86=E6=83=85=E5=86=B5?= =?UTF-8?q?=E5=86=8D=E8=87=AA=E5=8A=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/views/backend/crud/design.vue | 13 ++++++++----- web/src/views/backend/crud/index.ts | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) 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,