feature:自动化代码增加数据源配置功能

This commit is contained in:
pixelmaxQM
2024-04-27 21:35:29 +08:00
parent 6c62d73afb
commit d9a43ea1d6
12 changed files with 207 additions and 59 deletions

View File

@@ -22,6 +22,11 @@ export const filterDict = (value, options) => {
return rowLabel && rowLabel[0] && rowLabel[0].label
}
export const filterDataSource = (dataSource, value) => {
const rowLabel = dataSource && dataSource.find(item => item.value === value)
return rowLabel.label
}
export const getDictFunc = async(type) => {
const dicts = await getDict(type)
return dicts

View File

@@ -153,8 +153,40 @@
<el-form-item label="校验失败文案">
<el-input v-model="middleDate.errorText" />
</el-form-item>
</el-form>
<el-collapse v-model="activeNames">
<el-collapse-item
title="数据源配置(此配置为高级配置,如编程基础不牢,可能导致自动化代码不可用)"
name="1"
>
<el-row :gutter="8">
<el-col
:span="8"
>
<el-input
v-model="middleDate.dataSource.table"
placeholder="数据源表"
/>
</el-col>
<el-col
:span="8"
>
<el-input
v-model="middleDate.dataSource.label"
placeholder="展示用字段"
/>
</el-col>
<el-col
:span="8"
>
<el-input
v-model="middleDate.dataSource.value"
placeholder="存储用字端"
/>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
</div>
</template>
@@ -189,6 +221,8 @@ const props = defineProps({
},
})
const activeNames = ref([])
const middleDate = ref({})
const dictOptions = ref([])

View File

@@ -714,7 +714,12 @@ const fieldTemplate = {
primaryKey: false,
clearable: true,
fieldSearchType: '',
dictType: ''
dictType: '',
dataSource: {
table: '',
label: '',
value: ''
}
}
const route = useRoute()
const router = useRouter()
@@ -999,7 +1004,12 @@ const getColumnFunc = async() => {
clearable: true,
fieldSearchType: '',
dictType: '',
front: true
front: true,
dataSource: {
table: '',
label: '',
value: ''
}
})
}
})