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