mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
refactor(CRUD):远程下拉字段名视情况再自动修改
This commit is contained in:
parent
2b0a44a0a3
commit
438989cf43
@ -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]"
|
||||
>
|
||||
<FormItem
|
||||
prop="table"
|
||||
@ -1350,10 +1350,13 @@ const onJoinTableChange = (val: string) => {
|
||||
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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user