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