Commit faea04546e1004494b2a4444ce1da80fe1391097
1 parent
3cee922e
修复代码生成父菜单选择无效,前端代码缺少字段,格式错误
Showing
6 changed files
with
224 additions
and
218 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/api.ts.vm
| 1 | 1 | import { useAxios } from '@/hooks/web/useAxios' |
| 2 | -import { ${simpleClassName}VO,${simpleClassName}PageReqVO,${simpleClassName}ExcelReqVO } from './types' | |
| 2 | +import { ${simpleClassName}VO, ${simpleClassName}PageReqVO, ${simpleClassName}ExcelReqVO } from './types' | |
| 3 | 3 | |
| 4 | 4 | const request = useAxios() |
| 5 | 5 | |
| 6 | 6 | #set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}") |
| 7 | 7 | // 查询${table.classComment}列表 |
| 8 | 8 | export const get${simpleClassName}PageApi = async (params: ${simpleClassName}PageReqVO) => { |
| 9 | - return await request.get({ url: '${baseURL}/page', params }) | |
| 9 | + return await request.get({ url: '${baseURL}/page', params }) | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | // 查询${table.classComment}详情 |
| 13 | 13 | export const get${simpleClassName}Api = async (id: number) => { |
| 14 | - return await request.get({ url: '${baseURL}/get?id=' + id }) | |
| 14 | + return await request.get({ url: '${baseURL}/get?id=' + id }) | |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // 新增${table.classComment} |
| 18 | 18 | export const create${simpleClassName}Api = async (data: ${simpleClassName}VO) => { |
| 19 | - return await request.post({ url: '${baseURL}/create', data }) | |
| 19 | + return await request.post({ url: '${baseURL}/create', data }) | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | // 修改${table.classComment} |
| 23 | 23 | export const update${simpleClassName}Api = async (data: ${simpleClassName}VO) => { |
| 24 | - return await request.put({ url: '${baseURL}/update', data }) | |
| 24 | + return await request.put({ url: '${baseURL}/update', data }) | |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | // 删除${table.classComment} |
| 28 | 28 | export const delete${simpleClassName}Api = async (id: number) => { |
| 29 | - return await request.delete({ url: '${baseURL}/delete?id=' + id }) | |
| 29 | + return await request.delete({ url: '${baseURL}/delete?id=' + id }) | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // 导出${table.classComment} Excel |
| 33 | 33 | export const export${simpleClassName}Api = async (params: ${simpleClassName}ExcelReqVO) => { |
| 34 | - return await request.download({ url: '${baseURL}/export-excel', params }) | |
| 34 | + return await request.download({ url: '${baseURL}/export-excel', params }) | |
| 35 | 35 | } | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/api/types.ts.vm
| ... | ... | @@ -2,9 +2,11 @@ export type ${simpleClassName}VO = { |
| 2 | 2 | #foreach ($column in $columns) |
| 3 | 3 | #if ($column.createOperation || $column.updateOperation) |
| 4 | 4 | #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") |
| 5 | - ${column.javaField}: number | |
| 5 | + ${column.javaField}: number | |
| 6 | +#elseif(${column.javaType.toLowerCase()} == "date") | |
| 7 | + ${column.javaField}: string | |
| 6 | 8 | #else |
| 7 | - ${column.javaField}: ${column.javaType.toLowerCase()} | |
| 9 | + ${column.javaField}: ${column.javaType.toLowerCase()} | |
| 8 | 10 | #end |
| 9 | 11 | #end |
| 10 | 12 | #end |
| ... | ... | @@ -14,9 +16,11 @@ export type ${simpleClassName}PageReqVO = { |
| 14 | 16 | #foreach ($column in $columns) |
| 15 | 17 | #if (${column.listOperation})##查询操作 |
| 16 | 18 | #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") |
| 17 | - ${column.javaField}: number | |
| 19 | + ${column.javaField}: number | |
| 20 | +#elseif(${column.javaType.toLowerCase()} == "date") | |
| 21 | + ${column.javaField}: string | |
| 18 | 22 | #else |
| 19 | - ${column.javaField}: ${column.javaType.toLowerCase()} | |
| 23 | + ${column.javaField}: ${column.javaType.toLowerCase()} | |
| 20 | 24 | #end |
| 21 | 25 | #end |
| 22 | 26 | #end |
| ... | ... | @@ -26,9 +30,11 @@ export type ${simpleClassName}ExcelReqVO = { |
| 26 | 30 | #foreach ($column in $columns) |
| 27 | 31 | #if (${column.listOperation})##查询操作 |
| 28 | 32 | #if(${column.javaType.toLowerCase()} == "long" || ${column.javaType.toLowerCase()} == "integer") |
| 29 | - ${column.javaField}: number | |
| 33 | + ${column.javaField}: number | |
| 34 | +#elseif(${column.javaType.toLowerCase()} == "date") | |
| 35 | + ${column.javaField}: string | |
| 30 | 36 | #else |
| 31 | - ${column.javaField}: ${column.javaType.toLowerCase()} | |
| 37 | + ${column.javaField}: ${column.javaType.toLowerCase()} | |
| 32 | 38 | #end |
| 33 | 39 | #end |
| 34 | 40 | #end | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/data.ts.vm
| ... | ... | @@ -8,104 +8,104 @@ export const rules = reactive({ |
| 8 | 8 | #foreach ($column in $columns) |
| 9 | 9 | #if (($column.createOperation || $column.updateOperation) && !$column.nullable && !${column.primaryKey})## 创建或者更新操作 && 要求非空 && 非主键 |
| 10 | 10 | #set($comment=$column.columnComment) |
| 11 | - $column.javaField: [{ required: true, message: "${comment}不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }], | |
| 11 | + $column.javaField: [{ required: true, message: '${comment}不能为空', trigger: #if($column.htmlType == "select")'change'#else'blur'#end }], | |
| 12 | 12 | #end |
| 13 | 13 | #end |
| 14 | 14 | }) |
| 15 | 15 | // CrudSchema |
| 16 | 16 | const crudSchemas = reactive<CrudSchema[]>([ |
| 17 | 17 | #foreach($column in $columns) |
| 18 | - #if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation) | |
| 19 | - #set ($dictType = $column.dictType) | |
| 20 | - { | |
| 21 | - label: '${column.columnComment}', | |
| 22 | - field: '${column.javaField}', | |
| 23 | - #if ("" != $dictType)## 有数据字典 | |
| 24 | - dictType: DICT_TYPE.$dictType.toUpperCase(), | |
| 25 | - #end | |
| 26 | - #if($column.primaryKey) | |
| 27 | - type: 'index', | |
| 28 | - form: { | |
| 29 | - show: false | |
| 30 | - }, | |
| 31 | - detail: { | |
| 32 | - show: false | |
| 18 | + #if ($column.listOperation || $column.listOperationResult || $column.createOperation || $column.updateOperation) | |
| 19 | + #set ($dictType = $column.dictType) | |
| 20 | + { | |
| 21 | + label: '${column.columnComment}', | |
| 22 | + field: '${column.javaField}', | |
| 23 | + #if ("" != $dictType)## 有数据字典 | |
| 24 | + dictType: DICT_TYPE.$dictType.toUpperCase(), | |
| 25 | + #end | |
| 26 | + #if($column.primaryKey) | |
| 27 | + type: 'index', | |
| 28 | + form: { | |
| 29 | + show: false | |
| 30 | + }, | |
| 31 | + detail: { | |
| 32 | + show: false | |
| 33 | + } | |
| 34 | + #else | |
| 35 | + #if (!$column.createOperation && !$column.updateOperation) | |
| 36 | + form: { | |
| 37 | + show: false | |
| 38 | + }, | |
| 39 | + #elseif(!("" != $column.dictType)) | |
| 40 | + form: { | |
| 41 | + show: true, | |
| 42 | + #if ($column.htmlType == "datetime")## 时间框 | |
| 43 | + component: 'DatePicker', | |
| 44 | + componentProps: { | |
| 45 | + type: 'datetime', | |
| 46 | + valueFormat: 'YYYY-MM-DD HH:mm:ss' | |
| 33 | 47 | } |
| 34 | - #else | |
| 35 | - #if (!$column.createOperation && !$column.updateOperation) | |
| 36 | - form: { | |
| 37 | - false | |
| 48 | + #elseif($column.htmlType == "editor")## 文本编辑器 | |
| 49 | + component: 'Editor', | |
| 50 | + colProps: { | |
| 51 | + span: 24 | |
| 38 | 52 | }, |
| 39 | - #elseif(!("" != $column.dictType)) | |
| 40 | - form: { | |
| 41 | - show: true, | |
| 42 | - #if ($column.htmlType == "datetime")## 时间框 | |
| 43 | - component: 'DatePicker', | |
| 44 | - componentProps: { | |
| 45 | - type: 'datetime', | |
| 46 | - valueFormat: 'YYYY-MM-DD HH:mm:ss' | |
| 47 | - } | |
| 48 | - #elseif($column.htmlType == "editor")## 文本编辑器 | |
| 49 | - component: 'Editor', | |
| 50 | - colProps: { | |
| 51 | - span: 24 | |
| 52 | - }, | |
| 53 | - componentProps: { | |
| 54 | - valueHtml: '' | |
| 55 | - } | |
| 56 | - #elseif($column.htmlType == "textarea")## 文本框 | |
| 57 | - component: 'Input', | |
| 58 | - componentProps: { | |
| 59 | - type: 'textarea', | |
| 60 | - rows: 4 | |
| 61 | - }, | |
| 62 | - colProps: { | |
| 63 | - span: 24 | |
| 64 | - } | |
| 65 | - #end | |
| 53 | + componentProps: { | |
| 54 | + valueHtml: '' | |
| 55 | + } | |
| 56 | + #elseif($column.htmlType == "textarea")## 文本框 | |
| 57 | + component: 'Input', | |
| 58 | + componentProps: { | |
| 59 | + type: 'textarea', | |
| 60 | + rows: 4 | |
| 66 | 61 | }, |
| 62 | + colProps: { | |
| 63 | + span: 24 | |
| 64 | + } | |
| 67 | 65 | #end |
| 68 | - #if ($column.listOperationResult) | |
| 69 | - search: { | |
| 70 | - #if($column.htmlType == "input") | |
| 71 | - show: true | |
| 72 | - #else | |
| 73 | - #if($column.htmlType == "datetime") | |
| 74 | - show: true, | |
| 75 | - component: 'DatePicker', | |
| 76 | - componentProps: { | |
| 77 | - type: 'datetimerange', | |
| 78 | - valueFormat: 'YYYY-MM-DD HH:mm:ss' | |
| 79 | - } | |
| 80 | - #elseif($column.htmlType == "select" || $column.htmlType == "radio") | |
| 81 | - #if ("" == $dictType)## 没有数据字典 | |
| 82 | - show: true, | |
| 83 | - component: 'Select', | |
| 84 | - componentProps: { | |
| 85 | - option: [{'','请选择字典生成'}] | |
| 86 | - } | |
| 87 | - #else | |
| 88 | - show: true | |
| 89 | - #end | |
| 90 | - #end | |
| 91 | - #end | |
| 66 | + }, | |
| 67 | + #end | |
| 68 | + #if ($column.listOperationResult) | |
| 69 | + search: { | |
| 70 | + #if($column.htmlType == "input") | |
| 71 | + show: true | |
| 72 | + #else | |
| 73 | + #if($column.htmlType == "datetime") | |
| 74 | + show: true, | |
| 75 | + component: 'DatePicker', | |
| 76 | + componentProps: { | |
| 77 | + type: 'datetimerange', | |
| 78 | + valueFormat: 'YYYY-MM-DD HH:mm:ss' | |
| 79 | + } | |
| 80 | + #elseif($column.htmlType == "select" || $column.htmlType == "radio") | |
| 81 | + #if ("" == $dictType)## 没有数据字典 | |
| 82 | + show: true, | |
| 83 | + component: 'Select', | |
| 84 | + componentProps: { | |
| 85 | + option: [{'','请选择字典生成'}] | |
| 92 | 86 | } |
| 87 | + #else | |
| 88 | + show: true | |
| 93 | 89 | #end |
| 94 | 90 | #end |
| 95 | - }, | |
| 91 | + #end | |
| 92 | + } | |
| 96 | 93 | #end |
| 94 | + #end | |
| 95 | + }, | |
| 96 | + #end | |
| 97 | 97 | #end |
| 98 | - { | |
| 99 | - label: t('table.action'), | |
| 100 | - field: 'action', | |
| 101 | - width: '240px', | |
| 102 | - form: { | |
| 103 | - show: false | |
| 104 | - }, | |
| 105 | - detail: { | |
| 106 | - show: false | |
| 107 | - } | |
| 98 | + { | |
| 99 | + label: t('table.action'), | |
| 100 | + field: 'action', | |
| 101 | + width: '240px', | |
| 102 | + form: { | |
| 103 | + show: false | |
| 104 | + }, | |
| 105 | + detail: { | |
| 106 | + show: false | |
| 108 | 107 | } |
| 108 | + } | |
| 109 | 109 | ]) |
| 110 | 110 | |
| 111 | 111 | export const { allSchemas } = useCrudSchemas(crudSchemas) |
| 112 | 112 | \ No newline at end of file | ... | ... |
yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue3/views/index.vue.vm
| 1 | 1 | <script setup lang="ts"> |
| 2 | - import { ref, unref } from 'vue' | |
| 3 | - import dayjs from 'dayjs' | |
| 4 | - import { ElMessage } from 'element-plus' | |
| 5 | - import { DICT_TYPE } from '@/utils/dict' | |
| 6 | - import { useTable } from '@/hooks/web/useTable' | |
| 7 | - import { useI18n } from '@/hooks/web/useI18n' | |
| 8 | - import { FormExpose } from '@/components/Form' | |
| 9 | - import type { ${simpleClassName}VO } from '@/api/${table.moduleName}/${simpleClassName}/types' | |
| 10 | - import { rules, allSchemas } from './${simpleClassName}.data' | |
| 11 | - import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${simpleClassName}' | |
| 12 | - const { t } = useI18n() // 国际化 | |
| 2 | +import { ref, unref } from 'vue' | |
| 3 | +import dayjs from 'dayjs' | |
| 4 | +import { ElMessage } from 'element-plus' | |
| 5 | +import { DICT_TYPE } from '@/utils/dict' | |
| 6 | +import { useTable } from '@/hooks/web/useTable' | |
| 7 | +import { useI18n } from '@/hooks/web/useI18n' | |
| 8 | +import { FormExpose } from '@/components/Form' | |
| 9 | +import type { ${simpleClassName}VO } from '@/api/${table.moduleName}/${simpleClassName}/types' | |
| 10 | +import { rules, allSchemas } from './${simpleClassName}.data' | |
| 11 | +import * as ${simpleClassName}Api from '@/api/${table.moduleName}/${simpleClassName}' | |
| 12 | +const { t } = useI18n() // 国际化 | |
| 13 | 13 | |
| 14 | - // ========== 列表相关 ========== | |
| 15 | - const { register, tableObject, methods } = useTable<${simpleClassName}VO>({ | |
| 16 | - getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi, | |
| 17 | - delListApi: ${simpleClassName}Api.delete${simpleClassName}Api, | |
| 18 | - exportListApi: ${simpleClassName}Api.export${simpleClassName}Api | |
| 19 | - }) | |
| 20 | - const { getList, setSearchParams, delList, exportList } = methods | |
| 14 | +// ========== 列表相关 ========== | |
| 15 | +const { register, tableObject, methods } = useTable<${simpleClassName}VO>({ | |
| 16 | + getListApi: ${simpleClassName}Api.get${simpleClassName}PageApi, | |
| 17 | + delListApi: ${simpleClassName}Api.delete${simpleClassName}Api, | |
| 18 | + exportListApi: ${simpleClassName}Api.export${simpleClassName}Api | |
| 19 | +}) | |
| 20 | +const { getList, setSearchParams, delList, exportList } = methods | |
| 21 | 21 | |
| 22 | - // ========== CRUD 相关 ========== | |
| 23 | - const actionLoading = ref(false) // 遮罩层 | |
| 24 | - const actionType = ref('') // 操作按钮的类型 | |
| 25 | - const dialogVisible = ref(false) // 是否显示弹出层 | |
| 26 | - const dialogTitle = ref('edit') // 弹出层标题 | |
| 27 | - const formRef = ref<FormExpose>() // 表单 Ref | |
| 22 | +// ========== CRUD 相关 ========== | |
| 23 | +const actionLoading = ref(false) // 遮罩层 | |
| 24 | +const actionType = ref('') // 操作按钮的类型 | |
| 25 | +const dialogVisible = ref(false) // 是否显示弹出层 | |
| 26 | +const dialogTitle = ref('edit') // 弹出层标题 | |
| 27 | +const formRef = ref<FormExpose>() // 表单 Ref | |
| 28 | 28 | |
| 29 | - // 设置标题 | |
| 30 | - const setDialogTile = (type: string) => { | |
| 31 | - dialogTitle.value = t('action.' + type) | |
| 32 | - actionType.value = type | |
| 33 | - dialogVisible.value = true | |
| 34 | - } | |
| 29 | +// 设置标题 | |
| 30 | +const setDialogTile = (type: string) => { | |
| 31 | + dialogTitle.value = t('action.' + type) | |
| 32 | + actionType.value = type | |
| 33 | + dialogVisible.value = true | |
| 34 | +} | |
| 35 | 35 | |
| 36 | - // 新增操作 | |
| 37 | - const handleCreate = () => { | |
| 38 | - setDialogTile('create') | |
| 39 | - // 重置表单 | |
| 40 | - unref(formRef)?.getElFormRef()?.resetFields() | |
| 41 | - } | |
| 36 | +// 新增操作 | |
| 37 | +const handleCreate = () => { | |
| 38 | + setDialogTile('create') | |
| 39 | + // 重置表单 | |
| 40 | + unref(formRef)?.getElFormRef()?.resetFields() | |
| 41 | +} | |
| 42 | 42 | |
| 43 | - // 修改操作 | |
| 44 | - const handleUpdate = async (row: ${simpleClassName}VO) => { | |
| 45 | - setDialogTile('update') | |
| 46 | - // 设置数据 | |
| 47 | - const res = await ${simpleClassName}Api.get${simpleClassName}Api(row.id) | |
| 48 | - unref(formRef)?.setValues(res) | |
| 49 | - } | |
| 43 | +// 修改操作 | |
| 44 | +const handleUpdate = async (row: ${simpleClassName}VO) => { | |
| 45 | + setDialogTile('update') | |
| 46 | + // 设置数据 | |
| 47 | + const res = await ${simpleClassName}Api.get${simpleClassName}Api(row.id) | |
| 48 | + unref(formRef)?.setValues(res) | |
| 49 | +} | |
| 50 | 50 | |
| 51 | - // 提交按钮 | |
| 52 | - const submitForm = async () => { | |
| 53 | - const elForm = unref(formRef)?.getElFormRef() | |
| 54 | - if (!elForm) return | |
| 55 | - elForm.validate(async (valid) => { | |
| 56 | - if (valid) { | |
| 57 | - actionLoading.value = true | |
| 58 | - // 提交请求 | |
| 59 | - try { | |
| 60 | - const data = unref(formRef)?.formModel as ${simpleClassName}VO | |
| 61 | - if (actionType.value === 'create') { | |
| 62 | - await ${simpleClassName}Api.create${simpleClassName}Api(data) | |
| 63 | - ElMessage.success(t('common.createSuccess')) | |
| 64 | - } else { | |
| 65 | - await ${simpleClassName}Api.update${simpleClassName}Api(data) | |
| 66 | - ElMessage.success(t('common.updateSuccess')) | |
| 67 | - } | |
| 68 | - // 操作成功,重新加载列表 | |
| 69 | - dialogVisible.value = false | |
| 70 | - await getList() | |
| 71 | - } finally { | |
| 72 | - actionLoading.value = false | |
| 51 | +// 提交按钮 | |
| 52 | +const submitForm = async () => { | |
| 53 | + const elForm = unref(formRef)?.getElFormRef() | |
| 54 | + if (!elForm) return | |
| 55 | + elForm.validate(async (valid) => { | |
| 56 | + if (valid) { | |
| 57 | + actionLoading.value = true | |
| 58 | + // 提交请求 | |
| 59 | + try { | |
| 60 | + const data = unref(formRef)?.formModel as ${simpleClassName}VO | |
| 61 | + if (actionType.value === 'create') { | |
| 62 | + await ${simpleClassName}Api.create${simpleClassName}Api(data) | |
| 63 | + ElMessage.success(t('common.createSuccess')) | |
| 64 | + } else { | |
| 65 | + await ${simpleClassName}Api.update${simpleClassName}Api(data) | |
| 66 | + ElMessage.success(t('common.updateSuccess')) | |
| 73 | 67 | } |
| 68 | + // 操作成功,重新加载列表 | |
| 69 | + dialogVisible.value = false | |
| 70 | + await getList() | |
| 71 | + } finally { | |
| 72 | + actionLoading.value = false | |
| 74 | 73 | } |
| 75 | - }) | |
| 76 | - } | |
| 74 | + } | |
| 75 | + }) | |
| 76 | +} | |
| 77 | 77 | |
| 78 | - // ========== 详情相关 ========== | |
| 79 | - const detailRef = ref() // 详情 Ref | |
| 78 | +// ========== 详情相关 ========== | |
| 79 | +const detailRef = ref() // 详情 Ref | |
| 80 | 80 | |
| 81 | - // 详情操作 | |
| 82 | - const handleDetail = async (row: ${simpleClassName}VO) => { | |
| 83 | - // 设置数据 | |
| 84 | - detailRef.value = row | |
| 85 | - setDialogTile('detail') | |
| 86 | - } | |
| 81 | +// 详情操作 | |
| 82 | +const handleDetail = async (row: ${simpleClassName}VO) => { | |
| 83 | + // 设置数据 | |
| 84 | + detailRef.value = row | |
| 85 | + setDialogTile('detail') | |
| 86 | +} | |
| 87 | 87 | |
| 88 | - // ========== 初始化 ========== | |
| 89 | - getList() | |
| 88 | +// ========== 初始化 ========== | |
| 89 | +getList() | |
| 90 | 90 | </script> |
| 91 | 91 | |
| 92 | 92 | <template> |
| ... | ... | @@ -101,63 +101,63 @@ |
| 101 | 101 | <Icon icon="ep:zoom-in" class="mr-5px" /> {{ t('action.add') }} |
| 102 | 102 | </el-button> |
| 103 | 103 | <el-button |
| 104 | - type="warning" | |
| 105 | - v-hasPermi="['${permissionPrefix}:export']" | |
| 106 | - :loading="tableObject.exportLoading" | |
| 107 | - @click="exportList('数据.xls')" | |
| 104 | + type="warning" | |
| 105 | + v-hasPermi="['${permissionPrefix}:export']" | |
| 106 | + :loading="tableObject.exportLoading" | |
| 107 | + @click="exportList('数据.xls')" | |
| 108 | 108 | > |
| 109 | 109 | <Icon icon="ep:download" class="mr-5px" /> {{ t('action.export') }} |
| 110 | 110 | </el-button> |
| 111 | 111 | </div> |
| 112 | 112 | <!-- 列表 --> |
| 113 | 113 | <Table |
| 114 | - :columns="allSchemas.tableColumns" | |
| 115 | - :selection="false" | |
| 116 | - :data="tableObject.tableList" | |
| 117 | - :loading="tableObject.loading" | |
| 118 | - :pagination="{ | |
| 114 | + :columns="allSchemas.tableColumns" | |
| 115 | + :selection="false" | |
| 116 | + :data="tableObject.tableList" | |
| 117 | + :loading="tableObject.loading" | |
| 118 | + :pagination="{ | |
| 119 | 119 | total: tableObject.total |
| 120 | 120 | }" |
| 121 | - v-model:pageSize="tableObject.pageSize" | |
| 122 | - v-model:currentPage="tableObject.currentPage" | |
| 123 | - @register="register" | |
| 121 | + v-model:pageSize="tableObject.pageSize" | |
| 122 | + v-model:currentPage="tableObject.currentPage" | |
| 123 | + @register="register" | |
| 124 | 124 | > |
| 125 | 125 | #foreach($column in $columns) |
| 126 | 126 | #if ($column.listOperationResult) |
| 127 | 127 | #set ($dictType=$column.dictType) |
| 128 | 128 | #if ($column.javaType == "Date")## 时间类型 |
| 129 | - <template #${column.javaField}="{ row }"> | |
| 130 | - <span>{{ dayjs(row.${column.javaField}).format('YYYY-MM-DD HH:mm:ss') }}</span> | |
| 131 | - </template> | |
| 129 | + <template #${column.javaField}="{ row }"> | |
| 130 | + <span>{{ dayjs(row.${column.javaField}).format('YYYY-MM-DD HH:mm:ss') }}</span> | |
| 131 | + </template> | |
| 132 | 132 | #elseif("" != $column.dictType)## 数据字典 |
| 133 | - <template #${column.javaField}="{ row }"> | |
| 134 | - <DictTag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${column.javaField}" /> | |
| 135 | - </template> | |
| 133 | + <template #${column.javaField}="{ row }"> | |
| 134 | + <DictTag :type="DICT_TYPE.$dictType.toUpperCase()" :value="row.${column.javaField}" /> | |
| 135 | + </template> | |
| 136 | 136 | #end |
| 137 | 137 | #end |
| 138 | 138 | #end |
| 139 | 139 | <template #action="{ row }"> |
| 140 | 140 | <el-button |
| 141 | - link | |
| 142 | - type="primary" | |
| 143 | - v-hasPermi="['${permissionPrefix}:update']" | |
| 144 | - @click="handleUpdate(row)" | |
| 141 | + link | |
| 142 | + type="primary" | |
| 143 | + v-hasPermi="['${permissionPrefix}:update']" | |
| 144 | + @click="handleUpdate(row)" | |
| 145 | 145 | > |
| 146 | 146 | <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} |
| 147 | 147 | </el-button> |
| 148 | 148 | <el-button |
| 149 | - link | |
| 150 | - type="primary" | |
| 151 | - v-hasPermi="['${permissionPrefix}:update']" | |
| 152 | - @click="handleDetail(row)" | |
| 149 | + link | |
| 150 | + type="primary" | |
| 151 | + v-hasPermi="['${permissionPrefix}:update']" | |
| 152 | + @click="handleDetail(row)" | |
| 153 | 153 | > |
| 154 | 154 | <Icon icon="ep:view" class="mr-1px" /> {{ t('action.detail') }} |
| 155 | 155 | </el-button> |
| 156 | 156 | <el-button |
| 157 | - link | |
| 158 | - type="primary" | |
| 159 | - v-hasPermi="['${permissionPrefix}:delete']" | |
| 160 | - @click="delList(row.id, false)" | |
| 157 | + link | |
| 158 | + type="primary" | |
| 159 | + v-hasPermi="['${permissionPrefix}:delete']" | |
| 160 | + @click="delList(row.id, false)" | |
| 161 | 161 | > |
| 162 | 162 | <Icon icon="ep:delete" class="mr-1px" /> {{ t('action.del') }} |
| 163 | 163 | </el-button> |
| ... | ... | @@ -168,16 +168,16 @@ |
| 168 | 168 | <Dialog v-model="dialogVisible" :title="dialogTitle"> |
| 169 | 169 | <!-- 对话框(添加 / 修改) --> |
| 170 | 170 | <Form |
| 171 | - v-if="['create', 'update'].includes(actionType)" | |
| 172 | - :schema="allSchemas.formSchema" | |
| 173 | - :rules="rules" | |
| 174 | - ref="formRef" | |
| 171 | + v-if="['create', 'update'].includes(actionType)" | |
| 172 | + :schema="allSchemas.formSchema" | |
| 173 | + :rules="rules" | |
| 174 | + ref="formRef" | |
| 175 | 175 | /> |
| 176 | 176 | <!-- 对话框(详情) --> |
| 177 | 177 | <Descriptions |
| 178 | - v-if="actionType === 'detail'" | |
| 179 | - :schema="allSchemas.detailSchema" | |
| 180 | - :data="detailRef" | |
| 178 | + v-if="actionType === 'detail'" | |
| 179 | + :schema="allSchemas.detailSchema" | |
| 180 | + :data="detailRef" | |
| 181 | 181 | > |
| 182 | 182 | #foreach($column in $columns) |
| 183 | 183 | #if ($column.listOperationResult) |
| ... | ... | @@ -197,10 +197,10 @@ |
| 197 | 197 | <!-- 操作按钮 --> |
| 198 | 198 | <template #footer> |
| 199 | 199 | <el-button |
| 200 | - v-if="['create', 'update'].includes(actionType)" | |
| 201 | - type="primary" | |
| 202 | - :loading="actionLoading" | |
| 203 | - @click="submitForm" | |
| 200 | + v-if="['create', 'update'].includes(actionType)" | |
| 201 | + type="primary" | |
| 202 | + :loading="actionLoading" | |
| 203 | + @click="submitForm" | |
| 204 | 204 | > |
| 205 | 205 | {{ t('action.save') }} |
| 206 | 206 | </el-button> | ... | ... |
yudao-ui-admin-vue3/src/views/infra/codegen/EditTable.vue
| ... | ... | @@ -38,15 +38,15 @@ const submitForm = async () => { |
| 38 | 38 | if (basicForm && genForm) { |
| 39 | 39 | const basicInfoData = (await basicInfo?.getFormData()) as CodegenTableVO |
| 40 | 40 | const genInfoData = (await genInfo?.getFormData()) as CodegenTableVO |
| 41 | - const genTable: CodegenUpdateReqVO = { | |
| 42 | - table: Object.assign({}, basicInfoData, genInfoData), | |
| 43 | - columns: cloumCurrentRow.value | |
| 44 | - } | |
| 45 | 41 | if (parentMenuId.value) { |
| 46 | 42 | genInfoData.parentMenuId = parentMenuId.value |
| 47 | 43 | } else { |
| 48 | 44 | genInfoData.parentMenuId = 0 |
| 49 | 45 | } |
| 46 | + const genTable: CodegenUpdateReqVO = { | |
| 47 | + table: Object.assign({}, basicInfoData, genInfoData), | |
| 48 | + columns: cloumCurrentRow.value | |
| 49 | + } | |
| 50 | 50 | await updateCodegenTableApi(genTable) |
| 51 | 51 | ElMessage.success(t('common.updateSuccess')) |
| 52 | 52 | push('/infra/codegen') | ... | ... |
yudao-ui-admin-vue3/src/views/infra/codegen/components/GenInfoForm.vue