mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-14 02:55:07 +08:00
fix: 代码生成器
This commit is contained in:
@ -26,6 +26,10 @@ const activeName = ref('cloum')
|
||||
const basicInfoRef = ref<ComponentRef<typeof BasicInfoForm>>()
|
||||
const genInfoRef = ref<ComponentRef<typeof GenInfoForm>>()
|
||||
const cloumInfoRef = ref(null)
|
||||
const parentMenuId = ref<number>()
|
||||
const menu = (id: number) => {
|
||||
parentMenuId.value = id
|
||||
}
|
||||
const submitForm = async () => {
|
||||
const basicInfo = unref(basicInfoRef)
|
||||
const genInfo = unref(genInfoRef)
|
||||
@ -38,6 +42,11 @@ const submitForm = async () => {
|
||||
table: Object.assign({}, basicInfoData, genInfoData),
|
||||
columns: cloumCurrentRow.value
|
||||
}
|
||||
if (parentMenuId.value) {
|
||||
genInfoData.parentMenuId = parentMenuId.value
|
||||
} else {
|
||||
genInfoData.parentMenuId = 0
|
||||
}
|
||||
await updateCodegenTableApi(genTable)
|
||||
ElMessage.success(t('common.updateSuccess'))
|
||||
push('/infra/codegen')
|
||||
@ -57,7 +66,7 @@ onMounted(() => {
|
||||
<CloumInfoForm ref="cloumInfoRef" :info="cloumCurrentRow" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="生成信息" name="genInfo">
|
||||
<GenInfoForm ref="genInfoRef" :genInfo="tableCurrentRow" />
|
||||
<GenInfoForm ref="genInfoRef" :genInfo="tableCurrentRow" @menu="menu" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<template #right>
|
||||
|
@ -15,7 +15,8 @@ const props = defineProps({
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
const defaultProps = {
|
||||
const menuProps = {
|
||||
checkStrictly: true,
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
value: 'id'
|
||||
@ -31,7 +32,6 @@ const rules = reactive({
|
||||
})
|
||||
const templateTypeOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE)
|
||||
const sceneOptions = getIntDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE)
|
||||
const parentMenuId = ref()
|
||||
const treeRef = ref<InstanceType<typeof ElTreeSelect>>()
|
||||
const menuOptions = ref<any>([]) // 树形结构
|
||||
const getTree = async () => {
|
||||
@ -112,9 +112,13 @@ const schema = reactive<FormSchema[]>([
|
||||
const { register, methods, elFormRef } = useForm({
|
||||
schema
|
||||
})
|
||||
const parentMenuId = ref<number>()
|
||||
//子组件像父组件传值
|
||||
const emit = defineEmits(['menu'])
|
||||
const handleNodeClick = () => {
|
||||
console.log(parentMenuId.value)
|
||||
emit('menu', parentMenuId.value)
|
||||
}
|
||||
|
||||
// ========== 初始化 ==========
|
||||
onMounted(async () => {
|
||||
await getTree()
|
||||
@ -143,10 +147,9 @@ defineExpose({
|
||||
v-model="parentMenuId"
|
||||
ref="treeRef"
|
||||
node-key="id"
|
||||
check-on-click-node
|
||||
expand-on-click-node="false"
|
||||
:props="defaultProps"
|
||||
:props="menuProps"
|
||||
:data="menuOptions"
|
||||
check-strictly
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</template>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue'
|
||||
import { reactive, ref, defineEmits } from 'vue'
|
||||
import { getSchemaTableListApi, createCodegenListApi } from '@/api/infra/codegen'
|
||||
import {
|
||||
ElMessage,
|
||||
|
@ -150,7 +150,6 @@ onMounted(async () => {
|
||||
<DictTag :type="DICT_TYPE.COMMON_STATUS" :value="row.status" />
|
||||
</template>
|
||||
<template #packageId="{ row }">
|
||||
<!-- <DictTag :type="DICT_TYPE.SYSTEM_TENANT_PACKAGE_ID" :value="row.packageId" />-->
|
||||
<el-tag v-if="row.packageId === 0" type="danger">系统租户</el-tag>
|
||||
<el-tag v-else type="success"> {{ getPackageName(row.packageId) }} </el-tag>
|
||||
</template>
|
||||
@ -161,7 +160,6 @@ onMounted(async () => {
|
||||
<span>{{ dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<!-- <el-button type="text" v-hasPermi="['system:tenant:update']" @click="handleUpdate(row)">-->
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
|
Reference in New Issue
Block a user