REVIEW 代码生成
This commit is contained in:
parent
e6dac1ebda
commit
98afdfc040
@ -10,7 +10,7 @@ export type DictTypeVO = {
|
||||
}
|
||||
|
||||
// 查询字典(精简)列表
|
||||
export const listSimpleDictType = () => {
|
||||
export const getSimpleDictTypeList = () => {
|
||||
return request.get({ url: '/system/dict-type/list-all-simple' })
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
<el-input placeholder="请输入" v-model="formData.tableComment" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item prop="className">
|
||||
<template #label>
|
||||
@ -25,7 +24,6 @@
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<el-input placeholder="请输入" v-model="formData.className" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -43,13 +41,12 @@
|
||||
</el-form>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { CodegenTableVO } from '@/api/infra/codegen/types'
|
||||
import * as CodegenApi from '@/api/infra/codegen'
|
||||
import { PropType } from 'vue'
|
||||
|
||||
const emits = defineEmits(['update:basicInfo'])
|
||||
const props = defineProps({
|
||||
table: {
|
||||
type: Object as PropType<Nullable<CodegenTableVO>>,
|
||||
type: Object as PropType<Nullable<CodegenApi.CodegenTableVO>>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
@ -62,7 +59,6 @@ const formData = ref({
|
||||
author: '',
|
||||
remark: ''
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
tableName: [required],
|
||||
tableComment: [required],
|
||||
@ -70,6 +66,7 @@ const rules = reactive({
|
||||
author: [required]
|
||||
})
|
||||
|
||||
/** 监听 table 属性,复制给 formData 属性 */
|
||||
watch(
|
||||
() => props.table,
|
||||
(table) => {
|
||||
@ -81,12 +78,7 @@ watch(
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
emits('update:basicInfo', val)
|
||||
}
|
||||
)
|
||||
|
||||
defineExpose({
|
||||
validate: async () => unref(formRef)?.validate()
|
||||
})
|
||||
|
@ -114,28 +114,24 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { CodegenColumnVO } from '@/api/infra/codegen/types'
|
||||
import { DictTypeVO, listSimpleDictType } from '@/api/system/dict/dict.type'
|
||||
import * as CodegenApi from '@/api/infra/codegen'
|
||||
import * as DictDataApi from '@/api/system/dict/dict.type'
|
||||
|
||||
const emits = defineEmits(['update:columns'])
|
||||
const props = defineProps({
|
||||
columns: {
|
||||
type: Array as unknown as PropType<CodegenColumnVO[]>,
|
||||
type: Array as unknown as PropType<CodegenApi.CodegenColumnVO[]>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
|
||||
const formData = ref<CodegenColumnVO[]>([])
|
||||
const formData = ref<CodegenApi.CodegenColumnVO[]>([])
|
||||
const tableHeight = document.documentElement.scrollHeight - 350 + 'px'
|
||||
|
||||
/** 查询字典下拉列表 */
|
||||
const dictOptions = ref<DictTypeVO[]>()
|
||||
const dictOptions = ref<DictDataApi.DictTypeVO[]>()
|
||||
const getDictOptions = async () => {
|
||||
dictOptions.value = await listSimpleDictType()
|
||||
dictOptions.value = await DictDataApi.getSimpleDictTypeList()
|
||||
}
|
||||
onMounted(async () => {
|
||||
await getDictOptions()
|
||||
})
|
||||
|
||||
watch(
|
||||
() => props.columns,
|
||||
@ -148,10 +144,8 @@ watch(
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
emits('update:columns', val)
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
await getDictOptions()
|
||||
})
|
||||
</script>
|
||||
|
@ -5,10 +5,10 @@
|
||||
<el-form-item prop="templateType" label="生成模板">
|
||||
<el-select v-model="formData.templateType" @change="tplSelectChange">
|
||||
<el-option
|
||||
v-for="dict in getDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)"
|
||||
:key="parseInt(dict.value)"
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -17,10 +17,10 @@
|
||||
<el-form-item prop="scene" label="生成场景">
|
||||
<el-select v-model="formData.scene">
|
||||
<el-option
|
||||
v-for="dict in getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)"
|
||||
:key="parseInt(dict.value)"
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -280,17 +280,16 @@
|
||||
</el-form>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { CodegenTableVO } from '@/api/infra/codegen/types'
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
import * as CodegenApi from '@/api/infra/codegen'
|
||||
import * as MenuApi from '@/api/system/menu'
|
||||
import { PropType } from 'vue'
|
||||
import { getDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { handleTree } from '@/utils/tree'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const emits = defineEmits(['update:basicInfo'])
|
||||
const props = defineProps({
|
||||
table: {
|
||||
type: Object as PropType<Nullable<CodegenTableVO>>,
|
||||
type: Object as PropType<Nullable<CodegenApi.CodegenTableVO>>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
@ -335,6 +334,7 @@ const menuTreeProps = {
|
||||
const subSelectChange = () => {
|
||||
formData.value.subTableFkName = ''
|
||||
}
|
||||
|
||||
/** 选择生成模板触发 */
|
||||
const tplSelectChange = (value) => {
|
||||
if (value !== 1) {
|
||||
@ -361,18 +361,14 @@ watch(
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
emits('update:basicInfo', val)
|
||||
}
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const resp = await MenuApi.getSimpleMenusList()
|
||||
menus.value = handleTree(resp)
|
||||
} catch {}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
validate: async () => unref(formRef)?.validate()
|
||||
})
|
||||
|
@ -190,7 +190,7 @@ const handleExport = async () => {
|
||||
|
||||
/** 查询字典(精简)列表 */
|
||||
const getDictList = async () => {
|
||||
dicts.value = await DictTypeApi.listSimpleDictType()
|
||||
dicts.value = await DictTypeApi.getSimpleDictTypeList()
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
|
Loading…
Reference in New Issue
Block a user