mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 20:35:16 +00:00
feature:增加数据源一对多关系。
This commit is contained in:
@@ -156,32 +156,52 @@
|
||||
</el-form>
|
||||
<el-collapse v-model="activeNames">
|
||||
<el-collapse-item
|
||||
title="数据源配置(此配置为高级配置,如编程基础不牢,可能导致自动化代码不可用)"
|
||||
name="1"
|
||||
title="数据源配置(此配置为高级配置,如编程基础不牢,可能导致自动化代码不可用)"
|
||||
name="1"
|
||||
>
|
||||
<el-row :gutter="8">
|
||||
<el-col
|
||||
:span="8"
|
||||
:span="2"
|
||||
>
|
||||
<el-select
|
||||
v-model="middleDate.dataSource.association"
|
||||
placeholder="关联模式"
|
||||
@change="associationChange"
|
||||
>
|
||||
<el-option
|
||||
label="一对一"
|
||||
:value="1"
|
||||
/>
|
||||
<el-option
|
||||
label="一对多"
|
||||
:value="2"
|
||||
/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col
|
||||
:span="7"
|
||||
>
|
||||
<el-input
|
||||
v-model="middleDate.dataSource.table"
|
||||
placeholder="数据源表"
|
||||
v-model="middleDate.dataSource.table"
|
||||
placeholder="数据源表"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="8"
|
||||
:span="7"
|
||||
>
|
||||
<el-input
|
||||
v-model="middleDate.dataSource.label"
|
||||
placeholder="展示用字段"
|
||||
v-model="middleDate.dataSource.label"
|
||||
placeholder="展示用字段"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col
|
||||
:span="8"
|
||||
:span="7"
|
||||
>
|
||||
<el-input
|
||||
v-model="middleDate.dataSource.value"
|
||||
placeholder="存储用字端"
|
||||
v-model="middleDate.dataSource.value"
|
||||
placeholder="存储用字端"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -195,6 +215,7 @@ import { toLowerCase, toSQLLine } from '@/utils/stringFun'
|
||||
import { getSysDictionaryList } from '@/api/sysDictionary'
|
||||
import WarningBar from '@/components/warningBar/warningBar.vue'
|
||||
import { ref } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
defineOptions({
|
||||
name: 'FieldDialog'
|
||||
@@ -277,6 +298,24 @@ const clearOther = () => {
|
||||
middleDate.value.dictType = ''
|
||||
}
|
||||
|
||||
const associationChange = (val) => {
|
||||
if (val === 2) {
|
||||
ElMessageBox.confirm(
|
||||
'一对多关联模式下,数据类型会改变为数组,后端表现为json,具体表现为数组模式,是否继续?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '继续',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
).then(() => {
|
||||
middleDate.value.fieldType = 'array'
|
||||
}).catch(() => {
|
||||
middleDate.value.dataSource.association = 1
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const fieldDialogFrom = ref(null)
|
||||
defineExpose({ fieldDialogFrom })
|
||||
</script>
|
||||
|
||||
@@ -663,6 +663,10 @@ const typeOptions = ref([
|
||||
{
|
||||
label: 'JSON',
|
||||
value: 'json',
|
||||
},
|
||||
{
|
||||
label: '数组',
|
||||
value: 'array',
|
||||
}
|
||||
])
|
||||
|
||||
@@ -716,6 +720,7 @@ const fieldTemplate = {
|
||||
fieldSearchType: '',
|
||||
dictType: '',
|
||||
dataSource: {
|
||||
association:1,
|
||||
table: '',
|
||||
label: '',
|
||||
value: ''
|
||||
@@ -810,6 +815,7 @@ const editAndAddField = (item) => {
|
||||
addFlag.value = 'edit'
|
||||
if(!item.dataSource){
|
||||
item.dataSource = {
|
||||
association:1,
|
||||
table: '',
|
||||
label: '',
|
||||
value: ''
|
||||
|
||||
Reference in New Issue
Block a user