提交 | 用户 | 时间
|
820397
|
1 |
<template> |
H |
2 |
<el-form ref="formRef" :model="formData" :rules="rules" label-width="120px"> |
|
3 |
<el-row> |
|
4 |
<el-col :span="12"> |
|
5 |
<el-form-item label="表名称" prop="tableName"> |
|
6 |
<el-input v-model="formData.tableName" placeholder="请输入仓库名称" /> |
|
7 |
</el-form-item> |
|
8 |
</el-col> |
|
9 |
<el-col :span="12"> |
|
10 |
<el-form-item label="表描述" prop="tableComment"> |
|
11 |
<el-input v-model="formData.tableComment" placeholder="请输入" /> |
|
12 |
</el-form-item> |
|
13 |
</el-col> |
|
14 |
<el-col :span="12"> |
|
15 |
<el-form-item prop="className"> |
|
16 |
<template #label> |
|
17 |
<span> |
|
18 |
实体类名称 |
|
19 |
<el-tooltip |
|
20 |
content="默认去除表名的前缀。如果存在重复,则需要手动添加前缀,避免 MyBatis 报 Alias 重复的问题。" |
|
21 |
placement="top" |
|
22 |
> |
|
23 |
<Icon class="" icon="ep:question-filled" /> |
|
24 |
</el-tooltip> |
|
25 |
</span> |
|
26 |
</template> |
|
27 |
<el-input v-model="formData.className" placeholder="请输入" /> |
|
28 |
</el-form-item> |
|
29 |
</el-col> |
|
30 |
<el-col :span="12"> |
|
31 |
<el-form-item label="作者" prop="author"> |
|
32 |
<el-input v-model="formData.author" placeholder="请输入" /> |
|
33 |
</el-form-item> |
|
34 |
</el-col> |
|
35 |
<el-col :span="24"> |
|
36 |
<el-form-item label="备注" prop="remark"> |
|
37 |
<el-input v-model="formData.remark" :rows="3" type="textarea" /> |
|
38 |
</el-form-item> |
|
39 |
</el-col> |
|
40 |
</el-row> |
|
41 |
</el-form> |
|
42 |
</template> |
|
43 |
<script lang="ts" setup> |
|
44 |
import * as CodegenApi from '@/api/infra/codegen' |
|
45 |
import { PropType } from 'vue' |
|
46 |
|
|
47 |
defineOptions({ name: 'InfraCodegenBasicInfoForm' }) |
|
48 |
|
|
49 |
const props = defineProps({ |
|
50 |
table: { |
|
51 |
type: Object as PropType<Nullable<CodegenApi.CodegenTableVO>>, |
|
52 |
default: () => null |
|
53 |
} |
|
54 |
}) |
|
55 |
|
|
56 |
const formRef = ref() |
|
57 |
const formData = ref({ |
|
58 |
tableName: '', |
|
59 |
tableComment: '', |
|
60 |
className: '', |
|
61 |
author: '', |
|
62 |
remark: '' |
|
63 |
}) |
|
64 |
const rules = reactive({ |
|
65 |
tableName: [required], |
|
66 |
tableComment: [required], |
|
67 |
className: [required], |
|
68 |
author: [required] |
|
69 |
}) |
|
70 |
|
|
71 |
/** 监听 table 属性,复制给 formData 属性 */ |
|
72 |
watch( |
|
73 |
() => props.table, |
|
74 |
(table) => { |
|
75 |
if (!table) return |
|
76 |
formData.value = table |
|
77 |
}, |
|
78 |
{ |
|
79 |
deep: true, |
|
80 |
immediate: true |
|
81 |
} |
|
82 |
) |
|
83 |
|
|
84 |
defineExpose({ |
|
85 |
validate: async () => unref(formRef)?.validate() |
|
86 |
}) |
|
87 |
</script> |