45
45
/>
46
46
<el-table-column label =" 创建时间" align =" center" prop =" createTime" />
47
47
48
- <el-table-column fixed =" right" label =" 操作" width =" 150 " >
48
+ <el-table-column fixed =" right" label =" 操作" width =" 200 " >
49
49
<template #default =" scope " >
50
50
<el-button
51
51
type =" primary"
54
54
@click =" handleOpenDialog(scope.row.tableName)"
55
55
>
56
56
<i-ep-MagicStick />
57
- 生成
57
+ 生成代码
58
+ </el-button >
59
+
60
+ <el-button
61
+ type =" danger"
62
+ size =" small"
63
+ link
64
+ @click =" handleResetConfig(scope.row.tableName)"
65
+ >
66
+ <i-ep-RefreshLeft />
67
+ 重置配置
58
68
</el-button >
59
69
</template >
60
70
</el-table-column >
72
82
<el-drawer
73
83
v-model =" dialog.visible"
74
84
:title =" dialog.title"
75
- @close =" handleCloseDialog "
85
+ @close =" dialog.visible = false "
76
86
size =" 80%"
77
87
>
78
88
<el-steps :active =" active" align-center finish-status =" success" simple >
91
101
</el-col >
92
102
<el-col :span =" 12" >
93
103
<el-form-item label =" 业务名" >
94
- <el-input v-model =" formData.businessName" />
104
+ <el-input v-model =" formData.businessName" placeholder = " 用户 " />
95
105
</el-form-item >
96
106
</el-col >
97
107
</el-row >
98
108
99
109
<el-row >
100
110
<el-col :span =" 12" >
101
111
<el-form-item label =" 模块名" >
102
- <el-input v-model =" formData.moduleName" />
112
+ <el-input v-model =" formData.moduleName" placeholder = " system " />
103
113
</el-form-item >
104
114
</el-col >
105
115
<el-col :span =" 12" >
106
116
<el-form-item label =" 包名" >
107
- <el-input v-model =" formData.packageName" />
117
+ <el-input
118
+ v-model =" formData.packageName"
119
+ placeholder =" com.youlai.boot"
120
+ />
108
121
</el-form-item >
109
122
</el-col >
110
123
</el-row >
111
124
112
125
<el-row >
113
126
<el-col :span =" 12" >
114
127
<el-form-item label =" 实体名" >
115
- <el-input v-model =" formData.entityName" />
128
+ <el-input v-model =" formData.entityName" placeholder = " User " />
116
129
</el-form-item >
117
130
</el-col >
118
131
<el-col :span =" 12" >
119
132
<el-form-item label =" 作者" >
120
- <el-input v-model =" formData.author" />
133
+ <el-input v-model =" formData.author" placeholder =" youlai" />
134
+ </el-form-item >
135
+ </el-col >
136
+ </el-row >
137
+
138
+ <el-row >
139
+ <el-col :span =" 24" >
140
+ <el-form-item label =" 父菜单" >
141
+ <el-tree-select
142
+ v-model =" formData.parentMenuId"
143
+ placeholder =" 选择父菜单"
144
+ :data =" menuOptions"
145
+ filterable
146
+ check-strictly
147
+ :render-after-expand =" false"
148
+ />
121
149
</el-form-item >
122
150
</el-col >
123
151
</el-row >
@@ -351,6 +379,7 @@ import GeneratorAPI, {
351
379
} from " @/api/generator" ;
352
380
353
381
import DictAPI from " @/api/dict" ;
382
+ import MenuAPI from " @/api/menu" ;
354
383
355
384
const queryFormRef = ref (ElForm );
356
385
@@ -366,6 +395,7 @@ const formData = ref<GenConfigForm>({});
366
395
const formTypeOptions: Record <string , OptionType > = FormTypeEnum ;
367
396
const queryTypeOptions: Record <string , OptionType > = QueryTypeEnum ;
368
397
const dictOptions = ref <OptionType []>();
398
+ const menuOptions = ref <OptionType []>([]);
369
399
370
400
const dialog = reactive ({
371
401
visible: false ,
@@ -452,27 +482,42 @@ function handleResetQuery() {
452
482
handleQuery ();
453
483
}
454
484
455
- function handleCloseDialog() {
456
- dialog .visible = false ;
457
- }
458
-
459
485
/** 打开弹窗 */
460
- function handleOpenDialog(tableName : string ) {
486
+ async function handleOpenDialog(tableName : string ) {
461
487
dialog .visible = true ;
462
488
489
+ menuOptions .value = await MenuAPI .getOptions ();
490
+
463
491
// 获取字典数据
464
492
DictAPI .getList ().then ((data ) => {
465
493
dictOptions .value = data ;
494
+ loading .value = true ;
466
495
467
- GeneratorAPI .getGenConfig (tableName ).then ((data ) => {
468
- dialog .title = ` ${tableName } 代码生成 ` ;
469
- formData .value = data ;
470
- if (formData .value .id ) {
471
- active .value = 2 ;
472
- handlePreview (tableName );
473
- } else {
474
- active .value = 0 ;
475
- }
496
+ GeneratorAPI .getGenConfig (tableName )
497
+ .then ((data ) => {
498
+ dialog .title = ` ${tableName } 代码生成 ` ;
499
+ formData .value = data ;
500
+ if (formData .value .id ) {
501
+ active .value = 2 ;
502
+ handlePreview (tableName );
503
+ } else {
504
+ active .value = 0 ;
505
+ }
506
+ })
507
+ .finally (() => {
508
+ loading .value = false ;
509
+ });
510
+ });
511
+ }
512
+
513
+ /** 重置配置 */
514
+ function handleResetConfig(tableName : string ) {
515
+ ElMessageBox .confirm (" 确定要重置配置吗?" , " 提示" , {
516
+ type: " warning" ,
517
+ }).then (() => {
518
+ GeneratorAPI .resetGenConfig (tableName ).then (() => {
519
+ ElMessage .success (" 重置成功" );
520
+ handleQuery ();
476
521
});
477
522
});
478
523
}
0 commit comments