mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-14 08:58:40 +08:00
feat(generator): 代码生成字段配置支持选择关联字典
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import type * as Tool from './type'
|
import type * as Tool from './type'
|
||||||
|
import type { LabelValueState } from '@/types/global'
|
||||||
import http from '@/utils/http'
|
import http from '@/utils/http'
|
||||||
|
|
||||||
const BASE_URL = '/generator'
|
const BASE_URL = '/generator'
|
||||||
@@ -36,3 +37,8 @@ export function generate(tableNames: Array<string>) {
|
|||||||
responseType: 'blob'
|
responseType: 'blob'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @desc 查询字典列表 */
|
||||||
|
export function listFieldConfigDict() {
|
||||||
|
return http.get<LabelValueState[]>(`${BASE_URL}/dict`)
|
||||||
|
}
|
||||||
|
@@ -27,6 +27,7 @@ export interface FieldConfigResp {
|
|||||||
showInQuery: boolean
|
showInQuery: boolean
|
||||||
formType: string
|
formType: string
|
||||||
queryType: string
|
queryType: string
|
||||||
|
dictCode: string
|
||||||
createTime?: string
|
createTime?: string
|
||||||
}
|
}
|
||||||
export interface GenConfigResp {
|
export interface GenConfigResp {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
:title="title"
|
:title="title"
|
||||||
:mask-closable="false"
|
:mask-closable="false"
|
||||||
:esc-to-close="false"
|
:esc-to-close="false"
|
||||||
:width="width >= 1050 ? 1050 : '100%'"
|
:width="width >= 1350 ? 1350 : '100%'"
|
||||||
@before-ok="save"
|
@before-ok="save"
|
||||||
@close="reset"
|
@close="reset"
|
||||||
>
|
>
|
||||||
@@ -106,6 +106,15 @@
|
|||||||
/>
|
/>
|
||||||
<span v-else>无需设置</span>
|
<span v-else>无需设置</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template #dictCode="{ record }">
|
||||||
|
<a-select
|
||||||
|
v-model="record.dictCode"
|
||||||
|
:options="dictList"
|
||||||
|
placeholder="请选择字典类型"
|
||||||
|
allow-search
|
||||||
|
allow-clear
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
</GiTable>
|
</GiTable>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
@@ -115,7 +124,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { type FormInstance, Message } from '@arco-design/web-vue'
|
import { type FormInstance, Message } from '@arco-design/web-vue'
|
||||||
import { useWindowSize } from '@vueuse/core'
|
import { useWindowSize } from '@vueuse/core'
|
||||||
import { type FieldConfigResp, type GeneratorConfigResp, getGenConfig, listFieldConfig, saveGenConfig } from '@/apis'
|
import { type FieldConfigResp, type GeneratorConfigResp, getGenConfig, listFieldConfig, listFieldConfigDict, saveGenConfig } from '@/apis'
|
||||||
|
import type { LabelValueState } from '@/types/global'
|
||||||
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
import type { TableInstanceColumns } from '@/components/GiTable/type'
|
||||||
import { useForm } from '@/hooks'
|
import { useForm } from '@/hooks'
|
||||||
import { useDict } from '@/hooks/app'
|
import { useDict } from '@/hooks/app'
|
||||||
@@ -136,9 +146,11 @@ const columns: TableInstanceColumns[] = [
|
|||||||
{ title: '必填', slotName: 'isRequired', width: 60, align: 'center' },
|
{ title: '必填', slotName: 'isRequired', width: 60, align: 'center' },
|
||||||
{ title: '查询', slotName: 'showInQuery', width: 60, align: 'center' },
|
{ title: '查询', slotName: 'showInQuery', width: 60, align: 'center' },
|
||||||
{ title: '表单类型', slotName: 'formType', width: 150 },
|
{ title: '表单类型', slotName: 'formType', width: 150 },
|
||||||
{ title: '查询方式', slotName: 'queryType' }
|
{ title: '查询方式', slotName: 'queryType' },
|
||||||
|
{ title: '关联字典', slotName: 'dictCode' }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const dictList = ref<LabelValueState[]>([])
|
||||||
const dataList = ref<FieldConfigResp[]>([])
|
const dataList = ref<FieldConfigResp[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
// 查询列表数据
|
// 查询列表数据
|
||||||
@@ -147,6 +159,8 @@ const getDataList = async (tableName: string, requireSync: boolean) => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
const res = await listFieldConfig(tableName, requireSync)
|
const res = await listFieldConfig(tableName, requireSync)
|
||||||
dataList.value = res.data
|
dataList.value = res.data
|
||||||
|
const { data } = await listFieldConfigDict()
|
||||||
|
dictList.value = data
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user