Commit 6ac6cddbc707d14c49ba67fdaa8a8c4a1b7f3e64

Authored by YunaiV
1 parent bdb4e3fa

feat:【infra】vben5 + antd 的代码生成器模版的优化

yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/form.vue.vm
1 1 <script lang="ts" setup>
2 2 import type { Rule } from 'ant-design-vue/es/form';
3   -import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  3 +import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
4 4  
5 5 import { computed, ref } from 'vue';
6 6  
... ... @@ -11,7 +11,7 @@ import { Tinymce as RichTextarea } from &#39;#/components/tinymce&#39;;
11 11 import { ImageUpload, FileUpload } from "#/components/upload";
12 12 import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
13 13 #if($table.templateType == 2)## 树表需要导入这些
14   -import { get${simpleClassName}List } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  14 +import { get${simpleClassName}List } from '#/api/${table.moduleName}/${table.businessName}';
15 15 import { handleTree } from '@vben/utils'
16 16 #end
17 17 ## 特殊:主子表专属逻辑
... ... @@ -24,7 +24,7 @@ import { handleTree } from &#39;@vben/utils&#39;
24 24 #end
25 25  
26 26 import { $t } from '#/locales';
27   -import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  27 +import { get${simpleClassName}, create${simpleClassName}, update${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
28 28  
29 29 const emit = defineEmits(['success']);
30 30  
... ...
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/index.vue.vm
1 1 <script lang="ts" setup>
2   -import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  2 +import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
3 3  
4 4 import { ref, h, reactive, onMounted, nextTick } from 'vue';
5 5  
... ... @@ -7,12 +7,13 @@ import { Page, useVbenModal } from &#39;@vben/common-ui&#39;;
7 7 import { DICT_TYPE } from '@vben/constants';
8 8 import { getDictOptions } from '@vben/hooks';
9 9 import { useTableToolbar, VbenVxeTableToolbar } from '@vben/plugins/vxe-table';
10   -import { cloneDeep, downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
11   -import { Button, message,Tabs,Pagination,Form,RangePicker,DatePicker,Select,Input } from 'ant-design-vue';
  10 +import { cloneDeep, downloadFileFromBlobPart, formatDateTime, isEmpty } from '@vben/utils';
  11 +import { Button, Card, message, Tabs, Pagination, Form, RangePicker, DatePicker, Select, Input } from 'ant-design-vue';
12 12 import ${simpleClassName}Form from './modules/form.vue';
13 13 import { Download, Plus, RefreshCw, Search, Trash2 } from '@vben/icons';
14   -import { ContentWrap } from '#/components/content-wrap';
  14 +import { DictTag } from '#/components/dict-tag';
15 15 import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
  16 +import { getRangePickerDefaultProps } from '#/utils/rangePickerProps';
16 17  
17 18 ## 特殊:主子表专属逻辑
18 19 #if ( $table.templateType == 11 || $table.templateType == 12 )
... ... @@ -25,13 +26,11 @@ import { VxeColumn, VxeTable } from &#39;#/adapter/vxe-table&#39;;
25 26  
26 27 import { $t } from '#/locales';
27 28 #if (${table.templateType} == 2)## 树表接口
28   -import { handleTree,isEmpty } from '@vben/utils'
29   -import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  29 +import { handleTree } from '@vben/utils'
  30 +import { get${simpleClassName}List, delete${simpleClassName}, export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
30 31 #else## 标准表接口
31   -import { isEmpty } from '@vben/utils';
32   -import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}List,#end export${simpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  32 +import { get${simpleClassName}Page, delete${simpleClassName},#if ($deleteBatchEnable) delete${simpleClassName}List,#end export${simpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
33 33 #end
34   -import { downloadFileFromBlobPart } from '@vben/utils';
35 34  
36 35 #if ($table.templateType == 12 || $table.templateType == 11) ## 内嵌和erp情况
37 36 /** 子表的列表 */
... ... @@ -211,7 +210,7 @@ onMounted(() =&gt; {
211 210 <Page auto-content-height>
212 211 <FormModal @success="getList" />
213 212  
214   - <ContentWrap v-if="!hiddenSearchBar">
  213 + <Card v-if="!hiddenSearchBar" class="mb-4">
215 214 <!-- 搜索工作栏 -->
216 215 <Form
217 216 :model="queryParams"
... ... @@ -292,10 +291,10 @@ onMounted(() =&gt; {
292 291 </Button>
293 292 </Form.Item>
294 293 </Form>
295   - </ContentWrap>
  294 + </Card>
296 295  
297 296 <!-- 列表 -->
298   - <ContentWrap title="${table.classComment}">
  297 + <Card title="${table.classComment}">
299 298 <template #extra>
300 299 <VbenVxeTableToolbar
301 300 ref="tableToolbarRef"
... ... @@ -338,9 +337,9 @@ onMounted(() =&gt; {
338 337 批量删除
339 338 </Button>
340 339 #end
341   - </TableToolbar>
  340 + </VbenVxeTableToolbar>
342 341 </template>
343   - <vxe-table
  342 + <VxeTable
344 343 ref="tableRef"
345 344 :data="list"
346 345 #if ( $table.templateType == 2 )
... ... @@ -368,12 +367,12 @@ onMounted(() =&gt; {
368 367 #end
369 368 >
370 369 #if ($table.templateType != 2 && $deleteBatchEnable)
371   - <vxe-column type="checkbox" width="40"></vxe-column>
  370 + <VxeColumn type="checkbox" width="40" />
372 371 #end
373 372 ## 特殊:主子表专属逻辑
374 373 #if ( $table.templateType == 12 && $subTables && $subTables.size() > 0 )
375 374 <!-- 子表的列表 -->
376   - <vxe-column type="expand" width="60">
  375 + <VxeColumn type="expand" width="60">
377 376 <template #content="{ row }">
378 377 <!-- 子表的表单 -->
379 378 <Tabs v-model:active-key="subTabsName" class="mx-8">
... ... @@ -388,7 +387,7 @@ onMounted(() =&gt; {
388 387 #end
389 388 </Tabs>
390 389 </template>
391   - </vxe-column>
  390 + </VxeColumn>
392 391 #end
393 392 #foreach($column in $columns)
394 393 #if ($column.listOperationResult)
... ... @@ -397,31 +396,31 @@ onMounted(() =&gt; {
397 396 #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
398 397 #set ($comment=$column.columnComment)
399 398 #if ($column.javaType == "LocalDateTime")## 时间类型
400   - <vxe-column field="${javaField}" title="${comment}" align="center">
  399 + <VxeColumn field="${javaField}" title="${comment}" align="center">
401 400 <template #default="{row}">
402 401 {{formatDateTime(row.${javaField})}}
403 402 </template>
404   - </vxe-column>
  403 + </VxeColumn>
405 404 #elseif($column.dictType && "" != $column.dictType)## 数据字典
406   - <vxe-column field="${javaField}" title="${comment}" align="center">
  405 + <VxeColumn field="${javaField}" title="${comment}" align="center">
407 406 <template #default="{row}">
408 407 <dict-tag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${javaField}" />
409 408 </template>
410   - </vxe-column>
  409 + </VxeColumn>
411 410 #elseif ($table.templateType == 2 && $javaField == $treeNameColumn.javaField)
412   - <vxe-column field="${javaField}" title="${comment}" align="center" tree-node/>
  411 + <VxeColumn field="${javaField}" title="${comment}" align="center" tree-node/>
413 412 #else
414   - <vxe-column field="${javaField}" title="${comment}" align="center" />
  413 + <VxeColumn field="${javaField}" title="${comment}" align="center" />
415 414 #end
416 415 #end
417 416 #end
418   - <vxe-column field="operation" title="操作" align="center">
  417 + <VxeColumn field="operation" title="操作" align="center">
419 418 <template #default="{row}">
420 419 #if ( $table.templateType == 2 )
421 420 <Button
422 421 size="small"
423 422 type="link"
424   - @click="handleAppend(row as any)"
  423 + @click="handleAppend(row)"
425 424 v-access:code="['${permissionPrefix}:create']"
426 425 >
427 426 新增下级
... ... @@ -430,7 +429,7 @@ onMounted(() =&gt; {
430 429 <Button
431 430 size="small"
432 431 type="link"
433   - @click="handleEdit(row as any)"
  432 + @click="handleEdit(row)"
434 433 v-access:code="['${permissionPrefix}:update']"
435 434 >
436 435 {{ $t('ui.actionTitle.edit') }}
... ... @@ -443,14 +442,14 @@ onMounted(() =&gt; {
443 442 #if ( $table.templateType == 2 )
444 443 :disabled="!isEmpty(row?.children)"
445 444 #end
446   - @click="handleDelete(row as any)"
  445 + @click="handleDelete(row)"
447 446 v-access:code="['${permissionPrefix}:delete']"
448 447 >
449 448 {{ $t('ui.actionTitle.delete') }}
450 449 </Button>
451 450 </template>
452   - </vxe-column>
453   - </vxe-table>
  451 + </VxeColumn>
  452 + </VxeTable>
454 453 #if ( $table.templateType != 2 )
455 454 <!-- 分页 -->
456 455 <div class="mt-2 flex justify-end">
... ... @@ -463,9 +462,9 @@ onMounted(() =&gt; {
463 462 />
464 463 </div>
465 464 #end
466   - </ContentWrap>
  465 + </Card>
467 466 #if ($table.templateType == 11) ## erp情况
468   - <ContentWrap>
  467 + <Card>
469 468 <!-- 子表的表单 -->
470 469 <Tabs v-model:active-key="subTabsName">
471 470 #foreach ($subTable in $subTables)
... ... @@ -478,7 +477,7 @@ onMounted(() =&gt; {
478 477 </Tabs.TabPane>
479 478 #end
480 479 </Tabs>
481   - </ContentWrap>
  480 + </Card>
482 481 #end
483 482 </Page>
484 483 </template>
... ...
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/form_sub_erp.vue.vm
... ... @@ -4,21 +4,20 @@
4 4 #set ($subSimpleClassName = $subSimpleClassNames.get($subIndex))
5 5 <script lang="ts" setup>
6 6 import type { Rule } from 'ant-design-vue/es/form';
7   -import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  7 +import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
8 8  
9 9 import { computed, ref } from 'vue';
10 10  
11 11 import { useVbenModal } from '@vben/common-ui';
12 12 import { DICT_TYPE } from '@vben/constants';
13 13 import { getDictOptions } from '@vben/hooks';
14   -import { cloneDeep, formatDateTime } from '@vben/utils';
15 14 import { Tinymce as RichTextarea } from '#/components/tinymce';
16 15 import { ImageUpload, FileUpload } from "#/components/upload";
17 16 import { message, Tabs, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker, TreeSelect } from 'ant-design-vue';
18 17  
19 18 import { $t } from '#/locales';
20 19  
21   -import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  20 +import { get${subSimpleClassName}, create${subSimpleClassName}, update${subSimpleClassName} } from '#/api/${table.moduleName}/${table.businessName}';
22 21  
23 22 const emit = defineEmits(['success']);
24 23 const getTitle = computed(() => {
... ...
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/form_sub_normal.vue.vm
... ... @@ -5,25 +5,27 @@
5 5 #set ($subClassNameVar = $subClassNameVars.get($subIndex))
6 6 #set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
7 7 <script lang="ts" setup>
8   -import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  8 +import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
9 9  
10   -import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
  10 +import { computed, ref, h, onMounted, watch, nextTick } from 'vue';
11 11  
12 12 import { DICT_TYPE } from '@vben/constants';
13 13 import { getDictOptions } from '@vben/hooks';
14 14  
15   -import { message, Tabs, Form, Input, Textarea,Button, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker } from 'ant-design-vue';
  15 +import { message, Tabs, Form, Input, Textarea, Button, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, DatePicker } from 'ant-design-vue';
16 16 import { $t } from '#/locales';
17 17  
18 18 #if ($subTable.subJoinMany) ## 一对多
19 19 import type { VxeTableInstance } from '#/adapter/vxe-table';
20 20 import { Plus } from "@vben/icons";
21 21 import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
22   -import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  22 +import { ImageUpload, FileUpload } from "#/components/upload";
  23 +import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${table.businessName}';
23 24 #else
24 25 import type { Rule } from 'ant-design-vue/es/form';
25 26 import { Tinymce as RichTextarea } from '#/components/tinymce';
26   -import { get${subSimpleClassName}By${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  27 +import { ImageUpload, FileUpload } from "#/components/upload";
  28 +import { get${subSimpleClassName}By${SubJoinColumnName} } from '#/api/${table.moduleName}/${table.businessName}';
27 29 #end
28 30  
29 31 const props = defineProps<{
... ... @@ -55,6 +57,7 @@ defineExpose({
55 57 (row) => !removeRecords.some((removed) => removed.id === row.id),
56 58 ),
57 59 ...insertRecords.map((row: any) => ({ ...row, id: undefined })),
  60 + ];
58 61 },
59 62 });
60 63  
... ... @@ -113,7 +116,7 @@ watch(
113 116  
114 117 <template>
115 118 #if ($subTable.subJoinMany) ## 一对多
116   - <vxe-table ref="tableRef" :data="list" show-overflow class="mx-4">
  119 + <VxeTable ref="tableRef" :data="list" show-overflow class="mx-4">
117 120 #foreach($column in $subColumns)
118 121 #if ($column.createOperation || $column.updateOperation)
119 122 #set ($comment = $column.columnComment)
... ... @@ -128,25 +131,25 @@ watch(
128 131 #end
129 132 #if ( $column.id == $subJoinColumn.id) ## 特殊:忽略主子表的 join 字段,不用填写
130 133 #elseif ($column.htmlType == "input" && !$column.primaryKey)## 忽略主键,不用在表单里
131   - <vxe-column field="${javaField}" title="${comment}" align="center">
  134 + <VxeColumn field="${javaField}" title="${comment}" align="center">
132 135 <template #default="{ row }">
133 136 <Input v-model:value="row.${javaField}" />
134 137 </template>
135   - </vxe-column>
  138 + </VxeColumn>
136 139 #elseif($column.htmlType == "imageUpload")## 图片上传
137   - <vxe-column field="${javaField}" title="${comment}" align="center">
  140 + <VxeColumn field="${javaField}" title="${comment}" align="center">
138 141 <template #default="{ row }">
139 142 <ImageUpload v-model:value="row.${javaField}" />
140 143 </template>
141   - </vxe-column>
  144 + </VxeColumn>
142 145 #elseif($column.htmlType == "fileUpload")## 文件上传
143   - <vxe-column field="${javaField}" title="${comment}" align="center">
  146 + <VxeColumn field="${javaField}" title="${comment}" align="center">
144 147 <template #default="{ row }">
145 148 <FileUpload v-model:value="row.${javaField}" />
146 149 </template>
147   - </vxe-column>
  150 + </VxeColumn>
148 151 #elseif($column.htmlType == "select")## 下拉框
149   - <vxe-column field="${javaField}" title="${comment}" align="center">
  152 + <VxeColumn field="${javaField}" title="${comment}" align="center">
150 153 <template #default="{ row }">
151 154 <Select v-model:value="row.${javaField}" placeholder="请选择${comment}">
152 155 #if ("" != $dictType)## 有数据字典
... ... @@ -162,9 +165,9 @@ watch(
162 165 #end
163 166 </Select>
164 167 </template>
165   - </vxe-column>
  168 + </VxeColumn>
166 169 #elseif($column.htmlType == "checkbox")## 多选框
167   - <vxe-column field="${javaField}" title="${comment}" align="center">
  170 + <VxeColumn field="${javaField}" title="${comment}" align="center">
168 171 <template #default="{ row }">
169 172 <CheckboxGroup v-model:value="row.${javaField}">
170 173 #if ("" != $dictType)## 有数据字典
... ... @@ -180,9 +183,9 @@ watch(
180 183 #end
181 184 </CheckboxGroup>
182 185 </template>
183   - </vxe-column>
  186 + </VxeColumn>
184 187 #elseif($column.htmlType == "radio")## 单选框
185   - <vxe-column field="${javaField}" title="${comment}" align="center">
  188 + <VxeColumn field="${javaField}" title="${comment}" align="center">
186 189 <template #default="{ row }">
187 190 <RadioGroup v-model:value="row.${javaField}">
188 191 #if ("" != $dictType)## 有数据字典
... ... @@ -198,9 +201,9 @@ watch(
198 201 #end
199 202 </RadioGroup>
200 203 </template>
201   - </vxe-column>
  204 + </VxeColumn>
202 205 #elseif($column.htmlType == "datetime")## 时间框
203   - <vxe-column field="${javaField}" title="${comment}" align="center">
  206 + <VxeColumn field="${javaField}" title="${comment}" align="center">
204 207 <template #default="{ row }">
205 208 <DatePicker
206 209 v-model:value="row.${javaField}"
... ... @@ -209,30 +212,30 @@ watch(
209 212 valueFormat='x'
210 213 />
211 214 </template>
212   - </vxe-column>
  215 + </VxeColumn>
213 216 #elseif($column.htmlType == "textarea" || $column.htmlType == "editor")## 文本框
214   - <vxe-column field="${javaField}" title="${comment}" align="center">
  217 + <VxeColumn field="${javaField}" title="${comment}" align="center">
215 218 <template #default="{ row }">
216 219 <Textarea v-model:value="row.${javaField}" />
217 220 </template>
218   - </vxe-column>
  221 + </VxeColumn>
219 222 #end
220 223 #end
221 224 #end
222   - <vxe-column field="operation" title="操作" align="center">
  225 + <VxeColumn field="operation" title="操作" align="center">
223 226 <template #default="{ row }">
224 227 <Button
225 228 size="small"
226 229 type="link"
227 230 danger
228   - @click="handleDelect(row)"
  231 + @click="handleDelete(row)"
229 232 v-access:code="['${permissionPrefix}:delete']"
230 233 >
231 234 {{ $t('ui.actionTitle.delete') }}
232 235 </Button>
233 236 </template>
234   - </vxe-column>
235   - </vxe-table>
  237 + </VxeColumn>
  238 + </VxeTable>
236 239 <div class="flex justify-center mt-4">
237 240 <Button :icon="h(Plus)" type="primary" ghost @click="handleAdd" v-access:code="['${permissionPrefix}:create']">
238 241 {{ $t('ui.actionTitle.create', ['${subTable.classComment}']) }}
... ...
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/general/views/modules/list_sub_erp.vue.vm
... ... @@ -6,18 +6,18 @@
6 6 #set ($subSimpleClassName_strikeCase = $subSimpleClassName_strikeCases.get($subIndex))
7 7 #set ($SubJoinColumnName = $subJoinColumn.javaField.substring(0,1).toUpperCase() + ${subJoinColumn.javaField.substring(1)})##首字母大写
8 8 <script lang="ts" setup>
9   -import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  9 +import type { ${simpleClassName}Api } from '#/api/${table.moduleName}/${table.businessName}';
10 10 import type { VxeTableInstance } from '#/adapter/vxe-table';
11 11  
12   -import { reactive,ref, h, nextTick,watch,onMounted } from 'vue';
  12 +import { reactive, ref, h, nextTick, watch, onMounted } from 'vue';
13 13  
14 14 import { DICT_TYPE } from '@vben/constants';
15 15 import { getDictOptions } from '@vben/hooks';
16 16  
17 17 import { DictTag } from '#/components/dict-tag';
18   -import { getRangePickerDefaultProps } from '#/utils';
  18 +import { getRangePickerDefaultProps } from '#/utils/rangePickerProps';
19 19 import { VxeColumn, VxeTable } from '#/adapter/vxe-table';
20   -import { ContentWrap } from '#/components/content-wrap';
  20 +import { formatDateTime } from '@vben/utils';
21 21  
22 22 #if ($table.templateType == 11) ## erp
23 23 import { useVbenModal } from '@vben/common-ui';
... ... @@ -25,19 +25,19 @@ import { useTableToolbar, VbenVxeTableToolbar } from &#39;@vben/plugins/vxe-table&#39;;
25 25 import ${subSimpleClassName}Form from './${subSimpleClassName_strikeCase}-form.vue'
26 26 import { Tinymce as RichTextarea } from '#/components/tinymce';
27 27 import { ImageUpload, FileUpload } from "#/components/upload";
28   -import { message,Button, Tabs,Pagination, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox,RangePicker, DatePicker, TreeSelect } from 'ant-design-vue';
  28 +import { message, Button, Card, Tabs, Pagination, Form, Input, Textarea, Select, RadioGroup, Radio, CheckboxGroup, Checkbox, RangePicker, DatePicker, TreeSelect } from 'ant-design-vue';
29 29 import { Plus, Trash2 } from '@vben/icons';
30 30 import { $t } from '#/locales';
31 31 #end
32 32  
33 33 #if ($table.templateType == 11) ## erp
34   -import { delete${subSimpleClassName},#if ($deleteBatchEnable) delete${subSimpleClassName}List,#end get${subSimpleClassName}Page } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
35   -import { isEmpty } from '@vben/utils';
  34 +import { delete${subSimpleClassName},#if ($deleteBatchEnable) delete${subSimpleClassName}List,#end get${subSimpleClassName}Page } from '#/api/${table.moduleName}/${table.businessName}';
  35 +import { isEmpty, cloneDeep } from '@vben/utils';
36 36 #else
37 37 #if ($subTable.subJoinMany) ## 一对多
38   -import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  38 +import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${table.businessName}';
39 39 #else
40   -import { get${subSimpleClassName}By${SubJoinColumnName} } from '#/api/${table.moduleName}/${simpleClassName_strikeCase}';
  40 +import { get${subSimpleClassName}By${SubJoinColumnName} } from '#/api/${table.moduleName}/${table.businessName}';
41 41 #end
42 42 #end
43 43  
... ... @@ -203,7 +203,7 @@ onMounted(() =&gt; {
203 203 #if ($table.templateType == 11) ## erp
204 204 <FormModal @success="getList" />
205 205 <div class="h-[600px]">
206   - <ContentWrap v-if="!hiddenSearchBar">
  206 + <Card v-if="!hiddenSearchBar" class="mb-4">
207 207 <!-- 搜索工作栏 -->
208 208 <Form
209 209 :model="queryParams"
... ... @@ -284,10 +284,10 @@ onMounted(() =&gt; {
284 284 </Button>
285 285 </Form.Item>
286 286 </Form>
287   - </ContentWrap>
  287 + </Card>
288 288  
289 289 <!-- 列表 -->
290   - <ContentWrap title="${table.classComment}">
  290 + <Card title="${table.classComment}">
291 291 <template #extra>
292 292 <VbenVxeTableToolbar
293 293 ref="tableToolbarRef"
... ... @@ -315,9 +315,9 @@ onMounted(() =&gt; {
315 315 批量删除
316 316 </Button>
317 317 #end
318   - </TableToolbar>
  318 + </VbenVxeTableToolbar>
319 319 </template>
320   - <vxe-table
  320 + <VxeTable
321 321 ref="tableRef"
322 322 :data="list"
323 323 show-overflow
... ... @@ -328,7 +328,7 @@ onMounted(() =&gt; {
328 328 #end
329 329 >
330 330 #if ($deleteBatchEnable)
331   - <vxe-column type="checkbox" width="40"></vxe-column>
  331 + <VxeColumn type="checkbox" width="40" />
332 332 #end
333 333 #foreach($column in $subColumns)
334 334 #if ($column.listOperationResult)
... ... @@ -336,30 +336,30 @@ onMounted(() =&gt; {
336 336 #set ($javaField = $column.javaField)
337 337 #set ($comment=$column.columnComment)
338 338 #if ($column.javaType == "LocalDateTime")## 时间类型
339   - <vxe-column field="${javaField}" title="${comment}" align="center">
  339 + <VxeColumn field="${javaField}" title="${comment}" align="center">
340 340 <template #default="{row}">
341 341 {{formatDateTime(row.${javaField})}}
342 342 </template>
343   - </vxe-column>
  343 + </VxeColumn>
344 344 #elseif($column.dictType && "" != $column.dictType)## 数据字典
345   - <vxe-column field="${javaField}" title="${comment}" align="center">
  345 + <VxeColumn field="${javaField}" title="${comment}" align="center">
346 346 <template #default="{row}">
347 347 <dict-tag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${javaField}" />
348 348 </template>
349   - </vxe-column>
  349 + </VxeColumn>
350 350 #elseif ($table.templateType == 2 && $javaField == $treeNameColumn.javaField)
351   - <vxe-column field="${javaField}" title="${comment}" align="center" tree-node/>
  351 + <VxeColumn field="${javaField}" title="${comment}" align="center" tree-node/>
352 352 #else
353   - <vxe-column field="${javaField}" title="${comment}" align="center" />
  353 + <VxeColumn field="${javaField}" title="${comment}" align="center" />
354 354 #end
355 355 #end
356 356 #end
357   - <vxe-column field="operation" title="操作" align="center">
  357 + <VxeColumn field="operation" title="操作" align="center">
358 358 <template #default="{row}">
359 359 <Button
360 360 size="small"
361 361 type="link"
362   - @click="handleEdit(row as any)"
  362 + @click="handleEdit(row)"
363 363 v-access:code="['${permissionPrefix}:update']"
364 364 >
365 365 {{ $t('ui.actionTitle.edit') }}
... ... @@ -369,14 +369,14 @@ onMounted(() =&gt; {
369 369 type="link"
370 370 danger
371 371 class="ml-2"
372   - @click="handleDelete(row as any)"
  372 + @click="handleDelete(row)"
373 373 v-access:code="['${permissionPrefix}:delete']"
374 374 >
375 375 {{ $t('ui.actionTitle.delete') }}
376 376 </Button>
377 377 </template>
378   - </vxe-column>
379   - </vxe-table>
  378 + </VxeColumn>
  379 + </VxeTable>
380 380 <!-- 分页 -->
381 381 <div class="mt-2 flex justify-end">
382 382 <Pagination
... ... @@ -387,11 +387,11 @@ onMounted(() =&gt; {
387 387 @change="getList"
388 388 />
389 389 </div>
390   - </ContentWrap>
  390 + </Card>
391 391 </div>
392 392 #else
393   - <ContentWrap title="${subTable.classComment}列表">
394   - <vxe-table
  393 + <Card title="${subTable.classComment}列表">
  394 + <VxeTable
395 395 :data="list"
396 396 show-overflow
397 397 :loading="loading"
... ... @@ -402,23 +402,23 @@ onMounted(() =&gt; {
402 402 #set ($javaField = $column.javaField)
403 403 #set ($comment=$column.columnComment)
404 404 #if ($column.javaType == "LocalDateTime")## 时间类型
405   - <vxe-column field="${javaField}" title="${comment}" align="center">
  405 + <VxeColumn field="${javaField}" title="${comment}" align="center">
406 406 <template #default="{row}">
407 407 {{formatDateTime(row.${javaField})}}
408 408 </template>
409   - </vxe-column>
  409 + </VxeColumn>
410 410 #elseif($column.dictType && "" != $column.dictType)## 数据字典
411   - <vxe-column field="${javaField}" title="${comment}" align="center">
  411 + <VxeColumn field="${javaField}" title="${comment}" align="center">
412 412 <template #default="{row}">
413 413 <dict-tag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${javaField}" />
414 414 </template>
415   - </vxe-column>
  415 + </VxeColumn>
416 416 #else
417   - <vxe-column field="${javaField}" title="${comment}" align="center" />
  417 + <VxeColumn field="${javaField}" title="${comment}" align="center" />
418 418 #end
419 419 #end
420 420 #end
421   - </vxe-table>
422   - </ContentWrap>
  421 + </VxeTable>
  422 + </Card>
423 423 #end
424 424 </template>
... ...
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/form_sub_normal.vue.vm
... ... @@ -8,7 +8,7 @@
8 8 <script lang="ts" setup>
9 9 import type { ${apiName} } from '#/api/${table.moduleName}/${table.businessName}';
10 10  
11   - import { computed, ref, h, onMounted,watch,nextTick } from 'vue';
  11 + import { computed, ref, h, onMounted, watch, nextTick } from 'vue';
12 12  
13 13 import { $t } from '#/locales';
14 14  
... ... @@ -16,7 +16,6 @@
16 16 import { Plus } from "@vben/icons";
17 17 import { Button, Tabs, Checkbox, Input, Textarea, Select,RadioGroup,CheckboxGroup, DatePicker } from 'ant-design-vue';
18 18 import { ImageUpload, FileUpload } from "#/components/upload";
19   -import type { OnActionClickParams } from '#/adapter/vxe-table';
20 19 import { useVbenVxeGrid } from '#/adapter/vxe-table';
21 20 import { use${subSimpleClassName}GridEditColumns } from '../data';
22 21 import { get${subSimpleClassName}ListBy${SubJoinColumnName} } from '#/api/${table.moduleName}/${table.businessName}';
... ... @@ -31,22 +30,9 @@ const props = defineProps&lt;{
31 30 }>()
32 31  
33 32 #if ($subTable.subJoinMany) ## 一对多
34   -/** 表格操作按钮的回调函数 */
35   -function onActionClick({
36   - code,
37   - row,
38   -}: OnActionClickParams<${apiName}.${subSimpleClassName}>) {
39   - switch (code) {
40   - case 'delete': {
41   - handleDelete(row);
42   - break;
43   - }
44   - }
45   -}
46   -
47 33 const [Grid, gridApi] = useVbenVxeGrid({
48 34 gridOptions: {
49   - columns: use${subSimpleClassName}GridEditColumns(onActionClick),
  35 + columns: use${subSimpleClassName}GridEditColumns(),
50 36 border: true,
51 37 showOverflow: true,
52 38 autoResize: true,
... ... @@ -186,6 +172,17 @@ watch(
186 172 #end
187 173 #end
188 174 #end
  175 + <template #actions="{ row }">
  176 + <Button
  177 + size="small"
  178 + type="link"
  179 + danger
  180 + @click="handleDelete(row)"
  181 + v-access:code="['${subTable.moduleName}:${simpleClassName_strikeCase}:delete']"
  182 + >
  183 + {{ $t('ui.actionTitle.delete') }}
  184 + </Button>
  185 + </template>
189 186 </Grid>
190 187 <div class="flex justify-center -mt-4">
191 188 <Button :icon="h(Plus)" type="primary" ghost @click="handleAdd" v-access:code="['${subTable.moduleName}:${simpleClassName_strikeCase}:create']">
... ...
yudao-module-infra/src/main/resources/codegen/vue3_vben5_antd/schema/views/modules/list_sub_erp.vue.vm
... ... @@ -82,7 +82,7 @@ async function handleDeleteBatch() {
82 82 try {
83 83 await delete${subSimpleClassName}List(checkedIds.value);
84 84 checkedIds.value = [];
85   - message.success($t('ui.actionMessage.deleteSuccess', [row.id]));
  85 + message.success($t('ui.actionMessage.deleteSuccess'));
86 86 handleRefresh();
87 87 } finally {
88 88 hideLoading();
... ... @@ -134,7 +134,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
134 134 #else
135 135 columns: use${subSimpleClassName}GridColumns(),
136 136 pagerConfig: {
137   - nabled: false,
  137 + enabled: false,
138 138 },
139 139 toolbarConfig: {
140 140 enabled: false,
... ...